Received: by 10.213.65.68 with SMTP id h4csp1122223imn; Sun, 18 Mar 2018 15:42:22 -0700 (PDT) X-Google-Smtp-Source: AG47ELsL3Ofe0JeylMK82YNOw5LI00nMFZLRBZsKcIy5Uulmn1LMI6CAYxrs+vT05LnnmlKe1LqD X-Received: by 2002:a17:902:2468:: with SMTP id m37-v6mr9960421plg.388.1521412942288; Sun, 18 Mar 2018 15:42:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521412942; cv=none; d=google.com; s=arc-20160816; b=m8skVEYo0FBpo0VVHUKcwaYEmpb+DOjpU91mZuL61UiYRig5kEag1vrRxVZanUzpPO bX5DXZwcWfqIG2toq09/ZHyf73iivVhvT00/43en9B2xTbzjZvf6415NdZbHDwjmQCUx aLgP4sqfZnQyl6xx1YgBkHYwVaqhK61TshcZADaPvsvbGdH8XiWMKaPoad7O+txgh2oC KU1XPCDMcizsgoik2E0CsNlzxRXXb97Qa/OcjXw6zK3MRV7OON0xxvcIrkwixDnkLF1x lN1hxEDkwpH2v/Ks9lzPXq55IcRyrFQansjor5kr9qOnBDS5bqiPrNb8wQrPoOY7/1Z2 GQtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:msip_labels :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=BrGqsTKBQtZKE8cW95QKaLxlZ/eznOvSKAPs20JN0HQ=; b=PAFdkvraBQzRtaIa5YC9jsxLOP77XfWU0czMIQJMVIJX/kkoBiEPhK6PDacSSFjDOF 1aROp6m+rsgWRg5uV+uQWhrTRJf0zOQxZnSbnEbF9+N1yCPe2ORT8Yd28k1Vd1U3NXNC OtX9+95U7m0TN2VGPqkNEIEoUjuYUT/h6euwuCZjA2xQ2ZvCjeVGocjsl4apsqSrC++H m8ITMxrJNuIviVeZTwPk095VFKskJdrjdYMgtO38h5HsSFM8XLHvlxFCeZS0U7lUIrK7 jHxoUqb5t8+aC3NTBWKuZcJutnhQ3u+nlPyrynw0yRkq5ZguXKaqZyePRkgjTUJlQFot Ds6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=isIM9fkx; 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 x61-v6si10803353plb.741.2018.03.18.15.42.08; Sun, 18 Mar 2018 15:42:22 -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=isIM9fkx; 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 S1754708AbeCRWlB (ORCPT + 99 others); Sun, 18 Mar 2018 18:41:01 -0400 Received: from mail-by2nam03on0107.outbound.protection.outlook.com ([104.47.42.107]:29664 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754230AbeCRWk6 (ORCPT ); Sun, 18 Mar 2018 18:40:58 -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; bh=BrGqsTKBQtZKE8cW95QKaLxlZ/eznOvSKAPs20JN0HQ=; b=isIM9fkxYxI1Dm82jo2rzI3b6yTRQSCvXLZKwZFfAFlgt95GkUZaqDKQ/o2kMCVS/seudh5DRhywairjmfsM6hMir5z1u9Iu/XfuWa1tIToQgUWWAJCjyLMEmDr3l7HmuuijE9XiXX/Mk3b/7cJ4cNJEGKMnflqUOBFDpT1zATQ= Received: from DM5PR2101MB1030.namprd21.prod.outlook.com (52.132.128.11) by DM5PR2101MB1080.namprd21.prod.outlook.com (52.132.130.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.631.0; Sun, 18 Mar 2018 22:40:55 +0000 Received: from DM5PR2101MB1030.namprd21.prod.outlook.com ([fe80::14f:785d:71f2:d396]) by DM5PR2101MB1030.namprd21.prod.outlook.com ([fe80::14f:785d:71f2:d396%4]) with mapi id 15.20.0631.002; Sun, 18 Mar 2018 22:40:55 +0000 From: "Michael Kelley (EOSG)" To: Jia-Ju Bai , KY Srinivasan , Haiyang Zhang , Stephen Hemminger , "bhelgaas@google.com" CC: "devel@linuxdriverproject.org" , "linux-pci@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH 1/2] pci: host: pci-hyperv: Replace GFP_ATOMIC with GFP_KERNEL in hv_pci_onchannelcallback Thread-Topic: [PATCH 1/2] pci: host: pci-hyperv: Replace GFP_ATOMIC with GFP_KERNEL in hv_pci_onchannelcallback Thread-Index: AQHTvsja6KbTRPVg0UyrOUPXmgRmnKPWlbsA Date: Sun, 18 Mar 2018 22:40:55 +0000 Message-ID: References: <1521384782-23539-1-git-send-email-baijiaju1990@gmail.com> In-Reply-To: <1521384782-23539-1-git-send-email-baijiaju1990@gmail.com> 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=mikelley@ntdev.microsoft.com; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SetDate=2018-03-18T22:40:53.8933675Z; 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_Extended_MSFT_Method=Automatic; Sensitivity=General x-originating-ip: [24.22.167.197] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM5PR2101MB1080;7:hULsFqYr1fadHw1kH2RFZl4BrkyZSRWYCle6Y7CI6wJkRnIiVwRpBgUmM4p6xNDiDWMv+9hwIWNkXwp40+5tEomC3URfu3uWV3EYzO5bw4JaiT0bZ+1gmkGZnqiPcOL38Fk5Wmpf0M4LCZAI3zveRSqY2meqqu0SgkNCpWlu04Dsbo2Dey0VDhySZqbMS428pClNfjorlnKaSh2bnjr50FTu/mfZolTn6pH+9STw0CSDHEf3LKtm6NqEYqrIbrVE;20:4d87qYavPyndoIczl1KBE9b3Db3fBoQizQXah5A4i8ON0uiLRMbYhuCyObswXWB37EitTK8jfEm6+PvHh9a8ti1hKZsFoITFVXf6VBWq7T2jCKva9sRYywUxkhJceQA6GVmSLqw/4To51bCApMn7yAq99cDKBs+UapqkuhZLQpo= x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 393bf07d-c432-4eb3-de48-08d58d214fdb x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB1080; x-ms-traffictypediagnostic: DM5PR2101MB1080: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Michael.H.Kelley@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(9452136761055)(85827821059158)(788757137089)(211936372134217); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(3231221)(944501300)(52105095)(3002001)(6055026)(61426038)(61427038)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(20161123558120)(20161123560045)(6072148)(201708071742011);SRVR:DM5PR2101MB1080;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB1080; x-forefront-prvs: 06157D541C x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(39860400002)(39380400002)(376002)(396003)(346002)(366004)(199004)(189003)(13464003)(74316002)(5660300001)(3660700001)(2906002)(76176011)(54906003)(110136005)(53936002)(186003)(39060400002)(4326008)(6116002)(3846002)(3280700002)(99286004)(97736004)(2950100002)(316002)(106356001)(6436002)(26005)(7696005)(9686003)(6246003)(55016002)(81156014)(81166006)(8676002)(305945005)(10090500001)(10290500003)(478600001)(33656002)(1511001)(8990500004)(72206003)(22452003)(105586002)(86362001)(8936002)(86612001)(25786009)(102836004)(2501003)(5250100002)(14454004)(53546011)(6506007)(68736007)(229853002)(2900100001)(66066001)(7736002);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB1080;H:DM5PR2101MB1030.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-microsoft-antispam-message-info: rzesWP/ruTL0lxLWfenVeP9lXowgsVY8VobsAkr4CKR0akXR78iyC3mIJYAAvRtrGwE0+GHXwO5qvJ+Z539uVR5nIis6xLjx1PUatmEuFEe4fcInO68CY/8snBhBrHx80myq2mg7p2WhJgzxerabf5UHrLY3+QmT9iPQqJdtTvVJtavrEqiCeli2gTeoZ/sfo8XghcZkGoHLME0vDbARrirhW8aP9rDfwHNetqqs5Wrxgk+2UpSNMEtSPKahAcZ88CGG2Tbc1QSX/UeLr75xU/omL9cymbJrvibYL+CtanusDhsMgyyF6G13RvoClYcrx3P7UGRtIbfmw8HjVPH+1w== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM 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: 393bf07d-c432-4eb3-de48-08d58d214fdb X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Mar 2018 22:40:55.4068 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1080 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > -----Original Message----- > From: linux-kernel-owner@vger.kernel.org On Behalf > Of Jia-Ju Bai > Sent: Sunday, March 18, 2018 7:53 AM > To: KY Srinivasan ; Haiyang Zhang ; Stephen > Hemminger ; bhelgaas@google.com > Cc: devel@linuxdriverproject.org; linux-pci@vger.kernel.org; linux-kernel= @vger.kernel.org; > Jia-Ju Bai > Subject: [PATCH 1/2] pci: host: pci-hyperv: Replace GFP_ATOMIC with GFP_K= ERNEL in > hv_pci_onchannelcallback >=20 > hv_pci_onchannelcallback() is not called in atomic context. >=20 > The call chain ending up at hv_pci_onchannelcallback() is: > [1] hv_pci_onchannelcallback() <- hv_pci_probe() > hv_pci_probe() is only set as ".probe" in hv_driver > structure "hv_pci_drv". >=20 > Despite never getting called from atomic context, Not true. hv_pci_probe() registers hv_pci_onchannelcallback() as a callback function that is invoked from the VMbus interrupt handler. So GFP_ATOMIC is appropriate. Michael > hv_pci_onchannelcallback() calls kmalloc with GFP_ATOMIC, > which waits busily for allocation. > GFP_ATOMIC is not necessary and can be replaced with GFP_KERNEL > to avoid busy waiting. >=20 > This is found by a static analysis tool named DCNS written by myself. >=20 > Signed-off-by: Jia-Ju Bai > --- > drivers/pci/host/pci-hyperv.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) >=20 > diff --git a/drivers/pci/host/pci-hyperv.c b/drivers/pci/host/pci-hyperv.= c > index 0fe3ea1..c5c8a99 100644 > --- a/drivers/pci/host/pci-hyperv.c > +++ b/drivers/pci/host/pci-hyperv.c > @@ -1887,7 +1887,7 @@ static void hv_pci_onchannelcallback(void *context) > struct pci_dev_incoming *dev_message; > struct hv_pci_dev *hpdev; >=20 > - buffer =3D kmalloc(bufferlen, GFP_ATOMIC); > + buffer =3D kmalloc(bufferlen, GFP_KERNEL); > if (!buffer) > return; >=20 > @@ -1899,7 +1899,7 @@ static void hv_pci_onchannelcallback(void *context) > kfree(buffer); > /* Handle large packet */ > bufferlen =3D bytes_recvd; > - buffer =3D kmalloc(bytes_recvd, GFP_ATOMIC); > + buffer =3D kmalloc(bytes_recvd, GFP_KERNEL); > if (!buffer) > return; > continue; > -- > 1.9.1