[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZtUYZE6t3COCwvg0@yzhao56-desk.sh.intel.com>
Date: Mon, 2 Sep 2024 09:44:04 +0800
From: Yan Zhao <yan.y.zhao@...el.com>
To: Vitaly Kuznetsov <vkuznets@...hat.com>
CC: Sean Christopherson <seanjc@...gle.com>, Gerd Hoffmann
<kraxel@...hat.com>, Paolo Bonzini <pbonzini@...hat.com>,
<kvm@...r.kernel.org>, <rcu@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
Kevin Tian <kevin.tian@...el.com>, Yiwei Zhang <zzyiwei@...gle.com>, "Lai
Jiangshan" <jiangshanlai@...il.com>, "Paul E. McKenney" <paulmck@...nel.org>,
Josh Triplett <josh@...htriplett.org>
Subject: Re: [PATCH 5/5] KVM: VMX: Always honor guest PAT on CPUs that
support self-snoop
On Fri, Aug 30, 2024 at 03:47:11PM +0200, Vitaly Kuznetsov wrote:
> Gerd Hoffmann <kraxel@...hat.com> writes:
>
> >> Necroposting!
> >>
> >> Turns out that this change broke "bochs-display" driver in QEMU even
> >> when the guest is modern (don't ask me 'who the hell uses bochs for
> >> modern guests', it was basically a configuration error :-). E.g:
> >
> > qemu stdvga (the default display device) is affected too.
> >
>
> So far, I was only able to verify that the issue has nothing to do with
> OVMF and multi-vcpu, it reproduces very well with
>
> $ qemu-kvm -machine q35,accel=kvm,kernel-irqchip=split -name guest=c10s
> -cpu host -smp 1 -m 16384 -drive file=/var/lib/libvirt/images/c10s-bios.qcow2,if=none,id=drive-ide0-0-0
> -device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1
> -vnc :0 -device VGA -monitor stdio --no-reboot
>
> Comparing traces of working and broken cases, I couldn't find anything
> suspicious but I may had missed something of course. For now, it seems
> like a userspace misbehavior resulting in a segfault.
Could you please share steps launch the broken guest desktop?
(better also with guest kernel version, name of desktop processes,
name of X server)
Currently, I couldn't reproduce the error with "-device bochs-display" or
"-device VGA" locally on a "Coffee Lake-S" test machine.
Qemu cmd as below:
qemu-system-x86_64 -m 4096 -smp 1 -M q35 -name guest-01
-hda ubuntu22-1.qcow2 -bios /usr/bin/bios.bin -enable-kvm -k en-us
-serial stdio -device bochs-display -machine kernel_irqchip=on
-cpu host -usb -usbdevice tablet
The guest can see a VGA device
00:02.0 Display controller: Device 1234:1111 (rev 02)
with driver
# readlink /sys/bus/pci/devices/0000\:00\:02.0/driver
../../../bus/pci/drivers/bochs-drm
I have tried hardcoding several fields as below:
(1) hardcoded the fb_map to wc in the guest driver
--- a/drivers/gpu/drm/tiny/bochs.c
+++ b/drivers/gpu/drm/tiny/bochs.c
@@ -261,7 +261,9 @@ static int bochs_hw_init(struct drm_device *dev)
if (pci_request_region(pdev, 0, "bochs-drm") != 0)
DRM_WARN("Cannot request framebuffer, boot fb still active?\n");
- bochs->fb_map = ioremap(addr, size);
+ bochs->fb_map = ioremap_wc(addr, size);
+ printk("bochs wc fb_map=%lx, addr=%lx, size=%lx\n", (unsigned long)bochs->fb_map, (unsigned long)addr, (unsigned long)size);
if (bochs->fb_map == NULL) {
DRM_ERROR("Cannot map framebuffer\n");
return -ENOMEM;
With dmesg as below:
[ 7.565840] ioremap wc phys_addr fd000000 size 1000000 to wc
[ 7.565856] bochs wc fb_map=ffffc90004000000, addr=fd000000, size=1000000
[ 7.565859] [drm] Found bochs VGA, ID 0xb0c5.
[ 7.565861] [drm] Framebuffer size 16384 kB @ 0xfd000000, mmio @ 0xfebd9000.
[ 7.591995] [drm] Found EDID data blob.
[ 7.603956] [drm] Initialized bochs-drm 1.0.0 20130925 for 0000:00:02.0 on minor 1
[ 7.614263] bochs-drm 0000:00:02.0: [drm] fb1: bochs-drmdrmfb frame buffer device
(2) hardcoded the memory type to WC in KVM intel driver.
+ if (gfn >= 0xfd000 && gfn < 0xfe000)
+ return (MTRR_TYPE_WRCOMB << VMX_EPT_MT_EPTE_SHIFT) | VMX_EPT_IPAT_BIT;
(3) hardcoded mmap flags to WC for some bo objects for Xorg.
Powered by blists - more mailing lists