Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Muchun Song" <songmuchun@bytedance.com>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Mike Rapoport" <rppt@kernel.org>,
	"Madhavan Srinivasan" <maddy@linux.ibm.com>
Cc: "Muchun Song" <muchun.song@linux.dev>,
	"David Hildenbrand" <david@kernel.org>,
	"Michael Ellerman" <mpe@ellerman.id.au>,
	"Ritesh Harjani" <ritesh.list@gmail.com>,
	"Aneesh Kumar K . V" <aneesh.kumar@linux.ibm.com>,
	"Pavithra Prakash" <pavrampu@linux.ibm.com>,
	"Lance Yang" <lance.yang@linux.dev>,
	"Qi Zheng" <qi.zheng@linux.dev>,
	linux-mm@kvack.org, "Chris Down" <chris@chrisdown.name>
Subject: Re: [PATCH v2 5/7] powerpc/mm: remove radix-specific vmemmap PMD overrides
Date: Sat, 05 Dec 2026 04:01:11 +0000	[thread overview]
Message-ID: <sashiko-outbox-251034@kernel.org> (raw)
In-Reply-To: <20261205032627.4745-6-songmuchun@bytedance.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] powerpc/mm: generic vmemmap_set_pmd() triggers DEBUG_VIRTUAL
  WARN_ON
--

commit a9504cd665757ddc46e5e09b6e4346110cc1bfe2
Author: Muchun Song <muchun.song@linux.dev>

powerpc/mm: remove radix-specific vmemmap PMD overrides

This commit removes the PowerPC radix-specific vmemmap_check_pmd() and
vmemmap_set_pmd() overrides in favor of the generic helpers in
mm/sparse-vmemmap.c, and drops the per-PTE ptesync in
radix__vmemmap_pte_populate().

> diff --git a/arch/powerpc/mm/book3s64/radix_pgtable.c b/arch/powerpc/mm/book3s64/radix_pgtable.c
> index 63f369d296b47..f8217de00bff3 100644
> --- a/arch/powerpc/mm/book3s64/radix_pgtable.c
> +++ b/arch/powerpc/mm/book3s64/radix_pgtable.c
> @@ -978,31 +978,6 @@ int __meminit radix__vmemmap_create_mapping(unsigned long start,
[ ... ]
> -void __meminit vmemmap_set_pmd(pmd_t *pmdp, void *p, int node,
> -			       unsigned long addr, unsigned long next)
> -{
> -	pte_t entry;
> -	pte_t *ptep = pmdp_ptep(pmdp);
> -
> -	VM_BUG_ON(!IS_ALIGNED(addr, PMD_SIZE));
> -	entry = pfn_pte(__pa(p) >> PAGE_SHIFT, PAGE_KERNEL);
> -	set_pte_at(&init_mm, addr, ptep, entry);
> -	asm volatile("ptesync": : :"memory");
> -
> -	vmemmap_verify(ptep, node, addr, next);
> -}

[Severity: Medium]
Can removing the PowerPC vmemmap_set_pmd() override trigger a
CONFIG_DEBUG_VIRTUAL warning on every PMD vmemmap mapping during boot?

The removed override converted p with __pa(p), whereas the generic
vmemmap_set_pmd() in mm/sparse-vmemmap.c calls virt_to_phys(p).  On
PowerPC, virt_to_phys() runs WARN_ON(IS_ENABLED(CONFIG_DEBUG_VIRTUAL) &&
!virt_addr_valid(address)), and virt_addr_valid() requires pfn_valid().

During early boot in sparse_init() -> sparse_metadata_init_nid(),
__populate_section_memmap() populates vmemmap before
sparse_init_one_section() sets SECTION_HAS_MEM_MAP, so pfn_valid()
returns 0 for p.

With CONFIG_DEBUG_VIRTUAL enabled, this fires an unthrottled WARN_ON on
every PMD vmemmap mapping and panics on boot when panic_on_warn is set.
Using __pa(p) in the generic vmemmap_set_pmd(), matching
vmemmap_pte_populate(), would avoid this regression.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261205032627.4745-1-songmuchun@bytedance.com?part=5


  reply	other threads:[~2026-12-05  4:01 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-05  3:26 [PATCH v2 0/7] mm: Generalize HVO vmemmap population Muchun Song
2026-12-05  3:26 ` [PATCH v2 1/7] mm/sparse-vmemmap: use page-table constructors for runtime tables Muchun Song
2026-12-05  3:26 ` [PATCH v2 2/7] mm/sparse-vmemmap: align page-table helpers with core MM Muchun Song
2026-12-05  3:26 ` [PATCH v2 3/7] mm/sparse-vmemmap: introduce vmemmap_optimizable_pte_populate Muchun Song
2026-12-05  3:26 ` [PATCH v2 4/7] mm/sparse-vmemmap: support PMD mappings spanning sections Muchun Song
2026-12-05  4:01   ` sashiko-bot
2026-12-05  3:26 ` [PATCH v2 5/7] powerpc/mm: remove radix-specific vmemmap PMD overrides Muchun Song
2026-12-05  4:01   ` sashiko-bot [this message]
2026-12-05  3:26 ` [PATCH v2 6/7] powerpc/mm: fix uninitialized ZONE_DEVICE struct pages with PMDs Muchun Song
2026-12-05  3:26 ` [PATCH v2 7/7] powerpc/mm: reuse generic HVO vmemmap population Muchun Song

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-251034@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=aneesh.kumar@linux.ibm.com \
    --cc=chris@chrisdown.name \
    --cc=david@kernel.org \
    --cc=lance.yang@linux.dev \
    --cc=linux-mm@kvack.org \
    --cc=maddy@linux.ibm.com \
    --cc=mpe@ellerman.id.au \
    --cc=muchun.song@linux.dev \
    --cc=pavrampu@linux.ibm.com \
    --cc=qi.zheng@linux.dev \
    --cc=ritesh.list@gmail.com \
    --cc=rppt@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=songmuchun@bytedance.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox