lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAAywjhRtK007cSQMMdmw9dYrzDohjFsr-b6r-gXhK_K-RahJLA@mail.gmail.com>
Date: Wed, 14 May 2025 09:31:49 -0700
From: Samiullah Khawaja <skhawaja@...gle.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: "David S . Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, 
	Paolo Abeni <pabeni@...hat.com>, almasrymina@...gle.com, willemb@...gle.com, 
	jdamato@...tly.com, mkarsten@...terloo.ca, weiwan@...gle.com, 
	netdev@...r.kernel.org
Subject: Re: [PATCH net-next] net: stop napi kthreads when THREADED napi is disabled

On Tue, May 13, 2025 at 5:08 PM Jakub Kicinski <kuba@...nel.org> wrote:
>
> On Tue, 13 May 2025 00:26:31 +0000 Samiullah Khawaja wrote:
> > @@ -7463,6 +7482,15 @@ static int napi_thread_wait(struct napi_struct *napi)
> >                       return 0;
> >               }
> >
> > +             /* Since the SCHED_THREADED is not set so we do not own this
> > +              * napi and it is safe to stop here if we are asked to. Checking
> > +              * the SCHED_THREADED before stopping here makes sure that this
> > +              * napi was not schedule again while napi threaded was being
> > +              * disabled.
> > +              */
>
> Not sure if this works:
>
>           CPU 0 (IRQ)             CPU 1 (NAPI thr)          CPU 2 (config)
>
>   ____napi_schedule()
>     if (test_bit(NAPI_STATE_THREADED))
>
>                                                          clear_bit(NAPI_STATE_THREADED)
>                                                          kthread_stop(thread)
>
>                               if (test_bit(NAPI_STATE_SCHED_THREADED))
>                                    ..
>                               if (kthread_should_stop())
>                                    exit
>
>        set_bit(NAPI_STATE_SCHED_THREADED)
Thanks for pointing this out. I didn't consider this, I'll sort it out.
>        wake_up_process(thread);
>
>
>
> > +             if (kthread_should_stop())
> > +                     break;
> > +
> >               schedule();
> >               set_current_state(TASK_INTERRUPTIBLE);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ