From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.1 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 08E8BC433ED for ; Tue, 11 May 2021 16:23:35 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5C53D6187E for ; Tue, 11 May 2021 16:23:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5C53D6187E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id D1D636B0073; Tue, 11 May 2021 12:23:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CCD4E6B0074; Tue, 11 May 2021 12:23:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B717B6B0075; Tue, 11 May 2021 12:23:33 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0061.hostedemail.com [216.40.44.61]) by kanga.kvack.org (Postfix) with ESMTP id 9D57F6B0073 for ; Tue, 11 May 2021 12:23:33 -0400 (EDT) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 57CB08249980 for ; Tue, 11 May 2021 16:23:33 +0000 (UTC) X-FDA: 78129470706.13.006AB88 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf02.hostedemail.com (Postfix) with ESMTP id 6553240002ED for ; Tue, 11 May 2021 16:22:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620750212; 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=HFdExlKg8EqxzBOOaH7hRhKKJ9DSZNzMVgfNvJS94XYqqMloJL86ko7miWWLcqJWSYch8P jNu+yi36iC6c9p0IC7lhnf8B16chhJ5CIeLUDVmHj+8ufmUNWWhoC3iCED13fxia6BZckc FEggNvQI8/8ZGxh+rnq73EG+Z3xqDws= 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-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=HFdExlKg; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf02.hostedemail.com: domain of ddutile@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=ddutile@redhat.com X-Stat-Signature: 6otgnywba83qi6hub7zpd61ix3zpkk37 X-Rspamd-Queue-Id: 6553240002ED X-Rspamd-Server: rspam02 Received-SPF: none (redhat.com>: No applicable sender policy available) receiver=imf02; identity=mailfrom; envelope-from=""; helo=us-smtp-delivery-124.mimecast.com; client-ip=170.10.133.124 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1620750179-35884 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 func= tion, >>>> 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 >>>> --- >>>> =C2=A0 drivers/pci/p2pdma.c | 21 +++++++++++---------- >>>> =C2=A0 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_d= ev *pdev) >>>> =C2=A0 =C2=A0 static void seq_buf_print_bus_devfn(struct seq_buf *b= uf, struct pci_dev *pdev) >>>> =C2=A0 { >>>> -=C2=A0=C2=A0=C2=A0 if (!buf) >>>> +=C2=A0=C2=A0=C2=A0 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 th= e code to pass-in the >> GFP_KERNEL that was originally hard-coded into upstream_bridge_distanc= e_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 redunda= ncy it's adding to your feedback review & changes. -Don