Re: [PATCH 5.15.y 6/6] KVM: x86/mmu: Rename __direct_map() to direct_map()
Kenta Akagi <[email protected]>
| Newsgroups | org.kernel.vger.stable |
|---|---|
| Message-ID | <010601a02454bfc0-33fc8bd0-1233-4be1-a122-da1f9490105d-000000@ap-northeast-1.amazonses.com> |
Hi Sasha, On 2026/07/31 4:29, Sasha Levin wrote: > From: David Matlack <[email protected]> > > [ Upstream commit 6c882ef4fc7bd99b67ad152e75428b669281c521 ] > > Rename __direct_map() to direct_map() since the leading underscores are > unnecessary. This also makes the page fault handler names more > consistent: kvm_tdp_mmu_page_fault() calls kvm_tdp_mmu_map() and > direct_page_fault() calls direct_map(). > > Opportunistically make some trivial cleanups to comments that had to be > modified anyway since they mentioned __direct_map(). Specifically, use > "()" when referring to functions, and include kvm_tdp_mmu_map() among > the various callers of disallowed_hugepage_adjust(). > > No functional change intended. > > Signed-off-by: David Matlack <[email protected]> > Reviewed-by: Isaku Yamahata <[email protected]> > Signed-off-by: Paolo Bonzini <[email protected]> > Message-Id: <[email protected]> > Signed-off-by: Paolo Bonzini <[email protected]> > Stable-dep-of: 2abd5287f083 ("KVM: x86: Check for invalid/obsolete root *after* making MMU pages available") Maybe I'm missing something, but commit 2abd5287f083 ("KVM: x86: Check for invalid/obsolete root *after* making MMU pages available") cannot be backported as-is. It depends on is_page_fault_stale(), introduced by commit a955cad84cda ("KVM: x86/mmu: Retry page fault if root is invalidated by memslot update"), which is missing in 5.15.y. Furthermore, a955cad84cda is required to fix a regression in 5.15.y when applying the CVE-2026-46113 and CVE-2026-53359 fixes, but its backport remains pending [1][2]. I plan to send a manual backport of a955cad84cda and 2abd5287f083. In doing so, the interface of is_page_fault_stale() will end up incompatible with mainline. While not ideal, making the interface compatible requires struct kvm_page_fault and its 50+ prerequisite commits. [1] https://lore.kernel.org/all/[email protected]/ [2] https://lore.kernel.org/all/CABgObfaKqT0gMUB_XRP5DW5HmpgaoTgmD-A8_zQVG2Vp5xZE4g@mail.gmail.com/ Thanks, akagi > Signed-off-by: Sasha Levin <[email protected]> > --- > arch/x86/kvm/mmu/mmu.c | 20 ++++++++++---------- > 1 file changed, 10 insertions(+), 10 deletions(-) > > diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c > index 04e814816b17..c274ab0ceff9 100644 > --- a/arch/x86/kvm/mmu/mmu.c > +++ b/arch/x86/kvm/mmu/mmu.c > @@ -2991,11 +2991,11 @@ void disallowed_hugepage_adjust(u64 spte, gfn_t gfn, int cur_level, > is_shadow_present_pte(spte) && > !is_large_pte(spte)) { > /* > - * A small SPTE exists for this pfn, but FNAME(fetch) > - * and __direct_map would like to create a large PTE > - * instead: just force them to go down another level, > - * patching back for them into pfn the next 9 bits of > - * the address. > + * A small SPTE exists for this pfn, but FNAME(fetch), > + * direct_map(), or kvm_tdp_mmu_map() would like to create a > + * large PTE instead: just force them to go down another level, > + * patching back for them into pfn the next 9 bits of the > + * address. > */ > u64 page_mask = KVM_PAGES_PER_HPAGE(level) - > KVM_PAGES_PER_HPAGE(level - 1); > @@ -3004,9 +3004,9 @@ void disallowed_hugepage_adjust(u64 spte, gfn_t gfn, int cur_level, > } > } > > -static int __direct_map(struct kvm_vcpu *vcpu, gpa_t gpa, u32 error_code, > - int map_writable, int max_level, kvm_pfn_t pfn, > - bool prefault, bool is_tdp) > +static int direct_map(struct kvm_vcpu *vcpu, gpa_t gpa, u32 error_code, > + int map_writable, int max_level, kvm_pfn_t pfn, > + bool prefault, bool is_tdp) > { > bool nx_huge_page_workaround_enabled = is_nx_huge_page_enabled(); > bool write = error_code & PFERR_WRITE_MASK; > @@ -4037,8 +4037,8 @@ static int direct_page_fault(struct kvm_vcpu *vcpu, gpa_t gpa, u32 error_code, > if (r) > goto out_unlock; > > - r = __direct_map(vcpu, gpa, error_code, map_writable, max_level, pfn, > - prefault, is_tdp); > + r = direct_map(vcpu, gpa, error_code, map_writable, max_level, pfn, > + prefault, is_tdp); > > out_unlock: > write_unlock(&vcpu->kvm->mmu_lock); > -- > 2.53.0 > > >