Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp3756480rwb; Mon, 5 Sep 2022 18:27:00 -0700 (PDT) X-Google-Smtp-Source: AA6agR7LTbJC4v4carP8yaVyDNzKHlbZZ4aT46T01lEKjhYbEXoheY4Qa38vyZlsqD2GC+gKLgWy X-Received: by 2002:a17:907:94d0:b0:730:7a68:3093 with SMTP id dn16-20020a17090794d000b007307a683093mr38476246ejc.760.1662427619977; Mon, 05 Sep 2022 18:26:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1662427619; cv=pass; d=google.com; s=arc-20160816; b=LjlzAeh0EQ7VDrSYlOoIWPOovm3+sU53Ym6vok8rZOD6DkgxFv+zAvG5QWZd8ZqMjr +Dcg1n5r0X8nQAge1GBSZbc9OxRgT51VXlIhzzbN95iFs1ylghS4OUjCziZn7PCbeM2O cdvoa9eEL36xhTbEwITrhU1/r51ntH7wfkfPR674lJOP5iA3UWtT2YzDj4u0MoYzVlF9 X0Jltji34GXn5MTGn7vLjPXGs363Qyi3q4ta1Es6kzuZMItGXTy7UM6V/PIetXwGUPPE 5NFmG0lRvOiZQCwiWRRFy+wcPEWcMRu4y8Aima9qsxwmliCG9To1xTfsztilOcV0Zwix +HbA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:from:references:cc:to:content-language:subject :user-agent:date:message-id:dkim-signature; bh=SaAizI2gBE4SGUfqZlyjoPlE77vmB2ErKSz59vy3BOA=; b=tkbErYwKrPZdnPaa3EXkNOr32w4emHb656EESl4SRdPqQ0312CNNIoRfNQ1IWe3/Fh IoUZXfCQig7OJ4fhS1AluVVh7f/5qhqFNCQ06El882lXzSJwX2keeYva4gkm5YoQGcmr E/4jkD6uA9AXIDjpn6+mu1MJijFJxzR7YcXWTJuh6uFkyDDHb22z7iChGxv0O9C4MRQ7 ZSMR+C3wH5IYpVf0OB+HA9bHpq5UEt1fc+WRbWpY32caxLYomYu5Wex5tjDjY6oZUa27 xv8TO+CNijFCPOQ8rGPdFEq9GiHVlCc0dBuV3z1N3jkW9JEEq62LMhNU7EqdSmqZa4vF RlXw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=rlGAsQK2; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b9-20020a056402084900b00446e658cfdbsi10465049edz.240.2022.09.05.18.26.34; Mon, 05 Sep 2022 18:26:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=rlGAsQK2; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231571AbiIFAye (ORCPT + 99 others); Mon, 5 Sep 2022 20:54:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229787AbiIFAyY (ORCPT ); Mon, 5 Sep 2022 20:54:24 -0400 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1anam02on2074.outbound.protection.outlook.com [40.107.96.74]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E36044C618; Mon, 5 Sep 2022 17:54:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZmqpRaWmOOWMl/Hp4c1OytQfmVyqOVPYWvDDd5BBnPHO+NkbJ0sakApAEEnPyExKXXBUvICuhqlJJ0r3E3UIG8fyruL+9m1B+w+jdnIA2C3xfrQZocQHkQ+jfHpyRfO1/Vyqxe9x2l4VP9gn++GnZpIQUeGl/zi87mQ/sC+rEHCT3zioDGEgC+dNOjl4MmT/afJNQ85NPvQo4Q66+gCajiHu1XB45qYeyQM7SMxHUF1TNIWv6CCZJMtLXWxze39N6p1jhsEKSbmr+gp/vCx7GKfD4wXBoh0J9u60QnNk+nxbZVeKQniN2T58un6hQAWkM6ellENJ9D8UFii1aeWXog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=SaAizI2gBE4SGUfqZlyjoPlE77vmB2ErKSz59vy3BOA=; b=Blvt+VCTNFGZgdehn4PmUvjqqsaeXEfQNcmy0Lm7pcR7lZKJx3tWbRX7RqH4FjrLkpKaG/2lenPX8fPQfiMujIDjx/2bCY2HGcefhC9dy9lYCb+bpUwzaUZiJ+JMNwZDhUdvkrp66g7YlZwuZh9wSuPBijyAfqvjXq87L/BuQMSyoCXAXzr5yc9A9T4AwoeCyzYS3JVqkdqLAg0jcvScNg1wYCeLH9Gt9CQURaiVs1AOpC49HlDQKZf/vMhYANBFAZUHteRPBS1041sX1SzXK/P/aoFNHP2CeT0Jf564zwH8OaGaxDTgyaejzD2ZjA06dbDOUMl+5AwTbQ6FWq5Wgg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SaAizI2gBE4SGUfqZlyjoPlE77vmB2ErKSz59vy3BOA=; b=rlGAsQK2z6B4zQyCdTTFP3oDEiuKKeymw4RpEfJDtU6U1kUb7vjp6gBz9057XBgjlAgWJ4lGTXyi7J+hIMmpcW7N2B8OyWvqQq1OhhkNJzF4c3LFQKE0EiaFox721+JcrZxobA4RA5KFHGzHM2ymBKxbNw2nC8eX7dNbeGk6lf33/Xxi1wAMBgwPPcEde1XcOpYwJVQnWWOQ4Kuyu/q8KqArf2Ehx1MhkgtDvniuod6NMfOhkPTjKh8k6lD1gqgAzN5GAwCcmbwGcZS8QMjkcfscatdhwCRZrvuZ8dkM8W8xuFj3uyQdcHqKRcHbout7TGfqR9FVsIwYnNBJnqJ3sg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BY5PR12MB4130.namprd12.prod.outlook.com (2603:10b6:a03:20b::16) by BY5PR12MB5015.namprd12.prod.outlook.com (2603:10b6:a03:1db::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.10; Tue, 6 Sep 2022 00:54:16 +0000 Received: from BY5PR12MB4130.namprd12.prod.outlook.com ([fe80::508d:221c:9c9e:e1a5]) by BY5PR12MB4130.namprd12.prod.outlook.com ([fe80::508d:221c:9c9e:e1a5%9]) with mapi id 15.20.5588.018; Tue, 6 Sep 2022 00:54:16 +0000 Message-ID: <7b0df76d-a920-90a1-2e1e-044671c386fc@nvidia.com> Date: Mon, 5 Sep 2022 17:54:13 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.0 Subject: Re: [PATCH v9 6/8] block: set FOLL_PCI_P2PDMA in bio_map_user_iov() Content-Language: en-US To: Logan Gunthorpe , linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, linux-pci@vger.kernel.org, linux-mm@kvack.org Cc: Christoph Hellwig , Greg Kroah-Hartman , Dan Williams , Jason Gunthorpe , =?UTF-8?Q?Christian_K=c3=b6nig?= , Don Dutile , Matthew Wilcox , Daniel Vetter , Minturn Dave B , Jason Ekstrand , Dave Hansen , Xiong Jianxin , Bjorn Helgaas , Ira Weiny , Robin Murphy , Martin Oliveira , Chaitanya Kulkarni , Ralph Campbell , Stephen Bates References: <20220825152425.6296-1-logang@deltatee.com> <20220825152425.6296-7-logang@deltatee.com> From: John Hubbard In-Reply-To: <20220825152425.6296-7-logang@deltatee.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: BYAPR21CA0027.namprd21.prod.outlook.com (2603:10b6:a03:114::37) To BY5PR12MB4130.namprd12.prod.outlook.com (2603:10b6:a03:20b::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: de65a855-87fc-4b05-6eb6-08da8fa25293 X-MS-TrafficTypeDiagnostic: BY5PR12MB5015:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: r6e4AQ9Gm2fTCsuYtXCJEaQvYv1j1Gokb39TYyq+SkVwE118j7eNDAIXfplVbYJ921Eiyn3tVm4Kf6sym1lKA6SgyKy77gicYhnfIlhfY5BauIAPxiN+HfFeBPCYlqYpXVZJHFjKCodsHiMlcLoKDvQQXp4D6/DFNPQ+BDymE7N4J02aolWzDslW8nhBmIaLrHf40vItCvLW06WHbGbt0aZMfzwu+Vz+rnKQPtARJW5q/0ok6uMs9PbqycFZH9G8stQrzNxkJzlvQb3tITwe5VdeVuAyYDoS6zja+kVRi4lemUIuulZZBHN4OpIvTXECr3KtD+t+3Ujr5/VrEXhDk2wIeGU5qtifOiRHoZL2PbFQBzM26EFZ1DEeBejK6plvNYW7qjkoYZhBpu1ZgnpaXLnsiwGrcTJQMj/+pQAaioxI9D/IYYtjPAf4Q1xzM9oEnDDHEobd8mMokgSaQRVDazkspSdko3Fw6q6hgN6Gd6Ed5YrVnzY52oELSpgr3SQpxQSeexOGO1m3YLUGf0j4+Qgbyu092+BEskoRjff1hqg3K0VfoJLS8LVhIUzlnMK8omgqImEdpXHghiZIB2TpMGiOL17WVvCgKmVkH3ctNZvcVG5U3NR5qRejaamgEhWaG7ETTnuUcAek+05Y1zV32RuS6q1Up0aaIuLhqpp1MVdlb8qwJGBK7clC7gHDgT3LB21+o3r/nZzQ7pzvMZuD0naiTDoFFkAsfgNx33Md+20NeD0EuySkwIigQtgkp6u5Wut5zcq/5uEmAqe2iWAvwKFz+TCOajxvqJX4SUzfbAU= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR12MB4130.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(376002)(136003)(346002)(396003)(366004)(39860400002)(86362001)(5660300002)(2906002)(7416002)(8936002)(38100700002)(53546011)(6486002)(6506007)(478600001)(6666004)(316002)(41300700001)(54906003)(66476007)(8676002)(66946007)(66556008)(4326008)(83380400001)(26005)(6512007)(2616005)(186003)(31696002)(31686004)(36756003)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?YnliZXZJejZTUTVGaWFxWWdnTzhabUtVaE1adDNNVEdINC82M24vYzhsclM3?= =?utf-8?B?WGdzVUR1aUlpdG03amNMckVBUlBKTFgyYWEvdkY0cGk5YU93djI4WjJQamQy?= =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zR0S2F2dERENGMzcUZlbTE0YWhXL29BdDY2?= =?utf-8?B?SXNvY1VBWXpzaWZSUHp3SitvQlFydTV0RlZCajk0UzN6Zy9TaFFURzcvTTEx?= =?utf-8?B?QzQ0cGl1bnIxMFppRmJMWGk0a09DWmt5WkhkMTR3T1lXUU1nQjF3OVdSQ1BG?= =?utf-8?B?VzV2NlViMVFudTMzOTJaeCtKZ25aUXNlZDVpSzk4a3ByVmh3S3JlWDhTaVdi?= =?utf-8?B?ZmM2NnhWczFWcDFYZkVCUCtEaUxwdkRtQ2hUVXJRVDJtSzhpZ3hVNVhNL2xB?= =?utf-8?B?Z1E9PQ==?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: de65a855-87fc-4b05-6eb6-08da8fa25293 X-MS-Exchange-CrossTenant-AuthSource: BY5PR12MB4130.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Sep 2022 00:54:16.1401 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: jJB7sBEkS/0j3niTvSPJ35DkiwwfToCBZW1Tc0Lb0M7vmOQ8qWBQoptkW5UMrXRQieRVe3WALrRSxOxWAlDngQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB5015 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/25/22 08:24, Logan Gunthorpe wrote: > When a bio's queue supports PCI P2PDMA, set FOLL_PCI_P2PDMA for > iov_iter_get_pages_flags(). This allows PCI P2PDMA pages to be > passed from userspace and enables the NVMe passthru requests to > use P2PDMA pages. > > Signed-off-by: Logan Gunthorpe > --- > block/blk-map.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/block/blk-map.c b/block/blk-map.c > index 7196a6b64c80..1378f49ca5ca 100644 > --- a/block/blk-map.c > +++ b/block/blk-map.c > @@ -236,6 +236,7 @@ static int bio_map_user_iov(struct request *rq, struct iov_iter *iter, > { > unsigned int max_sectors = queue_max_hw_sectors(rq->q); > unsigned int nr_vecs = iov_iter_npages(iter, BIO_MAX_VECS); > + unsigned int flags = 0; A small thing, but I'd also like to name that one gup_flags, instead of flags. > struct bio *bio; > int ret; > int j; > @@ -248,13 +249,17 @@ static int bio_map_user_iov(struct request *rq, struct iov_iter *iter, > return -ENOMEM; > bio_init(bio, NULL, bio->bi_inline_vecs, nr_vecs, req_op(rq)); > > + if (blk_queue_pci_p2pdma(rq->q)) > + flags |= FOLL_PCI_P2PDMA; > + > while (iov_iter_count(iter)) { > struct page **pages; > ssize_t bytes; > size_t offs, added = 0; > int npages; > > - bytes = iov_iter_get_pages_alloc2(iter, &pages, LONG_MAX, &offs); > + bytes = iov_iter_get_pages_alloc_flags(iter, &pages, LONG_MAX, > + &offs, flags); > if (unlikely(bytes <= 0)) { > ret = bytes ? bytes : -EFAULT; > goto out_unmap; Looks good, please feel free to add: Reviewed-by: John Hubbard thanks, -- John Hubbard NVIDIA