From patchwork Thu Oct 19 15:25:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever X-Patchwork-Id: 13429367 Return-Path: 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 A7F04CDB465 for ; Thu, 19 Oct 2023 15:25:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2A2FC80094; Thu, 19 Oct 2023 11:25:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 252DD8000B; Thu, 19 Oct 2023 11:25:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1423280094; Thu, 19 Oct 2023 11:25:38 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 058328000B for ; Thu, 19 Oct 2023 11:25:38 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id D1C5A1605D0 for ; Thu, 19 Oct 2023 15:25:37 +0000 (UTC) X-FDA: 81362585514.09.D608BBF Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf04.hostedemail.com (Postfix) with ESMTP id 2F00540023 for ; Thu, 19 Oct 2023 15:25:35 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="s/A5u5nu"; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf04.hostedemail.com: domain of cel@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=cel@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1697729136; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=cX5aZ6mOEQDrOawUDAzp6GCxq09mE7rC9ZDBEzG04KU=; b=kV8oJAX7GSBV/90wEPGZ9YF4FCHJtPaXY+lzCx07r19xjPxUuQ4Ia5AVMyy/Qcd+MAMy87 KayUQRV03B3vWZ37ciVF3dnQtqOLZ/sxNcLPJy7A3uAheh/AA9uRrHLzXhNUXCGL1okV9g lgNcp86wN1gfeBOo4iK0jmvUFjYa174= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="s/A5u5nu"; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf04.hostedemail.com: domain of cel@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=cel@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1697729136; a=rsa-sha256; cv=none; b=Vif/bNmSg2Rt2w7mlMT3RkaMVUir9UB5E16tX54GSyGN7HELa2WXTpSNgtzPBKgKi5AV4F bMT3xyNfv88cO8SsR9x/MucJgVAtP7dDSh6Ok9y9pid+qg13FozVD/FZg0LVRwx/WrBo3j 6O9kyMDnapJUbHQ5rqXD1heV+FR6HJo= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by ams.source.kernel.org (Postfix) with ESMTP id 3A255B828A4; Thu, 19 Oct 2023 15:25:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B5754C433C7; Thu, 19 Oct 2023 15:25:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697729133; bh=u/lMWJ+F7E/hlh7pbvNFzd6HWcLB+2i2s6p2bJhsGNM=; h=Subject:From:Cc:Date:From; b=s/A5u5nuYoWGo2aupBwIYcocCx0oznUJzPAn7aPczoF6P6tSHzITH5v2c6K7hAVmx GhmTRWBYv+D/AwH5OX2rDNeHaI802fKR9+OHWUh7LMofQKaIMbOeNuJKOyRmGxi3YS E031nLW9QIJpzOZmLdi8u3jVoU1Zr5pEeGkvKR1ElUgTG6d6ABKDb6Kpb5zUaxu0Gv cetfm0rfcQgArFAzt8rtEatpFxYgzUw0G+g3AByGweBtac3m4XLQWcjM5gGMVbXs41 fcUJZ6sY6ouUxZUIH8+gkDEr9c3e+Un53EG1ew/0Rv0AJrUzyfmBbsRJYdqnqvjlVq VK0KEJhBcHYWQ== Subject: [PATCH RFC 0/9] Exploring biovec support in (R)DMA API From: Chuck Lever Cc: Marek Szyprowski , Chuck Lever , Robin Murphy , Alexander Potapenko , linux-mm@kvack.org, linux-rdma@vger.kernel.org, Jens Axboe , kasan-dev@googlegroups.com, David Howells , iommu@lists.linux.dev, Christoph Hellwig Date: Thu, 19 Oct 2023 11:25:31 -0400 Message-ID: <169772852492.5232.17148564580779995849.stgit@klimt.1015granger.net> User-Agent: StGit/1.5 MIME-Version: 1.0 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 2F00540023 X-Stat-Signature: ak4s8kraaa8sqnqr1xw1a36387we5tgk X-Rspam-User: X-HE-Tag: 1697729135-970364 X-HE-Meta: U2FsdGVkX1+hKPah5PDIXkVYIPLaAwUxiaugUyPi74m322wquHdzCwNqbZvGygn9BxeEQLhCrcAUYwaEGNI6JCXwY3x4vdLSHArSxGJZTz6QigVgz6FLBaKvI0OnWBT4jXlrI8GndISfvTJ51LpAD46IyRz66qB4ypsOzUO2mj0Ras5i+VVigH4EYIVn5q4wHOzHvvWqd+XJfU25jeCXed8p1xah/+kypC5M6W69jvidvyLpufBlkP/CAB2Aj6ITYwkvLuOllBDxzIFyuZmV2vXAj+xmvNnQ/fB2tgpAq9jG9MgEbbdtXluwGp1mGuPwSd3+WhmmBQ/rtr9655zkqibx3C6owwk+wmxmSgZl5Oj9xG4/6snTHg/enIFkCa8aH2+ADP7xrkP8440ND4a4pxOvcC00H5932szkbVqp9s47pRSJr81MOAxHZg8IYxk5WEZmZfI/tegvbB7ernaYzCOj95MnnzS5vFQtWF0XYobDbNKn2fh+PcNFo18maIt+NaJg2hwgZhjGbZHrejR5+QGnxVcYqz7DVSlFlHXalJ+bMZ5uBlLV/ENriYcmsXR8kfosOAioIxo5uqjWa53W6mukJS5m7h3naEVAo0VGikhdquraOaqueSu8nAVva91i51FKWpe81pLpQVAsxNCBUkXtzZ/XtjKiVWkUIs29PSJ3PMZ7DrQq5Fp2AiVoF/v9FLc3Q8bepY/wgAXCkK1hboZfX9WOnErw4xcgjfIt+kC9O5jxeavtaRUNMmHn5Bt7732QzVq2Ch5snV1wnKJXad28VPLuGeTGs4L+Sn1yZubSzNOr/5F3rCNhJbrdLRiFo187CSJ72hfzY7KOPEHS2pePl9hSweEUc4b+HiPRaGL7k86/ZbOzN4yiMRY1tjWoSw2E5aHQmH7+3SAvpo4HEB6teBND3QaHqD80eYRVM4M83aPKwji94AJQiLSiAO/1kBFn8vG3r5WEg01O1gx 5gSPy1ih lFylU+UmsqPxPCJiu4OpRnvk1E/hR1pCRn1RFVly4Z/bgP2rs5Cf6Vkgbmh2FWRj3FC7ELX22FNLLs2q72D6yJ4afc2OvyyKZEgJAKSs23kc+q6pwHXlBZLn1M+l9c+7W7sfidYFKovERUz1/3oVZQwJDjXQKD2ul9anAp51H++vz7JSk5dL5RBqeg33H5S9Ng550+v9pSuc8wR0= 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: The SunRPC stack manages pages (and eventually, folios) via an array of struct biovec items within struct xdr_buf. We have not fully committed to replacing the struct page array in xdr_buf because, although the socket API supports biovec arrays, the RDMA stack uses struct scatterlist rather than struct biovec. This (incomplete) series explores what it might look like if the RDMA core API could support struct biovec array arguments. The series compiles on x86, but I haven't tested it further. I'm posting early in hopes of starting further discussion. Are there other upper layer API consumers, besides SunRPC, who might prefer the use of biovec over scatterlist? Besides handling folios as well as single pages in bv_page, what other work might be needed in the DMA layer? What RDMA core APIs should be converted? IMO a DMA mapping and registration API for biovecs would be needed. Maybe RDMA Read and Write too? --- Chuck Lever (9): dma-debug: Fix a typo in a debugging eye-catcher bvec: Add bio_vec fields to manage DMA mapping dma-debug: Add dma_debug_ helpers for mapping bio_vec arrays mm: kmsan: Add support for DMA mapping bio_vec arrays dma-direct: Support direct mapping bio_vec arrays DMA-API: Add dma_sync_bvecs_for_cpu() and dma_sync_bvecs_for_device() DMA: Add dma_map_bvecs_attrs() iommu/dma: Support DMA-mapping a bio_vec array RDMA: Add helpers for DMA-mapping an array of bio_vecs drivers/iommu/dma-iommu.c | 368 ++++++++++++++++++++++++++++++++++++ drivers/iommu/iommu.c | 58 ++++++ include/linux/bvec.h | 143 ++++++++++++++ include/linux/dma-map-ops.h | 8 + include/linux/dma-mapping.h | 9 + include/linux/iommu.h | 4 + include/linux/kmsan.h | 20 ++ include/rdma/ib_verbs.h | 29 +++ kernel/dma/debug.c | 165 +++++++++++++++- kernel/dma/debug.h | 38 ++++ kernel/dma/direct.c | 92 +++++++++ kernel/dma/direct.h | 17 ++ kernel/dma/mapping.c | 93 +++++++++ mm/kmsan/hooks.c | 13 ++ 14 files changed, 1056 insertions(+), 1 deletion(-) -- Chuck Lever