diff mbox series

[v10,01/50] KVM: SVM: INTERCEPT_RDTSCP is never intercepted anyway

Message ID 20231016132819.1002933-2-michael.roth@amd.com (mailing list archive)
State Not Applicable
Delegated to: Herbert Xu
Headers show
Series Add AMD Secure Nested Paging (SEV-SNP) Hypervisor Support | expand

Commit Message

Michael Roth Oct. 16, 2023, 1:27 p.m. UTC
From: Paolo Bonzini <pbonzini@redhat.com>

svm_recalc_instruction_intercepts() is always called at least once
before the vCPU is started, so the setting or clearing of the RDTSCP
intercept can be dropped from the TSC_AUX virtualization support.

Extracted from a patch by Tom Lendacky.

Cc: stable@vger.kernel.org
Fixes: 296d5a17e793 ("KVM: SEV-ES: Use V_TSC_AUX if available instead of RDTSC/MSR_TSC_AUX intercepts")
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit e8d93d5d93f85949e7299be289c6e7e1154b2f78)
Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 arch/x86/kvm/svm/sev.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

Greg KH Oct. 16, 2023, 3:12 p.m. UTC | #1
On Mon, Oct 16, 2023 at 08:27:30AM -0500, Michael Roth wrote:
> From: Paolo Bonzini <pbonzini@redhat.com>
> 
> svm_recalc_instruction_intercepts() is always called at least once
> before the vCPU is started, so the setting or clearing of the RDTSCP
> intercept can be dropped from the TSC_AUX virtualization support.
> 
> Extracted from a patch by Tom Lendacky.
> 
> Cc: stable@vger.kernel.org
> Fixes: 296d5a17e793 ("KVM: SEV-ES: Use V_TSC_AUX if available instead of RDTSC/MSR_TSC_AUX intercepts")
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> (cherry picked from commit e8d93d5d93f85949e7299be289c6e7e1154b2f78)
> Signed-off-by: Michael Roth <michael.roth@amd.com>
> ---
>  arch/x86/kvm/svm/sev.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)

What stable tree(s) are you wanting this applied to (same for the others
in this series)?  It's already in the 6.1.56 release, and the Fixes tag
is for 5.19, so I don't see where it could be missing from?

thanks,

greg k-h
Paolo Bonzini Oct. 16, 2023, 3:14 p.m. UTC | #2
On 10/16/23 17:12, Greg KH wrote:
> On Mon, Oct 16, 2023 at 08:27:30AM -0500, Michael Roth wrote:
>> From: Paolo Bonzini <pbonzini@redhat.com>
>>
>> svm_recalc_instruction_intercepts() is always called at least once
>> before the vCPU is started, so the setting or clearing of the RDTSCP
>> intercept can be dropped from the TSC_AUX virtualization support.
>>
>> Extracted from a patch by Tom Lendacky.
>>
>> Cc: stable@vger.kernel.org
>> Fixes: 296d5a17e793 ("KVM: SEV-ES: Use V_TSC_AUX if available instead of RDTSC/MSR_TSC_AUX intercepts")
>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>> (cherry picked from commit e8d93d5d93f85949e7299be289c6e7e1154b2f78)
>> Signed-off-by: Michael Roth <michael.roth@amd.com>
>> ---
>>   arch/x86/kvm/svm/sev.c | 5 +----
>>   1 file changed, 1 insertion(+), 4 deletions(-)
> 
> What stable tree(s) are you wanting this applied to (same for the others
> in this series)?  It's already in the 6.1.56 release, and the Fixes tag
> is for 5.19, so I don't see where it could be missing from?

I tink it's missing in the (destined for 6.7) tree that Michael is 
basing this series on, so he's cherry picking it from Linus's tree.

Paolo
Michael Roth Oct. 16, 2023, 3:21 p.m. UTC | #3
On Mon, Oct 16, 2023 at 05:14:38PM +0200, Paolo Bonzini wrote:
> On 10/16/23 17:12, Greg KH wrote:
> > On Mon, Oct 16, 2023 at 08:27:30AM -0500, Michael Roth wrote:
> > > From: Paolo Bonzini <pbonzini@redhat.com>
> > > 
> > > svm_recalc_instruction_intercepts() is always called at least once
> > > before the vCPU is started, so the setting or clearing of the RDTSCP
> > > intercept can be dropped from the TSC_AUX virtualization support.
> > > 
> > > Extracted from a patch by Tom Lendacky.
> > > 
> > > Cc: stable@vger.kernel.org
> > > Fixes: 296d5a17e793 ("KVM: SEV-ES: Use V_TSC_AUX if available instead of RDTSC/MSR_TSC_AUX intercepts")
> > > Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> > > (cherry picked from commit e8d93d5d93f85949e7299be289c6e7e1154b2f78)
> > > Signed-off-by: Michael Roth <michael.roth@amd.com>
> > > ---
> > >   arch/x86/kvm/svm/sev.c | 5 +----
> > >   1 file changed, 1 insertion(+), 4 deletions(-)
> > 
> > What stable tree(s) are you wanting this applied to (same for the others
> > in this series)?  It's already in the 6.1.56 release, and the Fixes tag
> > is for 5.19, so I don't see where it could be missing from?
> 
> I tink it's missing in the (destined for 6.7) tree that Michael is basing
> this series on, so he's cherry picking it from Linus's tree.

Yes, this and PATCH #2 are both prereqs that have already been applied
upstream, and are only being included in this series because they are
preqs for PATCH #3 which is new. Sorry for any confusion.

-Mike

> 
> Paolo
>
diff mbox series

Patch

diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c
index b9a0a939d59f..fa1fb81323b5 100644
--- a/arch/x86/kvm/svm/sev.c
+++ b/arch/x86/kvm/svm/sev.c
@@ -3027,11 +3027,8 @@  static void sev_es_init_vmcb(struct vcpu_svm *svm)
 
 	if (boot_cpu_has(X86_FEATURE_V_TSC_AUX) &&
 	    (guest_cpuid_has(&svm->vcpu, X86_FEATURE_RDTSCP) ||
-	     guest_cpuid_has(&svm->vcpu, X86_FEATURE_RDPID))) {
+	     guest_cpuid_has(&svm->vcpu, X86_FEATURE_RDPID)))
 		set_msr_interception(vcpu, svm->msrpm, MSR_TSC_AUX, 1, 1);
-		if (guest_cpuid_has(&svm->vcpu, X86_FEATURE_RDTSCP))
-			svm_clr_intercept(svm, INTERCEPT_RDTSCP);
-	}
 }
 
 void sev_init_vmcb(struct vcpu_svm *svm)