Re: [PATCH 5.15.y 6/6] KVM: x86/mmu: Rename __direct_map() to direct_map()

Harshit Mogalapalli <[email protected]>
Newsgroups org.kernel.vger.stable
Message-ID <[email protected]>
Hi Sasha

On 31/07/26 12:59 am, 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")
> Signed-off-by: Sasha Levin <[email protected]>

I don't see them in queue-5.15 , FYI.

Also I think along with 6 prerequisites and final 7th patch, we also 
might need: commit: 9f33697ac7ff ("KVM: x86/mmu: Stop needlessly making 
MMU pages available for TDP MMU faults") should be a clean cherru-pick.


thanks,
harshit
> ---
>   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);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.