Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3666967pxj; Tue, 11 May 2021 09:15:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz8pdt0LHWieT8lCgQd2CA24ia7aY4uiivg3cT7ob+by6QG2DCF+g+OX+mjJTWIA4wQmVi/ X-Received: by 2002:ac2:4887:: with SMTP id x7mr21522558lfc.561.1620749704223; Tue, 11 May 2021 09:15:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620749704; cv=none; d=google.com; s=arc-20160816; b=Z8Ya0XbzY1rsWb1nuzwGBDsgFcICy8t05cz1nbvMkvfmeNuO9ffcGAp7LwXOL9FWPu ZUzUAC6YiSo8FGhVmmR36PAuRyN3r/pKz2kspm0NUqafhJeeie4ehWVbfGLOSNnklWZf U2lo5GajjYTvfEOi6MMRqKgsud/AlM7yjY6qaxwfnXuI2U7QJ/2zR7LosxQtSM7oEhbB 9s3ryNPPpYq4ymQzL3/fRkfHiJh6Di8sCEj9dieE5dfnGFSaez+LRyeaV/UfYIwUGc6w 3aMOBzuBAMxwrMsA+gakjlhByPxPZAfmb0NoMESMyKIbaXYIVqF+ycbrnc5wNjzMM3VJ KFCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:dkim-signature; bh=BHBUlVYkvN7U/TbnhdmSfxdbBO7hmMx8+ZQaSS91pAY=; b=vTfUMNzTx4upDBKYg6xZ89tgJmx+ApdixC7JiEh+Dmz8pESUW8bbVFkHMUl+aUf1tP +b94swN17z1QF8nyImtN+CXpf/rm3CNNMCofYG34RvtePHMQlSt+b9II2LUeDf3xnzdD IbPpVJdkc+71+tW7WyYB8Wveb/6+UA73MGUxEe6MTaxd4EFAVkBpleT2nsGMwVwg7ojW Pa/904RRP8IAC8Y0m/As4rkcAPnytSc6Fy4IvuJLhzhryv4eDgSGWrf5JmQc9XMA67TV 4b0cAlXsb6hi727TT4akXFA281ANkyldXRaBboNkbYxa7FYshha4kItcMeTvsU4KxWe8 wdkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@deltatee.com header.s=20200525 header.b=rsu7y4L6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v9si21917567ljc.577.2021.05.11.09.14.34; Tue, 11 May 2021 09:15:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@deltatee.com header.s=20200525 header.b=rsu7y4L6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231769AbhEKQOM (ORCPT + 99 others); Tue, 11 May 2021 12:14:12 -0400 Received: from ale.deltatee.com ([204.191.154.188]:53438 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231220AbhEKQOK (ORCPT ); Tue, 11 May 2021 12:14:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=deltatee.com; s=20200525; h=Subject:In-Reply-To:MIME-Version:Date: Message-ID:From:References:Cc:To:content-disposition; bh=BHBUlVYkvN7U/TbnhdmSfxdbBO7hmMx8+ZQaSS91pAY=; b=rsu7y4L6BqjnqY43bR2EjC+q8w I21N4GuEIsZtEN66HoQVR0eBUqXn9sLnhmeyjs1LmpX8ONK+4bR40It7S3HEyHUIadkFTRMjL6PnS bB0n5Fr7Zjp0fYF0PszR86jiQekrG0/YiMxjzKlvZ/EcoIT5WUU+u4BdzM71EtarOlouiAJGtNWbC OG0YRsSDn0akFPUGxxgbghzFEP500GKyJxOfhhP+VXZH6y4SdBhM2JjpjA9kGzUYu84S0WPnK8dl7 8QQukFL6DMVaPGaBHKFNGJzPQm7aOqvldJK3cdI6OmASeQ1CBV71z6pmz8w0UZUeslplJDlf0fzGw VvW5QwDQ==; Received: from guinness.priv.deltatee.com ([172.16.1.162]) by ale.deltatee.com with esmtp (Exim 4.92) (envelope-from ) id 1lgUzy-0006Xk-Lw; Tue, 11 May 2021 10:12:43 -0600 To: Don Dutile , John Hubbard , linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, linux-pci@vger.kernel.org, linux-mm@kvack.org, iommu@lists.linux-foundation.org Cc: Stephen Bates , Christoph Hellwig , Dan Williams , Jason Gunthorpe , =?UTF-8?Q?Christian_K=c3=b6nig?= , Matthew Wilcox , Daniel Vetter , Jakowski Andrzej , Minturn Dave B , Jason Ekstrand , Dave Hansen , Xiong Jianxin , Bjorn Helgaas , Ira Weiny , Robin Murphy , Bjorn Helgaas References: <20210408170123.8788-1-logang@deltatee.com> <20210408170123.8788-2-logang@deltatee.com> From: Logan Gunthorpe Message-ID: <36b86579-da30-0671-26e9-75977a265742@deltatee.com> Date: Tue, 11 May 2021 10:12:36 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-CA Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 172.16.1.162 X-SA-Exim-Rcpt-To: bhelgaas@google.com, robin.murphy@arm.com, ira.weiny@intel.com, helgaas@kernel.org, jianxin.xiong@intel.com, dave.hansen@linux.intel.com, jason@jlekstrand.net, dave.b.minturn@intel.com, andrzej.jakowski@intel.com, daniel.vetter@ffwll.ch, willy@infradead.org, christian.koenig@amd.com, jgg@ziepe.ca, dan.j.williams@intel.com, hch@lst.de, sbates@raithlin.com, iommu@lists.linux-foundation.org, linux-mm@kvack.org, linux-pci@vger.kernel.org, linux-block@vger.kernel.org, linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, jhubbard@nvidia.com, ddutile@redhat.com X-SA-Exim-Mail-From: logang@deltatee.com X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on ale.deltatee.com X-Spam-Level: X-Spam-Status: No, score=-8.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, GREYLIST_ISWHITE,NICE_REPLY_A autolearn=ham autolearn_force=no version=3.4.2 Subject: Re: [PATCH 01/16] PCI/P2PDMA: Pass gfp_mask flags to upstream_bridge_distance_warn() X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021-05-11 10:05 a.m., Don Dutile wrote: > On 5/1/21 11:58 PM, John Hubbard wrote: >> On 4/8/21 10:01 AM, Logan Gunthorpe wrote: >>> In order to call upstream_bridge_distance_warn() from a dma_map function, >>> it must not sleep. The only reason it does sleep is to allocate the seqbuf >>> to print which devices are within the ACS path. >>> >>> Switch the kmalloc call to use a passed in gfp_mask and don't print that >>> message if the buffer fails to be allocated. >>> >>> Signed-off-by: Logan Gunthorpe >>> Acked-by: Bjorn Helgaas >>> --- >>>   drivers/pci/p2pdma.c | 21 +++++++++++---------- >>>   1 file changed, 11 insertions(+), 10 deletions(-) >>> >>> diff --git a/drivers/pci/p2pdma.c b/drivers/pci/p2pdma.c >>> index 196382630363..bd89437faf06 100644 >>> --- a/drivers/pci/p2pdma.c >>> +++ b/drivers/pci/p2pdma.c >>> @@ -267,7 +267,7 @@ static int pci_bridge_has_acs_redir(struct pci_dev *pdev) >>>     static void seq_buf_print_bus_devfn(struct seq_buf *buf, struct pci_dev *pdev) >>>   { >>> -    if (!buf) >>> +    if (!buf || !buf->buffer) >> >> This is not great, sort of from an overall design point of view, even though >> it makes the rest of the patch work. See below for other ideas, that will >> avoid the need for this sort of odd point fix. >> > +1. > In fact, I didn't see how the kmalloc was changed... you refactored the code to pass-in the > GFP_KERNEL that was originally hard-coded into upstream_bridge_distance_warn(); > I don't see how that avoided the kmalloc() call. > in fact, I also see you lost a failed kmalloc() check, so it seems to have taken a step back. I've changed this in v2 to just use some memory allocated on the stack. Avoids this argument all together. Logan