From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 526F1C4CEC4 for ; Wed, 18 Sep 2019 06:14:55 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 72A5D20882 for ; Wed, 18 Sep 2019 06:14:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=ellerman.id.au header.i=@ellerman.id.au header.b="QY/9K8+m" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 72A5D20882 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ellerman.id.au Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 46Y8pN1Y1ZzF3S5 for ; Wed, 18 Sep 2019 16:14:52 +1000 (AEST) Received: from ozlabs.org (bilbo.ozlabs.org [203.11.71.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 46Y8lq5LK0zDq7F for ; Wed, 18 Sep 2019 16:12:39 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=ellerman.id.au Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ellerman.id.au header.i=@ellerman.id.au header.b="QY/9K8+m"; dkim-atps=neutral Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 46Y8lq3kqtz9sCJ; Wed, 18 Sep 2019 16:12:39 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ellerman.id.au; s=201909; t=1568787159; bh=rKbION4BRPZJT2pVRWztj3dezrjkCwmBEIqMY9p6PwM=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=QY/9K8+m/yJdqnZ3LNdZBaa+TpfQPC3Ev3jRfcmfiOogz72qFx1Ge0VppqA0ik4sf /pT+hFIbHBUlB/4gKA52zNc6pW83UbJE9nESuNFU8ayoAKY5s5LZJGFDAMYCbsilFE N/R0TbJb+RcLzLfDL4O45/bepv7BWhiq0DdbuqVupmIVIBtoqVWLi8vAiErAAea6uK ZvFEstiXYCGM8PnvqtiBktJ8PdbhoIZySgWJr+Wg91mhVnIXobZNcSoE4yUjPwg8O5 3yJTH9fmEeruNdQVGGdclsxHlqhm7lEDO6YhU4qocUNRvNUcS1FXhv9gqTHzk+KPyY JjBuIDdR8qmCw== From: Michael Ellerman To: Juliet Kim , netdev@vger.kernel.org Subject: Re: [PATCH v3 2/2] net/ibmvnic: prevent more than one thread from running in reset In-Reply-To: <20190917171552.32498-3-julietk@linux.vnet.ibm.com> References: <20190917171552.32498-1-julietk@linux.vnet.ibm.com> <20190917171552.32498-3-julietk@linux.vnet.ibm.com> Date: Wed, 18 Sep 2019 16:12:39 +1000 Message-ID: <87ef0ew2so.fsf@mpe.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: julietk@linux.vnet.ibm.com, tlfalcon@linux.vnet.ibm.com, linuxppc-dev@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" Hi Juliet, Juliet Kim writes: > Signed-off-by: Juliet Kim > --- > 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