On Fri, Feb 17, 2006 at 06:12:04PM -0800, Roland Dreier wrote:
>  > +int execute_in_process_context(void (*fn)(void *data), void *data,
>  > +                         struct execute_work *ew)
>  > +{
>  > +  if (!in_interrupt()) {
>  > +          fn(data);
>  > +          return 0;
>  > +  }
> 
> Is testing in_interrupt() really sufficient to make this work?  I seem
> to remember that (at least) with CONFIG_PREEMPT disabled, there are
> contexts where it is not safe to sleep but where both in_interrupt()
> and in_atomic() still return 0.

That's correct -- in process context, with PREEMPT disabled and a spinlock
held, it's unsafe to call this function.  It works well for the SCSI
usage (where it's called either in interrupt context or in user
context with no spinlocks held), but it's not *always* safe.

I think this needs to be documented in the kerneldoc.


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to