From: "Dong Feng" <middle.fengdong@gmail.com>
To: pradeep singh <2500.pradeep@gmail.com>
Cc: Helge Hafting <helge.hafting@aitel.hist.no>,
Learning Linux <learninglinux4@gmail.com>,
kernelnewbies@nl.linux.org, linux-newbie@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: Why can't we sleep in an ISR?
Date: Mon, 14 May 2007 21:36:24 +0800 [thread overview]
Message-ID: <a2ebde260705140636n1428f808s839505825a71df49@mail.gmail.com> (raw)
In-Reply-To: <366312910705140552o6a507cbbl806f2ad0efc9d90c@mail.gmail.com>
My understanding is as follows.
Whenever the kernel code sleeps, it means the latest process running
in user space will have to wait for the event on which the kernel code
sleeps.
It makes sense for an exception handler to sleep because an exception
handler always serves the latest process running in user space. So a
process can complain nothing for it having to wait for the event on
which the exception handler in its own context sleeps.
It makes no sense for an ISR to sleep because an ISR does not
necessarily serve the latest process (that is, the interrupted
process). It makes no sense having a process wait for the event having
nothing to do with it.
I could be wrong, so please correct me if the understanding is not right.
2007/5/14, pradeep singh <2500.pradeep@gmail.com>:
>
>
> On 5/14/07, Helge Hafting <helge.hafting@aitel.hist.no> wrote:
> > Learning Linux wrote:
> > > I have a very basic doubt here ... what makes it impossible to sleep
> > > in an ISR? I mean, I know that the kernel preemption is disabled and
> > > the kernel will panic, but I could not understand why?
> > First: an ISR is meant to be very quick. It is supposed to do only a
> > minimum of work needed to service the interrupt, then exit.
> > This is important, as other interrupts might be blocked during your ISR.
> > Sleeping is out of question, even a long-running loop in no-no.
> >
> > Second: You don't ever need to sleep in an ISR anyway.
> > Complicated work that might take time or might need to sleep
> > is not supposed to be in an ISR. If you think you have a need,
> > tell us what you're up to and hopefully someone will explain
> > how do do things properly.
> >
> > When an interrupt happens that needs complicated servicing, the
> > ISR don't do the whole job. It just acknowledges the interrupt,
> > perhaps does a few things with the device in question, then it
> > exits. It leaves the rest of the work for a bottom half or kernel
> > thread or something like that. Kernel threads may sleep . . .
>
> Helge, i think the Original poster wants to know why
> *exactly* cannot you sleep? What prevents me from
> sleeping?
>
> What is this complicated processing which force an ISR not to sleep?
>
> Thanks
>
> > Helge Hafting
> >
> > --
> > To unsubscribe from this list: send an email with
> > "unsubscribe kernelnewbies" to ecartis@nl.linux.org
> > Please read the FAQ at http://kernelnewbies.org/FAQ
> >
> >
>
>
>
> --
> play the game
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
next prev parent reply other threads:[~2007-05-14 13:36 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-14 6:37 Why can't we sleep in an ISR? Learning Linux
2007-05-14 7:10 ` pradeep singh
2007-05-14 7:16 ` Learning Linux
2007-05-14 15:24 ` Bahadir Balban
2007-05-14 15:56 ` Dong Feng
2007-05-15 5:17 ` pradeep singh
2007-05-15 6:45 ` Dong Feng
2007-05-15 7:10 ` pradeep singh
2007-05-15 7:28 ` Dong Feng
2007-05-15 8:12 ` pradeep singh
2007-05-15 8:40 ` Learning Linux
2007-05-15 8:58 ` Dong Feng
2007-05-15 16:57 ` Phillip Susi
2007-05-15 22:49 ` Dong Feng
2007-05-16 15:20 ` Phillip Susi
2007-05-16 23:17 ` Dong Feng
2007-05-17 16:07 ` Phillip Susi
2007-05-17 23:50 ` Dong Feng
2007-05-14 12:25 ` Helge Hafting
2007-05-14 12:52 ` pradeep singh
2007-05-14 13:36 ` Dong Feng [this message]
-- strict thread matches above, loose matches on Subject: below --
2007-05-14 15:22 linux
2007-05-14 15:55 ` Rik van Riel
2007-05-15 9:34 rohit hooda
2007-05-15 9:46 ` pradeep singh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a2ebde260705140636n1428f808s839505825a71df49@mail.gmail.com \
--to=middle.fengdong@gmail.com \
--cc=2500.pradeep@gmail.com \
--cc=helge.hafting@aitel.hist.no \
--cc=kernelnewbies@nl.linux.org \
--cc=learninglinux4@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-newbie@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox