linux/arch/powerpc/kvm
Matthew Brost 12b2285bf3 mm/zone_device: reinitialize large zone device private folios
Reinitialize metadata for large zone device private folios in
zone_device_page_init prior to creating a higher-order zone device private
folio.  This step is necessary when the folio's order changes dynamically
between zone_device_page_init calls to avoid building a corrupt folio.  As
part of the metadata reinitialization, the dev_pagemap must be passed in
from the caller because the pgmap stored in the folio page may have been
overwritten with a compound head.

Without this fix, individual pages could have invalid pgmap fields and
flags (with PG_locked being notably problematic) due to prior different
order allocations, which can, and will, result in kernel crashes.

Link: https://lkml.kernel.org/r/20260116111325.1736137-2-francois.dugast@intel.com
Fixes: d245f9b4ab ("mm/zone_device: support large zone device private folios")
Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: Francois Dugast <francois.dugast@intel.com>
Acked-by: Felix Kuehling <felix.kuehling@amd.com>
Reviewed-by: Balbir Singh <balbirs@nvidia.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Zi Yan <ziy@nvidia.com>
Cc: Alistair Popple <apopple@nvidia.com>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: "Christophe Leroy (CS GROUP)" <chleroy@kernel.org>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: "Christian König" <christian.koenig@amd.com>
Cc: David Airlie <airlied@gmail.com>
Cc: Simona Vetter <simona@ffwll.ch>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Lyude Paul <lyude@redhat.com>
Cc: Danilo Krummrich <dakr@kernel.org>
Cc: David Hildenbrand <david@kernel.org>
Cc: Oscar Salvador <osalvador@suse.de>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Leon Romanovsky <leon@kernel.org>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Liam R. Howlett <Liam.Howlett@oracle.com>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Michal Hocko <mhocko@suse.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2026-01-26 19:03:48 -08:00
..
Kconfig KVM: Make support for kvm_arch_vcpu_async_ioctl() mandatory 2025-11-05 11:03:10 -08:00
Makefile KVM: PPC: Add support for nestedv2 guests 2023-09-14 22:04:24 +10:00
book3s.c KVM: PPC: Use kvm_faultin_pfn() to handle page faults on Book3s PR 2024-10-25 13:00:49 -04:00
book3s.h KVM: delete .change_pte MMU notifier callback 2024-04-11 13:18:27 -04:00
book3s_32_mmu.c KVM: Use 'unsigned long' as kvm_for_each_vcpu()'s index 2021-12-08 04:24:15 -05:00
book3s_32_mmu_host.c powerpc/vmlinux: Remove etext, edata and end 2025-02-24 12:26:21 +05:30
book3s_32_sr.S KVM: PPC: Book3S PR: Enable MSR_DR for switch_mmu_context() 2022-05-11 23:03:16 +10:00
book3s_64_entry.S docs: move powerpc under arch 2023-10-10 13:35:55 -06:00
book3s_64_mmu.c KVM: Use 'unsigned long' as kvm_for_each_vcpu()'s index 2021-12-08 04:24:15 -05:00
book3s_64_mmu_host.c KVM: PPC: Use kvm_faultin_pfn() to handle page faults on Book3s PR 2024-10-25 13:00:49 -04:00
book3s_64_mmu_hv.c KVM: PPC: Use __kvm_faultin_pfn() to handle page faults on Book3s HV 2024-10-25 13:00:48 -04:00
book3s_64_mmu_radix.c KVM: PPC: Drop unused @kvm_ro param from kvmppc_book3s_instantiate_page() 2024-10-25 13:00:48 -04:00
book3s_64_slb.S treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 266 2019-06-05 17:30:28 +02:00
book3s_64_vio.c fdget(), trivial conversions 2024-11-03 01:28:06 -05:00
book3s_emulate.c powerpc: rename SPRN_HID2 define to SPRN_HID2_750FX 2024-05-08 00:25:00 +10:00
book3s_exports.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 266 2019-06-05 17:30:28 +02:00
book3s_hv.c KVM: PPC: Book3S HV: Fix IRQ map warnings with XICS on pSeries KVM Guest 2025-05-12 10:19:29 +05:30
book3s_hv.h KVM: PPC: Book3S HV: Add one-reg interface for HASHPKEYR register 2024-06-06 22:39:04 +10:00
book3s_hv_builtin.c KVM: PPC: Book3S HV: Introduce low level MSR accessor 2023-09-14 22:04:24 +10:00
book3s_hv_hmi.c KVM: PPC: Book3S HV P9: Remove subcore HMI handling 2021-11-24 21:09:03 +11:00
book3s_hv_interrupts.S powerpc: Fix objtool unannotated intra-function call warnings 2022-11-15 20:11:47 +11:00
book3s_hv_nested.c The biggest change here is eliminating the awful idea that KVM had, of 2024-11-23 16:00:50 -08:00
book3s_hv_nestedv2.c kvm powerpc/book3s-apiv2: Add support for Hostwide GSB elements 2025-04-16 22:16:09 +05:30
book3s_hv_p9_entry.c KVM: PPC: Use accessors for VCPU registers 2023-09-14 22:04:24 +10:00
book3s_hv_p9_perf.c powerpc/kvm: Remove comment related to moving PMU code to perf subsystem 2022-07-20 22:28:31 +10:00
book3s_hv_ras.c KVM: PPC: Use accessors for VCORE registers 2023-09-14 22:04:24 +10:00
book3s_hv_rm_mmu.c KVM: PPC: Always use the GPR accessors 2023-09-14 22:04:23 +10:00
book3s_hv_rm_xics.c genirq: Convert kstat_irqs to a struct 2024-04-12 17:08:05 +02:00
book3s_hv_rmhandlers.S powerpc: Fix 'intra_function_call not a direct call' warning 2025-03-10 10:00:17 +05:30
book3s_hv_tm.c KVM: PPC: Book3S HV Nested: Fix TM softpatch HFAC interrupt emulation 2021-08-25 16:37:17 +10:00
book3s_hv_tm_builtin.c KVM: PPC: Book3S HV: Treat TM-related invalid form instructions on P9 like the valid ones 2020-03-19 16:39:52 +11:00
book3s_hv_uvmem.c mm/zone_device: reinitialize large zone device private folios 2026-01-26 19:03:48 -08:00
book3s_interrupts.S powerpc: Replace PPC64_ELF_ABI_v{1/2} by CONFIG_PPC64_ELF_ABI_V{1/2} 2022-05-19 23:11:29 +10:00
book3s_mmu_hpte.c KVM: PPC: replace call_rcu by kfree_rcu for simple kmem_cache_free callback 2024-10-16 10:40:31 +11:00
book3s_paired_singles.c KVM: PPC: Make kvmppc_get_last_inst() produce a ppc_inst_t 2023-04-03 15:45:41 +10:00
book3s_pr.c KVM: PPC: Use kvm_vcpu_map() to map guest memory to patch dcbz instructions 2024-10-25 13:00:49 -04:00
book3s_pr_papr.c KVM: remove KVM_REQ_UNHALT 2022-09-26 12:37:21 -04:00
book3s_rmhandlers.S KVM: PPC: Enable prefixed instructions for HV KVM and disable for PR KVM 2023-04-03 15:45:59 +10:00
book3s_rtas.c KVM: Add helpers to wrap vcpu->srcu_idx and yell if it's abused 2022-04-21 13:16:11 -04:00
book3s_segment.S KVM: PPC: Book3S 64: move bad_host_intr check to HV handler 2021-06-10 22:12:12 +10:00
book3s_xics.c powerpc: fix typos in comments 2022-05-05 22:12:44 +10:00
book3s_xics.h KVM: PPC: Book3s: Fix warning about xics_rm_h_xirr_x 2022-06-24 12:58:33 +10:00
book3s_xive.c powerpc, ocxl: Fix extraction of struct xive_irq_data 2025-10-13 09:40:55 +05:30
book3s_xive.h powerpc/xive: remove unused parameter 2022-11-24 23:12:18 +11:00
book3s_xive_native.c KVM: Drop KVM_ERR_PTR_BAD_PAGE and instead return NULL to indicate an error 2024-10-25 12:54:42 -04:00
booke.c treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
booke.h KVM: PPC: BookE: Fix W=1 warnings 2023-04-03 14:54:20 +10:00
booke_emulate.c KVM: PPC: Clean up redundant 'kvm_run' parameters 2020-05-27 11:39:31 +10:00
booke_interrupts.S powerpc: Remove CONFIG_FSL_BOOKE 2022-09-26 22:47:37 +10:00
bookehv_interrupts.S KVM: PPC: Fetch prefixed instructions from the guest 2023-04-03 15:45:50 +10:00
e500.c KVM: Drop kvm_arch_check_processor_compat() hook 2022-12-29 15:41:28 -05:00
e500.h KVM: e500: track host-writability of pages 2025-01-12 10:35:41 +01:00
e500_emulate.c KVM: Use 'unsigned long' as kvm_for_each_vcpu()'s index 2021-12-08 04:24:15 -05:00
e500_mmu.c KVM: PPC: Kill kvmppc_ops::mmu_destroy() and kvmppc_mmu_destroy() 2020-03-19 16:43:07 +11:00
e500_mmu_host.c KVM: e500: perform hugepage check after looking up the PFN 2025-01-12 10:53:00 +01:00
e500_mmu_host.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
e500mc.c powerpc/inst: add PPC_TLBILX_LPID 2023-08-16 23:54:48 +10:00
emulate.c KVM: PPC: Fetch prefixed instructions from the guest 2023-04-03 15:45:50 +10:00
emulate_loadstore.c KVM: PPC: Reduce reliance on analyse_instr() in mmio emulation 2023-12-07 23:33:08 +11:00
fpu.S powerpc/32: Fix objtool unannotated intra-function call warnings 2022-11-18 19:00:06 +11:00
guest-state-buffer.c kvm powerpc/book3s-apiv2: Add support for Hostwide GSB elements 2025-04-16 22:16:09 +05:30
mpic.c KVM: Remove unnecessary asm/kvm_host.h includes 2020-03-16 17:57:34 +01:00
powerpc.c KVM: Rename kvm_arch_vcpu_async_ioctl() to kvm_arch_vcpu_unlocked_ioctl() 2025-11-05 11:03:11 -08:00
test-guest-state-buffer.c kvm powerpc/book3s-apiv2: Add kunit tests for Hostwide GSB elements 2025-04-16 22:16:09 +05:30
timing.c KVM: PPC: Merge powerpc's debugfs entry content into generic entry 2022-02-02 20:30:26 +11:00
timing.h KVM: powerpc: Enable commented out BUILD_BUG_ON() assertion 2025-04-16 22:19:38 +05:30
tm.S powerpc: replace #include <asm/export.h> with #include <linux/export.h> 2023-08-16 23:54:48 +10:00
trace.h KVM: PPC: Move and undef TRACE_INCLUDE_PATH/FILE 2018-11-07 23:04:38 +11:00
trace_book3s.h KVM: PPC: Book3S HV: Add H_VIRT mapping for tracing exits 2025-06-23 09:58:06 +05:30
trace_booke.h KVM: Move arm64's MMU notifier trace events to generic code 2021-04-17 08:30:56 -04:00
trace_hv.h KVM: PPC: Book3S HV: Fix kmv -> kvm typo 2024-11-14 22:22:30 +11:00
trace_pr.h KVM: PPC: Move and undef TRACE_INCLUDE_PATH/FILE 2018-11-07 23:04:38 +11:00