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 02B71E77182 for ; Thu, 12 Dec 2024 08:55:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5D0306B0093; Thu, 12 Dec 2024 03:55:00 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 46A826B0092; Thu, 12 Dec 2024 03:55:00 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 26EC06B0093; Thu, 12 Dec 2024 03:55:00 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 0A1A76B008C for ; Thu, 12 Dec 2024 03:55:00 -0500 (EST) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 8F2F2161637 for ; Thu, 12 Dec 2024 08:54:59 +0000 (UTC) X-FDA: 82885696656.04.2918D4D Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf20.hostedemail.com (Postfix) with ESMTP id 842D91C0006 for ; Thu, 12 Dec 2024 08:54:32 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Ojj28dCC; spf=pass (imf20.hostedemail.com: domain of leon@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=leon@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1733993682; 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:dkim-signature; bh=BwiohXe2LpqwSbaayvK5WRdb0Es7ZzhHmd4u+kN1o34=; b=Sa5ODkCYWL2ZDqDWdnfPsseAFqQcKzpxzNojz4flxpJjazFvfMC+WhvgDgwqqRoYjnD4/b NvEyK0nWY13YetZgKBbvqM2f+7RF07mVj9bWftrakvSLQ0gSvxxOxIyqR51Zhv8xM6wi7b OmfEXTGxvmBUsbVZLXIQ5zBiVrIMocM= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1733993682; a=rsa-sha256; cv=none; b=4b6DczypTC7Jamj60/QJKk1FEKZscU3VPQNSl5UTLlvG4WqfEC0qrHPqm1+tjc5CyZjkBW L08WKg8HGFtPlsLa+37S1usET9reWf3vevsDbJkq/Eft81dtwYvI7PeEdSbOh49c3M9iMn l3LJ3YYfhbN8pGtYyNa+s9XTf/QT0pA= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Ojj28dCC; spf=pass (imf20.hostedemail.com: domain of leon@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=leon@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id E5021A426B8; Thu, 12 Dec 2024 08:53:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CE6C8C4CECE; Thu, 12 Dec 2024 08:54:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733993696; bh=Fy4YngrVcpagRsu5yXaXhy6khObq1+63mtDUkXZu0Hs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Ojj28dCCyJsYWCQ3nZtMUHqqKD7pLZ/ITymNq/65CKEPSxvMwaKmSBEcXxLYPPKy0 bCCF3nZPaJ7k//9SBQ/rYhvwJimsjRdm+91sZWCtORRbzPjDtteY0DSoFIUcv1x+Lr 1CBtlVjnuOx8tTbgfpy+LEAsfWvTLFFTYZp7gkMuh4x2UvzAENWOExWVLSc4743UO9 JCTRe0c+Y4hkv7hgXehu2a9IN4oO88rQf5qeTV3yngqTzQ8uA8ZEtTJYYWl8RkEd5C CPaD72/jVRnOkLoezb3tHNft0IcASYCJ/ywixjCc6QTi7fbpx3tk7LTpPjb2MxQzXP gZjbGel83uyhg== Date: Thu, 12 Dec 2024 10:54:52 +0200 From: Leon Romanovsky To: Christoph Hellwig Cc: Jens Axboe , Jason Gunthorpe , Robin Murphy , Joerg Roedel , Will Deacon , Sagi Grimberg , Keith Busch , Bjorn Helgaas , Logan Gunthorpe , Yishai Hadas , Shameer Kolothum , Kevin Tian , Alex Williamson , Marek Szyprowski , =?iso-8859-1?B?Suly9G1l?= 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 v4 11/18] mm/hmm: let users to tag specific PFN with DMA mapped bit Message-ID: <20241212085452.GI1245331@unreal> References: <20241212084856.GE9376@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20241212084856.GE9376@lst.de> X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 842D91C0006 X-Stat-Signature: kdc8u1b5cjkqimazw45bb3yh1iiiammf X-Rspam-User: X-HE-Tag: 1733993672-594359 X-HE-Meta: U2FsdGVkX18VX2EXSZm3rkF0I0cM42T+blC5ty6wdfeWPwYkkaQrHDiAQgq7GI98rY0zkmWl6BD5QeuO3DaCWHP7Nlyz5DJF0TA09dOMkbTM/lJ6Z/O68Zic9eC4SwSi1oteRvuVwuWAB6Z+1ZL3sjNllO+UPPjzjl7ZhhpSixZklv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hHpXaBskA== 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 Thu, Dec 12, 2024 at 09:48:56AM +0100, Christoph Hellwig wrote: > On Thu, Dec 05, 2024 at 03:21:10PM +0200, Leon Romanovsky wrote: > > From: Leon Romanovsky > > > > Introduce new sticky flag (HMM_PFN_DMA_MAPPED), which isn't overwritten > > by HMM range fault. Such flag allows users to tag specific PFNs with information > > if this specific PFN was already DMA mapped. > > Missing line wrap at 73 characters here. > > > > > @@ -253,14 +262,14 @@ static int hmm_vma_handle_pte(struct mm_walk *walk, unsigned long addr, > > cpu_flags = HMM_PFN_VALID; > > if (is_writable_device_private_entry(entry)) > > cpu_flags |= HMM_PFN_WRITE; > > - *hmm_pfn = swp_offset_pfn(entry) | cpu_flags; > > + *hmm_pfn = (*hmm_pfn & HMM_PFN_INOUT_FLAGS) | swp_offset_pfn(entry) | cpu_flags; > > Please avoid the overly long line here. > > That being said I hate the structure here. Can't we just have a local > variable for the actual new pfn value, and then a single goto label > at the end that takes the keeper flags from the argument and assigning > the new out value to *hmm_pfn instead of duplicating this in half a > dozen places? Yes, sure, it makes sense, will do. >