xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Keir Fraser <keir.xen@gmail.com>
To: Kai Huang <mail.kai.huang@gmail.com>, Xen-devel@lists.xensource.com
Subject: Re: [question] will softirq handler potentially be called many times?
Date: Fri, 17 Feb 2012 09:20:03 +0000	[thread overview]
Message-ID: <CB63CC43.2B6E0%keir.xen@gmail.com> (raw)
In-Reply-To: <CANqQZNHc11vDEbkT2_JMER7FWeqdSQi+5_n1gN36BnJGs8mDiA@mail.gmail.com>

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

      reply	other threads:[~2012-02-17  9:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-17  4:47 [question] will softirq handler potentially be called many times? Kai Huang
2012-02-17  9:20 ` Keir Fraser [this message]

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=CB63CC43.2B6E0%keir.xen@gmail.com \
    --to=keir.xen@gmail.com \
    --cc=Xen-devel@lists.xensource.com \
    --cc=mail.kai.huang@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).