Thread (24 messages) 24 messages, 4 authors, 2025-01-27

Re: [RFC net-next v3 1/4] net: protect queue -> napi linking with netdev_lock()

From: Jakub Kicinski <kuba@kernel.org>
Date: 2025-01-27 21:37:58
Also in: lkml

On Tue, 21 Jan 2025 19:10:41 +0000 Joe Damato wrote:
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 :(
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help