Re: When can I call wake_up_interruptible?

Linus Torvalds (torvalds@transmeta.com)
3 May 1998 18:56:22 GMT


In article <19980503001436.26327@arbat.com>,
Erik Corry <erik@arbat.com> wrote:
>
>I am trying to write a driver for a character device (a phone
>port, into which you can plug a POTS telephone). When I get
>an interrupt from the phone I want to wake up the processes
>that were blocked trying to read events from a file descriptor.
>
>I keep getting 'Aiee scheduling in interrupt' errors. Should
>I be setting a flag and waiting for the next clock tick? Should
>I call wake_up_interruptible with interrupts on or off? Is the
>problem somewhere completely different? (error in the linked
>list of wait structures?). Here is an excerpt from the code

No, the "scheduling in interrupt" doesn't imply that you tried to wake
something up in the interrupt - it means that something had to sleep in
the interrupt handler, which in turn forces a re-schedule, which is why
you get the message.

One classic reason for this is if you're reading from (or writing to)
user land from the interrupt: this is a no-no, as the user pages may be
paged out and thus the system needs to page it in (and sleep).

There are other ways you can trigger the message: if your interrupt
handler dies with an oops, the interrupt counts will be corrupted, and
the next scheduling will be unhappy (but then you really shoul dhave
seen an oops too).

Or if you call something from your interrupt handler that can sleep.
Like allocating memory without the GFP_ATOMIC flag, or doing a "down()",
or any number of things that imply a re-schedule.

Linus

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu