[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <PH7PR21MB32638B8B639FC2B9CEC99C05CEAB9@PH7PR21MB3263.namprd21.prod.outlook.com>
Date: Mon, 13 Jun 2022 18:25:43 +0000
From: Long Li <longli@...rosoft.com>
To: David Miller <davem@...emloft.net>,
"longli@...uxonhyperv.com" <longli@...uxonhyperv.com>
CC: KY Srinivasan <kys@...rosoft.com>,
Haiyang Zhang <haiyangz@...rosoft.com>,
Stephen Hemminger <sthemmin@...rosoft.com>,
"wei.liu@...nel.org" <wei.liu@...nel.org>,
Dexuan Cui <decui@...rosoft.com>,
"kuba@...nel.org" <kuba@...nel.org>,
"pabeni@...hat.com" <pabeni@...hat.com>,
"jgg@...pe.ca" <jgg@...pe.ca>, "leon@...nel.org" <leon@...nel.org>,
"edumazet@...gle.com" <edumazet@...gle.com>,
"shiraz.saleem@...el.com" <shiraz.saleem@...el.com>,
Ajay Sharma <sharmaajay@...rosoft.com>,
"linux-hyperv@...r.kernel.org" <linux-hyperv@...r.kernel.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-rdma@...r.kernel.org" <linux-rdma@...r.kernel.org>
Subject: RE: [Patch v3 03/12] net: mana: Handle vport sharing between devices
> Subject: Re: [Patch v3 03/12] net: mana: Handle vport sharing between
> devices
>
> From: longli@...uxonhyperv.com
> Date: Sun, 12 Jun 2022 14:14:45 -0700
>
> > +int mana_cfg_vport(struct mana_port_context *apc, u32
> protection_dom_id,
> > + u32 doorbell_pg_id)
> > {
> > + /* Ethernet driver and IB driver can't take the port at the same time
> */
> > + refcount_inc(&apc->port_use_count);
> > + if (refcount_read(&apc->port_use_count) > 2) {
>
> This is a racy test, the count could change after the test against '2'. It would
> be nice if there was a primitive to do the increment and test atomically, but I
> fail to see one that matches this scenerio currently.
>
> Thank you.
I'm changing it to mutex.
Thank you,
Long
Powered by blists - more mailing lists