From: Long Li <longli@microsoft.com>
To: Jason Gunthorpe <jgg@ziepe.ca>,
"longli@linuxonhyperv.com" <longli@linuxonhyperv.com>
Cc: Leon Romanovsky <leon@kernel.org>,
Konstantin Taranov <kotaranov@microsoft.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
"linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-hyperv@vger.kernel.org" <linux-hyperv@vger.kernel.org>
Subject: RE: [EXTERNAL] Re: [Patch rdma-next] RDMA/mana_ib: handle net event for pointing to the current netdev
Date: Tue, 4 Mar 2025 01:58:01 +0000 [thread overview]
Message-ID: <SA6PR21MB4231E3DC3F2D88ADFBD0F74DCEC82@SA6PR21MB4231.namprd21.prod.outlook.com> (raw)
In-Reply-To: <20250301002604.GN5011@ziepe.ca>
> Subject: [EXTERNAL] Re: [Patch rdma-next] RDMA/mana_ib: handle net event
> for pointing to the current netdev
>
> On Fri, Feb 28, 2025 at 02:41:59PM -0800, longli@linuxonhyperv.com wrote:
> > + struct mana_ib_dev *dev = container_of(this, struct mana_ib_dev,
> nb);
> > + struct net_device *event_dev = netdev_notifier_info_to_dev(ptr);
> > + struct gdma_context *gc = dev->gdma_dev->gdma_context;
> > + struct mana_context *mc = gc->mana.driver_data;
> > + struct net_device *ndev;
> > +
> > + if (event_dev != mc->ports[0])
> > + return NOTIFY_DONE;
> > +
> > + switch (event) {
> > + case NETDEV_CHANGEUPPER:
> > + rcu_read_lock();
> > + ndev = mana_get_primary_netdev_rcu(mc, 0);
> > + rcu_read_unlock();
>
> That locking sure looks weird/wrong.
>
> Jason
I think the locking is necessary as mana_get_primary_netdev_rcu() requires a RCU lock. It's safe to nest rcu_read_lock() if it's already held.
I have sent v2. v1 is from an earlier branch and is missing some error handling code.
Thanks,
Long
next prev parent reply other threads:[~2025-03-04 1:58 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-28 22:41 longli
2025-02-28 22:51 ` [EXTERNAL] " Long Li
2025-03-01 0:26 ` Jason Gunthorpe
2025-03-04 1:58 ` Long Li [this message]
2025-03-04 6:39 ` Ratheesh Kannoth
2025-03-04 18:26 ` [EXTERNAL] " Long Li
2025-03-04 19:41 ` Jason Gunthorpe
2025-03-05 0:00 ` Long Li
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=SA6PR21MB4231E3DC3F2D88ADFBD0F74DCEC82@SA6PR21MB4231.namprd21.prod.outlook.com \
--to=longli@microsoft.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jgg@ziepe.ca \
--cc=kotaranov@microsoft.com \
--cc=kuba@kernel.org \
--cc=leon@kernel.org \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=longli@linuxonhyperv.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®