Received: by 10.213.65.68 with SMTP id h4csp1213608imn; Sun, 18 Mar 2018 19:54:39 -0700 (PDT) X-Google-Smtp-Source: AG47ELvx2Ix2tZi8EGjTlUgEz5QWVpNaIu00TlI1jz5UFHumdo7HSbHd6VVmaayIBCavfcqryvcK X-Received: by 10.99.174.67 with SMTP id e3mr7547195pgp.139.1521428079291; Sun, 18 Mar 2018 19:54:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521428079; cv=none; d=google.com; s=arc-20160816; b=IpPZ+vm7KPCsA2urdkOBjCt/ih+7PWHL8KiJ2a0GlvhuG7Pmj7yGuXtGJyDHfN41YA BVqYVajcoTse4O7/WAvzpMelOO+6ZviNHakCx/CzPi8cwAIUe60CKQEnU8nOyx2E0Jq6 g0cTDkO5tAl8P5DW/9yOadTu/75vavaO6eIdRekiiEPdKRIJjDWtaP+B/7W2eQxYDvoA jeNb3x32eyeK1NIm8FtCUvcWimBcH9Y74Q3By4q2TtZkCFzqJ5H53qp198Gl0Iv61yDB rknhndFCeeygtGz9k2JOfggDLVkjo8lrkTfiHyHFgRJigSD6GlJKq+NcF0SEImXQTfuT 6/3w== 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: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=rbVOgkYqMr3PuRm0o+QYLOMthOLWsYsd3MkXAzoNQuc=; b=TyqlCCFKxuF6ENK1NW1Mxo/PWIFTyNJrcBCOHeLrccoz0EUKDm9W90N09wgRoAVUkm LJ6mSj+pPi0YO5Q2BFc6bfAtc9m9ZvT0DpWTyXkMXJF6PeqO35mxP4FN2TzxVl7GdvDj 1mXmNt6JeduLXh4z//CWG9aP6lL1MfDcpGBegssWunLg8sU7WlCRe7ymNmVPV1IYjEc/ N/I7MZvokAKrMqxH4AEsjl1nSQs06GNT98vBHEmcgkjCGr1Th7kfgnqcup5YjJ1Uy5P8 N6o5goGyIvmDqNyJxX8thUT9SeRIjZcGA1hF77U5/Ffn+aTpWaGSmdm96gZEvRyHrOGu Xarw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=dbLWW+8R; 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 x22si9623439pfm.321.2018.03.18.19.54.24; Sun, 18 Mar 2018 19:54:39 -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=dbLWW+8R; 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 S1755114AbeCSCwN (ORCPT + 99 others); Sun, 18 Mar 2018 22:52:13 -0400 Received: from mail-co1nam03on0112.outbound.protection.outlook.com ([104.47.40.112]:36512 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754383AbeCSCwL (ORCPT ); Sun, 18 Mar 2018 22:52:11 -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=rbVOgkYqMr3PuRm0o+QYLOMthOLWsYsd3MkXAzoNQuc=; b=dbLWW+8REXi3TMM8oz9D479jZMGrG6j2/LBTHNihD97AVLqcHLY5F9p807BBKe2qEajBWmOQC4O9FqaZoZjq0x/N8NAZbfVeXb9l/jay5nURN3B1q0ZscNze0cd2WMVVgAJ7plsKcP9q3i12zbb61YQXIQ746W3IirMwtfbU2TI= Received: from SN6PR2101MB0893.namprd21.prod.outlook.com (52.132.116.158) by SN6PR2101MB0895.namprd21.prod.outlook.com (52.132.116.160) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.631.1; Mon, 19 Mar 2018 02:52:08 +0000 Received: from SN6PR2101MB0893.namprd21.prod.outlook.com ([fe80::704b:ebb2:33e2:6c22]) by SN6PR2101MB0893.namprd21.prod.outlook.com ([fe80::704b:ebb2:33e2:6c22%5]) with mapi id 15.20.0631.004; Mon, 19 Mar 2018 02:52:08 +0000 From: KY Srinivasan To: Jia-Ju Bai , 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: AQHTvsjVSUKB8TnsSU2Le10VAKx9KKPW3Jbg Date: Mon, 19 Mar 2018 02:52:08 +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: x-originating-ip: [2601:600:a280:b50:8101:f39b:510f:222a] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;SN6PR2101MB0895;7:PGPqB9AXMDlgzaMApBJ6eOhp7365kd2V3OtVVGAUik0rOL1XJoOQ2m7323/bjve3eEk0wf2D90FrTsWcnDr0sb9cix2onM5BxJaDRW23zsD1aIS7FHskAQbkzUUYl4Tb6j9ZAJwcohWGjUcNm2icaIkgRYqmi8cUaR0XdWjInipUty7+RMUVyjob7CaP2G/dqC274+C5mL3fRmFaH1NMi3B8NX/kTDE7jg+wKF98dT3pgysZl5MIcHIdXcYdkCsg;20:lybCc9N5Cp+kf7gMo/2DTnCG2bpMfUVoxWKE1vhb1Z92FvTy6ryeh4SIjEXP4vf+lLvTbWbxq1YDu68jC3dICtVMth1Ui46Zck/qvW6AAuzHxpv7RsUgme+r/k+H3BECHFJjQ3ge+qcWp6nUbx2qPPWrTEijfCHR9+osdqw7R1s= x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 50c9440a-b3ca-48d0-19fe-08d58d44681b x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:SN6PR2101MB0895; x-ms-traffictypediagnostic: SN6PR2101MB0895: authentication-results: spf=none (sender IP is ) smtp.mailfrom=kys@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:SN6PR2101MB0895;BCL:0;PCL:0;RULEID:;SRVR:SN6PR2101MB0895; x-forefront-prvs: 06167FAD59 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(366004)(396003)(39380400002)(39860400002)(376002)(346002)(13464003)(199004)(189003)(25786009)(86612001)(97736004)(4326008)(6246003)(53936002)(14454004)(229853002)(86362001)(39060400002)(6116002)(6506007)(102836004)(53546011)(74316002)(8990500004)(46003)(305945005)(186003)(7736002)(33656002)(5250100002)(2501003)(10290500003)(68736007)(10090500001)(8676002)(2906002)(3280700002)(2950100002)(99286004)(81156014)(22452003)(316002)(54906003)(110136005)(8936002)(2900100001)(5660300001)(1511001)(478600001)(55016002)(7696005)(76176011)(9686003)(105586002)(6436002)(3660700001)(106356001)(81166006);DIR:OUT;SFP:1102;SCL:1;SRVR:SN6PR2101MB0895;H:SN6PR2101MB0893.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: 4D27BPynSin0S3ZRnOdzq1WfHH8wtt4drXIXTNDzf+Ce0Ld/Cy6ANtuO9oiXwBXXc9Sz+F/RK5qaW4JOjCH1fyltMfxbB2WKYuHC26hFdGUFcAt2wmwgBUDohezwyXGgCU3EgHHaG31lMkGlWzRW6aDknUs3wBcL4luZEEnaeu9Seg0DC7tfxqLbVzsSvpIi+NrBVCcyY4FmsM6Yh2Vd4wXOCjIcUnppbTCltuQf31r5NrO8tG2TLe+nvmRIXQnHSPLjLsAypRbPa2awxPLWLGPWgXcfRAK4fKxoUP+0yjO2hN2FGR8wx79IIYqRwEkHjH58BStwMwj/I/9VoTsv2g== 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: 50c9440a-b3ca-48d0-19fe-08d58d44681b X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Mar 2018 02:52:08.5451 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR2101MB0895 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > -----Original Message----- > From: 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_KERNEL 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". This function is setup as the function to handle interrupts on the channel.= Hence the need for GFP_ATOMIC. K. Y >=20 > Despite never getting called from atomic context, > 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