Received: by 2002:a25:5b86:0:0:0:0:0 with SMTP id p128csp778244ybb; Thu, 28 Mar 2019 12:01:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqx6Rjjr3lV2WtNDTs81I6ogQZrOebtTT35LmcOtunF17D7XZSw2G57a3Lqd9ie32bsb1EyO X-Received: by 2002:aa7:90c7:: with SMTP id k7mr42340187pfk.186.1553799676502; Thu, 28 Mar 2019 12:01:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1553799676; cv=pass; d=google.com; s=arc-20160816; b=rfu0Xk3W4o4OeZ5COtFRan6QdVfpA0bDq1CLejOl0NX6YKa/1VAk7IqhFsd4fLODr2 U9mc9yUIan1AxPmIK+29wFJYuBQYaViXJETvw5V+30ZtyJ5k64/ZUvjMlu6VfVLB4mnH tqatVs4rKrS33CT+g1+rAJOllnazouVtAV1f4+2VuMxZsiPzcqneCvS6145zhR9eax8Q lkEB0l/DKDHIzkFm+B//EDXo43B1tXyNV++goumPzu2wLq8+abGrAR8VpblsM7v+i66u SDKxY9SB/O0nhtLHQytp5CdfzdCIH0KmRWYP6qaU5ZuygC7D21qrasn+hVU5eZLy+RmU rxjA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :msip_labels:content-language:accept-language:in-reply-to:references :message-id:date:thread-index:thread-topic:subject:cc:to:from :dkim-signature; bh=BY6JkmY8WMNsq9fC7/XPER6FNpVtAVUyQ1CR5k+vwiQ=; b=oREv3ZGquogQQLIDbBsNCe/RF688V0WbyusXbdWxZaXJiyrtPyOFNrMVflTPNW+cxp D02Jnm66XREaUmjtKpYoRM7U4olY8HH4AfBScRbm/irbGafc4zFjlVIhFviboGJWf0mZ Ws5v/BHi3k/IXfBaCIRBCnNH5AwxNFHyi/lvzK8SbOJFLL5BDZgUfR1OBIExx8MLCgWQ fFFucckbEc+zPaZkW9KjeA7ljzbrDYrD8AwxfkcX1j1Vi+E88ME2J1s9IZC5IkQpbngi s9KNzwbVF50ypQGE81FnNJzlPP2A1+lF764DkF/lzHULR5JIKFy7nayDnQ6vI7EpCwMi bVmg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=X1wk0xlp; arc=pass (i=1); spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r18si3957276pgl.530.2019.03.28.12.01.00; Thu, 28 Mar 2019 12:01:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=X1wk0xlp; arc=pass (i=1); spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726324AbfC1TAX (ORCPT + 99 others); Thu, 28 Mar 2019 15:00:23 -0400 Received: from mail-eopbgr680101.outbound.protection.outlook.com ([40.107.68.101]:64128 "EHLO NAM04-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725828AbfC1TAW (ORCPT ); Thu, 28 Mar 2019 15:00:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BY6JkmY8WMNsq9fC7/XPER6FNpVtAVUyQ1CR5k+vwiQ=; b=X1wk0xlp5CMB4GlJVgn5gYGuPdKa1d8btS9K9JezV84ji1dh43RiCB+4O904yw63v/gLK7doEK8z5C7PGUCvJ/4Zt1pzIYNT6A51XzKsJSphDISqpS72VBzdetVpECbiotxrd3RhMSQek77vBO7IDMcdEW/gORzNNJQ7dcHlrUw= ARC-Seal: i=1; a=rsa-sha256; s=testarcselector01; d=microsoft.com; cv=none; b=ZIk3+KCnVvuJFZBhlqCgoOrellwFHcufiVDKSt0J5EDJR/NrvrgUaCLs1xNE4/YNqvBb6G1j1HfmBpBsBemR4Wj251QexPChOaNR59wEL/7WEewlirLcXQafruljP3xCSpupTF6ZsibxLuGes3XxSnzOF6xnpqQWutxQgg2sBCo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=testarcselector01; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BY6JkmY8WMNsq9fC7/XPER6FNpVtAVUyQ1CR5k+vwiQ=; b=PdtYomEibLc1ggnSH53cwxCUQcTVp+2Q+zZlXVAoehqokYQareWc4xsmQoKIOqr3ZWfElts09AhSN60zAwbWLUapAXiyS0ggXNo2BaSRTGdleBKvbXmga4QMMbLIJmaqciiEReBN63k3UwCrDginXQkAjgZ0PIK1kQoInbkIjYo= ARC-Authentication-Results: =?us-ascii?Q?i=3D1;_test.office365.com_1;=0D=0A=09=09dmarc=3Dnone_action?= =?us-ascii?Q?=3Dnone_header.from=3Dmicrosoft.com;=0D=0A=09=09arc=3Dnone?= Received: from DM6PR21MB1337.namprd21.prod.outlook.com (20.179.53.80) by DM6PR21MB1273.namprd21.prod.outlook.com (20.179.51.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1771.4; Thu, 28 Mar 2019 19:00:18 +0000 Received: from DM6PR21MB1337.namprd21.prod.outlook.com ([fe80::a8f3:221a:ccfe:f049]) by DM6PR21MB1337.namprd21.prod.outlook.com ([fe80::a8f3:221a:ccfe:f049%8]) with mapi id 15.20.1771.007; Thu, 28 Mar 2019 19:00:18 +0000 From: Haiyang Zhang To: Stephen Hemminger , Haiyang Zhang CC: "sashal@kernel.org" , "linux-hyperv@vger.kernel.org" , KY Srinivasan , Stephen Hemminger , "olaf@aepfle.de" , vkuznets , "davem@davemloft.net" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH hyperv-fixes] hv_netvsc: Fix unwanted wakeup after tx_disable Thread-Topic: [PATCH hyperv-fixes] hv_netvsc: Fix unwanted wakeup after tx_disable Thread-Index: AQHU5Y6yCEd0RmutM0qGiubebdJ5HaYhX7uAgAAB3SA= Date: Thu, 28 Mar 2019 19:00:18 +0000 Message-ID: References: <20190328174845.4799-1-haiyangz@linuxonhyperv.com> <20190328113823.3c9b3599@shemminger-XPS-13-9360> In-Reply-To: <20190328113823.3c9b3599@shemminger-XPS-13-9360> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Enabled=True; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SiteId=72f988bf-86f1-41af-91ab-2d7cd011db47; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Owner=haiyangz@microsoft.com; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SetDate=2019-03-28T19:00:16.3869492Z; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Name=General; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Application=Microsoft Azure Information Protection; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ActionId=956a15e3-99e3-44b7-973e-d709cb7cf7b4; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Extended_MSFT_Method=Automatic x-originating-ip: [96.61.92.94] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: ff398a7b-2acd-43ee-4e04-08d6b3af9ed9 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(5600127)(711020)(4605104)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7193020);SRVR:DM6PR21MB1273; x-ms-traffictypediagnostic: DM6PR21MB1273: authentication-results: spf=none (sender IP is ) smtp.mailfrom=haiyangz@microsoft.com; x-ld-processed: 72f988bf-86f1-41af-91ab-2d7cd011db47,ExtAddr x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8273; x-forefront-prvs: 0990C54589 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(376002)(366004)(346002)(136003)(396003)(39860400002)(199004)(13464003)(189003)(2906002)(110136005)(14454004)(478600001)(86612001)(446003)(4326008)(316002)(486006)(8936002)(10090500001)(54906003)(86362001)(25786009)(476003)(229853002)(8990500004)(81156014)(81166006)(11346002)(8676002)(256004)(106356001)(74316002)(10290500003)(22452003)(305945005)(71190400001)(105586002)(71200400001)(14444005)(97736004)(55016002)(3846002)(33656002)(7736002)(9686003)(5660300002)(6436002)(6116002)(99286004)(102836004)(68736007)(52536014)(26005)(53546011)(53936002)(76176011)(6246003)(7696005)(66066001)(186003)(6506007)(26123001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM6PR21MB1273;H:DM6PR21MB1337.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: BeBY4eNF1rev42tvytKsrFvryxxkjgwItGQY5SRvefSIYQWGdHv9/a08ZNdCRV9Gdl9D2DaunwtxDMPrn2vGYD3h3xAOKUBqwAjZzQPMCNejrdBEEUbqpDvpl3YLkXS6TRnqkKaH09G7RKGKQhgwuXbU7Up40wU2YVwzZl8TRzOCWZJ1goue6UPF0pGw0+xmrRrDVuuxuIues0ibVaWHQoootCcy3iQi7RameYGzSGs+HskrnXTDtn9AjQPGOjYHmNS1fI2ygA9GNinBf+2uicwY4zEoihqnPXIlFxpUokAhVxfDUF3H9zRc2b1j4s+h6XXde8Uy+vTjVOojDPpxsmgAVvsOYylyB/jzuVOrms7Aj57fRc46WV1j39/kuInoZU2/ttmby+Lw9M+DXvYI5aYLKpPK0KZeI/DCH2Ke+MI= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: ff398a7b-2acd-43ee-4e04-08d6b3af9ed9 X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Mar 2019 19:00:18.4433 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR21MB1273 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > -----Original Message----- > From: Stephen Hemminger > Sent: Thursday, March 28, 2019 2:38 PM > To: Haiyang Zhang > Cc: sashal@kernel.org; linux-hyperv@vger.kernel.org; Haiyang Zhang > ; KY Srinivasan ; Stephen > Hemminger ; olaf@aepfle.de; vkuznets > ; davem@davemloft.net; netdev@vger.kernel.org; > linux-kernel@vger.kernel.org > Subject: Re: [PATCH hyperv-fixes] hv_netvsc: Fix unwanted wakeup after > tx_disable >=20 > On Thu, 28 Mar 2019 17:48:45 +0000 > Haiyang Zhang wrote: >=20 > > +static inline void netvsc_tx_enable(struct netvsc_device *nvscdev, > > + struct net_device *ndev) > > +{ > > + nvscdev->tx_disable =3D false; > > + mb(); /* ensure queue wake up mechanism is on */ > > + > > + netif_tx_wake_all_queues(ndev); > > +} >=20 > You don't need a full mb(). virt_wmb() should be sufficient. I will make this change.=20 > Could I suggest an alternative approach. > You don't need to introduce a local tx_disable flag, the only place where= a > wakeup could cause problems is after a send_completion was processed > during detach state. >=20 > Instead, just avoid wakeup in that place. In netvsc_detach(), after netif_tx_disable(), we call netvsc_wait_until_em= pty(nvdev); TX patch should not be waken up again while waiting for in/out ring to beco= mes empty. In my tests before this patch, there are wakeup happens before netif_device= _detach(),=20 so netif_device_present(ndev) is still true at that time. In other places, like netvsc_close(), link_change(), we also don't want wak= eup after tx_disable. Thanks. - Haiyang >=20 > --- a/drivers/net/hyperv/netvsc.c > +++ b/drivers/net/hyperv/netvsc.c > @@ -720,6 +720,7 @@ static void netvsc_send_tx_complete(struct > net_device *ndev, > struct netdev_queue *txq =3D netdev_get_tx_queue(ndev, q_= idx); >=20 > if (netif_tx_queue_stopped(txq) && > + netif_device_present(ndev) && > (hv_get_avail_to_write_percent(&channel->outbound) > > RING_AVAIL_PERCENT_HIWATER || queue_sends < 1)) { > netif_tx_wake_queue(txq);