Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Jinjiang Tu" <tujinjiang@huawei.com>,
	akpm@linux-foundation.org, david@kernel.org, ljs@kernel.org,
	catalin.marinas@arm.com, will@kernel.org, mark.rutland@arm.com,
	ryan.roberts@arm.com, peterx@redhat.com, dave.jiang@intel.com,
	linux-mm@kvack.org
Cc: wangkefeng.wang@huawei.com, sunnanyong@huawei.com
Subject: Re: [PATCH v2 3/4] mm: add spurious fault fixing support for huge pud
Date: Wed, 18 Nov 2026 02:03:17 +0000	[thread overview]
Message-ID: <sashiko-outbox-219925@kernel.org> (raw)
In-Reply-To: <20261117020237.4037980-4-tujinjiang@huawei.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] arm64: mm: unaligned address in
  flush_tlb_fix_spurious_fault_pud() flushes 2 PUDs
--

commit 89132c364112921acce9427dab367c258f86db04
Author: Jinjiang Tu <tujinjiang@huawei.com>

mm: add spurious fault fixing support for huge pud

This commit adds spurious page fault TLB flushing support for huge PUD
mappings and implements flush_tlb_fix_spurious_fault_pud() on arm64.

> diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
> index a06b0f5c34111..3c1c000cc5dd1 100644
> --- a/arch/arm64/include/asm/pgtable.h
> +++ b/arch/arm64/include/asm/pgtable.h
> @@ -107,6 +107,10 @@ static inline void arch_leave_lazy_mmu_mode(void)
>  	__flush_tlb_range(vma, address, address + PMD_SIZE, PMD_SIZE, 2,	\
>  			  TLBF_NOBROADCAST | TLBF_NONOTIFY | TLBF_NOWALKCACHE)
>  
> +#define flush_tlb_fix_spurious_fault_pud(vma, address, pudp)			\
> +	__flush_tlb_range(vma, address, address + PUD_SIZE, PUD_SIZE, 1,	\
> +			  TLBF_NOBROADCAST | TLBF_NONOTIFY | TLBF_NOWALKCACHE)
> +

[Severity: Low]
Does flush_tlb_fix_spurious_fault_pud() flush two PUDs instead of one
when the fault occurs at a non-zero page offset within the huge PUD?

fix_spurious_fault() passes vmf->address, which is only aligned to
PAGE_MASK.  __flush_tlb_range() then aligns start and end to stride
(PUD_SIZE):

arch/arm64/include/asm/tlbflush.h:__flush_tlb_range() {
    ...
	start = round_down(start, stride);
	end = round_up(end, stride);
	__do_flush_tlb_range(vma, start, end, stride, tlb_level, flags);
}

Whenever address is not PUD_SIZE-aligned, round_down(address, PUD_SIZE)
and round_up(address + PUD_SIZE, PUD_SIZE) span 2 * PUD_SIZE,
invalidating the adjacent PUD range on the local CPU as well.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261117020237.4037980-1-tujinjiang@huawei.com?part=3


  reply	other threads:[~2026-11-18  2:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17  2:02 [PATCH v2 0/4] arm64: Add PUD THP support for DAX and pfnmap Jinjiang Tu
2026-11-17  2:02 ` [PATCH v2 1/4] mm: define generic pudp_invalidate() implementation Jinjiang Tu
2026-11-17 21:32   ` David Hildenbrand (Arm)
2026-11-17  2:02 ` [PATCH v2 2/4] arm64: simplify pmd_special and pmd_mkspecial Jinjiang Tu
2026-11-17  2:02 ` [PATCH v2 3/4] mm: add spurious fault fixing support for huge pud Jinjiang Tu
2026-11-18  2:03   ` sashiko-bot [this message]
2026-11-17  2:02 ` [PATCH v2 4/4] arm64: Add PUD THP support for DAX and pfnmap Jinjiang Tu

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=sashiko-outbox-219925@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=catalin.marinas@arm.com \
    --cc=dave.jiang@intel.com \
    --cc=david@kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=peterx@redhat.com \
    --cc=ryan.roberts@arm.com \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=sunnanyong@huawei.com \
    --cc=tujinjiang@huawei.com \
    --cc=wangkefeng.wang@huawei.com \
    --cc=will@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox