Kai Huang
2012-Feb-17 04:47 UTC
[question] will softirq handler potentially be called many times?
Hi, I see the __do_softirq is called when ! in_atomic(), which means potentially __do_softirq may be interrupted by trap, exception, interrupt, etc, so seems softirq handler may be executed many times? For example, if interrupt happens after i find_first_set_bit(pending), the same softirq hander will be called twice as the do_softriq will be called after all interrupt handler returned, and the pending bit has not been cleared yet when first do_softirq was called. static void __do_softirq(unsigned long ignore_mask) { ...... for ( ; ; ) { ...... i = find_first_set_bit(pending); <- interrupt happens clear_bit(i, &softirq_pending(cpu)); (*softirq_handlers[i])(); } } -cody
Keir Fraser
2012-Feb-17 09:20 UTC
Re: [question] will softirq handler potentially be called many times?
On 17/02/2012 04:47, "Kai Huang" <mail.kai.huang@gmail.com> wrote:> Hi, > > I see the __do_softirq is called when ! in_atomic(), which means > potentially __do_softirq may be interrupted by trap, exception, > interrupt, etc, so seems softirq handler may be executed many times? > > For example, if interrupt happens after i > find_first_set_bit(pending), the same softirq hander will be called > twice as the do_softriq will be called after all interrupt handler > returned, and the pending bit has not been cleared yet when first > do_softirq was called.Can''t happen, we only call do_softirq() when returning from an interrupt back to guest context. Therefore a nested interrupt call does not cause do_softirq to run. -- Keir> static void __do_softirq(unsigned long ignore_mask) > { > ...... > for ( ; ; ) > { > ...... > i = find_first_set_bit(pending); > <- interrupt happens > clear_bit(i, &softirq_pending(cpu)); > (*softirq_handlers[i])(); > } > } > > -cody > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel