Re: [RFC net-next v3 1/4] net: protect queue -> napi linking with netdev_lock()
From: Joe Damato <hidden>
Date: 2025-01-27 22:21:57
Also in:
lkml
On Mon, Jan 27, 2025 at 01:37:56PM -0800, Jakub Kicinski wrote:
On Tue, 21 Jan 2025 19:10:41 +0000 Joe Damato wrote:quoted
From: Jakub Kicinski <kuba@kernel.org> netdev netlink is the only reader of netdev_{,rx_}queue->napi, and it already holds netdev->lock. Switch protection of the writes to netdev->lock as well. Add netif_queue_set_napi_locked() for API completeness, but the expectation is that most current drivers won't have to worry about locking any more. Today they jump thru hoops to take rtnl_lock.I started having second thoughts about this patch, sorry to say. NAPI objects were easy to protect with the lock because there's a clear registration and unregistration API. Queues OTOH are made visible by the netif_set_real_num_queues() call, which is tricky to protect with the instance lock. Queues are made visible, then we configure them. My thinking changed a bit, I think we should aim to protect all ndos and ethtool ops with the instance lock. Stanislav and Saeed seem to be working on that: https://lore.kernel.org/all/Z5LhKdNMO5CvAvZf@mini-arch/ (local) so hopefully that doesn't cause too much of a delay. But you may need to rework this series further :(
OK, I'll wait for something to emerge from that work before re-spinning this.