Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp1107334imm; Fri, 29 Jun 2018 11:29:41 -0700 (PDT) X-Google-Smtp-Source: AAOMgpf7kRr3PeVfUVGuTTJCwOFMcZDFSIU/2ebfNNZusjmufqyqshT5h+pO6MSLS6HZLh+BrQH2 X-Received: by 2002:a65:5a01:: with SMTP id y1-v6mr2797046pgs.125.1530296980988; Fri, 29 Jun 2018 11:29:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530296980; cv=none; d=google.com; s=arc-20160816; b=Vcv/t5WTT94nPp1wFARSkQjbtwVg/QCB5g7tfDjfhxtWAlwhYNKhdV8PYiYh2r8NkB pxnOg4sJf2nU6hWMZfTjUCopBG3HN8UVlWi2IVA9hyo60BoYEzkOXaem1wdCgBnyEkX5 kKvTW4gwZfsDnQKe+fihW/JxkN1/NSoDFBQnt3QjipWY2uRpkgjlcciZB5BvPJc3Re6+ zHzGAIqHqHMmBxHV9LbvarZfIJjy9mI/+MiWUB4GTNifxc1A5jDEe2ZiNQ6r695AkC8S oedStNzxqA1n5TLYTmX2d+fPkiklBdCZpOr1XmSiBoPOpg3+rfSpJdQoVgxm6T455kha AIyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=ZRNBg6pVlbtLc3J/+1YKk0ZBhoXGudn+B4hs35AOA5E=; b=SDk64YumU/Njg1V1F3dZsa3Duu9Tgj/qRvAYJOJ/wnUD6qczOPQYz9PJSgW6iChcs8 9/wRNxnEsOxd02Q7UH+cBpBLxFTAPkByG/+w1JUP478XKNaD90wWDSuJIj0GQloVlepC gIIaCGtZP3MKxNTugX7cdQzqJkmnhKPSW452HkQDdnQYKoQ41HhAAtuhfnbhJh0x4NzP ZdO4M2YLcMa4fXQuscaJqkMfdc0a5aEVM84aU/7Oiyp9ydrW52pn57Es9GB/xh+JpcSS 0C/r40s3WQc6QVHpDNUWHOp15uxaSv176uCUo3fhT5az+6ZQdIAparLSVNq2SqKHeXbF rhmA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x186-v6si9488909pgd.259.2018.06.29.11.29.26; Fri, 29 Jun 2018 11:29:40 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966369AbeF2PjQ (ORCPT + 99 others); Fri, 29 Jun 2018 11:39:16 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:36246 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933514AbeF2PjP (ORCPT ); Fri, 29 Jun 2018 11:39:15 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E2CC718A; Fri, 29 Jun 2018 08:39:14 -0700 (PDT) Received: from red-moon (unknown [10.1.206.55]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 6A8AF3F5C0; Fri, 29 Jun 2018 08:39:13 -0700 (PDT) Date: Fri, 29 Jun 2018 16:41:01 +0100 From: Lorenzo Pieralisi To: Jia-Ju Bai Cc: kys@microsoft.com, haiyangz@microsoft.com, sthemmin@microsoft.com, bhelgaas@google.com, devel@linuxdriverproject.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] pci: host: pci-hyperv: Replace GFP_ATOMIC with GFP_KERNEL in new_pcichild_device Message-ID: <20180629154101.GI9643@red-moon> References: <1521384808-23627-1-git-send-email-baijiaju1990@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1521384808-23627-1-git-send-email-baijiaju1990@gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Mar 18, 2018 at 10:53:28PM +0800, Jia-Ju Bai wrote: > new_pcichild_device() is not called in atomic context. > > The call chain ending up at new_pcichild_device() is: > [1] new_pcichild_device() <- pci_devices_present_work() > pci_devices_present_work() is only set in INIT_WORK(). > > Despite never getting called from atomic context, > new_pcichild_device() calls kzalloc with GFP_ATOMIC, > which waits busily for allocation. > GFP_ATOMIC is not necessary and can be replaced with GFP_KERNEL > to avoid busy waiting. > > This is found by a static analysis tool named DCNS written by myself. > > Signed-off-by: Jia-Ju Bai > --- > drivers/pci/host/pci-hyperv.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Applied to pci/hv for v4.19, thanks. Lorenzo > diff --git a/drivers/pci/host/pci-hyperv.c b/drivers/pci/host/pci-hyperv.c > index 0fe3ea1..289e31d 100644 > --- a/drivers/pci/host/pci-hyperv.c > +++ b/drivers/pci/host/pci-hyperv.c > @@ -1500,7 +1500,7 @@ static struct hv_pci_dev *new_pcichild_device(struct hv_pcibus_device *hbus, > unsigned long flags; > int ret; > > - hpdev = kzalloc(sizeof(*hpdev), GFP_ATOMIC); > + hpdev = kzalloc(sizeof(*hpdev), GFP_KERNEL); > if (!hpdev) > return NULL; > > -- > 1.9.1 >