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] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHS8izOk6o-CQwJf+3zGkd_2Bfi0du489JqngF8aJVOsfpihqg@mail.gmail.com>
Date: Wed, 12 Feb 2025 16:51:28 -0800
From: Mina Almasry <almasrymina@...gle.com>
To: Jason Xing <kerneljasonxing@...il.com>
Cc: davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org, 
	pabeni@...hat.com, hawk@...nel.org, ilias.apalodimas@...aro.org, 
	horms@...nel.org, netdev@...r.kernel.org
Subject: Re: [PATCH net-next v1] page_pool: avoid infinite loop to schedule
 delayed worker

On Wed, Feb 12, 2025 at 4:44 PM Jason Xing <kerneljasonxing@...il.com> wrote:
> >
> > ```
> > diff --git a/net/core/page_pool.c b/net/core/page_pool.c
> > index 2ea8041aba7e..6d62ea45571b 100644
> > --- a/net/core/page_pool.c
> > +++ b/net/core/page_pool.c
> > @@ -1113,13 +1113,12 @@ static void page_pool_release_retry(struct
> > work_struct *wq)
> >         int inflight;
> >
> >         inflight = page_pool_release(pool);
> > -       if (!inflight)
> > -               return;
> >
> >         /* Periodic warning for page pools the user can't see */
> >         netdev = READ_ONCE(pool->slow.netdev);
> >         if (time_after_eq(jiffies, pool->defer_warn) &&
> > -           (!netdev || netdev == NET_PTR_POISON)) {
> > +           (!netdev || netdev == NET_PTR_POISON) &&
> > +           inflight != 0) {
> >                 int sec = (s32)((u32)jiffies - (u32)pool->defer_start) / HZ;
> >
> >                 pr_warn("%s() stalled pool shutdown: id %u, %d
> > inflight %d sec devmem=%d\n",
> > @@ -1128,7 +1127,15 @@ static void page_pool_release_retry(struct
> > work_struct *wq)
> >                 pool->defer_warn = jiffies + DEFER_WARN_INTERVAL;
> >         }
> >
> > -       /* Still not ready to be disconnected, retry later */
> > +       /* In rare cases, a driver bug may cause inflight to go negative. Don't
> > +        * reschedule release if inflight is 0 or negative.
> > +        *      - If 0, the page_pool has been destroyed
> > +        *      - if negative, we will never recover
> > +        * in both cases no reschedule necessary.
> > +        */
> > +       if (inflight < 1)
>
> Maybe I would change the above to 'inflight <= 0' which looks more
> obvious at the first glance? :)
>

Good catch. Yes.

Also, write "no reschedule is necessary" on the last line in the
comment (add "is")

-- 
Thanks,
Mina

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ