Re: [RFC PATCH 2/4] KVM: SEV: Skip SNP-safe allocation when HvInUseWrAllowed is supported

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2025-08-25 at 15:20 +0000, Nikunj A Dadhania wrote:
> When HvInUseWrAllowed (CPUID 8000001F EAX[30]) is supported, the CPU allows
> hypervisor writes to in-use pages without RMP violations, making the 2MB
> alignment workaround unnecessary. Check for this capability to avoid the
> allocation overhead when it's not needed.

Could you add some text to explain why this is related to PML?

> 
> Suggested-by: Tom Lendacky <thomas.lendacky@xxxxxxx>
> Signed-off-by: Nikunj A Dadhania <nikunj@xxxxxxx>
> ---
>  arch/x86/kvm/svm/sev.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c
> index 2fbdebf79fbb..c5477efc90b9 100644
> --- a/arch/x86/kvm/svm/sev.c
> +++ b/arch/x86/kvm/svm/sev.c
> @@ -4666,7 +4666,8 @@ struct page *snp_safe_alloc_page_node(int node, gfp_t gfp)
>  	unsigned long pfn;
>  	struct page *p;
>  
> -	if (!cc_platform_has(CC_ATTR_HOST_SEV_SNP))
> +	if (!cc_platform_has(CC_ATTR_HOST_SEV_SNP) ||
> +	    cpu_feature_enabled(X86_FEATURE_HV_INUSE_WR_ALLOWED))
>  		return alloc_pages_node(node, gfp | __GFP_ZERO, 0);
>  
>  	/*




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux