Skip to contentSkip to conversation

mm-handle-poisoning-of-pfn-without-struct-pages.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Nov 17, 2025

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm: handle poisoning of pfn without struct pages
has been removed from the -mm tree. Its filename was
mm-handle-poisoning-of-pfn-without-struct-pages.patch

This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Ankit Agrawal <[email protected]>
Subject: mm: handle poisoning of pfn without struct pages
Date: Sun, 2 Nov 2025 18:44:33 +0000

Poison (or ECC) errors can be very common on a large size cluster. The kernel MM currently does not handle ECC errors / poison on a memory region that is not backed by struct pages. If a memory region mapped using remap_pfn_range() for example, but not added to the kernel, MM will not have associated struct pages. Add a new mechanism to handle memory failure on such memory.

Make kernel MM expose a function to allow modules managing the device memory to register the device memory SPA and the address space associated it. MM maintains this information as an interval tree. On poison, MM can search for the range that the poisoned PFN belong and use the address_space to determine the mapping VMA.

In this implementation, kernel MM follows the following sequence that is largely similar to the memory_failure() handler for struct page backed memory:

1. memory_failure() is triggered on reception of a poison error. An absence of struct page is detected and consequently memory_failure_pfn() is executed.

2. memory_failure_pfn() collects the processes mapped to the PFN.

3. memory_failure_pfn() sends SIGBUS to all the processes mapping the faulty PFN using kill_procs().

Note that there is one primary difference versus the handling of the poison on struct pages, which is to skip unmapping to the faulty PFN. This is done to handle the huge PFNMAP support added recently [1] that enables VM_PFNMAP vmas to map at PMD or PUD level. A poison to a PFN mapped in such as way would need breaking the PMD/PUD mapping into PTEs that will get mirrored into the S2. This can greatly increase the cost of table walks and have a major performance impact.

Cc Aniket Agashe <[email protected]>
Cc Borislav Betkov <[email protected]>
Cc David Hildenbrand <[email protected]>
Cc Hanjun Guo <[email protected]>
Cc Ira Weiny <[email protected]>
Cc Jason Gunthorpe <[email protected]>
Cc Joanthan Cameron <[email protected]>
Cc Kevin Tian <[email protected]>
Cc Kirti Wankhede <[email protected]>
Cc Len Brown <[email protected]>
Cc Liam Howlett <[email protected]>
Cc Lorenzo Stoakes <[email protected]>
Cc "Luck, Tony" <[email protected]>
Cc Matthew R. Ochs <[email protected]>
Cc Mauro Carvalho Chehab <[email protected]>
Cc Miaohe Lin <[email protected]>
Cc Michal Hocko <[email protected]>
Cc Mike Rapoport <[email protected]>
Cc Naoya Horiguchi <[email protected]>
Cc Neo Jia <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Shuai Xue <[email protected]>
Cc Smita Koralahalli Channabasappa <[email protected]>
Cc Suren Baghdasaryan <[email protected]>
Cc Tarun Gupta <[email protected]>
Cc Uwe Kleine-König <[email protected]>
Cc Vikram Sethi <[email protected]>
Cc Vlastimil Babka <[email protected]>
Cc Zhi Wang <[email protected]>

---

 MAINTAINERS                    |    1 
 include/linux/memory-failure.h |   17 +++
 include/linux/mm.h             |    1 
 include/ras/ras_event.h        |    1 
 mm/Kconfig                     |    1 
 mm/memory-failure.c            |  145 ++++++++++++++++++++++++++++++-
 6 files changed, 165 insertions(+), 1 deletion(-)
include/linux/memory-failure.h new file +17 -0
new file mode 100644
@@ -0,0 +1,17 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _LINUX_MEMORY_FAILURE_H
+#define _LINUX_MEMORY_FAILURE_H
+
+#include <linux/interval_tree.h>
+
+struct pfn_address_space;
+
+struct pfn_address_space {
+	struct interval_tree_node node;
+	struct address_space *mapping;
+};
+
+int register_pfn_address_space(struct pfn_address_space *pfn_space);
+void unregister_pfn_address_space(struct pfn_address_space *pfn_space);
+
+#endif /* _LINUX_MEMORY_FAILURE_H */
include/linux/mm.h renamed from include/linux/mm.h~mm-handle-poisoning-of-pfn-without-struct-pages +1 -0
@@ -4285,6 +4285,7 @@ enum mf_action_page_type {
 	MF_MSG_DAX,
 	MF_MSG_UNSPLIT_THP,
 	MF_MSG_ALREADY_POISONED,
+	MF_MSG_PFN_MAP,
 	MF_MSG_UNKNOWN,
 };
 
include/ras/ras_event.h renamed from include/ras/ras_event.h~mm-handle-poisoning-of-pfn-without-struct-pages +1 -0
@@ -375,6 +375,7 @@ TRACE_EVENT(aer_event,
 	EM ( MF_MSG_DAX, "dax page" )					\
 	EM ( MF_MSG_UNSPLIT_THP, "unsplit thp" )			\
 	EM ( MF_MSG_ALREADY_POISONED, "already poisoned" )		\
+	EM ( MF_MSG_PFN_MAP, "non struct page pfn" )                    \
 	EMe ( MF_MSG_UNKNOWN, "unknown page" )
 
 /*
MAINTAINERS renamed from MAINTAINERS~mm-handle-poisoning-of-pfn-without-struct-pages +1 -0
@@ -11557,6 +11557,7 @@ M:	Miaohe Lin <[email protected]>
 R:	Naoya Horiguchi <[email protected]>
 L:	[email protected]
 S:	Maintained
+F:	include/linux/memory-failure.h
 F:	mm/hwpoison-inject.c
 F:	mm/memory-failure.c
 
mm/Kconfig renamed from mm/Kconfig~mm-handle-poisoning-of-pfn-without-struct-pages +1 -0
@@ -741,6 +741,7 @@ config MEMORY_FAILURE
 	depends on ARCH_SUPPORTS_MEMORY_FAILURE
 	bool "Enable recovery from hardware memory errors"
 	select RAS
+	select INTERVAL_TREE
 	help
 	  Enables code to recover from some memory failures on systems
 	  with MCA recovery. This allows a system to continue running
mm/memory-failure.c renamed from mm/memory-failure.c~mm-handle-poisoning-of-pfn-without-struct-pages +144 -1

181 lines not on this page · raw message

_

Patches currently in -mm which might be from [email protected] are