linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 0/3] mm: fixup pfnmap memory failure handling
@ 2025-12-11  7:06 ankita
  2025-12-11  7:06 ` [PATCH v1 1/3] mm: fixup pfnmap memory failure handling to use pgoff ankita
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: ankita @ 2025-12-11  7:06 UTC (permalink / raw)
  To: ankita, vsethi, jgg, mochs, jgg, skolothumtho, alex, akpm,
	linmiaohe, nao.horiguchi
  Cc: cjia, zhiw, kjaju, yishaih, kevin.tian, kvm, linux-kernel, linux-mm

From: Ankit Agrawal <ankita@nvidia.com>

It was noticed during 6.19 merge window that the patch series [1] to
introduce memory failure handling for the PFNMAP memory is broken.

The expected behaviour of the series is to allow a driver (such as
nvgrace-gpu) to register its device memory with the mm. The mm would
then handle the poison on that registered memory region.

However, the following issues were identified in the patch series.
1. Faulty use of PFN instead of mapping file page offset to derive
the usermode process VA corresponding to the mapping to PFN.
2. nvgrace-gpu code called the registration at mmap, exposing it
to corruption. This may happen, when multiple mmap were called on the
same BAR. This issue was also noticed by Linus Torvalds who reverted
the patch [2].

This patch series addresses those issues.

Patch 1/3 fixes the first issue by translating PFN to page offset
and using that information to send the SIGBUS to the mapping process.
Patch 2/3 add stubs for CONFIG_MEMORY_FAILURE disabled.
Patch 3/3 is a resend of the reverted change to register the device
memory at the time of open instead of mmap.

Many thanks to Jason Gunthorpe (jgg@nvidia.com) and Alex Williamson
(alex@shazbot.org) for identifying the issue and suggesting the fix.

Link: https://lore.kernel.org/all/20251102184434.2406-1-ankita@nvidia.com/ [1]
Link: https://lore.kernel.org/all/20251102184434.2406-4-ankita@nvidia.com/ [2]

Ankit Agrawal (3):
  mm: fixup pfnmap memory failure handling to use pgoff
  mm: add stubs for PFNMAP memory failure registration functions
  vfio/nvgrace-gpu: register device memory for poison handling

 drivers/vfio/pci/nvgrace-gpu/main.c | 116 +++++++++++++++++++++++++++-
 include/linux/memory-failure.h      |  15 +++-
 mm/memory-failure.c                 |  29 ++++---
 3 files changed, 143 insertions(+), 17 deletions(-)

-- 
2.34.1



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2025-12-13  4:53 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-11  7:06 [PATCH v1 0/3] mm: fixup pfnmap memory failure handling ankita
2025-12-11  7:06 ` [PATCH v1 1/3] mm: fixup pfnmap memory failure handling to use pgoff ankita
2025-12-11  7:06 ` [PATCH v1 2/3] mm: add stubs for PFNMAP memory failure registration functions ankita
2025-12-11  7:06 ` [PATCH v1 3/3] vfio/nvgrace-gpu: register device memory for poison handling ankita
2025-12-12 23:47   ` Alex Williamson
2025-12-13  4:52     ` Ankit Agrawal
2025-12-11 20:11 ` [PATCH v1 0/3] mm: fixup pfnmap memory failure handling Andrew Morton
2025-12-11 23:14   ` Jason Gunthorpe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox