[PATCH v2 4/8] KVM: nSVM: Directly (re)calc vmcb02 intercepts from nested_vmcb02_prepare_control()

Sean Christopherson posted 8 patches 1 month, 1 week ago
[PATCH v2 4/8] KVM: nSVM: Directly (re)calc vmcb02 intercepts from nested_vmcb02_prepare_control()
Posted by Sean Christopherson 1 month, 1 week ago
Now that nested_vmcb02_recalc_intercepts() provides guardrails against it
being incorrectly called without vmcb02 active, invoke it directly from
nested_vmcb02_recalc_intercepts() instead of bouncing through
svm_mark_intercepts_dirty(), which unnecessarily marks vmcb01 as dirty.

Signed-off-by: Sean Christopherson <seanjc@google.com>
---
 arch/x86/kvm/svm/nested.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c
index 793f5d2eed3a..e8512de5aef7 100644
--- a/arch/x86/kvm/svm/nested.c
+++ b/arch/x86/kvm/svm/nested.c
@@ -916,7 +916,7 @@ static void nested_vmcb02_prepare_control(struct vcpu_svm *svm,
 	 * Merge guest and host intercepts - must be called with vcpu in
 	 * guest-mode to take effect.
 	 */
-	svm_mark_intercepts_dirty(svm);
+	nested_vmcb02_recalc_intercepts(svm);
 }
 
 static void nested_svm_copy_common_state(struct vmcb *from_vmcb, struct vmcb *to_vmcb)
-- 
2.53.0.345.g96ddfc5eaa-goog
Re: [PATCH v2 4/8] KVM: nSVM: Directly (re)calc vmcb02 intercepts from nested_vmcb02_prepare_control()
Posted by Yosry Ahmed 1 month, 1 week ago
On Wed, Feb 18, 2026 at 03:09:54PM -0800, Sean Christopherson wrote:
> Now that nested_vmcb02_recalc_intercepts() provides guardrails against it
> being incorrectly called without vmcb02 active, invoke it directly from
> nested_vmcb02_recalc_intercepts() instead of bouncing through
> svm_mark_intercepts_dirty(), which unnecessarily marks vmcb01 as dirty.
> 
> Signed-off-by: Sean Christopherson <seanjc@google.com>

Reviewed-by: Yosry Ahmed <yosry.ahmed@linux.dev>

> ---
>  arch/x86/kvm/svm/nested.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c
> index 793f5d2eed3a..e8512de5aef7 100644
> --- a/arch/x86/kvm/svm/nested.c
> +++ b/arch/x86/kvm/svm/nested.c
> @@ -916,7 +916,7 @@ static void nested_vmcb02_prepare_control(struct vcpu_svm *svm,
>  	 * Merge guest and host intercepts - must be called with vcpu in
>  	 * guest-mode to take effect.
>  	 */
> -	svm_mark_intercepts_dirty(svm);
> +	nested_vmcb02_recalc_intercepts(svm);
>  }
>  
>  static void nested_svm_copy_common_state(struct vmcb *from_vmcb, struct vmcb *to_vmcb)
> -- 
> 2.53.0.345.g96ddfc5eaa-goog
>