netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Juliet Kim <julietk@linux.vnet.ibm.com>
To: Michael Ellerman <mpe@ellerman.id.au>, netdev@vger.kernel.org
Cc: tlfalcon@linux.vnet.ibm.com, linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH v3 2/2] net/ibmvnic: prevent more than one thread from running in reset
Date: Wed, 18 Sep 2019 17:21:24 -0500	[thread overview]
Message-ID: <8afbe58f-4a4a-2b3b-37b7-90dad11de873@linux.vnet.ibm.com> (raw)
In-Reply-To: <87ef0ew2so.fsf@mpe.ellerman.id.au>


On 9/18/19 1:12 AM, Michael Ellerman wrote:
> Hi Juliet,
>
> Juliet Kim <julietk@linux.vnet.ibm.com> writes:
>> Signed-off-by: Juliet Kim <julietk@linux.vnet.ibm.com>
>> ---
>>  drivers/net/ethernet/ibm/ibmvnic.c | 23 ++++++++++++++++++++++-
>>  drivers/net/ethernet/ibm/ibmvnic.h |  3 +++
>>  2 files changed, 25 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
>> index ba340aaff1b3..f344ccd68ad9 100644
>> --- a/drivers/net/ethernet/ibm/ibmvnic.c
>> +++ b/drivers/net/ethernet/ibm/ibmvnic.c
>> @@ -2054,6 +2054,13 @@ static void __ibmvnic_reset(struct work_struct *work)
>>  
>>  	adapter = container_of(work, struct ibmvnic_adapter, ibmvnic_reset);
>>  
>> +	if (adapter->resetting) {
>> +		schedule_delayed_work(&adapter->ibmvnic_delayed_reset,
>> +				      IBMVNIC_RESET_DELAY);
>> +		return;
>> +	}
>> +
>> +	adapter->resetting = true;
>>  	reset_state = adapter->state;
> Is there some locking/serialisation around this?
>
> Otherwise that looks very racy. ie. two CPUs could both see
> adapter->resetting == false, then both set it to true, and then continue
> executing and stomp on each other.
>
> cheers

I agree there may be a race here. Thank you for reviewing.

I will address it in the next version.


      reply	other threads:[~2019-09-18 22:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-17 17:15 [PATCH v3 0/2] net/ibmvnic: serialization fixes Juliet Kim
2019-09-17 17:15 ` [PATCH v3 1/2] net/ibmvnic: unlock rtnl_lock in reset so linkwatch_event can run Juliet Kim
2019-09-17 17:15 ` [PATCH v3 2/2] net/ibmvnic: prevent more than one thread from running in reset Juliet Kim
2019-09-18  6:12   ` Michael Ellerman
2019-09-18 22:21     ` Juliet Kim [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=8afbe58f-4a4a-2b3b-37b7-90dad11de873@linux.vnet.ibm.com \
    --to=julietk@linux.vnet.ibm.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=netdev@vger.kernel.org \
    --cc=tlfalcon@linux.vnet.ibm.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;
as well as URLs for NNTP newsgroup(s).