[PATCH] KVM: nSVM: Drop redundant/wrong comment in nested_vmcb02_prepare_save()

Yosry Ahmed posted 1 patch 3 weeks, 4 days ago
arch/x86/kvm/svm/nested.c | 1 -
1 file changed, 1 deletion(-)
[PATCH] KVM: nSVM: Drop redundant/wrong comment in nested_vmcb02_prepare_save()
Posted by Yosry Ahmed 3 weeks, 4 days ago
The comment above DR6 and DR7 initializations is redundant, because the
entire function follows the same pattern of only initializing the fields
in vmcb02 if the vmcb12 changed or the fields are dirty, which handles
the first execution case.

Also, the comment refers to new_vmcb12 as new_vmcs12. Just drop the
comment.

No functional change intended.

Change-Id: Ib924765541fe3d8753b84b7ead8b47d8a24f0c8d
Signed-off-by: Yosry Ahmed <yosry.ahmed@linux.dev>
---
 arch/x86/kvm/svm/nested.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c
index f295a41ec659..cb00829896cc 100644
--- a/arch/x86/kvm/svm/nested.c
+++ b/arch/x86/kvm/svm/nested.c
@@ -699,7 +699,6 @@ static void nested_vmcb02_prepare_save(struct vcpu_svm *svm, struct vmcb *vmcb12
 	vmcb02->save.rsp = vmcb12->save.rsp;
 	vmcb02->save.rip = vmcb12->save.rip;
 
-	/* These bits will be set properly on the first execution when new_vmc12 is true */
 	if (unlikely(new_vmcb12 || vmcb_is_dirty(vmcb12, VMCB_DR))) {
 		vmcb02->save.dr7 = svm->nested.save.dr7 | DR7_FIXED_1;
 		svm->vcpu.arch.dr6  = svm->nested.save.dr6 | DR6_ACTIVE_LOW;

base-commit: f62b64b970570c92fe22503b0cdc65be7ce7fc7c
-- 
2.52.0.457.g6b5491de43-goog
Re: [PATCH] KVM: nSVM: Drop redundant/wrong comment in nested_vmcb02_prepare_save()
Posted by Sean Christopherson 3 weeks, 2 days ago
On Tue, 13 Jan 2026 17:28:07 +0000, Yosry Ahmed wrote:
> The comment above DR6 and DR7 initializations is redundant, because the
> entire function follows the same pattern of only initializing the fields
> in vmcb02 if the vmcb12 changed or the fields are dirty, which handles
> the first execution case.
> 
> Also, the comment refers to new_vmcb12 as new_vmcs12. Just drop the
> comment.
> 
> [...]

Applied to kvm-x86 svm, thanks!

[1/1] KVM: nSVM: Drop redundant/wrong comment in nested_vmcb02_prepare_save()
      https://github.com/kvm-x86/linux/commit/f00ccdede3c8

--
https://github.com/kvm-x86/linux/tree/next
Re: [PATCH] KVM: nSVM: Drop redundant/wrong comment in nested_vmcb02_prepare_save()
Posted by Yosry Ahmed 3 weeks, 4 days ago
On Tue, Jan 13, 2026 at 05:28:07PM +0000, Yosry Ahmed wrote:
> The comment above DR6 and DR7 initializations is redundant, because the
> entire function follows the same pattern of only initializing the fields
> in vmcb02 if the vmcb12 changed or the fields are dirty, which handles
> the first execution case.
> 
> Also, the comment refers to new_vmcb12 as new_vmcs12. Just drop the
> comment.
> 
> No functional change intended.
> 
> Change-Id: Ib924765541fe3d8753b84b7ead8b47d8a24f0c8d

Lesson learned: no patch is too simple to run checkpatch.pl

> Signed-off-by: Yosry Ahmed <yosry.ahmed@linux.dev>
> ---
>  arch/x86/kvm/svm/nested.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c
> index f295a41ec659..cb00829896cc 100644
> --- a/arch/x86/kvm/svm/nested.c
> +++ b/arch/x86/kvm/svm/nested.c
> @@ -699,7 +699,6 @@ static void nested_vmcb02_prepare_save(struct vcpu_svm *svm, struct vmcb *vmcb12
>  	vmcb02->save.rsp = vmcb12->save.rsp;
>  	vmcb02->save.rip = vmcb12->save.rip;
>  
> -	/* These bits will be set properly on the first execution when new_vmc12 is true */
>  	if (unlikely(new_vmcb12 || vmcb_is_dirty(vmcb12, VMCB_DR))) {
>  		vmcb02->save.dr7 = svm->nested.save.dr7 | DR7_FIXED_1;
>  		svm->vcpu.arch.dr6  = svm->nested.save.dr6 | DR6_ACTIVE_LOW;
> 
> base-commit: f62b64b970570c92fe22503b0cdc65be7ce7fc7c
> -- 
> 2.52.0.457.g6b5491de43-goog
>