[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220204074317.4a8be6d8@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
Date: Fri, 4 Feb 2022 07:43:17 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
Cc: Yannick Vignon <yannick.vignon@....nxp.com>,
Eric Dumazet <edumazet@...gle.com>,
Giuseppe Cavallaro <peppe.cavallaro@...com>,
Alexandre Torgue <alexandre.torgue@...s.st.com>,
Jose Abreu <joabreu@...opsys.com>,
"David S. Miller" <davem@...emloft.net>,
Maxime Coquelin <mcoquelin.stm32@...il.com>,
Antoine Tenart <atenart@...nel.org>,
Alexander Lobakin <alexandr.lobakin@...el.com>,
Paolo Abeni <pabeni@...hat.com>, Wei Wang <weiwan@...gle.com>,
Kumar Kartikeya Dwivedi <memxor@...il.com>,
Yunsheng Lin <linyunsheng@...wei.com>,
Arnd Bergmann <arnd@...db.de>, netdev <netdev@...r.kernel.org>,
Vladimir Oltean <olteanv@...il.com>,
Xiaoliang Yang <xiaoliang.yang_1@....com>, mingkai.hu@....com,
Joakim Zhang <qiangqing.zhang@....com>,
sebastien.laveze@....com, Yannick Vignon <yannick.vignon@....com>
Subject: Re: [PATCH net-next 1/2] net: napi: wake up ksoftirqd if needed
after scheduling NAPI
On Fri, 4 Feb 2022 09:19:22 +0100 Sebastian Andrzej Siewior wrote:
> On 2022-02-03 17:09:01 [-0800], Jakub Kicinski wrote:
> > Let's be clear that the problem only exists when switching to threaded
> > IRQs on _non_ PREEMPT_RT kernel (or old kernels). We already have a
> > check in __napi_schedule_irqoff() which should handle your problem on
> > PREEMPT_RT.
>
> It does not. The problem is the missing bh-off/on around the call. The
> forced-threaded handler has this. His explicit threaded-handler does not
> and needs it.
I see, what I was getting at is on PREEMPT_RT IRQs are already threaded
so I thought the patch was only targeting non-RT, I didn't think that
explicitly threading IRQ is advantageous also on RT.
> > We should slap a lockdep warning for non-irq contexts in
> > ____napi_schedule(), I think, it was proposed by got lost.
>
> Something like this perhaps?:
>
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 1baab07820f65..11c5f003d1591 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -4217,6 +4217,9 @@ static inline void ____napi_schedule(struct softnet_data *sd,
> {
> struct task_struct *thread;
>
> + lockdep_assert_once(hardirq_count() | softirq_count());
> + lockdep_assert_irqs_disabled();
> +
> if (test_bit(NAPI_STATE_THREADED, &napi->state)) {
> /* Paired with smp_mb__before_atomic() in
> * napi_enable()/dev_set_threaded().
👍 maybe with a comment above the first one saying that we want to make
sure softirq will be handled somewhere down the callstack. Possibly push
it as a helper in lockdep.h called "lockdep_assert_softirq_will_run()"
so it's self-explanatory?
> Be aware that this (the first assert) will trigger in dev_cpu_dead() and
> needs a bh-off/on around. I should have something in my RT tree :)
Or we could push the asserts only into the driver-facing helpers
(__napi_schedule(), __napi_schedule_irqoff()).
Powered by blists - more mailing lists