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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id AC449C369C2 for ; Tue, 22 Apr 2025 07:32:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 97A656B000A; Tue, 22 Apr 2025 03:32:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 92AEE6B000E; Tue, 22 Apr 2025 03:32:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 840436B0011; Tue, 22 Apr 2025 03:32:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 66DFD6B000A for ; Tue, 22 Apr 2025 03:32:29 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 5120AB4A17 for ; Tue, 22 Apr 2025 07:32:30 +0000 (UTC) X-FDA: 83360862060.15.A8B712C Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by imf26.hostedemail.com (Postfix) with ESMTP id 4D66E140003 for ; Tue, 22 Apr 2025 07:32:28 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=lst.de; spf=pass (imf26.hostedemail.com: domain of hch@lst.de designates 213.95.11.211 as permitted sender) smtp.mailfrom=hch@lst.de ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1745307148; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hYlGbAf0RGey9RFXPCMsCmrXYb553xfhYApUNZh+0vQ=; b=RyqtC4aQCqa6PccmvC0KjJsoZUK5fj7fslKEdBFbiRl2PMo1M3O/VzLA5XIsAcoMc1fw05 06Wc8Cx+m13p7Imx+gf3h3OMu5RU8YYDmUnWLnQu1/55TjRpstO6lrsdBtDUbLTmI9czwL 6jifHlZSkB+SGw3AFcyOP+T+61yZ/j8= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=lst.de; spf=pass (imf26.hostedemail.com: domain of hch@lst.de designates 213.95.11.211 as permitted sender) smtp.mailfrom=hch@lst.de ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1745307148; a=rsa-sha256; cv=none; b=aTYNtxdHaJ4mdLAJtQlWZanHcmS2e9DbZmT0bPPPx2mZ+WE9NEL1HJFWtTVgidW50mopFM bRCEGh4zj0tns5wixoGqr29SlvW5LOwBlchaQPhTg7CtjP50WSw1o9vKxmXb1rHLnwAOm7 OgX6vpu1MEEOGlpUI1KPbzV69RsHsyw= Received: by verein.lst.de (Postfix, from userid 2407) id 0CE9D68AA6; Tue, 22 Apr 2025 09:32:22 +0200 (CEST) Date: Tue, 22 Apr 2025 09:32:21 +0200 From: Christoph Hellwig To: Leon Romanovsky Cc: Christoph Hellwig , Marek Szyprowski , Jens Axboe , 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 Subject: Re: [PATCH v8 23/24] nvme-pci: convert to blk_rq_dma_map Message-ID: <20250422073221.GA31688@lst.de> References: <20250422050050.GB28077@lst.de> <20250422072606.GC48485@unreal> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20250422072606.GC48485@unreal> User-Agent: Mutt/1.5.17 (2007-11-01) X-Rspam-User: X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 4D66E140003 X-Stat-Signature: pbojzdwnu1bayhxayt9gptd3x9ht1f31 X-HE-Tag: 1745307148-151659 X-HE-Meta: U2FsdGVkX199Vr39NkliSRIxfu4uYXluuJ8rQ8ak6f0mtEl3Ot06K3QcUe36GY4wO/hF5xBHu87ojhSRVZw0IoIq8s0v7CzJYSCr7QuNRngzSOTwGYHu89iYghlv4NVo0ijDkVGpRNUB74qvaB+oX5U3pK/oEQ++PWQG+DH2Ne0biWGFpzcXcJrih3dCtwuaC9DN+bQzuA3kRMf5587GDOnat4gaqskMr894I5GZGGIsKBqXRrvHE+yQ7IVHZpdjqSE6U+/MVAmLKlBVSPRT1OIu528RfFyRP/lrIxmmPDqciumyVfit4WgCBzuK30AHa+Z32I6G/fNVwgxJxlzwjYE1ljjjKR3b4sR1eKTmvHeykrqpAnZ5xSRt00wvX7e/6dXLnPZgl+id9WhUYIHS5ZLsjiPZMl48arNtz8MAybF7ieDMtbJMmth4I0bVWTenugs3KeDzrkjexGLm9wVQYA/TgkOtQhhoIoC3feUfvAvNU4KWUn1KRcbjB9hTq+pAzsosOHZs2Utm3XZL/xnaZswU3vGXe9nq3JEGsvYy8ulV25D/ToHX1UgQ/Of8WghpKK88htipj+rqyIGqnp+1IfyvHPcp87flEZrxuzHEyaq7C+kHI2vzJjj3PFjj7FDqOVv26WIH6zpOY2TcnFAnrRpQWJruFHiHk+kK2Qz+Uys3RbwGmzZH0eHPvf6qoWVGvRjLd3OxNRKqbMVoQN06xs5epxoL4ME3MaJN6PGZNcBVgg6bkSm2FRAa5bPk0mZ+9G6Iaa//REKJSwRTWSz7NbfpvC4jixq1vDnLjHBZy93JiylVoJZK7D+6+9NmPDBTlwZoLOBPZI7SKxqe9TWnnEi7OpilymHwGbAEtGmMk5quDeFXmiUf7l1uvuKKKk6inPDe4OfEIKrqGg4DIXVPmdYJsntimAAn/T6iPyAyzqdRcvgY7soFI4euiMAMA6D/f1wk4s14R9TOcjxP4lA EayhX4bV PgSpjABI93nUSbsbDsHMEzwjjradvVGgyOCQKse8J+0MVX3HSZUZiOZgIthymQf0ajIUkfRuZ6ksc41K2ozK2YOBZmcA94PUGPkGkuAl3aLDxbnhMq99KJg4tPvk6cLaxB/g08hFYm4b2k+U= 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: List-Subscribe: List-Unsubscribe: On Tue, Apr 22, 2025 at 10:26:06AM +0300, Leon Romanovsky wrote: > On Tue, Apr 22, 2025 at 07:00:50AM +0200, Christoph Hellwig wrote: > > > + 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. > > I'm trying to say when this do {} while is taken and sector is a wrong > word to describe NVME_CTRL_PAGE_SIZE. Let's remove this comment. Yes, I'd say drop it. > > 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. > > Someone :), I thought that adding my SOB is enough. Well, it also has Chaitanya's, so it must have passed through both of you at least. Usually you want to add a little line explaining what you changed for non-trivial changes when changing it. > if (!blk_rq_dma_unmap(req, dev->dev, &iod->dma_meta_state, > iod->total_meta_len)) { > - if (entries == 1) { > + if (iod->cmd.common.flags & NVME_CMD_SGL_METASEG) { > + unsigned int i; > + > + for (i = 0; i < entries; i++) > + dma_unmap_page(dev->dev, > + le64_to_cpu(sg_list[i].addr), > + le32_to_cpu(sg_list[i].length), dir); > + } else { > dma_unmap_page(dev->dev, iod->meta_dma, > - rq_integrity_vec(req).bv_len, > - rq_dma_dir(req)); > + rq_integrity_vec(req).bv_len, dir); > return; It would be nice if we could share a bit of code with the data mapping, but I'm not sure that's possible. I'll try to look into it and review things more carefully once I've reduced my backlog.