Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Maxim Levitsky" <mlevitsk@redhat.com>, kvm@vger.kernel.org
Subject: Re: [PATCH v3 2/5] KVM: x86: split vcpu->arch.hflags into nested_guest_mode and smm_mode
Date: Mon, 23 Nov 2026 18:03:06 +0000	[thread overview]
Message-ID: <sashiko-outbox-229793@kernel.org> (raw)
In-Reply-To: <20261123175512.80438-3-mlevitsk@redhat.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [High] KVM: x86: build failure in kvm_vcpu_reset() when
  CONFIG_KVM_SMM=n
- [Low] KVM: x86: commit log names nested_guest_mode instead of
  nested_guest_state
--

commit f779a065108faeca6cdd5ce21f760f2b6bdeb40c
Author: Maxim Levitsky <mlevitsk@redhat.com>

KVM: x86: split vcpu->arch.hflags into nested_guest_mode and smm_mode

This commit replaces vcpu->arch.hflags with separate nested_guest_state
and smm_mode fields in struct kvm_vcpu_arch.

> diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
> index 683bb8bf43a94..17308713a2904 100644
> --- a/arch/x86/include/asm/kvm_host.h
> +++ b/arch/x86/include/asm/kvm_host.h
> @@ -735,7 +735,6 @@ struct kvm_vcpu_arch {
>  	unsigned long cr8;
>  	u32 host_pkru;
>  	u32 pkru;
> -	u32 hflags;
>  	u64 efer;
>  	u64 host_debugctl;
>  	u64 apic_base;
> @@ -755,6 +754,16 @@ struct kvm_vcpu_arch {
>  	u64 arch_capabilities;
>  	u64 perf_capabilities;
>  
> +#define KVM_NESTED_IN_GUEST	BIT(8)
> +	/* Non zero when the guest is executing another guest */
> +	u16 nested_guest_state;

[Severity: Low]
This isn't a bug, but the commit subject and message call this field
nested_guest_mode while the code names it nested_guest_state.

> +
> +#ifdef CONFIG_KVM_SMM
> +#define SMM_MASK		BIT(0)
> +#define SMM_INSIDE_NMI_MASK	BIT(1)
> +	/* Non zero when the guest is in SMM*/
> +	u16 smm_mode;
> +#endif
>  	/*
>  	 * Paging state of the vcpu
>  	 *

[ ... ]

> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index aad065d035fbb..4e515bcdc85cb 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c

[ ... ]

> @@ -9558,7 +9558,8 @@ void kvm_vcpu_reset(struct kvm_vcpu *vcpu, bool init_event)
>  	kvm_lapic_reset(vcpu, init_event);
>  
>  	WARN_ON_ONCE(is_guest_mode(vcpu) || is_smm(vcpu));
> -	vcpu->arch.hflags = 0;
> +	vcpu->arch.smm_mode = 0;
> +	vcpu->arch.nested_guest_state = 0;
>  
>  	vcpu->arch.smi_pending = 0;
>  	vcpu->arch.smi_count = 0;

[Severity: High]
Does this break the build when CONFIG_KVM_SMM is disabled?  smm_mode in
struct kvm_vcpu_arch is guarded by #ifdef CONFIG_KVM_SMM, but
kvm_vcpu_reset() clears vcpu->arch.smm_mode unconditionally.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261123175512.80438-1-mlevitsk@redhat.com?part=2

  reply	other threads:[~2026-11-23 18:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23 17:55 [PATCH v3 0/5] KVM: nVMX: fix nested APICv emulation for windows guests Maxim Levitsky
2026-11-23 17:55 ` [PATCH v3 1/5] KVM: nVMX: don't check PIR.ON when processing nested posted interrupts Maxim Levitsky
2026-11-23 18:02   ` sashiko-bot
2026-11-23 17:55 ` [PATCH v3 2/5] KVM: x86: split vcpu->arch.hflags into nested_guest_mode and smm_mode Maxim Levitsky
2026-11-23 18:03   ` sashiko-bot [this message]
2026-11-23 17:55 ` [PATCH v3 3/5] KVM: x86: convert nested_guest_state into an atomic variable Maxim Levitsky
2026-11-23 17:55 ` [PATCH v3 4/5] KVM: x86: nVMX: move nested APICv state to nested_guest_state Maxim Levitsky
2026-11-23 17:55 ` [PATCH v3 5/5] KVM: x86: nVMX: fix races in delivery of nested posted interrupts Maxim Levitsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-229793@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=mlevitsk@redhat.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox