Re: [net-next PATCH v2 3/4] netdev: replace napi_reschedule with napi_schedule

From: Christian Marangi
Date: Fri Oct 06 2023 - 14:54:47 EST


On Thu, Oct 05, 2023 at 06:41:03PM +0200, Eric Dumazet wrote:
> On Thu, Oct 5, 2023 at 6:32 PM Jakub Kicinski <kuba@xxxxxxxxxx> wrote:
> >
> > On Thu, 5 Oct 2023 18:11:56 +0200 Eric Dumazet wrote:
> > > OK, but I suspect some users of napi_reschedule() might not be race-free...
> >
> > What's the race you're thinking of?
>
> This sort of thing... the race is in fl_starving() though...
>
> diff --git a/drivers/net/ethernet/chelsio/cxgb4/sge.c
> b/drivers/net/ethernet/chelsio/cxgb4/sge.c
> index 98dd78551d89..b5ff2e1a9975 100644
> --- a/drivers/net/ethernet/chelsio/cxgb4/sge.c
> +++ b/drivers/net/ethernet/chelsio/cxgb4/sge.c
> @@ -4261,7 +4261,7 @@ static void sge_rx_timer_cb(struct timer_list *t)
>
> if (fl_starving(adap, fl)) {
> rxq = container_of(fl, struct sge_eth_rxq, fl);
> - if (napi_reschedule(&rxq->rspq.napi))
> + if (napi_schedule(&rxq->rspq.napi))
> fl->starving++;
> else
> set_bit(id, s->starving_fl);

Ehhh problem is that this is a simple rename so if any race is present,
it's already there and not caused by this rename :(

Don't know maybe this is out of scope and should be investigated with a
bug report?

Maybe this should be changed to prep/__schedule to prevent any kind of
race? But doing so doesn't prevent any kind of ""starving""?

--
Ansuel