2008-11-12 09:32:08     Problem with kill_fasync SIGIO signalling

Document created by Aaronwu Employee on Aug 8, 2013
Version 1Show Document
  • View in full screen mode

2008-11-12 09:32:08     Problem with kill_fasync SIGIO signalling

roger froysaa (NORWAY)

Message: 65156   

 

Hi.

 

I'm having a problem with sigio asych messaging to userspace using kill_fasync.

 

I'm testing this on a CM-BF537U with 2008R1.5-RC3.

 

The case I'm having is that if the kill_fasync calls come too close together the signals

"disappear", i.e. they are not received in userspace. The first signal goes through,

but all the rest disappear. I'm using this to let the blackfin be an SPI interface which forwards interrupts from an SPI device. But I have seen that sometimes the interrupts come to quickly for the sigio handling to work...

 

I was hoping maybe someone here could give me a pointer on the following:

 

1. Why do signals disappear when I send them too quickly (msleep(1) works, but nothing lower that I have tried?

 

2. The code works if I use msleep(1) (msleep(0) doesn't work), but not udelay(1000). The latter is

supposedly busy-waiting. How can I do microsecond non-busy-wait delaying? I tried

 

for (i = 0; i < times; i++)

{

      kill_fasync(&signaltest_info.async_queue, SIGIO, POLL_IN);

 

      x = 1000;

      while (x > 0)

     {

          udelay(1);

          x--;

         schedule();

     }

 

}

 

with/without a desktop premption scheduler, but this did not help.

 

The user app does

 

fcntl (fhandle, F_SETOWN, getpid()) and

fcntl (fhandle, F_SETFL,  fcntl (fhandle, F_GETFL) | FASYNC) to enable async

mode in the (char) driver, then sets up a sigio signal handler and waits for

signals.

 

 

 

The char driver has fasync support and an ioctl function which I call to trigger

sending of some sigio signals:

 

 

 

retVal = __get_user(times, (__u32 __user *)arg);

if (retVal == 0 && signaltest_info.async_queue)

{

u32 i, microsecs, x;

 

for (i = 0; i < times; i++)

{

kill_fasync(&signaltest_info.async_queue, SIGIO, POLL_IN);

msleep(1); // works

 

// udelay(1000); does not work

                      

/* does not work

x = 2048;

while (x > 0)

{

udelay(1);

x--;

schedule();

}

*/  

}

 

Any pointers on this would be appreciated

 

 

 

/RF

 

 

QuoteReplyEditDelete

 

 

2008-11-12 09:42:11     Re: Problem with kill_fasync SIGIO signalling

Mike Frysinger (UNITED STATES)

Message: 65159   

 

please read `man 7 signal`.  it documents how there is no queueing of standard signals.  if a standard signal is sent while it is already pending, then userspace still only gets 1 notification.

Attachments

    Outcomes