* [alternative-merged] riscv-mm-avoid-spurious-fault-after-hotplugging-vmemmap.patch removed from -mm tree
@ 2026-07-14 17:14 Andrew Morton
0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2026-07-14 17:14 UTC (permalink / raw)
To: mm-commits, vbabka, surenb, rppt, palmer, mhocko, ljs, liam,
david, alex, wangruikang, akpm
The quilt patch titled
Subject: riscv: mm: avoid spurious fault after hotplugging vmemmap
has been removed from the -mm tree. Its filename was
riscv-mm-avoid-spurious-fault-after-hotplugging-vmemmap.patch
This patch was dropped because an alternative patch was or shall be merged
------------------------------------------------------
From: Vivian Wang <wangruikang@iscas.ac.cn>
Subject: riscv: mm: avoid spurious fault after hotplugging vmemmap
Date: Tue, 30 Jun 2026 15:51:59 +0800
section_activate() does not flush TLB after populating new vmemmap pages.
On most architectures, this is okay. However it is a problem on RISC-V
since there the TLB caching non-present entries is permitted, which causes
spurious faults on some hardwares.
This seems to be most easily reproduced with DEBUG_VM=y and
PAGE_POISONING=y, which causes these newly mapped struct pages to be
poisoned i.e. written to immediately after mapping.
Add a hook vmemmap_populate_finalize() in __populate_section_memmap()
after population, to allow architectures to handle such situations as
needed. Then implement it on RISC-V to arrange for the existing exception
handler code to deal with these faults if they happen.
Link: https://lore.kernel.org/20260630-mark-after-vmemmap-populate-v4-1-febbc15da028@iscas.ac.cn
Signed-off-by: Vivian Wang <wangruikang@iscas.ac.cn>
Cc: Alexandre Ghiti <alex@ghiti.fr>
Cc: David Hildenbrand <david@kernel.org>
Cc: Liam R. Howlett <liam@infradead.org>
Cc: Lorenzo Stoakes <ljs@kernel.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Vlastimil Babka <vbabka@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
arch/riscv/include/asm/pgtable.h | 4 ++++
arch/riscv/mm/init.c | 6 ++++++
mm/sparse-vmemmap.c | 8 ++++++++
3 files changed, 18 insertions(+)
--- a/arch/riscv/include/asm/pgtable.h~riscv-mm-avoid-spurious-fault-after-hotplugging-vmemmap
+++ a/arch/riscv/include/asm/pgtable.h
@@ -1260,6 +1260,10 @@ static inline pte_t pte_swp_clear_exclus
#define TASK_SIZE FIXADDR_START
#endif
+/* Needed on SPARSEMEM_VMEMMAP */
+#define vmemmap_populate_finalize vmemmap_populate_finalize
+void __meminit vmemmap_populate_finalize(void);
+
#else /* CONFIG_MMU */
#define PAGE_SHARED __pgprot(0)
--- a/arch/riscv/mm/init.c~riscv-mm-avoid-spurious-fault-after-hotplugging-vmemmap
+++ a/arch/riscv/mm/init.c
@@ -1372,6 +1372,12 @@ int __meminit vmemmap_populate(unsigned
*/
return vmemmap_populate_hugepages(start, end, node, altmap);
}
+
+void __meminit vmemmap_populate_finalize(void)
+{
+ /* Avoid faults on cached non-present TLB entries. */
+ mark_new_valid_map();
+}
#endif
#if defined(CONFIG_MMU) && defined(CONFIG_64BIT)
--- a/mm/sparse-vmemmap.c~riscv-mm-avoid-spurious-fault-after-hotplugging-vmemmap
+++ a/mm/sparse-vmemmap.c
@@ -544,6 +544,12 @@ static int __meminit vmemmap_populate_co
#endif
+#ifndef vmemmap_populate_finalize
+static void __meminit vmemmap_populate_finalize(void)
+{
+}
+#endif
+
struct page * __meminit __populate_section_memmap(unsigned long pfn,
unsigned long nr_pages, int nid, struct vmem_altmap *altmap,
struct dev_pagemap *pgmap)
@@ -564,6 +570,8 @@ struct page * __meminit __populate_secti
if (r < 0)
return NULL;
+ vmemmap_populate_finalize();
+
return pfn_to_page(pfn);
}
_
Patches currently in -mm which might be from wangruikang@iscas.ac.cn are
riscv-mm-fix-concurrency-in-mark_new_valid_map.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-07-14 17:14 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-14 17:14 [alternative-merged] riscv-mm-avoid-spurious-fault-after-hotplugging-vmemmap.patch removed from -mm tree Andrew Morton
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.