All of lore.kernel.org
 help / color / mirror / Atom feed
From: Balbir Singh <balbirs@nvidia.com>
To: Aveline Noir <jm5905938@gmail.com>
Cc: jgg@nvidia.com, leonro@nvidia.com, akpm@linux-foundation.org,
	 airlied@gmail.com, apopple@nvidia.com, christian.koenig@amd.com,
	 dri-devel@lists.freedesktop.org,
	Francois Dugast <francois.dugast@intel.com>,
	 intel-xe@lists.freedesktop.org, jgg@ziepe.ca, leon@kernel.org,
	linux-kernel@vger.kernel.org,  linux-mm@kvack.org,
	Lorenzo Stoakes <lorenzo.stoakes@oracle.com>,
	 Matthew Brost <matthew.brost@intel.com>,
	mm-commits@vger.kernel.org, mpenttil@redhat.com,
	 Patchwork <patchwork@emeril.freedesktop.org>,
	SeongJae Park <sj@kernel.org>,
	thomas.hellstrom@linux.intel.com,
	 Vlastimil Babka <vbabka@suse.cz>,
	ziy@nvidia.com
Subject: Re: [PATCH] mm/hmm: account for subpage offsets in device-private PMDs
Date: Mon, 23 Nov 2026 16:52:10 +1100	[thread overview]
Message-ID: <awObsp2ugvQZ1JQV@parvat> (raw)
In-Reply-To: <179342234355.4.16705453209886955762@gmail.com>

On Sat, Oct 31, 2026 at 03:07:58PM +1100, Aveline Noir wrote:
> When a query starts inside a device-private PMD owned by
> range->dev_private_owner, hmm_vma_handle_absent_pmd() still fills the PFN
> array from the folio's first page. The returned PFNs therefore refer to
> earlier pages rather than the requested subrange.
> 
> Add the query's PMD-relative page offset to the initial PFN, as the
> present PMD path already does.
> 
> Fixes: 10b9feee2d0d ("mm/hmm: populate PFNs from PMD swap entry")
> Signed-off-by: Aveline Noir <jm5905938@gmail.com>
> 
> ---
> Found during a synthetic test_hmm check of device-private THP handling.
> Tested PMD-aligned and non-aligned subranges, PMD boundaries, split
> PTEs and fake-device data accesses with test_hmm in QEMU TCG; all
> executed tests passed with the fix. No real GPU testing was performed.
> ---
>  mm/hmm.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/mm/hmm.c b/mm/hmm.c
> index 2f1e98c6b644..e89f140d3e5c 100644
> --- a/mm/hmm.c
> +++ b/mm/hmm.c
> @@ -355,7 +355,8 @@ static int hmm_vma_handle_absent_pmd(struct mm_walk *walk, unsigned long start,
>  	    range->dev_private_owner) {
>  		unsigned long cpu_flags = HMM_PFN_VALID |
>  			hmm_pfn_flags_order(PMD_SHIFT - PAGE_SHIFT);
> -		unsigned long pfn = softleaf_to_pfn(entry);
> +		unsigned long pfn = softleaf_to_pfn(entry) +
> +			((start & ~PMD_MASK) >> PAGE_SHIFT);
>  		unsigned long i;
>  
>  		if (softleaf_is_device_private_write(entry))
>

Looks good to me!

Reviewed-by: Balbir Singh <balbirs@nvidia.com>


  parent reply	other threads:[~2026-11-23  5:52 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-31  4:07 [PATCH] mm/hmm: account for subpage offsets in device-private PMDs Aveline Noir
2026-11-22  0:00 ` Andrew Morton
2026-11-22  5:55   ` Mika Penttilä
2026-11-22  9:52     ` Andrew Morton
2026-11-22 12:04       ` Mika Penttilä
2026-11-22 14:45       ` Aveline Noir
2026-11-22 16:32         ` Mika Penttilä
2026-11-22 16:41         ` Mika Penttilä
2026-11-22 17:14           ` Andrew Morton
2026-11-22 17:37             ` Mika Penttilä
2026-11-22  0:01 ` + mm-hmm-account-for-subpage-offsets-in-device-private-pmds.patch added to mm-hotfixes-unstable branch Andrew Morton
2026-11-23  5:52 ` Balbir Singh [this message]
2026-12-02  3:47 ` [merged mm-hotfixes-stable] mm-hmm-account-for-subpage-offsets-in-device-private-pmds.patch removed from -mm tree Andrew Morton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=awObsp2ugvQZ1JQV@parvat \
    --to=balbirs@nvidia.com \
    --cc=airlied@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=apopple@nvidia.com \
    --cc=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=francois.dugast@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jgg@nvidia.com \
    --cc=jgg@ziepe.ca \
    --cc=jm5905938@gmail.com \
    --cc=leon@kernel.org \
    --cc=leonro@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=matthew.brost@intel.com \
    --cc=mm-commits@vger.kernel.org \
    --cc=mpenttil@redhat.com \
    --cc=patchwork@emeril.freedesktop.org \
    --cc=sj@kernel.org \
    --cc=thomas.hellstrom@linux.intel.com \
    --cc=vbabka@suse.cz \
    --cc=ziy@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.