From mboxrd@z Thu Jan 1 00:00:00 1970 From: Keir Fraser Subject: Re: [question] will softirq handler potentially be called many times? Date: Fri, 17 Feb 2012 09:20:03 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Kai Huang , Xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org On 17/02/2012 04:47, "Kai Huang" 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