Gonglei (Arei)
2013-Jul-26 08:18 UTC
Re: [Qemu-devel] Cirrus VGA slow screen update, show blank screen last 13s or so for windows XP guest
I got VMEXIT counts by xentrace When using the VNC protocol grab the RDP to connect Windows XP guest. the time-interval of running xentrace is five seconds.The number of VMEXIT (EXIT_REASON_EPT_VIOLATION) in unstream qemu far greater than qemu-dm. the command likes: xentrace -D -T 5 -c 0x03 -e 0x0008f000 data/xentrace_$dt.log The results of qemu upstream: linux-sAGhxH:/home/sdb/gonglei/xentrace # ./xentrace.sh change evtmask to 0x8f000 change cpumask to 0x3 Start analyze xentrace-format_2013-0726-1444.log ... VMExitCode VMExitReason VMExitCnt VMExitTicks 0x0000000000 EXIT_REASON_EXCEPTION_NMI 447 329716 0x0000000001 EXIT_REASON_EXTERNAL_INTERRUPT 1126 3039311 0x0000000007 EXIT_REASON_PENDING_VIRT_INTR 1865 1608939 0x000000001c EXIT_REASON_CR_ACCESS 350 913047 0x000000001d EXIT_REASON_DR_ACCESS 4 8266 0x000000001e EXIT_REASON_IO_INSTRUCTION 7669 258978672 0x000000002b EXIT_REASON_TPR_BELOW_THRESHOLD 1203 1535626 0x000000002c EXIT_REASON_APIC_ACCESS 12971 106012627 0x0000000030 EXIT_REASON_EPT_VIOLATION 657459 5808859252 Total 683094 6181285456 The results of traditional qemu-dm: linux-sAGhxH:/home/sdb/gonglei/xentrace # ./xentrace.sh change evtmask to 0x8f000 change cpumask to 0xc Start analyze xentrace-format_2013-0726-1451.log ... VMExitCode VMExitReason VMExitCnt VMExitTicks 0x0000000000 EXIT_REASON_EXCEPTION_NMI 8693 6344766 0x0000000001 EXIT_REASON_EXTERNAL_INTERRUPT 3587 10601657 0x0000000007 EXIT_REASON_PENDING_VIRT_INTR 8086 6555873 0x000000000a EXIT_REASON_CPUID 34 56060 0x000000001c EXIT_REASON_CR_ACCESS 1424 3757518 0x000000001d EXIT_REASON_DR_ACCESS 13 27297 0x000000001e EXIT_REASON_IO_INSTRUCTION 21250 492487340 0x000000002b EXIT_REASON_TPR_BELOW_THRESHOLD 6458 8184132 0x000000002c EXIT_REASON_APIC_ACCESS 61749 506233523 0x0000000030 EXIT_REASON_EPT_VIOLATION 20329 261274392 0x0000000036 EXIT_REASON_WBINVD 2 2027 Total 131625 1295524585 -Gonglei> -----Original Message----- > From: Gonglei (Arei) > Sent: Friday, July 26, 2013 2:41 PM > To: ''Anthony Liguori'' > Cc: qemu-devel@nongnu.org; xen-devel@lists.xen.org; Hanweidong; > Luonengjun; Huangweidong (Hardware) > Subject: RE: [Qemu-devel] Cirrus VGA slow screen update, show blank screen > last 13s or so for windows XP guest > > > > > -----Original Message----- > > From: Anthony Liguori [mailto:anthony@codemonkey.ws] > > Sent: Friday, July 26, 2013 11:21 AM > > To: Gonglei (Arei) > > Cc: qemu-devel@nongnu.org; xen-devel@lists.xen.org; Hanweidong; > > Luonengjun; Huangweidong (Hardware) > > Subject: Re: [Qemu-devel] Cirrus VGA slow screen update, show blank screen > > last 13s or so for windows XP guest > > > > On Thu, Jul 25, 2013 at 10:08 PM, Gonglei (Arei) > > <arei.gonglei@huawei.com> wrote: > > >> -----Original Message----- > > >> From: Anthony Liguori [mailto:anthony@codemonkey.ws] > > >> Sent: Friday, July 26, 2013 10:09 AM > > >> To: Gonglei (Arei) > > >> Cc: qemu-devel@nongnu.org; xen-devel@lists.xen.org; Hanweidong; > > >> Luonengjun; Huangweidong (Hardware) > > >> Subject: Re: [Qemu-devel] Cirrus VGA slow screen update, show blank > > screen > > >> last 13s or so for windows XP guest > > >> > > >> Windows XP uses VGA planar mode during boot up. This means that to > > >> set a pixel requires 3 MMIO operations (one for the red pixel, one for > > >> the green pixel, one for the blue pixel). KVM has an optimization > > >> called MMIO coalescing which avoids a heavy weight exit for planar > > >> mode exits. I guess Xen doesn''t have an optimization like this. > > >> > > >> Regards, > > >> > > >> Anthony Liguori > > > > > > Thanks, Anthony. > > > I tested the Windows XP guest again on KVM and XEN, and I found: > > > 1. Windows XP will show blank screen during boot up as the same as > > > the protocol switch between VNC and RDP. > > > 2. Standard VGA works well, what''s difference between cirrus and standard > > VGA for the guest? > > > > Cirrus predates VESA. VESA has a linear framebuffer mode and WinXP > > can use VESA modes (provided that VESA drivers are installed). A > > linear framebuffer mode requires no exits to update individual pixels. > > Instead, there is a timer that fires 30-60 times a second to handle > > any pixels that have been dirtied during that period. > > > > > 3. Why does the traditional qemu has no blank screen problem on cirrus > VGA > > emulation ? > > > > This is one of the few cases where TCG is actually faster than KVM or > > Xen. In TCG, an MMIO exit is converted to a function call. OTOH, > > even with KVM, an MMIO exit is at least a couples thousand cycles. > > It''s worse with Xen because dom0 has to be scheduled. > > Perhaps I did not express clearly what I mean at #3. > I don''t understand why the qemu-dm(qemu-0.10.2) works well > but the upstream qemu(begin with qemu-0.14) is not for the > same windows XP guest image in cirrus vga emulation. Does > the cirrus vga emulation have some differences between > qemu-dm and unstream qemu ? > > Thank you so much! > > -Gonglei > > > > If you search a bit for the V2E project, there was an attempt to > > combine TCG emulation with hardware virtualization specifically to > > handle cases like this. Coalesced MMIO was good enough for KVM though > > that something like V2E wasn''t pursued for KVM. > > > > Regards, > > > > Anthony Liguori > > > > > Eagerly looking forward to your reply! > > > > > > -Gonglei > > >