netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Ellerman <mpe@ellerman.id.au>
To: Juliet Kim <julietk@linux.vnet.ibm.com>, netdev@vger.kernel.org
Cc: julietk@linux.vnet.ibm.com, linuxppc-dev@lists.ozlabs.org,
	tlfalcon@linux.vnet.ibm.com
Subject: Re: [PATCH v3 2/2] net/ibmvnic: prevent more than one thread from running in reset
Date: Wed, 18 Sep 2019 16:12:39 +1000	[thread overview]
Message-ID: <87ef0ew2so.fsf@mpe.ellerman.id.au> (raw)
In-Reply-To: <20190917171552.32498-3-julietk@linux.vnet.ibm.com>

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

  reply	other threads:[~2019-09-18  6:12 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 [this message]
2019-09-18 22:21     ` Juliet Kim

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=87ef0ew2so.fsf@mpe.ellerman.id.au \
    --to=mpe@ellerman.id.au \
    --cc=julietk@linux.vnet.ibm.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --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).