From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 92D0119CCEA; Thu, 24 Apr 2025 08:07:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745482070; cv=none; b=ZRavegX6XgO4ycdaIFapp66EzgMH4jwnRiYHYECVNbjM5GlYxy23egJRDwp79HJiW12ieeXZV+wx66UmhotCI5Eip/tDLOvzXIFWT61lAkBoNlKvHU9BieKczHwcfw/qr3kysb6zd5KaDsMwSsBiUN18OQbF4jLePVKA9QddKYs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745482070; c=relaxed/simple; bh=gQ9J0xOhC6db6xC9+l1fS/rU8P/+uRvFwj9Ophiqh+Q=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=hEhM7mKefqFsB2aVpNrsNouf01/pPPMsJhi33z0xeNU66DwGpXb/oY9s5wrLJUWUOSqqhWaXFfGBcYChvPx1pEc3UqZfCKlMqC34mDU0dSd0i7O3dgC8+/Vdz7PC14srmGIsqqc5CHb8C5MOotDmQMAxfmwUI5GEZR9/RIx60sA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ODyOD7bZ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ODyOD7bZ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0ED08C4CEEB; Thu, 24 Apr 2025 08:07:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1745482069; bh=gQ9J0xOhC6db6xC9+l1fS/rU8P/+uRvFwj9Ophiqh+Q=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ODyOD7bZFe6psyTBbbqHrGyTN9bbO06+mLsjpOZpZAtyeVZhSMtIzzHp4uk/bPwRF Fg+5AuYPCHFaO1iJ7AZ0hnuzbSatu3RKpWWB0igu+ysf5GxyCdAj0/zoHi8abPgms6 UyWqrFeuVLz7KWExbAlMl6sGk3pIBXhjJdgkeyS5U7v4meyETDlnI/bCnajjhgK5ip tIFTA4qEdRjUs4v9+5Yqy4cTSqzgz9evKITnLdxHo0yebJZSxHX+clynB3yYqiaA9g TAOPbev3sVV+FH5Ob1WbUIU/+f8jJU3YQkiM1kHRm7HKmFAywX5r91KPZh1EV5IySo WbMrUBYNBAOvw== Date: Thu, 24 Apr 2025 11:07:44 +0300 From: Leon Romanovsky To: Jason Gunthorpe Cc: Mika =?iso-8859-1?Q?Penttil=E4?= , Marek Szyprowski , Jens Axboe , Christoph Hellwig , Keith Busch , Jake Edge , Jonathan Corbet , 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 v9 10/24] mm/hmm: let users to tag specific PFN with DMA mapped bit Message-ID: <20250424080744.GP48485@unreal> References: <0a7c1e06269eee12ff8912fe0da4b7692081fcde.1745394536.git.leon@kernel.org> <7185c055-fc9e-4510-a9bf-6245673f2f92@redhat.com> <20250423181706.GT1213339@ziepe.ca> <36891b0e-d5fa-4cf8-a181-599a20af1da3@redhat.com> <20250423233335.GW1213339@ziepe.ca> 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=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20250423233335.GW1213339@ziepe.ca> On Wed, Apr 23, 2025 at 08:33:35PM -0300, Jason Gunthorpe wrote: > On Wed, Apr 23, 2025 at 09:37:24PM +0300, Mika Penttilä wrote: > > > > On 4/23/25 21:17, Jason Gunthorpe wrote: > > > On Wed, Apr 23, 2025 at 08:54:05PM +0300, Mika Penttilä wrote: > > >>> @@ -36,6 +38,13 @@ enum hmm_pfn_flags { > > >>> HMM_PFN_VALID = 1UL << (BITS_PER_LONG - 1), > > >>> HMM_PFN_WRITE = 1UL << (BITS_PER_LONG - 2), > > >>> HMM_PFN_ERROR = 1UL << (BITS_PER_LONG - 3), > > >>> + > > >>> + /* > > >>> + * Sticky flags, carried from input to output, > > >>> + * don't forget to update HMM_PFN_INOUT_FLAGS > > >>> + */ > > >>> + HMM_PFN_DMA_MAPPED = 1UL << (BITS_PER_LONG - 7), > > >>> + > > >> How is this playing together with the mapped order usage? > > > Order shift starts at bit 8, DMA_MAPPED is at bit 7 > > > > hmm bits are the high bits, and order is 5 bits starting from > > (BITS_PER_LONG - 8) > > I see, so yes order occupies 5 bits [-4,-5,-6,-7,-8] and the > DMA_MAPPED overlaps, it should be 9 not 7 because of the backwardness. Thanks for the fix.