lkml.org 
[lkml]   [2022]   [Jun]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [Patch v3 03/12] net: mana: Handle vport sharing between devices
Date
> Subject: Re: [Patch v3 03/12] net: mana: Handle vport sharing between
> devices
>
> From: longli@linuxonhyperv.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

\
 
 \ /
  Last update: 2022-06-13 21:55    [W:0.053 / U:1.136 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site