From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Frederic Weisbecker <frederic@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Thomas Gleixner <tglx@linutronix.de>,
"Paul E . McKenney" <paulmck@kernel.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Anna-Maria Behnsen <anna-maria@linutronix.de>,
Eric Dumazet <edumazet@google.com>
Subject: Re: [RFC PATCH 0/6] softirq: Start pushing down the big softirq lock
Date: Tue, 8 Aug 2023 09:15:14 +0200 [thread overview]
Message-ID: <20230808071514.VTDoPGMm@linutronix.de> (raw)
In-Reply-To: <ZNEMImA1dWs07U3z@lothringen>
On 2023-08-07 17:22:10 [+0200], Frederic Weisbecker wrote:
> > However, how do you continue here? Assuming all timers are marked
> > TIMER_SOFTINTERRUPTIBLE then you could avoid the BH-lock at the
> > timer-softirq.
> > But when is a timer considered safe? Would the lack of the _bh suffix be
> > that and you would simply add it during your push down?
>
> Yeah that requires manual inspection. A timer that obviously doesn't mess
> up with other softirqs, as is the case most of the time, can simply get the flag.
>
> Other timers can be dealt with individually with local_bh_disable() or
> spin_lock_bh() or critical section.
The question is what keeps _bh() doing if you intend to get rid of the
lock.
> > Then you continue the same thing for the remaining softirqs. And once
> > you are done you would remove that RT lock within local_bh_disable()?
> > This isn't something a !RT user would benefit, right?
>
> Why not? A long lasting ksoftirqd handling lots of NET_RX could be
> interrupted by a timer/rcu softirq in !RT for example. Further, there
> could even be more than one ksoftirqd if necessary, though I doubt it.
That would require more thinking on how to accomplish this. It is
generally assumed that a softirq callback makes always progress if you
look at it from a different CPU. Therefore a loop like in
__timer_delete_sync() is "okay" because the callback will continue and
finish. If you drop the BH bits from the preemption pointer and allow
preemption then the other CPU could spin until that timer gets back and
continues to work. There is more of this kind of logic…
But I don't think that you want ksoftirqd handling NET_RX in the first
place. However having a long running NET_RX is a problem in RT because
it blocks all other force-threaded interrupts. Mainline doesn't have
this problem unless it uses threaded interrupts.
The other problematic thing is that everything is mixed up. So you can't
really distinguish between TASKLET as in USB vs SCSI. Not to mention
NET_RX vs TASKLET. If you don't have luxury to move them to different
CPU I *think* assigning them a priority would be a good thing.
> > The other idea I have (besides the preemption point in each softirq
> > handler (mentioned earlier)) is to simple drop the BH-lock on RT. Unlike
> > mainline, RT wouldn't deadlock then. The only that would be missing is
> > synchronisation against local_bh_disable() only locking for variables.
> > From what I remember from the various BH-models we have in RT in the
> > past, that was the only thing that exploded.
>
> I thought the issue was about timers fiddling with per-cpu state assuming
> they wouldn't be disturbed by other vectors and thus they lack
> local_bh_disable() on appropriate places. Or perhaps I misunderstood?
>
> Otherwise all timers can carry TIMER_SOFTINTERRUPTIBLE right away, right?
The last time I have been looking at it is just the usage of per-CPU
variables. For instance assume a timer invokes napi_consume_skb().
> Thanks.
Sebastian
prev parent reply other threads:[~2023-08-08 19:18 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-01 13:24 Frederic Weisbecker
2023-08-01 13:24 ` [RFC PATCH 1/6] softirq: Turn set_softirq_pending() to reset_softirq_pending() Frederic Weisbecker
2023-08-01 13:24 ` [RFC PATCH 2/6] softirq: Make softirq handling entry/exit generally available Frederic Weisbecker
2023-08-01 13:24 ` [RFC PATCH 3/6] softirq: Introduce softirq disabled mask Frederic Weisbecker
2023-08-01 13:24 ` [RFC PATCH 4/6] x86/softirq: Support " Frederic Weisbecker
2023-08-01 13:24 ` [RFC PATCH 5/6] timers: Introduce soft-interruptible timers Frederic Weisbecker
2023-08-01 13:24 ` [RFC PATCH 6/6] timers: Make process_timeout() soft-interruptible Frederic Weisbecker
2023-08-07 12:50 ` [RFC PATCH 0/6] softirq: Start pushing down the big softirq lock Sebastian Andrzej Siewior
2023-08-07 15:22 ` Frederic Weisbecker
2023-08-08 7:15 ` Sebastian Andrzej Siewior [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=20230808071514.VTDoPGMm@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=anna-maria@linutronix.de \
--cc=edumazet@google.com \
--cc=frederic@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=paulmck@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
/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®