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 975F9202F88; Thu, 12 Dec 2024 08:49:03 +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=1733993345; cv=none; b=OBdf3T33N3p02SriLUiiWlwypWujv4QncyJyianfrF+8dmLsBdSaPyL8W7kVPVxBIkcks2sias69GoGOm2VEkTgKkb7JDVLvvpBf9BrnqgI5k4TEKokINRjGNXq6aZr5jRGQnxckHaiZXxEq1xHcQxqKgcERNVCMW7P5rKTUdLw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733993345; c=relaxed/simple; bh=wNfdSZmyat0UwD7526wx2IW+8Fb/6Fxc7sKATjUY7Pc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=so7/uMXLU9em7oTaW7vkuiq62EiEVQ5mBWiBnC9Aw1jEa3G12HDYzo2I8iwygg1ZPti9Omjg/qxz5+eua8rByuDa+/x8MOW3QmLjEzai2xvCL8X0l4w4DuVFL6OxeuXmyXxtSmonmzpkSPPH2+Mx20iSeL1wcjNSCgU46mRUxfE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (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=none (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 594C268D1E; Thu, 12 Dec 2024 09:48:57 +0100 (CET) Date: Thu, 12 Dec 2024 09:48:56 +0100 From: Christoph Hellwig To: Leon Romanovsky Cc: Jens Axboe , Jason Gunthorpe , Robin Murphy , Joerg Roedel , Will Deacon , Christoph Hellwig , Sagi Grimberg , Leon Romanovsky , 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: <20241212084856.GE9376@lst.de> References: Precedence: bulk X-Mailing-List: linux-doc@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: User-Agent: Mutt/1.5.17 (2007-11-01) 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?