Message ID | 20220615161233.17527-19-logang@deltatee.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 55B44C43334 for <linux-mm@archiver.kernel.org>; Wed, 15 Jun 2022 16:54:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 980676B0075; Wed, 15 Jun 2022 12:54:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 948326B0078; Wed, 15 Jun 2022 12:54:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 718A96B0074; Wed, 15 Jun 2022 12:54:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 5EC846B0072 for <linux-mm@kvack.org>; Wed, 15 Jun 2022 12:54:56 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 3030F33E0A for <linux-mm@kvack.org>; Wed, 15 Jun 2022 16:54:56 +0000 (UTC) X-FDA: 79581069792.14.D160232 Received: from ale.deltatee.com (ale.deltatee.com [204.191.154.188]) by imf31.hostedemail.com (Postfix) with ESMTP id B7513200AB for <linux-mm@kvack.org>; Wed, 15 Jun 2022 16:54:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=deltatee.com; s=20200525; h=Subject:MIME-Version:References:In-Reply-To: Message-Id:Date:Cc:To:From:content-disposition; bh=lkkVGV05lv0CRWPOx1aNSbQEHovTv1Jz5BwTja4gYMc=; b=UA65EMT8xNvd8UHWetmwqme2a8 mbh5ZAtLMo8oOkZni6a7e7xdFqgBaoKX6BW/nxEmRzBODrgtFlIhBvcgXCHi8DFCSj6ybFs8cFwFU JN5NcIKa2YwfaEFkGBKhq98tfYdc1ip6TDMNluisXCqwKBiArxGhT8ctmSh7yv0ONfMQKfAbFrlZ9 GPQ1EKHrP0E8uLkOsybyw5PjBkPkxm2wJNwPMXA7XshLSwQare9mNo0JzCLQGmtGTjS8GRORUOZTW 4uR6gNCfjlfo6idpW5EL2HFlkSZ0pa8rOW0YLmVjRT5GSymz5ydETTSteAPM/W/wXKf8A0ksSqUyH Qqr3rCNQ==; Received: from cgy1-donard.priv.deltatee.com ([172.16.1.31]) by ale.deltatee.com with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from <gunthorp@deltatee.com>) id 1o1VdP-0084iS-Qu; Wed, 15 Jun 2022 10:12:48 -0600 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.94.2) (envelope-from <gunthorp@deltatee.com>) id 1o1VdJ-0004as-C7; Wed, 15 Jun 2022 10:12:41 -0600 From: Logan Gunthorpe <logang@deltatee.com> To: 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 <sbates@raithlin.com>, Christoph Hellwig <hch@lst.de>, Dan Williams <dan.j.williams@intel.com>, Jason Gunthorpe <jgg@ziepe.ca>, =?utf-8?q?Christian_K=C3=B6nig?= <christian.koenig@amd.com>, John Hubbard <jhubbard@nvidia.com>, Don Dutile <ddutile@redhat.com>, Matthew Wilcox <willy@infradead.org>, Daniel Vetter <daniel.vetter@ffwll.ch>, Minturn Dave B <dave.b.minturn@intel.com>, Jason Ekstrand <jason@jlekstrand.net>, Dave Hansen <dave.hansen@linux.intel.com>, Xiong Jianxin <jianxin.xiong@intel.com>, Bjorn Helgaas <helgaas@kernel.org>, Ira Weiny <ira.weiny@intel.com>, Robin Murphy <robin.murphy@arm.com>, Martin Oliveira <martin.oliveira@eideticom.com>, Chaitanya Kulkarni <ckulkarnilinux@gmail.com>, Ralph Campbell <rcampbell@nvidia.com>, Logan Gunthorpe <logang@deltatee.com> Date: Wed, 15 Jun 2022 10:12:30 -0600 Message-Id: <20220615161233.17527-19-logang@deltatee.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220615161233.17527-1-logang@deltatee.com> References: <20220615161233.17527-1-logang@deltatee.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 172.16.1.31 X-SA-Exim-Rcpt-To: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, linux-pci@vger.kernel.org, linux-mm@kvack.org, iommu@lists.linux-foundation.org, sbates@raithlin.com, hch@lst.de, jgg@ziepe.ca, christian.koenig@amd.com, ddutile@redhat.com, willy@infradead.org, daniel.vetter@ffwll.ch, jason@jlekstrand.net, dave.hansen@linux.intel.com, helgaas@kernel.org, dan.j.williams@intel.com, dave.b.minturn@intel.com, jianxin.xiong@intel.com, ira.weiny@intel.com, robin.murphy@arm.com, martin.oliveira@eideticom.com, ckulkarnilinux@gmail.com, jhubbard@nvidia.com, rcampbell@nvidia.com, logang@deltatee.com X-SA-Exim-Mail-From: gunthorp@deltatee.com Subject: [PATCH v7 18/21] block: set FOLL_PCI_P2PDMA in __bio_iov_iter_get_pages() X-SA-Exim-Version: 4.2.1 (built Sat, 13 Feb 2021 17:57:42 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1655312095; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=lkkVGV05lv0CRWPOx1aNSbQEHovTv1Jz5BwTja4gYMc=; b=LnrNScsl2oHaAX1cW/kmcMN7FUDtNVbPRDHVmkxLa4bV5QW/2OO7GBLLfd6cOqxseCTZrF fWdxz6N354hyNr0bbiN2eZlb/EccMLx+oGeI3x3Ux1aba+qxnCvlVj28db93m57wLsS/A9 x+6/qqL6Sj5nhobYh3Q5Kh5YkYqf9n4= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1655312095; a=rsa-sha256; cv=none; b=shI/vMoVKA8oCmgBIl/1+ssVA49MqNYQzCa+Bt3wgnEq3VZKgoNMM2lW+v8csHcMQ9JaM6 p+uerBLI1rQoORT+in+i0l7n5Kb+2Y+Z3IX+csJV/azafhXhO4tSLweaT3jR1FnL7NaQej kgDjfYsdEL0k1M2TPI/kK8z+GOLWBfg= ARC-Authentication-Results: i=1; imf31.hostedemail.com; dkim=pass header.d=deltatee.com header.s=20200525 header.b=UA65EMT8; dmarc=pass (policy=none) header.from=deltatee.com; spf=pass (imf31.hostedemail.com: domain of gunthorp@deltatee.com designates 204.191.154.188 as permitted sender) smtp.mailfrom=gunthorp@deltatee.com Authentication-Results: imf31.hostedemail.com; dkim=pass header.d=deltatee.com header.s=20200525 header.b=UA65EMT8; dmarc=pass (policy=none) header.from=deltatee.com; spf=pass (imf31.hostedemail.com: domain of gunthorp@deltatee.com designates 204.191.154.188 as permitted sender) smtp.mailfrom=gunthorp@deltatee.com X-Rspamd-Server: rspam12 X-Rspam-User: X-Stat-Signature: ma1cd8dmjo8xxysoyano99o5s9b5e6wm X-Rspamd-Queue-Id: B7513200AB X-HE-Tag: 1655312095-166500 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: <linux-mm.kvack.org> |
Series |
Userspace P2PDMA with O_DIRECT NVMe devices
|
expand
|
diff --git a/block/bio.c b/block/bio.c index a402a4760457..0d152da8938d 100644 --- a/block/bio.c +++ b/block/bio.c @@ -1180,6 +1180,7 @@ static int __bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter) struct bio_vec *bv = bio->bi_io_vec + bio->bi_vcnt; struct page **pages = (struct page **)bv; bool same_page = false; + unsigned int flags = 0; ssize_t size, left; unsigned len, i; size_t offset; @@ -1192,7 +1193,12 @@ static int __bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter) BUILD_BUG_ON(PAGE_PTRS_PER_BVEC < 2); pages += entries_left * (PAGE_PTRS_PER_BVEC - 1); - size = iov_iter_get_pages(iter, pages, LONG_MAX, nr_pages, &offset); + if (bio->bi_bdev && bio->bi_bdev->bd_disk && + blk_queue_pci_p2pdma(bio->bi_bdev->bd_disk->queue)) + flags |= FOLL_PCI_P2PDMA; + + size = iov_iter_get_pages_flags(iter, pages, LONG_MAX, nr_pages, + &offset, flags); if (unlikely(size <= 0)) return size ? size : -EFAULT;
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 O_DIRECT path in iomap based filesystems and direct to block devices. Signed-off-by: Logan Gunthorpe <logang@deltatee.com> --- block/bio.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)