From: Stanislav Fomichev <stfomichev@gmail.com>
To: Cosmin Ratiu <cratiu@nvidia.com>
Cc: "davem@davemloft.net" <davem@davemloft.net>,
"kuba@kernel.org" <kuba@kernel.org>,
Tariq Toukan <tariqt@nvidia.com>,
Dragos Tatulea <dtatulea@nvidia.com>,
"sdf@fomichev.me" <sdf@fomichev.me>,
"pabeni@redhat.com" <pabeni@redhat.com>,
"horms@kernel.org" <horms@kernel.org>,
"edumazet@google.com" <edumazet@google.com>,
Saeed Mahameed <saeedm@nvidia.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: [PATCH net v2] net: Lock lower level devices when updating features
Date: Fri, 9 May 2025 08:04:24 -0700 [thread overview]
Message-ID: <aB4ZeKV8m3GKL9qc@mini-arch> (raw)
In-Reply-To: <b14f2b94b9ecfcb0926c09f8bce01dc2a52a0eca.camel@nvidia.com>
On 05/08, Cosmin Ratiu wrote:
> On Thu, 2025-05-08 at 09:12 -0700, Stanislav Fomichev wrote:
> > > --- a/net/core/dev.c
> > > +++ b/net/core/dev.c
> > > @@ -10454,7 +10454,9 @@ static void
> > > netdev_sync_lower_features(struct net_device *upper,
> > > netdev_dbg(upper, "Disabling feature %pNF
> > > on lower dev %s.\n",
> > > &feature, lower->name);
> > > lower->wanted_features &= ~feature;
> > > + netdev_lock_ops(lower);
> > > __netdev_update_features(lower);
> > > + netdev_unlock_ops(lower);
> > >
> > > if (unlikely(lower->features & feature))
> > > netdev_WARN(upper, "failed to
> > > disable %pNF on %s!\n",
> >
> > Any reason not to cover the whole section under the if()? For
> > example,
> > looking at netdev_features_change, most of its invocations are under
> > the
> > lock, so keeping the lock around it might help with consistency (and
> > we can clarify it as such in
> > Documentation/networking/netdevices.rst).
> > Plus, wanted_features is already sort of ops-protected (looking at
> > netif_disable_lro+dev_disable_lro).
>
> The critical section could be extended for the whole if, but there are
> a lot of netdev_features_change() calls in many drivers, which I am not
> sure are ops protected. So I'd be reluctant to state that
> NETDEV_FEAT_CHANGE is ops-protected in
> Documentation/networking/netdevices.rst, even though all core
> invocations would be made with the ops lock held.
Ack, I don't think the calls in drivers/ matter, none of these are
ops-protected drivers, but we can do that separately.
prev parent reply other threads:[~2025-05-09 15:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-08 14:54 [PATCH net v2] net: Lock lower level devices when updating features Cosmin Ratiu
2025-05-08 16:04 ` Jakub Kicinski
2025-05-08 16:12 ` Stanislav Fomichev
2025-05-08 18:24 ` Cosmin Ratiu
2025-05-09 15:04 ` Stanislav Fomichev [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aB4ZeKV8m3GKL9qc@mini-arch \
--to=stfomichev@gmail.com \
--cc=cratiu@nvidia.com \
--cc=davem@davemloft.net \
--cc=dtatulea@nvidia.com \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=saeedm@nvidia.com \
--cc=sdf@fomichev.me \
--cc=tariqt@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.