* Looking for comments on Bottom-Half/Tasklet/SoftIRQ @ 2001-08-19 3:17 chuckw 2001-08-19 16:59 ` Anders Peter Fugmann 0 siblings, 1 reply; 8+ messages in thread From: chuckw @ 2001-08-19 3:17 UTC (permalink / raw) To: linux-kernel Greetings, I was reading the unreliable guide to kernel hacking and was looking for a little clarification on something. 2 Bottom halves cannot run at the same time, why? Also, could someone give me an example of a service which is a bottom half/ tasklet/SoftIRQ? Thanks in advance, Chuck ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Looking for comments on Bottom-Half/Tasklet/SoftIRQ 2001-08-19 3:17 Looking for comments on Bottom-Half/Tasklet/SoftIRQ chuckw @ 2001-08-19 16:59 ` Anders Peter Fugmann 2001-08-19 5:35 ` chuckw 0 siblings, 1 reply; 8+ messages in thread From: Anders Peter Fugmann @ 2001-08-19 16:59 UTC (permalink / raw) To: chuckw; +Cc: linux-kernel chuckw@ieee.org wrote: > Greetings, > I was reading the unreliable guide to kernel hacking and was looking for > a little clarification on something. 2 Bottom halves cannot run at the same > time, why? Per linux definition of bottom halves, there can only run one buttom half at one system wide. But dont use those - They are old and waists resources. Try tasklets instead. Multible tasklets can run in parrallel (but not the same tasklet) > Also, could someone give me an example of a service which is a bottom half/ > tasklet/SoftIRQ? Simple. Imagine some hardware that generates interrupts. Now we want to write a driver that keeps the hardware busy, so we implement a top half handler (IRQ-handler), and let it retrieve som data from the hardware. Instead of processing it right away, we shedule a tasklet to do that job. This way we can handle more interrupts/sec from the card, and the hardware is kept busy. To summerize. Buttom halves are the strictest (only one at a time.) Takslets can run in parralel, but still no need to worry about reentrant code. SoftIrq give no guarrentee at all, and should be used with great care (code need to be reentrant). Also try to readLinux device drivers by A. Rubini: http://www.xml.com/ldd/chapter/book/index.html Hope it helps. Anders Fugmann > > Thanks in advance, > Chuck > - > To unsubscribe from this list: send the line "unsubscribe linux-kernel" 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.tux.org/lkml/ > > ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Looking for comments on Bottom-Half/Tasklet/SoftIRQ 2001-08-19 16:59 ` Anders Peter Fugmann @ 2001-08-19 5:35 ` chuckw 2001-08-19 19:01 ` Anders Peter Fugmann 2001-08-20 16:04 ` george anzinger 0 siblings, 2 replies; 8+ messages in thread From: chuckw @ 2001-08-19 5:35 UTC (permalink / raw) To: linux-kernel Thanks. So, Bottom halves don't need to be re-entrant as do tasklets. SoftIRQ's need to be re-entrant. The advantage of tasklets is that each tasklet can be farmed out to different CPU's AND they don't need to be re-entrant because only one instance is allowed at a time. I think I got it. Could you direct me to some code in the kernel which uses tasklets so I can see the inner workings? Thanks much, Chuck On Sun, Aug 19, 2001 at 06:59:22PM +0200, Anders Peter Fugmann wrote: > > chuckw@ieee.org wrote: > > Greetings, > > I was reading the unreliable guide to kernel hacking and was looking for > > a little clarification on something. 2 Bottom halves cannot run at the same > > time, why? > > Per linux definition of bottom halves, there can only run one buttom > half at one system wide. But dont use those - They are old and waists > resources. Try tasklets instead. Multible tasklets can run in parrallel > (but not the same tasklet) > > > Also, could someone give me an example of a service which is a bottom half/ > > tasklet/SoftIRQ? > Simple. > > Imagine some hardware that generates interrupts. > Now we want to write a driver that keeps the hardware busy, so we > implement a top half handler (IRQ-handler), and let it retrieve som data > from the hardware. Instead of processing it right away, we shedule a > tasklet to do that job. This way we can handle more interrupts/sec from > the card, and the hardware is kept busy. > > > To summerize. > Buttom halves are the strictest (only one at a time.) > Takslets can run in parralel, but still no need to worry about reentrant > code. > SoftIrq give no guarrentee at all, and should be used with great care > (code need to be reentrant). > > Also try to readLinux device drivers by A. Rubini: > http://www.xml.com/ldd/chapter/book/index.html > > Hope it helps. > Anders Fugmann > > > > > Thanks in advance, > > Chuck > > - > > To unsubscribe from this list: send the line "unsubscribe linux-kernel" 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.tux.org/lkml/ > > > > > > > - > To unsubscribe from this list: send the line "unsubscribe linux-kernel" 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.tux.org/lkml/ ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Looking for comments on Bottom-Half/Tasklet/SoftIRQ 2001-08-19 5:35 ` chuckw @ 2001-08-19 19:01 ` Anders Peter Fugmann 2001-08-19 10:57 ` chuckw 2001-08-20 16:04 ` george anzinger 1 sibling, 1 reply; 8+ messages in thread From: Anders Peter Fugmann @ 2001-08-19 19:01 UTC (permalink / raw) To: chuckw; +Cc: linux-kernel chuckw@ieee.org wrote: > Thanks > > So, Bottom halves don't need to be re-entrant as do tasklets. SoftIRQ's > need to be re-entrant. The advantage of tasklets is that each tasklet can > be farmed out to different CPU's AND they don't need to be re-entrant > because only one instance is allowed at a time. I think I got it. That is 100% correct. > > Could you direct me to some code in the kernel which uses tasklets > so I can see the inner workings? Actually very few systems in the kernel has been rewritten to use tasklets instead og BH's. But as they are very simillar to BH's, you should be able to use the same thinking, its just a new API. Take a look at include/linux/interrupt.h (or http://lxr.linux.no/source/include/linux/interrupt.h, an invaluable source when coding for linux). Regards Anders Fugmann ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Looking for comments on Bottom-Half/Tasklet/SoftIRQ 2001-08-19 19:01 ` Anders Peter Fugmann @ 2001-08-19 10:57 ` chuckw 0 siblings, 0 replies; 8+ messages in thread From: chuckw @ 2001-08-19 10:57 UTC (permalink / raw) To: linux-kernel Many thanks once again. Chuck On Sun, Aug 19, 2001 at 09:01:13PM +0200, Anders Peter Fugmann wrote: > chuckw@ieee.org wrote: > > Thanks > > > > So, Bottom halves don't need to be re-entrant as do tasklets. SoftIRQ's > > need to be re-entrant. The advantage of tasklets is that each tasklet can > > be farmed out to different CPU's AND they don't need to be re-entrant > > because only one instance is allowed at a time. I think I got it. > > That is 100% correct. > > > > > Could you direct me to some code in the kernel which uses tasklets > > so I can see the inner workings? > > Actually very few systems in the kernel has been rewritten to use > tasklets instead og BH's. > > But as they are very simillar to BH's, you should be able to use the > same thinking, its just a new API. > > Take a look at include/linux/interrupt.h > (or http://lxr.linux.no/source/include/linux/interrupt.h, an invaluable > source when coding for linux). > > Regards > Anders Fugmann > ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Looking for comments on Bottom-Half/Tasklet/SoftIRQ 2001-08-19 5:35 ` chuckw 2001-08-19 19:01 ` Anders Peter Fugmann @ 2001-08-20 16:04 ` george anzinger 2001-08-20 12:39 ` chuckw 2001-08-20 21:05 ` Anders Peter Fugmann 1 sibling, 2 replies; 8+ messages in thread From: george anzinger @ 2001-08-20 16:04 UTC (permalink / raw) To: chuckw; +Cc: linux-kernel chuckw@ieee.org wrote: > > Thanks. > > So, Bottom halves don't need to be re-entrant as do tasklets. SoftIRQ's > need to be re-entrant. The advantage of tasklets is that each tasklet can > be farmed out to different CPU's AND they don't need to be re-entrant > because only one instance is allowed at a time. I think I got it. > > Could you direct me to some code in the kernel which uses tasklets > so I can see the inner workings? > > Thanks much, > Chuck > > On Sun, Aug 19, 2001 at 06:59:22PM +0200, Anders Peter Fugmann wrote: > > > > chuckw@ieee.org wrote: > > > Greetings, > > > I was reading the unreliable guide to kernel hacking and was looking for > > > a little clarification on something. 2 Bottom halves cannot run at the same > > > time, why? > > > > Per linux definition of bottom halves, there can only run one buttom > > half at one system wide. But dont use those - They are old and waists > > resources. Try tasklets instead. Multible tasklets can run in parrallel > > (but not the same tasklet) > > > > > Also, could someone give me an example of a service which is a bottom half/ > > > tasklet/SoftIRQ? > > Simple. > > > > Imagine some hardware that generates interrupts. > > Now we want to write a driver that keeps the hardware busy, so we > > implement a top half handler (IRQ-handler), and let it retrieve som data > > from the hardware. Instead of processing it right away, we shedule a > > tasklet to do that job. This way we can handle more interrupts/sec from > > the card, and the hardware is kept busy. > > > > > > To summerize. > > Buttom halves are the strictest (only one at a time.) > > Takslets can run in parralel, but still no need to worry about reentrant > > code. > > SoftIrq give no guarrentee at all, and should be used with great care > > (code need to be reentrant). > > > > Also try to readLinux device drivers by A. Rubini: > > http://www.xml.com/ldd/chapter/book/index.html > > > > Hope it helps. > > Anders Fugmann > > > > > A simple example is the ../kernel/timer.c code. The "run_task_list()" function is called from a tasklet. "do_timer()" is called from interrupt and "mark_bh(TIMER_BH)" puts the tasklet in the queue. "timer_bh()" (old names die hard) is the tasklet. George ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Looking for comments on Bottom-Half/Tasklet/SoftIRQ 2001-08-20 16:04 ` george anzinger @ 2001-08-20 12:39 ` chuckw 2001-08-20 21:05 ` Anders Peter Fugmann 1 sibling, 0 replies; 8+ messages in thread From: chuckw @ 2001-08-20 12:39 UTC (permalink / raw) To: linux-kernel Thanks all for the info. You have been very helpful. Many Thanks, Chuck On Mon, Aug 20, 2001 at 09:04:28AM -0700, george anzinger wrote: > chuckw@ieee.org wrote: > > > > Thanks. > > > > So, Bottom halves don't need to be re-entrant as do tasklets. SoftIRQ's > > need to be re-entrant. The advantage of tasklets is that each tasklet can > > be farmed out to different CPU's AND they don't need to be re-entrant > > because only one instance is allowed at a time. I think I got it. > > > > Could you direct me to some code in the kernel which uses tasklets > > so I can see the inner workings? > > > > Thanks much, > > Chuck > > > > On Sun, Aug 19, 2001 at 06:59:22PM +0200, Anders Peter Fugmann wrote: > > > > > > chuckw@ieee.org wrote: > > > > Greetings, > > > > I was reading the unreliable guide to kernel hacking and was looking for > > > > a little clarification on something. 2 Bottom halves cannot run at the same > > > > time, why? > > > > > > Per linux definition of bottom halves, there can only run one buttom > > > half at one system wide. But dont use those - They are old and waists > > > resources. Try tasklets instead. Multible tasklets can run in parrallel > > > (but not the same tasklet) > > > > > > > Also, could someone give me an example of a service which is a bottom half/ > > > > tasklet/SoftIRQ? > > > Simple. > > > > > > Imagine some hardware that generates interrupts. > > > Now we want to write a driver that keeps the hardware busy, so we > > > implement a top half handler (IRQ-handler), and let it retrieve som data > > > from the hardware. Instead of processing it right away, we shedule a > > > tasklet to do that job. This way we can handle more interrupts/sec from > > > the card, and the hardware is kept busy. > > > > > > > > > To summerize. > > > Buttom halves are the strictest (only one at a time.) > > > Takslets can run in parralel, but still no need to worry about reentrant > > > code. > > > SoftIrq give no guarrentee at all, and should be used with great care > > > (code need to be reentrant). > > > > > > Also try to readLinux device drivers by A. Rubini: > > > http://www.xml.com/ldd/chapter/book/index.html > > > > > > Hope it helps. > > > Anders Fugmann > > > > > > > > > A simple example is the ../kernel/timer.c code. The "run_task_list()" > function is called from a tasklet. "do_timer()" is called from > interrupt and "mark_bh(TIMER_BH)" puts the tasklet in the queue. > "timer_bh()" (old names die hard) is the tasklet. > > George ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Looking for comments on Bottom-Half/Tasklet/SoftIRQ 2001-08-20 16:04 ` george anzinger 2001-08-20 12:39 ` chuckw @ 2001-08-20 21:05 ` Anders Peter Fugmann 1 sibling, 0 replies; 8+ messages in thread From: Anders Peter Fugmann @ 2001-08-20 21:05 UTC (permalink / raw) To: george anzinger, linux-kernel george anzinger wrote: > > A simple example is the ../kernel/timer.c code. The "run_task_list()" > function is called from a tasklet. "do_timer()" is called from > interrupt and "mark_bh(TIMER_BH)" puts the tasklet in the queue. > "timer_bh()" (old names die hard) is the tasklet. > mark_bh is the use of old BH's. You want to use tasklet_schedule if a tasklet should be sheduled. (_not_ tasklet_hi_schedule, those are the BH's) Regards Anders Fugmann > George > - > To unsubscribe from this list: send the line "unsubscribe linux-kernel" 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.tux.org/lkml/ > > ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2001-08-21 0:31 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2001-08-19 3:17 Looking for comments on Bottom-Half/Tasklet/SoftIRQ chuckw 2001-08-19 16:59 ` Anders Peter Fugmann 2001-08-19 5:35 ` chuckw 2001-08-19 19:01 ` Anders Peter Fugmann 2001-08-19 10:57 ` chuckw 2001-08-20 16:04 ` george anzinger 2001-08-20 12:39 ` chuckw 2001-08-20 21:05 ` Anders Peter Fugmann
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox