From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C997FEAFA for ; Tue, 22 Apr 2025 05:00:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.95.11.211 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745298059; cv=none; b=enF3mfp2WR4fMzm+UWn9EyoQo+Zy2EKQjxR41jeUdDM8sWyXgf33vriJ5NRi6GzkFG1PRLCbKz4zmzKDZe8tN8NEyFVxxptvbh8VxNW7bjoTAVYnaeAuJOcXX3z8TaASJ4HVhuF+TdfBcUD6PhUnFiVW1NkPx0yx/WAAVxSURYE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745298059; c=relaxed/simple; bh=/ELFZKv4e0D7TteJyW9Rpn8e4XtrEsidyb7gbxlwYqY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=tpAv26gBBWZuBgIcRp/sb38sqYmMaVif7ERzS1JKswIEe694A0NtYIJiE794RU3raw/fah4iWAqpmrpjmcjLE5T9SdMMo2Q/tXSewhXOZHu7C3WS0GvjDURgaLIDqVR0iDYbxLgEjnEbDliOJHX3DY3ywiI8PDgOXTDc75Su+js= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lst.de; spf=pass smtp.mailfrom=lst.de; arc=none smtp.client-ip=213.95.11.211 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lst.de Received: by verein.lst.de (Postfix, from userid 2407) id 1414268BFE; Tue, 22 Apr 2025 07:00:51 +0200 (CEST) Date: Tue, 22 Apr 2025 07:00:50 +0200 From: Christoph Hellwig To: Leon Romanovsky Cc: Marek Szyprowski , Jens Axboe , Christoph Hellwig , Keith Busch , Jake Edge , Jonathan Corbet , Jason Gunthorpe , Zhu Yanjun , Robin Murphy , Joerg Roedel , Will Deacon , Sagi Grimberg , Bjorn Helgaas , Logan Gunthorpe , Yishai Hadas , Shameer Kolothum , Kevin Tian , Alex Williamson , =?iso-8859-1?B?Suly9G1l?= 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, linux-pci@vger.kernel.org, kvm@vger.kernel.org, linux-mm@kvack.org, Niklas Schnelle , Chuck Lever , Luis Chamberlain , Matthew Wilcox , Dan Williams , Kanchan Joshi , Chaitanya Kulkarni , Leon Romanovsky Subject: Re: [PATCH v8 23/24] nvme-pci: convert to blk_rq_dma_map Message-ID: <20250422050050.GB28077@lst.de> References: Precedence: bulk X-Mailing-List: iommu@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) > + dma_len = min_t(u32, length, NVME_CTRL_PAGE_SIZE - (dma_addr & (NVME_CTRL_PAGE_SIZE - 1))); And overly long line slipped in here during one of the rebases. > + /* > + * We are in this mode as IOVA path wasn't taken and DMA length > + * is morethan two sectors. In such case, mapping was perfoormed > + * per-NVME_CTRL_PAGE_SIZE, so unmap accordingly. > + */ Where does this comment come from? Lots of spelling errors, and I also don't understand what it is talking about as setors are entirely irrelevant here. > + if (!blk_rq_dma_unmap(req, dev->dev, &iod->dma_state, iod->total_len)) { > + if (iod->cmd.common.flags & NVME_CMD_SGL_METABUF) > + nvme_free_sgls(dev, req); With the addition of metadata SGL support this also needs to check NVME_CMD_SGL_METASEG. The commit message should also really mentioned that someone significantly altered the patch for merging with latest upstream, as I as the nominal author can't recognize some of that code. > + unsigned int entries = req->nr_integrity_segments; > struct nvme_iod *iod = blk_mq_rq_to_pdu(req); > > + if (!blk_rq_dma_unmap(req, dev->dev, &iod->dma_meta_state, > + iod->total_meta_len)) { > + if (entries == 1) { > + dma_unmap_page(dev->dev, iod->meta_dma, > + rq_integrity_vec(req).bv_len, > + rq_dma_dir(req)); > + return; > } > } > > + dma_pool_free(dev->prp_small_pool, iod->meta_list, iod->meta_dma); This now doesn't unmap for entries > 1 in the non-IOVA case.