Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp1126470lqs; Wed, 6 Mar 2024 07:07:13 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV0m0vFNR1xQ5FGQIuBlF6B4etLjG7prR4+8qKUi0hR6SuViu+tSrVDi84c/n4zg2vl0i+KAQJAb25vz9eVHRCQRZib+eFdLA9QlmXJVQ== X-Google-Smtp-Source: AGHT+IHFSnaqGSCLxLhUGBYTNJgYAjbgBnr3jcRH5It840Omy72hT7QGou4HznFcdjHPGqtipR3X X-Received: by 2002:a05:6e02:1523:b0:365:2676:df13 with SMTP id i3-20020a056e02152300b003652676df13mr18621031ilu.24.1709737632900; Wed, 06 Mar 2024 07:07:12 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709737632; cv=pass; d=google.com; s=arc-20160816; b=sNaVdmGldqhKoBfExxn4w0jiOotGiNG7ignptPhICI4XWjVLFTqvDH7nfvweTlg8sx B/Kn+mNMqdvOU4TTkRvJxp5b+n24rC+spf+8CB1zCFjEun9zKyri0gKV+kjsvkgvGG6n bKYQCrfpcvuJjWXJFwz1SM0xrGuXfakiz+MEO+e1WK4dgMxfHC3zX6rdIklS22T5dXl3 vHqCsLVr/y0swwx+V+m1sBQpzXyswJFcdJlFLkZ6G6gSBcVvPFAeBa3Ffv5RfW41zNyB 5dqoQhuSoBiJRrcbvCevICiBLnzzOTW9owppFZ6Gi6gDnlMdinyE1TpWyCjTa7scyVbn 6P5Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=3q6XaWzdNlm5rZVTCa+MalaN5VSyURFchooXo3LCyRw=; fh=KSs5ehnUDb+7wp+zqZ4dCWYLqfVcH46mjlZcvXZC2+E=; b=Wq1yc3zAixqMPaSbK/T6BkBLwPWA22l96LVucDE1UVtXlRe9xOsIL2qKf3ySHeIU+h 8Rb3QOELQccXRZxOVrKYnCYN2wxJx8hleIcDSD7pfAZhxjjCd4bxIl5+s6txnUz4BYHU Xeddt9adBiH/onOHGMUat60TDsZCsA/OeE1QBeySPCFr4c2dQoiZxb+svz7VUzEHdROo 90P4S/USNWGM6Pmb+LAq+0Byc77nwThxGZhAbcIg9LI/wrfKQNh1lYGGbbI+2On8Yv1P UnXpTPcjDHQ6leZizzUflex/Poqf0JWuqP0Ii5nu/s6BGMo2y11W2xurahD5V73tbyge aekQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b="obAC/gG0"; arc=pass (i=1 spf=pass spfdomain=ziepe.ca dkim=pass dkdomain=ziepe.ca); spf=pass (google.com: domain of linux-kernel+bounces-94110-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-94110-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id l13-20020a056e020dcd00b00365239ae738si4659354ilj.148.2024.03.06.07.07.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Mar 2024 07:07:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-94110-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b="obAC/gG0"; arc=pass (i=1 spf=pass spfdomain=ziepe.ca dkim=pass dkdomain=ziepe.ca); spf=pass (google.com: domain of linux-kernel+bounces-94110-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-94110-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 7A5982883EC for ; Wed, 6 Mar 2024 15:05:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5F5D61353E2; Wed, 6 Mar 2024 15:05:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="obAC/gG0" Received: from mail-qt1-f181.google.com (mail-qt1-f181.google.com [209.85.160.181]) (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 BCFC2134411 for ; Wed, 6 Mar 2024 15:05:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.181 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709737524; cv=none; b=CwPhOR0+H5qYdd0ipma+1nI2eVFX59ira7wljNmvErZTObLJUyi0oYoy7WiQaqwzMj7CzlcYE8is92TkjQbza90uELsDXm3z4QLtqT8i17No+hXAoUO3nzzq/Aqt0VmXb9alqPjXnOSJ/OxaEb/mnlwNYS7i9JGfbwcWSo0WtB4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709737524; c=relaxed/simple; bh=FAE7tKzetJC0DRifXVvbyePo3HyTO0kdYHz5YfVi9U8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=hBDg5lYy9Wtz2Wlo+v6sf3gZtoVsRM38YNp49mdsrOKCyAYWv0JcWqGES+t56/4ZQSD24+chLafJ6TBxS9YydQMWh2IwyTBtJ/ZLZ+z482sreDguQDVyeT9HFSJjdPDOtc81yncCrMBapqkGmWJkReQWp7KXH5QyripRpu+6Buc= 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=obAC/gG0; arc=none smtp.client-ip=209.85.160.181 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 Received: by mail-qt1-f181.google.com with SMTP id d75a77b69052e-42eff08e3f8so8053761cf.1 for ; Wed, 06 Mar 2024 07:05:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1709737521; x=1710342321; 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=3q6XaWzdNlm5rZVTCa+MalaN5VSyURFchooXo3LCyRw=; b=obAC/gG0vpO9hZAA/ZlPaT6q/O+SveoM5lvKr5eUJnO/2Kk+cACVDiNLrhy6GsrVL6 CbsuQfWDk0qw89/m83TPnEqiyuYGrAdXXk2aAIA4T+HfNonzyqD2/e3sWv5KHZEionZ/ kWcWW/BfCS++nlDBaIJZC/8ZYA6Jd5fgtPe8E6zW71FTEwoeBl0kNtGDFhr0jQTKhLRs wiKx6rMrkXMIaf74ws6hR3WOqjkb+lpbOAK15DVCmI+Q9qiFOxOTRVKifCAjuxt8ubtr 85VzH9/VkRkMMJJkJqcwxa2DzMw/rjhXxgLHyBi1/OaDk8nYgj3UjdyOhxK/nBRpNWcx qRUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709737521; x=1710342321; 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=3q6XaWzdNlm5rZVTCa+MalaN5VSyURFchooXo3LCyRw=; b=dZxuOips8I2VUu6J2tivwuq/3Jsu/nQzp40ALTfKEcQxFaOf7VCpQXJQUDwRiOsfx5 VCTXzUnhgirkys97gudQ8XQ5qdnjSkM+xxkvK9PiZQ4Ig36QSzCzFP0rMtffGbne2ABW 8f1mMSv+uMaSLW6DzxBdxd1SfhiUY2hbft2oDSnPS0oP7QLmmyRQYjuJS0TKgnfgC1qH XoTPN3ghfi94ktWdaE5748ts52aKoZX+mL5eIRtfJWHro6G5j3sXIhtuqGOq3QV2++55 HrledWRVBw7fueB+LhUy69dB+1QxPLjtybvbrmguJjm3JYa7K83KYwZhyhnYi+Hk+C2G nXbw== X-Forwarded-Encrypted: i=1; AJvYcCWZC19f3754UL3mKlY+gybfykOQVWjCffdH04C6SNLzKYBKTyvctHTBe31T9YWfBOCdVJo4n6v+MTCvkL6qCtAME+QUvyG1BFpalopu X-Gm-Message-State: AOJu0YzWDp+fAPaXJY+JPNLzcjVgMDPaguhdOv7hqa3Tk6AIDXMytPpK jeDnLYfT4Jf1SY03NHvCh5g/+5cTJvxTZOHHB4bOUQCPPy7oszhbyK3flTS7DV4= X-Received: by 2002:a05:622a:1743:b0:42e:bcc4:2959 with SMTP id l3-20020a05622a174300b0042ebcc42959mr5571780qtk.4.1709737520530; Wed, 06 Mar 2024 07:05:20 -0800 (PST) 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 f5-20020a05622a1a0500b0042f01390d5csm1686793qtb.30.2024.03.06.07.05.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Mar 2024 07:05:19 -0800 (PST) Received: from jgg by wakko with local (Exim 4.95) (envelope-from ) id 1rhspa-001WNB-Tx; Wed, 06 Mar 2024 11:05:18 -0400 Date: Wed, 6 Mar 2024 11:05:18 -0400 From: Jason Gunthorpe To: Christoph Hellwig Cc: Keith Busch , Leon Romanovsky , Robin Murphy , Marek Szyprowski , Joerg Roedel , Will Deacon , Chaitanya Kulkarni , Chaitanya Kulkarni , Jonathan Corbet , Jens Axboe , Sagi Grimberg , Yishai Hadas , Shameer Kolothum , Kevin Tian , Alex Williamson , =?utf-8?B?SsOpcsO0bWU=?= Glisse , Andrew Morton , 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, kvm@vger.kernel.org, linux-mm@kvack.org, Bart Van Assche , Damien Le Moal , Amir Goldstein , "josef@toxicpanda.com" , "Martin K. Petersen" , "daniel@iogearbox.net" , Dan Williams , "jack@suse.com" , Leon Romanovsky , Zhu Yanjun Subject: Re: [RFC RESEND 16/16] nvme-pci: use blk_rq_dma_map() for NVMe SGL Message-ID: <20240306150518.GL9225@ziepe.ca> References: <016fc02cbfa9be3c156a6f74df38def1e09c08f1.1709635535.git.leon@kernel.org> <20240306143321.GA19711@lst.de> 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: <20240306143321.GA19711@lst.de> On Wed, Mar 06, 2024 at 03:33:21PM +0100, Christoph Hellwig wrote: > On Tue, Mar 05, 2024 at 08:51:56AM -0700, Keith Busch wrote: > > On Tue, Mar 05, 2024 at 01:18:47PM +0200, Leon Romanovsky wrote: > > > @@ -236,7 +236,9 @@ struct nvme_iod { > > > unsigned int dma_len; /* length of single DMA segment mapping */ > > > dma_addr_t first_dma; > > > dma_addr_t meta_dma; > > > - struct sg_table sgt; > > > + struct dma_iova_attrs iova; > > > + dma_addr_t dma_link_address[128]; > > > + u16 nr_dma_link_address; > > > union nvme_descriptor list[NVME_MAX_NR_ALLOCATIONS]; > > > }; > > > > That's quite a lot of space to add to the iod. We preallocate one for > > every request, and there could be millions of them. > > Yes. And this whole proposal also seems clearly confused (not just > because of the gazillion reposts) but because it mixes up the case > where we can coalesce CPU regions into a single dma_addr_t range > (iommu and maybe in the future swiotlb) and one where we need a I had the broad expectation that the DMA API user would already be providing a place to store the dma_addr_t as it has to feed that into the HW. That memory should simply last up until we do dma unmap and the cases that need dma_addr_t during unmap can go get it from there. If that is how things are organized, is there another reason to lean further into single-range case optimization? We can't do much on the map side as single range doesn't imply contiguous range, P2P and alignment create discontinuities in the dma_addr_t that still have to be delt with. Jason