# Re: \[PATCH net-next v10 04/14\] net: hold netdev instance lock during qdisc ndo\_setup\_tc

- From: Stanislav Fomichev \<hidden\>
- Date: 2025-05-05 18:55:01 
- List: netdev
- Page: https://ratatoskr.run/netdev/2025/05/11326490
- Thread: https://ratatoskr.run/netdev/2025/03/11321361/t.md

```text
On 05/05, Jakub Kicinski wrote:
> On Mon, 5 May 2025 15:12:39 +0000 Cosmin Ratiu wrote:
> > On Mon, 2025-05-05 at 08:07 -0700, Stanislav Fomichev wrote:
> > > On 05/05, Cosmin Ratiu wrote:  
> > > > diff --git a/net/core/dev.c b/net/core/dev.c
> > > > index d1a8cad0c99c..134ceddf7fa5 100644
> > > > --- a/net/core/dev.c
> > > > +++ b/net/core/dev.c
> > > > @@ -12020,9 +12020,9 @@ void
> > > > unregister_netdevice_many_notify(struct
> > > > list_head *head,
> > > >                 struct sk_buff *skb = NULL;
> > > >  
> > > >                 /* Shutdown queueing discipline. */
> > > > +               netdev_lock_ops(dev);
> > > >                 dev_shutdown(dev);
> > > >                 dev_tcx_uninstall(dev);  
> > > 
> > > There is a synchronize_net hidden inside of dev_tcx_uninstall, so
> > > let's ops-lock only dev_shutdown here? Other than that, don't see
> > > anything wrong. Can you send this separately and target net tree?  
> 
> Avoiding synchronize_net() under the instance lock as an optimization? 
> We're under rtnl_lock here, probably a premature optimization?
> But no strong preference..

Good point, yes, let's not over complicate and just move the lock_ops
up as Cosmin originally suggested.

> BTW isn't the naming scheme now that dev_* takes the lock? So we should
> probably add netif_ versions or rename these existing calls?

Can I follow up on these separately? I was thinking about sending
a bulk rename once we are closer to shipping 6.15. We have a lot of
cases where dev_ is inconsistent.
```
