linux/drivers/acpi
Ankit Agrawal 30d0a12910 mm: change ghes code to allow poison of non-struct pfn
Poison (or ECC) errors can be very common on a large size cluster.  The
kernel MM currently handles ECC errors / poison only on memory page backed
by struct page.  The handling is currently missing for the PFNMAP memory
that does not have struct pages.  The series adds such support.

Implement a new ECC handling for memory without struct pages.  Kernel MM
expose registration APIs to allow modules that are managing the device to
register its device memory region.  MM then tracks such regions using
interval tree.

The mechanism is largely similar to that of ECC on pfn with struct pages. 
If there is an ECC error on a pfn, all the mapping to it are identified
and a SIGBUS is sent to the user space processes owning those mappings. 
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.

nvgrace-gpu-vfio-pci module maps the device memory to user VA (Qemu) using
remap_pfn_range without being added to the kernel [2].  These device
memory PFNs are not backed by struct page.  So make nvgrace-gpu-vfio-pci
module make use of the mechanism to get poison handling support on the
device memory.


This patch (of 3):

The GHES code allows calling of memory_failure() on the PFNs that pass the
pfn_valid() check.  This contract is broken for the remapped PFNs which
fails the check and ghes_do_memory_failure() returns without triggering
memory_failure().

Update code to allow memory_failure() call on PFNs failing pfn_valid().

Link: https://lkml.kernel.org/r/20251102184434.2406-1-ankita@nvidia.com
Link: https://lkml.kernel.org/r/20251102184434.2406-2-ankita@nvidia.com
Signed-off-by: Ankit Agrawal <ankita@nvidia.com>
Reviewed-by: Shuai Xue <xueshuai@linux.alibaba.com>
Cc: Aniket Agashe <aniketa@nvidia.com>
Cc: Ankit Agrawal <ankita@nvidia.com>
Cc: Borislav Betkov <bp@alien8.de>
Cc: David Hildenbrand <david@redhat.com>
Cc: Hanjun Guo <guohanjun@huawei.com>
Cc: Ira Weiny <ira.weiny@intel.com>
Cc: Jason Gunthorpe <jgg@nvidia.com>
Cc: Joanthan Cameron <Jonathan.Cameron@huawei.com>
Cc: Kevin Tian <kevin.tian@intel.com>
Cc: Kirti Wankhede <kwankhede@nvidia.com>
Cc: Len Brown <lenb@kernel.org>
Cc: Liam Howlett <liam.howlett@oracle.com>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: "Luck, Tony" <tony.luck@intel.com>
Cc: Matthew R. Ochs <mochs@nvidia.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: Miaohe Lin <linmiaohe@huawei.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Naoya Horiguchi <nao.horiguchi@gmail.com>
Cc: Neo Jia <cjia@nvidia.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Smita Koralahalli Channabasappa <smita.koralahallichannabasappa@amd.com>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Tarun Gupta <targupta@nvidia.com>
Cc: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Cc: Vikram Sethi <vsethi@nvidia.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Zhi Wang <zhiw@nvidia.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2025-11-16 17:28:29 -08:00
..
acpica ACPICA: Work around bogus -Wstringop-overread warning since GCC 11 2025-10-21 15:54:34 +02:00
apei mm: change ghes code to allow poison of non-struct pfn 2025-11-16 17:28:29 -08:00
arm64 Updates for the clocksource/clockevents drivers subsystem: 2025-09-30 16:53:59 -07:00
dptf ACPI: DPTF: Support for Wildcat Lake 2025-06-18 20:53:52 +02:00
nfit ACPI: NFIT: Fix incorrect ndr_desc being reportedin dev_err message 2025-09-16 10:57:37 -05:00
numa acpi/hmat: Remove now unused hmat_update_target_coordinates() 2025-09-02 14:46:47 -07:00
pmic ACPI: PMIC: Remove unneeded check in tps68470_pmic_opregion_probe() 2024-08-02 17:05:08 +02:00
riscv ACPI: RIMT: Fix unused function warnings when CONFIG_IOMMU_API is disabled 2025-10-17 21:45:08 -06:00
x86 ACPI: LPSS: Remove AudioDSP related ID 2025-07-02 20:09:11 +02:00
Kconfig RISC-V updates for the v6.18 merge window (part two) 2025-10-04 10:36:22 -07:00
Makefile ACPI: MRRM: Minimal parse of ACPI MRRM table 2025-05-12 15:43:16 +02:00
ac.c ACPI: Switch back to struct platform_driver::remove() 2024-11-12 21:30:30 +01:00
acpi_adxl.c
acpi_apd.c ACPI: APD: Use strscpy() instead of strcpy() 2024-11-05 21:35:35 +01:00
acpi_configfs.c
acpi_dbg.c ACPI: debug: fix signedness issues in read/write helpers 2025-09-23 15:45:28 +02:00
acpi_extlog.c x86/msr: Add explicit includes of <asm/msr.h> 2025-05-02 10:23:47 +02:00
acpi_ffh.c ACPI: FFH: Drop the inclusion of linux/arm-smccc.h 2023-06-12 19:28:20 +02:00
acpi_fpdt.c ACPI: FPDT: properly handle invalid FPDT subtables 2023-10-03 21:12:22 +02:00
acpi_ipmi.c ACPI: IPMI: Add helper to wait for when SMI is selected 2024-04-28 10:07:34 -07:00
acpi_lpat.c
acpi_lpit.c x86/msr: Rename 'rdmsrl_safe()' to 'rdmsrq_safe()' 2025-04-10 11:58:38 +02:00
acpi_memhotplug.c mm/memory_hotplug: allow memmap on memory hotplug request to fallback 2023-08-21 13:37:48 -07:00
acpi_mrrm.c ACPI: MRRM: Check revision of MRRM table 2025-10-27 20:35:35 +01:00
acpi_pad.c ACPI: PAD: Update arguments of mwait_idle_with_hints() 2025-06-10 20:47:56 +02:00
acpi_pcc.c ACPI: PCC: Simplify PCC shared memory region handling 2025-04-30 21:51:23 +02:00
acpi_platform.c ACPI: platform: Move SMB0001 HID to the header and reuse 2023-07-04 19:28:20 +02:00
acpi_pnp.c More ACPI updates for 6.15-rc1 2025-04-02 15:16:30 -07:00
acpi_processor.c ACPI: processor: idle: Add module import namespace 2025-09-02 16:08:53 +02:00
acpi_tad.c ACPI: TAD: Add missing sysfs_remove_group() for ACPI_TAD_RT 2025-09-04 20:19:36 +02:00
acpi_video.c ACPI: video: Fix use-after-free in acpi_video_switch_brightness() 2025-10-23 20:36:55 +02:00
acpi_watchdog.c ACPI: use %pe for better readability of errors while printing 2024-02-16 19:31:12 +01:00
battery.c ACPI: battery: Add synchronization between interface updates 2025-09-28 12:25:02 +02:00
bgrt.c sysfs: treewide: switch back to attribute_group::bin_attrs 2025-06-17 10:44:15 +02:00
bus.c ACPI: Fix typos 2025-07-22 17:12:41 +02:00
button.c ACPI: button: Call input_free_device() on failing input device registration 2025-10-22 21:19:23 +02:00
container.c ACPI: container: Use acpi_dev_for_each_child() 2022-06-20 20:33:05 +02:00
cppc_acpi.c ACPI: CPPC: Fix typo in a comment 2025-11-03 17:25:42 +01:00
debugfs.c
device_pm.c ACPI updates for 6.17-rc1 2025-07-28 20:44:42 -07:00
device_sysfs.c ACPI: sysfs: Use ACPI_FREE() for freeing an ACPI object 2025-08-25 20:21:44 +02:00
dock.c ACPI: scan: Introduce typedef:s for struct acpi_hotplug_context members 2024-04-04 21:19:02 +02:00
ec.c ACPI: EC: Relax sanity check of the ECDT ID string 2025-08-12 19:16:27 +02:00
ec_sys.c
event.c ACPI: event: Use strscpy() instead of strcpy() 2024-11-05 21:35:35 +01:00
evged.c ACPI: Switch back to struct platform_driver::remove() 2024-11-12 21:30:30 +01:00
fan.h ACPI: fan: Use platform device for devres-related actions 2025-10-24 10:29:29 +02:00
fan_attr.c ACPI: fan: Use ACPI handle when retrieving _FST 2025-10-24 10:29:08 +02:00
fan_core.c ACPI: fan: Use platform device for devres-related actions 2025-10-24 10:29:29 +02:00
fan_hwmon.c ACPI: fan: Use platform device for devres-related actions 2025-10-24 10:29:29 +02:00
glue.c ACPI: Fix selecting wrong ACPI fwnode for the iGPU on some Dell laptops 2023-01-10 20:23:48 +01:00
hed.c ACPI: HED: Always initialize before evged 2025-02-18 19:24:29 +01:00
internal.h ACPI: PM: Add power resource init function 2025-08-25 16:25:54 +02:00
ioapic.c ACPI: Silence missing prototype warnings 2022-12-30 19:12:30 +01:00
irq.c ACPI: irq: Introduce acpi_get_gsi_dispatcher() 2025-05-23 16:30:55 +00:00
mipi-disco-img.c ACPI: bus: change the prototype for acpi_get_physical_device_location 2024-12-19 20:59:35 +01:00
nhlt.c ACPI: NHLT: Streamline struct naming 2024-03-27 16:36:45 +01:00
nvs.c
osi.c ACPI: OSI: Stop advertising support for "3.0 _SCP Extensions" 2025-05-16 15:53:26 +02:00
osl.c ACPI: OSL: Use usleep_range() in acpi_os_sleep() 2024-12-10 19:45:27 +01:00
pci_irq.c ACPI: Use str_low_high() helper in two places 2025-08-25 20:25:53 +02:00
pci_link.c ACPI/PCI: Remove space before newline 2025-07-22 11:52:47 +02:00
pci_mcfg.c PCI/ACPI: Increase Loongson max PCI hosts to 8 2024-08-01 18:04:05 -05:00
pci_root.c ACPI: PCI: Constify fwnode_handle in acpi_pci_root_remap_iospace() 2025-05-09 20:47:26 +02:00
pci_slot.c ACPI: use %pe for better readability of errors while printing 2024-02-16 19:31:12 +01:00
pfr_telemetry.c Merge branch 'acpi-misc' 2024-11-15 20:52:02 +01:00
pfr_update.c ACPI: pfr_update: Fix the driver update version check 2025-08-20 15:30:36 +02:00
platform_profile.c ACPI: platform_profile: Avoid initializing on non-ACPI platforms 2025-05-23 16:44:52 +02:00
power.c ACPI: PM: Add HP EliteBook 855 G7 WWAN modem power resource quirk 2025-08-25 16:25:54 +02:00
pptt.c ACPI: PPTT: Fix processor subtable walk 2025-05-08 20:23:16 +02:00
prmt.c ACPI: PRM: Skip handlers with NULL handler_address or NULL VA 2025-09-04 16:21:41 +02:00
proc.c ACPI: proc: Prefer to use octal permission 2025-06-26 21:08:13 +02:00
processor_core.c Updates for the interrupt subsystem: 2024-07-22 13:52:05 -07:00
processor_driver.c ACPI: processor: Do not expose global variable acpi_idle_driver 2025-09-23 15:33:19 +02:00
processor_idle.c ACPI: processor: Do not expose global variable acpi_idle_driver 2025-09-23 15:33:19 +02:00
processor_pdc.c ACPI: processor: Fix uninitialized access of buf in acpi_set_pdc_bits() 2023-09-18 12:16:16 +02:00
processor_perflib.c ACPI: processor: perflib: Move problematic pr->performance check 2025-08-12 15:33:58 +02:00
processor_thermal.c ACPI: processor: thermal: Release policy references using __free() 2025-09-08 19:53:32 +02:00
processor_throttling.c ACPI: processor: throttling: Remove space before newline 2025-07-21 16:45:40 +02:00
property.c ACPI: property: Fix argument order in __acpi_node_get_property_reference() 2025-10-20 22:01:15 +02:00
reboot.c
resource.c Merge branches 'acpi-apei', 'acpi-misc' and 'pnp' 2025-09-29 15:28:51 +02:00
sbs.c ACPI: SBS: Fix present test in acpi_battery_read() 2025-11-03 17:29:52 +01:00
sbshc.c Merge branch 'acpi-misc' 2024-11-15 20:52:02 +01:00
sbshc.h
scan.c RISC-V updates for the v6.18 merge window (part two) 2025-10-04 10:36:22 -07:00
sleep.c ACPI: PM: Quirk ASUS ROG M16 to default to S3 sleep 2024-09-10 20:19:52 +02:00
sleep.h ACPI: s2idle: Add a new ->check() callback for platform_s2idle_ops 2022-09-09 17:37:40 +02:00
spcr.c ACPI: SPCR: Check for table version when using precise baudrate 2025-10-27 20:43:41 +01:00
sysfs.c sysfs: treewide: switch back to bin_attribute::read()/write() 2025-06-17 10:44:13 +02:00
tables.c ACPICA: Add SoundWire File Table (SWFT) signature 2025-08-25 16:44:36 +02:00
thermal.c ACPI: thermal: Get rid of a dummy local variable 2025-09-04 20:22:33 +02:00
thermal_lib.c module: Convert symbol namespace to string literal 2024-12-02 11:34:44 -08:00
tiny-power-button.c ACPI: tiny-power-button: Eliminate the driver notify callback 2023-06-16 19:48:09 +02:00
utils.c ACPI: bus: change the prototype for acpi_get_physical_device_location 2024-12-19 20:59:35 +01:00
video_detect.c ACPI: video: force native for Lenovo 82K8 2025-08-25 20:00:17 +02:00
viot.c ACPI: VIOT: Remove (explicitly) unused header 2025-05-12 15:43:16 +02:00
wakeup.c ACPI: wakeup: Drop unneeded casting for sleep_state 2025-06-26 21:08:13 +02:00