From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Christoph Hellwig <hch@infradead.org>
Cc: linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org,
Peter Zijlstra <peterz@infradead.org>,
Thomas Gleixner <tglx@linutronix.de>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: Re: [PATCH] irq_poll: Use raise_softirq_irqoff() in cpu_dead notifier
Date: Mon, 18 Oct 2021 13:49:20 +0200 [thread overview]
Message-ID: <20211018114920.5rtvalux2w22j5ku@linutronix.de> (raw)
In-Reply-To: <YW1SIE08f3X3joxe@infradead.org>
On 2021-10-18 03:53:20 [-0700], Christoph Hellwig wrote:
> On Thu, Sep 30, 2021 at 12:37:54PM +0200, Sebastian Andrzej Siewior wrote:
> > __raise_softirq_irqoff() adds a bit to the pending sofirq mask and this
> > is it. The softirq won't be handled in a deterministic way but randomly
> > when an interrupt fires and handles softirq in its irq_exit() routine or
> > if something randomly checks and handles pending softirqs in the call
> > chain before the CPU goes idle.
> >
> > Add a local_bh_disable/enable() around the IRQ-off section which will
> > handle pending softirqs.
>
> This patch leaves me extremely confused, and it would even more if I was
> just reading the code. local_irq_disable is supposed to disable BHs
> as well, so the code looks pretty much nonsensical to me. But
> apparently that isn't the point if I follow your commit message as you
> don't care about an extra level of BH disabling but want to force a
> side-effect of the re-enabling? Why not directly call the helper
> to schedule the softirq then?
This side-effect is actually the way it works most of the time. There is
one exception in the network stack where do_softirq() is called manually
after checking for pending softirqs. I managed to remove one instance in
commit
fe420d87bbc23 ("net/core: remove explicit do_softirq() from busy_poll_stop()")
just wasn't so lucky with the other one (yet). Other than that, it is
either local_bh_enable() that ensures that pending softirqs are
processed or __irq_exit_rcu().
Same as preempt_enable() ensure that a context switch happens if the
scheudler decided that one is needed but the CPU was in a
preempt-disabled section at that time.
Anyway. Even with s/__raise_softirq_irqoff/raise_softirq_irqoff/ you are
not much better off. The latter will wake ksoftirqd but it might result
in setting the NEED-resched bit which is not checked by
local_irq_enable(). So you end up waiting until random spin_unlock()
which has the needed check. Nothing here does that here but probably
something before the CPU-HP code is left.
Sebastian
next prev parent reply other threads:[~2021-10-18 11:49 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-30 10:37 Sebastian Andrzej Siewior
2021-09-30 10:56 ` [RFC] Is lib/irq_poll still considered useful? Sebastian Andrzej Siewior
2021-10-01 4:24 ` Christoph Hellwig
2021-10-01 6:41 ` Sebastian Andrzej Siewior
2021-10-18 7:45 ` [PATCH] irq_poll: Use raise_softirq_irqoff() in cpu_dead notifier Sebastian Andrzej Siewior
2021-10-18 10:53 ` Christoph Hellwig
2021-10-18 11:49 ` Sebastian Andrzej Siewior [this message]
-- strict thread matches above, loose matches on Subject: below --
2020-04-02 19:50 Sebastian Andrzej Siewior
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=20211018114920.5rtvalux2w22j5ku@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=gregkh@linuxfoundation.org \
--cc=hch@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
/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
all inboxes | Powered by JetHome®