From: sashiko-bot@kernel.org
To: mpenttil@redhat.com
Cc: dri-devel@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v14 04/12] mm/hmm: do the plumbing for HMM to participate in migration
Date: Tue, 22 Sep 2026 05:50:16 +0000 [thread overview]
Message-ID: <20260922055016.EA5081F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260922053421.4092027-5-mpenttil@redhat.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Critical] mm: missing TLB flush on error path in hmm_vma_walk_pmd()
- [High] mm: unbalanced mmu_notifier_invalidate_range_start() on -EINTR
--
commit 7a6e1d53570e6b253761aafa0e2f9a00e3b80665
Author: Mika Penttilä <mpenttil@redhat.com>
Subject: mm/hmm: do the plumbing for HMM to participate in migration
This commit prepares hmm_range_fault() and pagewalk callbacks for migration
by adding hmm_vma_handle_migrate_prepare_pmd() and managing PMD and PTE
locks across the pagewalk.
diff --git a/mm/hmm.c b/mm/hmm.c
index be39d2e5403ab..4805c88347e67 100644
--- a/mm/hmm.c
+++ b/mm/hmm.c
@@ -398,15 +480,72 @@ static int hmm_vma_handle_absent_pmd(struct mm_walk *walk, unsigned long start,
[ ... ]
> +static int hmm_vma_capture_migrate_range(unsigned long start,
> + unsigned long end,
> + struct mm_walk *walk)
> +{
> + struct hmm_vma_walk *hmm_vma_walk = walk->private;
> + struct hmm_range *range = hmm_vma_walk->range;
[ ... ]
> + if (!hmm_vma_walk->mmu_range.owner) {
> + mmu_notifier_range_init_owner(&hmm_vma_walk->mmu_range, MMU_NOTIFY_MIGRATE, 0,
> + walk->vma->vm_mm, start, end,
> + range->dev_private_owner);
> + mmu_notifier_invalidate_range_start(&hmm_vma_walk->mmu_range);
> + }
> +
> + return 0;
> +}
[Severity: High]
Does this mmu_notifier_invalidate_range_start() become unbalanced if the
fault path is interrupted?
When hmm_vma_capture_migrate_range() sets up the active range, the matching
mmu_notifier_invalidate_range_end() happens in hmm_vma_post_range_fault() at
the end of hmm_range_fault_locked().
However, hmm_range_fault_locked() has an early return for fatal signals:
mm/hmm.c:hmm_range_fault_locked() {
...
if (ret == HMM_FAULT_PENDING) {
ret = hmm_do_fault(mm, &hmm_vma_walk);
if (ret == HMM_FAULT_UNLOCKED) {
if (fatal_signal_pending(current))
return -EINTR;
...
If we take this -EINTR return, does the MMU notifier range remain active
permanently, potentially hanging other invalidation threads?
@@ -465,46 +604,128 @@ static int hmm_vma_walk_pmd(pmd_t *pmdp,
[ ... ]
> for (; addr < end; addr += PAGE_SIZE, ptep++, hmm_pfns++) {
> - int r;
>
> r = hmm_vma_handle_pte(walk, addr, end, pmdp, ptep, hmm_pfns);
> if (r) {
> - /* hmm_vma_handle_pte() did pte_unmap() */
> + /* hmm_vma_handle_pte() did pte_unmap() / pte_unmap_unlock */
> return r;
> }
[Severity: Critical]
Can this early return bypass the TLB flush for pages unmapped in previous
iterations?
If hmm_vma_handle_migrate_prepare() sets unmapped = true in an earlier loop
iteration, and then hmm_vma_handle_pte() returns an error on a subsequent
iteration, we immediately return r here.
Does this leave stale TLB entries in place for the previously unmapped pages,
since we skip the flush_tlb_range(walk->vma, start, addr) at the end of the
function?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260922053421.4092027-1-mpenttil@redhat.com?part=4
next prev parent reply other threads:[~2026-09-22 5:50 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-22 5:34 [PATCH 00/12] [PATCH v14 00/12] migrate on fault for device pages mpenttil
2026-09-22 5:34 ` [PATCH v14 01/12] mm/Kconfig: changes for " mpenttil
2026-09-22 5:44 ` sashiko-bot
2026-09-22 22:27 ` Balbir Singh
2026-09-23 5:42 ` Mika Penttilä
2026-09-22 5:34 ` [PATCH v14 02/12] mm: add helper to convert HMM pfn to migrate pfn mpenttil
2026-09-22 5:34 ` [PATCH v14 03/12] mm/hmm: preparations for HMM to participate in migration mpenttil
2026-09-22 5:49 ` sashiko-bot
2026-09-22 5:34 ` [PATCH v14 04/12] mm/hmm: do the plumbing " mpenttil
2026-09-22 5:50 ` sashiko-bot [this message]
2026-09-22 5:34 ` [PATCH v14 05/12] mm/hmm: implement folio split for migrate needs in HMM pagewalk mpenttil
2026-09-22 5:47 ` sashiko-bot
2026-09-22 5:34 ` [PATCH v14 06/12] mm/hmm: migrate collection in HMM pagewalk - pte level mpenttil
2026-09-22 5:47 ` sashiko-bot
2026-09-22 5:34 ` [PATCH v14 07/12] mm/hmm: migrate collection in HMM pagewalk - pmd level mpenttil
2026-09-22 5:50 ` sashiko-bot
2026-09-22 5:34 ` [PATCH v14 08/12] mm/hmm: add lazy MMU mode support for migration in HMM pagewalk mpenttil
2026-09-22 5:51 ` sashiko-bot
2026-09-22 5:34 ` [PATCH v14 09/12] mm/hmm: implement rollback for device page " mpenttil
2026-09-22 5:34 ` [PATCH v14 10/12] mm: enable device page migration from " mpenttil
2026-09-22 5:58 ` sashiko-bot
2026-09-22 5:34 ` [PATCH v14 11/12] lib/test_hmm: add a new testcase for the migrate on fault mpenttil
2026-09-22 6:09 ` sashiko-bot
2026-09-22 5:34 ` [PATCH v14 12/12] Documentation/mm/hmm: document migration through hmm_range_fault() mpenttil
2026-09-22 5:41 ` ✗ CI.checkpatch: warning for Migrate on fault for device pages (rev6) Patchwork
2026-09-22 5:43 ` ✓ CI.KUnit: success " Patchwork
2026-09-22 6:00 ` ✗ CI.checksparse: warning " Patchwork
2026-09-22 7:08 ` ✓ Xe.CI.BAT: success " Patchwork
2026-09-22 15:03 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-09-23 2:27 ` [PATCH 00/12] [PATCH v14 00/12] migrate on fault for device pages Andrew Morton
2026-09-23 5:29 ` Mika Penttilä
2026-09-23 21:19 ` Andrew Morton
2026-09-23 23:24 ` Jason Gunthorpe
2026-09-24 0:14 ` Mika Penttilä
2026-09-24 0:10 ` Mika Penttilä
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=20260922055016.EA5081F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=mpenttil@redhat.com \
--cc=sashiko-reviews@lists.linux.dev \
/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.