public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: bugzilla-daemon@kernel.org
To: kvm@vger.kernel.org
Subject: [Bug 216045] New: KVM x2APIC virtualization causes EOI to be ignored
Date: Sun, 29 May 2022 04:26:58 +0000	[thread overview]
Message-ID: <bug-216045-28872@https.bugzilla.kernel.org/> (raw)

https://bugzilla.kernel.org/show_bug.cgi?id=216045

            Bug ID: 216045
           Summary: KVM x2APIC virtualization causes EOI to be ignored
           Product: Virtualization
           Version: unspecified
    Kernel Version: 5.17.9
          Hardware: Intel
                OS: Linux
              Tree: Mainline
            Status: NEW
          Severity: normal
          Priority: P1
         Component: kvm
          Assignee: virtualization_kvm@kernel-bugs.osdl.org
          Reporter: ercli@ucdavis.edu
        Regression: No

Created attachment 301071
  --> https://bugzilla.kernel.org/attachment.cgi?id=301071&action=edit
Guest hypervisor to reproduce this bug (xz compressed)

CPU model: 11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz
Host kernel version: 5.17.9
Host kernel arch: x86_64
Guest: a micro-hypervisor (called XMHF), which runs Linux (64-bit Debian,
5.10.0-9-amd64)
QEMU command line: qemu-system-x86_64 -m 512M -smp 2 -cpu Haswell,vmx=yes
-enable-kvm -serial stdio -drive media=disk,file=c.img,index=1 -drive
media=disk,file=debian11x64.qcow2,index=2
The problem goes away if using -machine kernel_irqchip=off
This problem cannot be tested with -accel tcg , because the guest requires
nested virtualization

Files used to reproduce this bug:

debian11x64.qcow2 (3.3G) is uploaded at
https://drive.google.com/uc?id=1LtUwnzH8pDvjoBhJhxk5wIz9_UTlGaBA . It should be
equivalent to a freshly installed Debian 5.10.0-9-amd64 on QEMU. Its kaslr is
disabled for debugging convenience.

c.img (8M) is uploaded at
https://drive.google.com/uc?id=1g3c9KMAoh_Yvb9bzSuOBMG5L-2VX6twU . It is also
compressed as c.img.xz and uploaded with this bug. It is built from
https://github.com/lxylxy123456/uberxmhf/tree/ab7968ed8017f43978081862526636f75c80a3b7
.

Actual behavior:

After running the QEMU command above, the hypervisor (XMHF) will boot and then
chain load Debian as a guest OS. Debian starts to boot and stuck. In QEMU's
monitor, if I enter "info lapic", I see

...
ISR      253
IRR      48 236 253

Expected behavior:

When running the QEMU command above, the hypervisor should boot Debian, and
Debian should boot successfully. The VGA screen should show "debian login:".

The expected behavior can be achieved in a few ways:
1. Remove "-drive media=disk,file=c.img,index=1" from QEMU command line. This
will boot Debian directly (instead of booting XMHF and then boot Debian)
2. Add "-machine kernel_irqchip=off" to the QEMU command line
3. Apply the following patch to KVM and re-compile. This patch will let KVM
think that x2APIC virtualization is not available.

diff --git a/arch/x86/kvm/vmx/capabilities.h b/arch/x86/kvm/vmx/capabilities.h
index 3f430e218..29b412ae4 100644
--- a/arch/x86/kvm/vmx/capabilities.h
+++ b/arch/x86/kvm/vmx/capabilities.h
@@ -157,8 +157,7 @@ static inline bool cpu_has_vmx_rdtscp(void)

 static inline bool cpu_has_vmx_virtualize_x2apic_mode(void)
 {
-       return vmcs_config.cpu_based_2nd_exec_ctrl &
-               SECONDARY_EXEC_VIRTUALIZE_X2APIC_MODE;
+       return 0;
 }

 static inline bool cpu_has_vmx_vpid(void)

-- 
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.

             reply	other threads:[~2022-05-29  4:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-29  4:26 bugzilla-daemon [this message]
2022-05-29  4:48 ` [Bug 216045] KVM x2APIC virtualization causes EOI to be ignored bugzilla-daemon

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=bug-216045-28872@https.bugzilla.kernel.org/ \
    --to=bugzilla-daemon@kernel.org \
    --cc=kvm@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox