From: kernel test robot <lkp@intel.com>
To: Maxim Levitsky <mlevitsk@redhat.com>, kvm@vger.kernel.org
Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org,
Paolo Bonzini <pbonzini@redhat.com>,
x86@kernel.org, Sean Christopherson <seanjc@google.com>,
Maxim Levitsky <mlevitsk@redhat.com>
Subject: Re: [PATCH v3 2/5] KVM: x86: split vcpu->arch.hflags into nested_guest_mode and smm_mode
Date: Tue, 24 Nov 2026 10:59:53 +0800 [thread overview]
Message-ID: <20261124105040.GgfsW2nq-lkp@intel.com> (raw)
In-Reply-To: <20261123175512.80438-3-mlevitsk@redhat.com>
Hi Maxim,
kernel test robot noticed the following build errors:
[auto build test ERROR on kvm/queue]
[also build test ERROR on kvm/next mst-vhost/linux-next linus/master v7.4-rc4]
[cannot apply to tip/master kvm/linux-next tip/auto-latest next-20261123]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Maxim-Levitsky/KVM-nVMX-don-t-check-PIR-ON-when-processing-nested-posted-interrupts/20261123-125508
base: https://git.kernel.org/pub/scm/virt/kvm/kvm.git queue
patch link: https://lore.kernel.org/r/20261123175512.80438-3-mlevitsk%40redhat.com
patch subject: [PATCH v3 2/5] KVM: x86: split vcpu->arch.hflags into nested_guest_mode and smm_mode
config: x86_64-buildonly-randconfig-1001-20261124 (https://download.01.org/0day-ci/archive/20261124/20261124105040.GgfsW2nq-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261124/20261124105040.GgfsW2nq-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/20261124105040.GgfsW2nq-lkp@intel.com/
All errors (new ones prefixed by >>):
arch/x86/kvm/x86.c: In function 'kvm_vcpu_reset':
>> arch/x86/kvm/x86.c:9652:19: error: 'struct kvm_vcpu_arch' has no member named 'smm_mode'
9652 | vcpu->arch.smm_mode = 0;
| ^
vim +9652 arch/x86/kvm/x86.c
9623
9624 void kvm_vcpu_reset(struct kvm_vcpu *vcpu, bool init_event)
9625 {
9626 struct kvm_cpuid_entry2 *cpuid_0x1;
9627 unsigned long old_cr0 = kvm_read_cr0(vcpu);
9628 unsigned long new_cr0;
9629
9630 /*
9631 * Several of the "set" flows, e.g. ->set_cr0(), read other registers
9632 * to handle side effects. RESET emulation hits those flows and relies
9633 * on emulated/virtualized registers, including those that are loaded
9634 * into hardware, to be zeroed at vCPU creation. Use CRs as a sentinel
9635 * to detect improper or missing initialization.
9636 */
9637 WARN_ON_ONCE(!init_event &&
9638 (old_cr0 || kvm_read_cr3(vcpu) || kvm_read_cr4(vcpu)));
9639
9640 /*
9641 * SVM doesn't unconditionally VM-Exit on INIT and SHUTDOWN, thus it's
9642 * possible to INIT the vCPU while L2 is active. Force the vCPU back
9643 * into L1 as EFER.SVME is cleared on INIT (along with all other EFER
9644 * bits), i.e. virtualization is disabled.
9645 */
9646 if (is_guest_mode(vcpu))
9647 kvm_leave_nested(vcpu);
9648
9649 kvm_lapic_reset(vcpu, init_event);
9650
9651 WARN_ON_ONCE(is_guest_mode(vcpu) || is_smm(vcpu));
> 9652 vcpu->arch.smm_mode = 0;
9653 vcpu->arch.nested_guest_state = 0;
9654
9655 vcpu->arch.smi_pending = 0;
9656 vcpu->arch.smi_count = 0;
9657 atomic_set(&vcpu->arch.nmi_queued, 0);
9658 vcpu->arch.nmi_pending = 0;
9659 vcpu->arch.nmi_injected = false;
9660 kvm_clear_interrupt_queue(vcpu);
9661 kvm_clear_exception_queue(vcpu);
9662
9663 memset(vcpu->arch.db, 0, sizeof(vcpu->arch.db));
9664 kvm_update_dr0123(vcpu);
9665 vcpu->arch.dr6 = DR6_ACTIVE_LOW;
9666 vcpu->arch.dr7 = DR7_FIXED_1;
9667 kvm_update_dr7(vcpu);
9668
9669 vcpu->arch.cr2 = 0;
9670
9671 kvm_make_request(KVM_REQ_EVENT, vcpu);
9672 vcpu->arch.apf.msr_en_val = 0;
9673 vcpu->arch.apf.msr_int_val = 0;
9674 vcpu->arch.st.msr_val = 0;
9675
9676 kvmclock_reset(vcpu);
9677
9678 kvm_clear_async_pf_completion_queue(vcpu);
9679 kvm_async_pf_hash_reset(vcpu);
9680 vcpu->arch.apf.halted = false;
9681
9682 kvm_xstate_reset(vcpu, init_event);
9683
9684 if (!init_event) {
9685 vcpu->arch.smbase = 0x30000;
9686
9687 vcpu->arch.pat = MSR_IA32_CR_PAT_DEFAULT;
9688
9689 vcpu->arch.msr_misc_features_enables = 0;
9690 vcpu->arch.ia32_misc_enable_msr = MSR_IA32_MISC_ENABLE_PEBS_UNAVAIL |
9691 MSR_IA32_MISC_ENABLE_BTS_UNAVAIL;
9692
9693 __kvm_set_xcr(vcpu, 0, XFEATURE_MASK_FP);
9694 kvm_msr_write(vcpu, MSR_IA32_XSS, 0);
9695 }
9696
9697 /* All GPRs except RDX (handled below) are zeroed on RESET/INIT. */
9698 memset(vcpu->arch.regs, 0, sizeof(vcpu->arch.regs));
9699 kvm_register_mark_dirty(vcpu, VCPU_REGS_RSP);
9700
9701 /*
9702 * Fall back to KVM's default Family/Model/Stepping of 0x600 (P6/Athlon)
9703 * if no CPUID match is found. Note, it's impossible to get a match at
9704 * RESET since KVM emulates RESET before exposing the vCPU to userspace,
9705 * i.e. it's impossible for kvm_find_cpuid_entry() to find a valid entry
9706 * on RESET. But, go through the motions in case that's ever remedied.
9707 */
9708 cpuid_0x1 = kvm_find_cpuid_entry(vcpu, 1);
9709 kvm_edx_write(vcpu, cpuid_0x1 ? cpuid_0x1->eax : 0x600);
9710
9711 kvm_x86_call(vcpu_reset)(vcpu, init_event);
9712
9713 kvm_set_rflags(vcpu, X86_EFLAGS_FIXED);
9714 kvm_rip_write(vcpu, 0xfff0);
9715
9716 vcpu->arch.cr3 = 0;
9717 kvm_register_mark_dirty(vcpu, VCPU_REG_CR3);
9718
9719 /*
9720 * CR0.CD/NW are set on RESET, preserved on INIT. Note, some versions
9721 * of Intel's SDM list CD/NW as being set on INIT, but they contradict
9722 * (or qualify) that with a footnote stating that CD/NW are preserved.
9723 */
9724 new_cr0 = X86_CR0_ET;
9725 if (init_event)
9726 new_cr0 |= (old_cr0 & (X86_CR0_NW | X86_CR0_CD));
9727 else
9728 new_cr0 |= X86_CR0_NW | X86_CR0_CD;
9729
9730 kvm_x86_call(set_cr0)(vcpu, new_cr0);
9731 kvm_x86_call(set_cr4)(vcpu, 0);
9732 kvm_x86_call(set_efer)(vcpu, 0);
9733 kvm_x86_call(update_exception_bitmap)(vcpu);
9734
9735 /*
9736 * Unconditionally reset the MMU, even though super strictly speaking,
9737 * a MMU reset is only necessary if and only one of the page role bits
9738 * is changing. All of the CR0/CR4/EFER bits effectively get covered
9739 * by checking CR0.PG=1, as CR0.WP and the paging-related bits in CR4
9740 * and EFER are irrelevant if CR0.PG was '0'. Subtly, if the vCPU was
9741 * in guest mode (L2) or SMM (although emulating INIT in SMM _should_
9742 * be impossible), an MMU reset is also necessary as "guest mode" and
9743 * "smm" are both encoded in the shadow page role. As a result, the
9744 * only scenarios where an MMU reset is *not* needed is if the vCPU is
9745 * in Real Mode or Unpaged Protected Mode, and micro-optimizing those
9746 * paths are not worth the risk of running with a stale MMU context.
9747 */
9748 kvm_mmu_reset_context(vcpu);
9749
9750 /*
9751 * Intel's SDM states that all TLB entries are flushed on INIT "as with
9752 * a hardware reset", and AMD's APM states the TLBs are flushed on
9753 * "External initialization of the processor". Flush the guest TLB for
9754 * both RESET and INIT, regardless of vendor, even though both the SDM
9755 * and APM contradict the above statements in other tables. There is
9756 * no meaningful benefit in relying on the guest to flush the TLB, and
9757 * a spurious TLB flush is benign and likely negligible from a
9758 * performance perspective (especially for RESET).
9759 */
9760 kvm_make_request(KVM_REQ_TLB_FLUSH_GUEST, vcpu);
9761 }
9762 EXPORT_SYMBOL_FOR_KVM_INTERNAL(kvm_vcpu_reset);
9763
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
next prev parent reply other threads:[~2026-11-24 3:00 UTC|newest]
Thread overview: 13+ 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-24 17:31 ` mlevitsk
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
2026-11-24 17:32 ` mlevitsk
2026-11-24 2:59 ` kernel test robot [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
2026-11-23 18:19 ` sashiko-bot
2026-11-24 18:00 ` mlevitsk
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=20261124105040.GgfsW2nq-lkp@intel.com \
--to=lkp@intel.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mlevitsk@redhat.com \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=x86@kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.