[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <939728a0-b479-4b60-ad0e-9778e2a41551@gmail.com>
Date: Fri, 17 Jan 2025 02:47:15 +0000
From: Pavel Begunkov <asml.silence@...il.com>
To: Jakub Kicinski <kuba@...nel.org>, David Wei <dw@...idwei.uk>
Cc: io-uring@...r.kernel.org, netdev@...r.kernel.org,
Jens Axboe <axboe@...nel.dk>, Paolo Abeni <pabeni@...hat.com>,
"David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
Jesper Dangaard Brouer <hawk@...nel.org>, David Ahern <dsahern@...nel.org>,
Mina Almasry <almasrymina@...gle.com>,
Stanislav Fomichev <stfomichev@...il.com>, Joe Damato <jdamato@...tly.com>,
Pedro Tammela <pctammela@...atatu.com>
Subject: Re: [PATCH net-next v11 10/21] net: add helpers for setting a memory
provider on an rx queue
On 1/17/25 02:25, Jakub Kicinski wrote:
> On Thu, 16 Jan 2025 15:16:52 -0800 David Wei wrote:
>> +static void __net_mp_close_rxq(struct net_device *dev, unsigned ifq_idx,
>> + struct pp_memory_provider_params *old_p)
>> +{
>> + struct netdev_rx_queue *rxq;
>> + int ret;
>> +
>> + if (WARN_ON_ONCE(ifq_idx >= dev->real_num_rx_queues))
>> + return;
>> +
>> + rxq = __netif_get_rx_queue(dev, ifq_idx);
>
> I think there's a small race between io_uring closing and the netdev
> unregister. We can try to uninstall twice, let's put
They're gated by checking ifq->netdev in io_uring code, which is
cleared by them under a spin. So either io_uring does
__net_mp_close_rxq() and ->uninstall does nothing, or vise versa.
> /* Callers holding a netdev ref may get here after we already
> * went thru shutdown via dev_memory_provider_uninstall().
> */
> if (dev->reg_state > NETREG_REGISTERED &&
> !rxq->mp_params.mp_ops)
> return;
>
> here, and in dev_memory_provider_uninstall() clear the pointers?
>
>> + if (WARN_ON_ONCE(rxq->mp_params.mp_ops != old_p->mp_ops ||
>> + rxq->mp_params.mp_priv != old_p->mp_priv))
>> + return;
>> +
>> + rxq->mp_params.mp_ops = NULL;
>> + rxq->mp_params.mp_priv = NULL;
>> + ret = netdev_rx_queue_restart(dev, ifq_idx);
>> + if (ret)
>> + pr_devel("Could not restart queue %u after removing memory provider.\n",
>> + ifq_idx);
>> +}
--
Pavel Begunkov
Powered by blists - more mailing lists