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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 288E8C3271E for ; Mon, 8 Jul 2024 16:52:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=44iLSgmAA8Jj5OzeQp5q3uGTMuRJb4ek81IJRNbfP50=; b=OcZrMCRAhTcaEI/6yu4zQPwARi KhmZe0wrQwxe+O0jZZQCYVzEWIAyldRn4ZA9wFSlzIpHspgLom1NDA6AA0RYyIFyYIuFAnVcHCeLS ep0C4ziPKoafGqrH0Plq7+gDVedA+WR8+zXw/uLl6zVWmDFaRGM6LmufiXRwi68x+QjzJqqmE3T6M 9nlBITQ9rhbzynORpKFZl7ZLj+Pzb+YLRmZsTK8tIzyRcM/rHe8pX+Sdfg8MnFLF1AvaTzEaykkoy OGpkHFK9iOFqtoO5YdjNKjJSgu1Z+IJVGU/Y0ZwZXSiDpeSRyCIAd2VzB9BaRCok/dkf03anOOFo6 /HYvhU+g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sQrbY-00000004Uyg-1jP3; Mon, 08 Jul 2024 16:52:44 +0000 Received: from mail-qt1-x836.google.com ([2607:f8b0:4864:20::836]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sQrbV-00000004Uxn-03q6 for linux-nvme@lists.infradead.org; Mon, 08 Jul 2024 16:52:42 +0000 Received: by mail-qt1-x836.google.com with SMTP id d75a77b69052e-445e1f933e0so22155691cf.0 for ; Mon, 08 Jul 2024 09:52:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1720457559; x=1721062359; darn=lists.infradead.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=44iLSgmAA8Jj5OzeQp5q3uGTMuRJb4ek81IJRNbfP50=; b=lkFNv5w4zLUkBuqpb0RkmWLovOoUZtAYMPDEm/QjAiR05nDoM6VG5jYdbXa7wVFAZ+ tDoxQxCA0R1CGYRL137usRipYvH9UKqCcsprQIo9p+ML5+Aer5uOZzmWYj0ZzJOtIum+ uy3U4E1pfmLa1w2uBNw/SrAzB8mMdvx4wBPM2Fa2WKLC+Lbwk+ZEyDeJQUrGWHFVTU9k JY3GBEoCjHNHvp0ZBq+zcwS/KbEieds+0iyF15ajofpbnQ8tha40io3tviIbb4U/m2Xa 54yHkSS9R6Sz2k+eDTHdEYTtRPMpkggU3hVDBnE6TO6nulVhRfVQ6kIPOvtBdxKYMzuE YFCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720457559; x=1721062359; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=44iLSgmAA8Jj5OzeQp5q3uGTMuRJb4ek81IJRNbfP50=; b=Z7mKcZAT2GPzepZXwNyqXJYmOAyNCB6oGeS3LNLRrVu8l3ECJmI/XOzqOe4Bsqxvtm qD5iftQVO1/Uz5zeq1Fhz8mm8y8VHGtgTALjUG5/XiRIkqXrUe6NJ91Qstn9icaFkcCl OZlH49Jmu4Oxhd91kUF0bsCEjVH+8oweP1t96OfDfligT6BT9vM0/+iGpbrEo1RQ79D9 p5gGZd8tOY7h5+GAVFalJfVj39LVZViXvYnh/fdU4/+zPlQ8HETFr8NeOYIHDGns+W0O q6jkzzibHZKHwsdpyiVxr3UDCUWtVNuRmYFVdr7t/v0WF8FhC+L3iCQoGZBwmSicpXV1 lUOQ== X-Forwarded-Encrypted: i=1; AJvYcCXpjorNBZBnaC5ohkeVPtKIe54mscj0PctLoqxQm8v7nzto7iVcvN/uwHguTr/91mAx5t3yHXIpeWdVT7whnsWp08Zp0eRWFDNe2j9kQKo= X-Gm-Message-State: AOJu0YxEpZs1YZ1QW7vPJle2oOaVeyCa1TaWBO1JDF7zIjxOs0RZOBJd SR4jnmPRz229E8gfFKRv/eYVFO0IgexQE9OXLrdK76W8zAAaBRitft/F91QCDUs= X-Google-Smtp-Source: AGHT+IHmTDKEE4X7UqSrEePQ2yW2AFHAIlc2Xn5bxdXHYF1pSNmcIuJQ4brop8xp0q/dd20hJkGD6Q== X-Received: by 2002:ac8:58c6:0:b0:447:e532:b370 with SMTP id d75a77b69052e-447fa8aefa5mr156831cf.10.1720457559408; Mon, 08 Jul 2024 09:52:39 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-142-68-80-239.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.68.80.239]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-447f9b40389sm1202611cf.36.2024.07.08.09.52.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jul 2024 09:52:38 -0700 (PDT) Received: from jgg by wakko with local (Exim 4.95) (envelope-from ) id 1sQrbS-000Uky-FO; Mon, 08 Jul 2024 13:52:38 -0300 Date: Mon, 8 Jul 2024 13:52:38 -0300 From: Jason Gunthorpe To: Christoph Hellwig Cc: Leon Romanovsky , Jens Axboe , Robin Murphy , Joerg Roedel , Will Deacon , Keith Busch , "Zeng, Oak" , Chaitanya Kulkarni , Sagi Grimberg , Bjorn Helgaas , Logan Gunthorpe , Yishai Hadas , Shameer Kolothum , Kevin Tian , Alex Williamson , Marek Szyprowski , =?utf-8?B?SsOpcsO0bWU=?= Glisse , Andrew Morton , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org, iommu@lists.linux.dev, linux-nvme@lists.infradead.org, linux-pci@vger.kernel.org, kvm@vger.kernel.org, linux-mm@kvack.org Subject: Re: [RFC PATCH v1 00/18] Provide a new two step DMA API mapping API Message-ID: <20240708165238.GE14050@ziepe.ca> References: <20240703054238.GA25366@lst.de> <20240703105253.GA95824@unreal> <20240703143530.GA30857@lst.de> <20240703155114.GB95824@unreal> <20240704074855.GA26913@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240704074855.GA26913@lst.de> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240708_095241_076818_8B50BE87 X-CRM114-Status: GOOD ( 24.98 ) X-BeenThere: linux-nvme@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-nvme" Errors-To: linux-nvme-bounces+linux-nvme=archiver.kernel.org@lists.infradead.org On Thu, Jul 04, 2024 at 09:48:56AM +0200, Christoph Hellwig wrote: > 1) The amount of code needed in nvme worries me a bit. Now NVMe a messy > driver due to the stupid PRPs vs just using SGLs, but needing a fair > amount of extra boilerplate code in drivers is a bit of a warning sign. > I plan to look into this to see if I can help on improving it, but for > that I need a working version first. It would be nice to have less. So much now depends on the caller to provide both the input and output data structure. Ideally we'd have some template code that consolidates these loops to common code with driver provided hooks - there are a few ways to get that efficiently in C. I think it will be clearer when we get to RDMA and there we have the same SGL/PRP kind of split up and we can see what is sharable. > Not quite as concerning, but doing an indirect call for each map > through dma_map_ops in addition to the iommu ops is not every > efficient. Yeah, there is no reason to support anything other than dma-iommu.c for the iommu path, so the dma_map_op indirection for this could just be removed. I'm also cooking something that should let us build a way to iommu map a bio_vec very efficiently, which should transform this into a single indirect call into the iommu driver per bio_vec, and a single radix walk/etc. > We've through for a while to allow direct calls to dma-iommu similar > how we do direct calls to dma-direct from the core mapping.c code. > This might be a good time to do that as a prep step for this work. I think there is room to benchmark and further improve these paths. Even the fast direct map path is not compiling down to a single load/store instruction per bio_vec entry as would be ideal. Jason