Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3677809pxj; Tue, 11 May 2021 09:27:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJytVaip8q63fDZlGyobi6AUyjoW5qFrPZ0fcNI1KbcLL/XMS3kHWLR1bkG5fUmzdWq+9CQp X-Received: by 2002:aa7:d146:: with SMTP id r6mr37981347edo.344.1620750475536; Tue, 11 May 2021 09:27:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620750475; cv=none; d=google.com; s=arc-20160816; b=DdoFHmb/U07XFn57u4YpTo1Xz3UZcR9ghUgbJRTyaS/H4B/XrZQRAh2qRc1KmSMXSX MTKTTWAoAy4iZcY1iUdGrCpoRHFnYpRJmnqkDQpYX/RfB+lpTpRhsrTOnhdY0Fm8X1LN cCYZ6ezbkESOpaphA+KNdFmzbeYocKzSoiB7gQ9cN59UXlv4V4KAKmlCR006GVi16dta tQh/edK/Cp6zwL28NwO7ppSTVMBEks7qUtOx/4xz0ybkLa0AEiqLj+7q0DqVPgEYVnz0 argIuIPsf1+areA60obG1mVu/sZWEO1azro5KL78w76RnsR896NSmGJJorgqUv9f6RpP jy4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=3M6tTHlyFNKQwbGOtrLH1dHnpAA9L/D3mvAYYkgV538=; b=JglyRV7WZ6sKsvb3VHUA9PjPB04xTueHfQRKx6x4JQHpozKSBEkcI4SGx3QvgGirH2 PCB3s7Lul3xiMhK44XPa6za24oPfVX5WRmg6A39cFgLnIIXmgX39G51iBdzpzyhZeIu9 jtD77QrG3n7jWVe0VfjIyuxXMAx/iVaOSdd6/6yf7nGeyeYCqVgbubWXqsKH5ZJr4kBd GYPZH1LPezvXzDaEVSpFOd/PEihRxvAhyqN3xEFvb8z4qIGbKATXTnnIPPnQ1+IO+fb4 D20KNXy2BjrNis7e54gdMrECaHhDu+ZAriSdkbSN1QM32wUydir1x/uFVIPuadOY2LuY tYUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=FM9u6tvb; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b13si511291ede.412.2021.05.11.09.27.31; Tue, 11 May 2021 09:27:55 -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=@redhat.com header.s=mimecast20190719 header.b=FM9u6tvb; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231404AbhEKQYp (ORCPT + 99 others); Tue, 11 May 2021 12:24:45 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:21855 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231445AbhEKQYm (ORCPT ); Tue, 11 May 2021 12:24:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620750215; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3M6tTHlyFNKQwbGOtrLH1dHnpAA9L/D3mvAYYkgV538=; b=FM9u6tvbnr1XG/bJM+0T7jmFjWv8pkv5AYKxIAJTnIU32q0TKbO40RdAd1925Ysmd7ED2A bK0jxBzhT42/qRxIjZDSRgOgZgKh598NmuhtK65bMpF5m0Fg46I8nf7v08yzbclYmLNrPA T2J9vB3llJqd1mITRpa2KaecbzG2oVM= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-392-e2fb4B8yPWyJlQzkc_nNww-1; Tue, 11 May 2021 12:23:16 -0400 X-MC-Unique: e2fb4B8yPWyJlQzkc_nNww-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 687B38015D0; Tue, 11 May 2021 16:23:13 +0000 (UTC) Received: from [10.3.115.19] (ovpn-115-19.phx2.redhat.com [10.3.115.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 968105DEAD; Tue, 11 May 2021 16:23:10 +0000 (UTC) Subject: Re: [PATCH 01/16] PCI/P2PDMA: Pass gfp_mask flags to upstream_bridge_distance_warn() To: Logan Gunthorpe , 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> <36b86579-da30-0671-26e9-75977a265742@deltatee.com> From: Don Dutile Message-ID: Date: Tue, 11 May 2021 12:23:10 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <36b86579-da30-0671-26e9-75977a265742@deltatee.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/11/21 12:12 PM, Logan Gunthorpe wrote: > > 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 > Looking fwd to the v2; again, my apologies for the delay, and the redundancy it's adding to your feedback review & changes. -Don