* sleep @ 2017-10-26 0:12 Tobin C. Harding 2017-10-28 12:41 ` sleep Bogdan Lazic 2017-11-14 16:52 ` sleep Bruno E. O. Meneguele 0 siblings, 2 replies; 6+ messages in thread From: Tobin C. Harding @ 2017-10-26 0:12 UTC (permalink / raw) To: kernelnewbies Is there any 'non-process' context apart from interrupt context? I had a re-read of sleep sections in ldd3 and in Robert Love's book but am still not totally clear on this. The reason for the question is understanding when we cannot sleep. thanks in advance, Tobin. ^ permalink raw reply [flat|nested] 6+ messages in thread
* sleep 2017-10-26 0:12 sleep Tobin C. Harding @ 2017-10-28 12:41 ` Bogdan Lazic 2017-11-14 16:52 ` sleep Bruno E. O. Meneguele 1 sibling, 0 replies; 6+ messages in thread From: Bogdan Lazic @ 2017-10-28 12:41 UTC (permalink / raw) To: kernelnewbies Sleeping while holding the spin lock is forbidden. Sleeping in Tasklets is forbidden. Best regards, Bogdan On 26.10.2017 02:12, Tobin C. Harding wrote: > Is there any 'non-process' context apart from interrupt context? I had a > re-read of sleep sections in ldd3 and in Robert Love's book but am still > not totally clear on this. > > The reason for the question is understanding when we cannot sleep. > > thanks in advance, > Tobin. > > _______________________________________________ > Kernelnewbies mailing list > Kernelnewbies at kernelnewbies.org > https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies > ^ permalink raw reply [flat|nested] 6+ messages in thread
* sleep 2017-10-26 0:12 sleep Tobin C. Harding 2017-10-28 12:41 ` sleep Bogdan Lazic @ 2017-11-14 16:52 ` Bruno E. O. Meneguele 2017-11-14 20:41 ` sleep Tobin C. Harding 2017-11-14 20:53 ` sleep Max Filippov 1 sibling, 2 replies; 6+ messages in thread From: Bruno E. O. Meneguele @ 2017-11-14 16:52 UTC (permalink / raw) To: kernelnewbies On 26-10, Tobin C. Harding wrote: > Is there any 'non-process' context apart from interrupt context? I had a > re-read of sleep sections in ldd3 and in Robert Love's book but am still > not totally clear on this. > > The reason for the question is understanding when we cannot sleep. Well, AFAIK you can simplify things to interrupt vs process context, but you might be aware that inside interrupt context there are others (NMI, HWIRQ, SOFTIRQ, ..), infos that you can find in Robert's book. What confused me for sometime was the 'atomic' vs 'interrupt' naming, but after reading Robert's book it cames to the fact that they're the same. The general rule is that in any interrupt context you can't sleep, and why is that? Because interrupts aren't processes, there isn't an actual process that the scheduler can put to sleep and wake it up later. It's basically a design decision. Kernel-RT patches provide the feature of sleepable interrupts, since the goal there is the latency and not performance. That said, in short, the idea in Linux Kernel (I'm not an expert, far from that actually, so anyone can correct me) is to make interrupts atomic in behalf of simplicity and performance. But hey, be careful, there are that talk about top vs bottom halves mechanisms (to defer work) right? Top are always in interrupt context, but bottom ones can run in process context. The most basic ones are Softirqs, Tasklets and Workqueues, the former is the most low-level available and I won't talk about it, but basicaly softirqs and tasklets run in interrupt context, thus can't sleep, while workqueues is handled in process context, thus can sleep normally (it can be rescheduled). But as I said, I'm far from expert in the subject. What I've said here is just what I know about :) Hope it helps you. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 488 bytes Desc: not available Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20171114/d5bd8b2e/attachment-0001.bin ^ permalink raw reply [flat|nested] 6+ messages in thread
* sleep 2017-11-14 16:52 ` sleep Bruno E. O. Meneguele @ 2017-11-14 20:41 ` Tobin C. Harding 2017-11-14 20:53 ` sleep Max Filippov 1 sibling, 0 replies; 6+ messages in thread From: Tobin C. Harding @ 2017-11-14 20:41 UTC (permalink / raw) To: kernelnewbies On Tue, Nov 14, 2017 at 02:52:06PM -0200, Bruno E. O. Meneguele wrote: > On 26-10, Tobin C. Harding wrote: > > Is there any 'non-process' context apart from interrupt context? I had a > > re-read of sleep sections in ldd3 and in Robert Love's book but am still > > not totally clear on this. > > > > The reason for the question is understanding when we cannot sleep. > > Well, AFAIK you can simplify things to interrupt vs process context, but > you might be aware that inside interrupt context there are others (NMI, > HWIRQ, SOFTIRQ, ..), infos that you can find in Robert's book. What > confused me for sometime was the 'atomic' vs 'interrupt' naming, but > after reading Robert's book it cames to the fact that they're the same. > > The general rule is that in any interrupt context you can't sleep, and > why is that? Because interrupts aren't processes, there isn't an actual > process that the scheduler can put to sleep and wake it up later. It's > basically a design decision. Kernel-RT patches provide the feature of > sleepable interrupts, since the goal there is the latency and not > performance. That said, in short, the idea in Linux Kernel (I'm not an > expert, far from that actually, so anyone can correct me) is to make > interrupts atomic in behalf of simplicity and performance. > > But hey, be careful, there are that talk about top vs bottom halves > mechanisms (to defer work) right? Top are always in interrupt context, > but bottom ones can run in process context. The most basic ones are > Softirqs, Tasklets and Workqueues, the former is the most low-level > available and I won't talk about it, but basicaly softirqs and tasklets > run in interrupt context, thus can't sleep, while workqueues is handled > in process context, thus can sleep normally (it can be rescheduled). > > But as I said, I'm far from expert in the subject. What I've said here > is just what I know about :) > > Hope it helps you. thanks for your response, Tobin. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 801 bytes Desc: not available Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20171115/94d3e61b/attachment.bin ^ permalink raw reply [flat|nested] 6+ messages in thread
* sleep 2017-11-14 16:52 ` sleep Bruno E. O. Meneguele 2017-11-14 20:41 ` sleep Tobin C. Harding @ 2017-11-14 20:53 ` Max Filippov 2017-11-16 13:34 ` sleep Bruno E. O. Meneguele 1 sibling, 1 reply; 6+ messages in thread From: Max Filippov @ 2017-11-14 20:53 UTC (permalink / raw) To: kernelnewbies On Tue, Nov 14, 2017 at 8:52 AM, Bruno E. O. Meneguele <bmeneguele@gmail.com> wrote: > What > confused me for sometime was the 'atomic' vs 'interrupt' naming, but > after reading Robert's book it cames to the fact that they're the same. Not exactly the same. Atomic means you're protected from some sort of interruption: e.g. you raise preemption counter and you're protected from scheduling, but you still may be interrupted, or you disable interrupts and you're protected from scheduling and interrupts, but there still may be an NMI. -- Thanks. -- Max ^ permalink raw reply [flat|nested] 6+ messages in thread
* sleep 2017-11-14 20:53 ` sleep Max Filippov @ 2017-11-16 13:34 ` Bruno E. O. Meneguele 0 siblings, 0 replies; 6+ messages in thread From: Bruno E. O. Meneguele @ 2017-11-16 13:34 UTC (permalink / raw) To: kernelnewbies On 14-11, Max Filippov wrote: > On Tue, Nov 14, 2017 at 8:52 AM, Bruno E. O. Meneguele > <bmeneguele@gmail.com> wrote: > > What > > confused me for sometime was the 'atomic' vs 'interrupt' naming, but > > after reading Robert's book it cames to the fact that they're the same. > > Not exactly the same. Atomic means you're protected from some sort of > interruption: e.g. you raise preemption counter and you're protected from > scheduling, but you still may be interrupted, or you disable interrupts and > you're protected from scheduling and interrupts, but there still may be an > NMI. > Ahh, well pointed. Got it. Thank you for the info :) -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 488 bytes Desc: not available Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20171116/ab20746b/attachment.bin ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-11-16 13:34 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2017-10-26 0:12 sleep Tobin C. Harding 2017-10-28 12:41 ` sleep Bogdan Lazic 2017-11-14 16:52 ` sleep Bruno E. O. Meneguele 2017-11-14 20:41 ` sleep Tobin C. Harding 2017-11-14 20:53 ` sleep Max Filippov 2017-11-16 13:34 ` sleep Bruno E. O. Meneguele
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).