From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qt1-f179.google.com (mail-qt1-f179.google.com [209.85.160.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7571579FE for ; Sat, 22 Mar 2025 00:41:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.179 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742604094; cv=none; b=HXR9AQ3oVu5pG5zWZxxm/3cFDg1nHMnKKx9TChhjfWXg35RnPQM9Zi4caautZXmSrzwzmedIlHWOh11I0i5aBSLF//cJYC7bav+JkrD0ZTufPsoTlXJGzwrt9s5SuZpdy/76q/tJ8na423mYxv6JIHJUS2kq9PF08rxtjzcRLJ8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742604094; c=relaxed/simple; bh=hqoJRCdWhjuEg7TGBkaWxPiFOMvAutcwW1byYHxtnno=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Q5RqYTR1XXEixaxXElr+AUr0CfLMMX52Q+BoLDMffG2G9KM4k80754pchmnPbUTUXR1q0caVwOnOPXgy+rU/mx2VgLrv1traA5lnqEq56t39ds63SwvTxu4N+lgX53H1fCaIeysSJpZuJOSsHEH1Lf1FDHPyFDTk8f4nyP2hEDs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca; spf=pass smtp.mailfrom=ziepe.ca; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b=R7B8UWhJ; arc=none smtp.client-ip=209.85.160.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ziepe.ca Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="R7B8UWhJ" Received: by mail-qt1-f179.google.com with SMTP id d75a77b69052e-47677b77725so22765931cf.3 for ; Fri, 21 Mar 2025 17:41:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1742604091; x=1743208891; darn=vger.kernel.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=7w18pLCxgYQdbgr4L7Ilx5M+dDme30Hw40dLx2kJ/Cs=; b=R7B8UWhJvzY42pvGEXzc6g/CCpxVufGWlUhFok38uou2OkWlLPGuDJtZw2zv0X4g2t 8J5H7J4iv1COZfvtScYcLqv9UYzmPga9O/PMs2PLCjtHMbt/F0sr/E5TOwdCISHFdnc8 exaOwDFrFSeER/EDk/U5R5I4ss8/9qVJpHWvlC5zpAs/igjUOeO+/BxSk93pH1UXx+SP LgqpLAQwbAZ0onbxeHG4Mp3udUsn+AaBi8XeRFKkfmStyPwJPUKi1tgDkHRXr9OXgZbx VNuHyNVmP70zXrP/aA9tz91BGWewef+tcco1OglHPjxMOipK+QxDWUYAtcqogWNoxQ8a yiYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742604091; x=1743208891; 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=7w18pLCxgYQdbgr4L7Ilx5M+dDme30Hw40dLx2kJ/Cs=; b=Oq7txRIEhSaYEZLuIBKD4dxNRy7UHKNsyronMLFvXimdaOxFJKHsZKwRX7adrVonNM CvRSZGN94Sc6W3QZzr6W/A9UBhK4Rcr4N4/SM7s0Fh3k2o548Dja+pEZmbWpPLBkuNFA BImUMG+jEiKo4rpsrzx8E+UAzVkGOCvHwc8CXq29pQI3apucHJrraPtsNPqU2lh3vfOU KKX9mBgji1EMkMUGhLQD5IEC75+BdJr4oVOQf+hi02USm/WqFu+gbidfAWHJRlKntrym gDIljYFpWn22WhIQIUCz3EL1qnKzAOmUhVombYlLnNHhau4DXAlgZQn0x+rzbIdwehUS 4PRQ== X-Forwarded-Encrypted: i=1; AJvYcCUtBtD4S/osUG/0dYqLBnZ+NDMK0pkhy3UBVDct396ro1EVwaig1wb5gV0630b7OMOLoR+Rls14OR2qlN0=@vger.kernel.org X-Gm-Message-State: AOJu0YwgfuCRy17LMur2EHNRMb6SMjzZoLh4n207spMR7L8wj1kr6LRA lGOIjf148BwaMKgGwMaXVDJzrvfSYrCwvKfwOo7UWLVAXRaUEjhMtv32bwEtdPs= X-Gm-Gg: ASbGnctdYIJhF9+1gtXXZ/ZREDQy9kKzavFn7oWYg37ZADUwaQXuYzfyLbvdYT5WQVj UCWX/nd5pan/rPaaqaLQxkAeRgZJYV8sFAYXjzIvA5yKfd2uFUF/hmBB/kQP2mclvIRuvsRHX9Y Yo31fNNaayFUGihKjV2te43cYZioCJ8R2N4KdW30BnCjwNsMmNvdTrLs4YMtkPW0lT9w1YkOV6c yS8unGhAKx5Om4UcEwe2RNRYshlVwUv5S37CCSrV3b6Ew41oYQnGm+H64KD7lKC7aV9201eYTUJ UxlgNU/3Z3Gel0udJw1OmQpTxORvCa13h+3HjpVkBwShJF/rdw/mIPDqlCBYs3GeNVot+YM50Xt zfI4FWFstY2MsdRS8AjVbygw= X-Google-Smtp-Source: AGHT+IF3UkobCdIF7lNWuu9KRAhdJDE5q4DcYOtKKTS+FcoMl1AlUzXXVqHHTKDK0VlDF9Mdifo+AQ== X-Received: by 2002:a05:622a:480c:b0:476:b7e2:385c with SMTP id d75a77b69052e-4771dd5d0e6mr84261721cf.2.1742604091376; Fri, 21 Mar 2025 17:41:31 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-142-167-219-86.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.167.219.86]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-4771d0ad87esm18121731cf.0.2025.03.21.17.41.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Mar 2025 17:41:30 -0700 (PDT) Received: from jgg by wakko with local (Exim 4.97) (envelope-from ) id 1tvmva-00000001CZm-0pDT; Fri, 21 Mar 2025 21:41:30 -0300 Date: Fri, 21 Mar 2025 21:41:30 -0300 From: Jason Gunthorpe To: Marek Szyprowski Cc: Leon Romanovsky , Robin Murphy , Christoph Hellwig , Jens Axboe , Joerg Roedel , Will Deacon , Sagi Grimberg , Keith Busch , Bjorn Helgaas , Logan Gunthorpe , Yishai Hadas , Shameer Kolothum , Kevin Tian , Alex Williamson , =?utf-8?B?SsOpcsO0bWU=?= Glisse , Andrew Morton , Jonathan Corbet , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-block@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, Randy Dunlap Subject: Re: [PATCH v7 00/17] Provide a new two step DMA mapping API Message-ID: <20250322004130.GS126678@ziepe.ca> References: <20250220124827.GR53094@unreal> <1166a5f5-23cc-4cce-ba40-5e10ad2606de@arm.com> <20250312193249.GI1322339@unreal> <20250319175840.GG10600@ziepe.ca> <1034b694-2b25-4649-a004-19e601061b90@samsung.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1034b694-2b25-4649-a004-19e601061b90@samsung.com> On Fri, Mar 21, 2025 at 12:52:30AM +0100, Marek Szyprowski wrote: > > Christoph's vision was to make a performance DMA API path that could > > be used to implement any scatterlist-like data structure very > > efficiently without having to teach the DMA API about all sorts of > > scatterlist-like things. > > Thanks for explaining one more motivation behind this patchset! Sure, no problem. To close the loop on the bigger picture here.. When you put the parts together: 1) dma_map_sg is the only API that is both performant and fully functional 2) scatterlist is a horrible leaky design and badly misued all over the place. When Logan added SG_DMA_BUS_ADDRESS it became quite clear that any significant changes to scatterlist are infeasible, or at least we'd break a huge number of untestable legacy drivers in the process. 3) We really want to do full featured performance DMA *without* a struct page. This requires changing scatterlist, inventing a new scatterlist v2 and DMA map for it, or this idea here of a flexible lower level DMA API entry point. Matthew has been talking about struct-pageless for a long time now from the block/mm direction using folio & memdesc and this is meeting his work from the other end of the stack by starting to build a way to do DMA on future struct pageless things. This is going to be huge multi-year project but small parts like this need to be solved and agreed to make progress. 4) In the immediate moment we still have problems in VFIO, RDMA, and DRM managing P2P transfers because dma_map_resource/page() don't properly work, and we don't have struct pages to use dma_map_sg(). Hacks around the DMA API have been in the kernel for a long time now, we want to see a properly architected solution. Jason