Patchwork Re: QEMU-KVM and video performance

login
register
mail settings
Submitter Gerhard Wiesinger
Date May 12, 2010, 6:14 a.m.
Message ID <alpine.LFD.2.00.1005120804330.26873@bbs.intern>
Download mbox | patch
Permalink /patch/52354/
State New
Headers show

Comments

Gerhard Wiesinger - May 12, 2010, 6:14 a.m.
On Mon, 10 May 2010, Avi Kivity wrote:

> On 05/09/2010 10:35 PM, Gerhard Wiesinger wrote:
>>>> 
>
> For 256 color more the first priority is to find out why direct mapping is 
> not used.  I'd suggest tracing the code that makes this decision (in 
> hw/*vga.c) and seeing if it's right or not.

I think this is because A000 is not initialized for KVM (see log below 
and logging patch attached).

Switches tried without success:
-vga std (log is from this one)
-vga cirrus
-vga vmware

I tried also to force the mapping (see patch where it is commented out) 
but some errors occour (see 2nd log below) and performance is still 
low at ~1MB/s:
s->lfb_vram_mapped = 1;

On testing the following line occour:
vga_dirty_log_start
vga_dirty_log_start
vga_dirty_log_start
vga_dirty_log_start
vga_dirty_log_start
vga_dirty_log_start
...

Any ideas? Can you reproduce it?

Thnx.

Ciao,
Gerhard

--
http://www.wiesinger.com/

vga_dirty_log_start
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0xE0000000, len=0x01000000
vga_dirty_log_start
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0xE0000000, len=0x01000000
vga_dirty_log_start
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0xE0000000, len=0x01000000
vga_dirty_log_start
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0xE0000000, len=0x01000000
vga_dirty_log_start
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0xE0000000, len=0x01000000
vga_dirty_log_start
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0xE0000000, len=0x01000000
vga_dirty_log_start
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0xE0000000, len=0x01000000
vga_dirty_log_start
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0xE0000000, len=0x01000000
vga_dirty_log_start
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0xE0000000, len=0x01000000
vga_dirty_log_start
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0xE0000000, len=0x01000000
vga_dirty_log_start
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0xE0000000, len=0x01000000
vga_dirty_log_start
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0xE0000000, len=0x01000000
vga_dirty_log_start
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0xE0000000, len=0x01000000
vga_dirty_log_start
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0xE0000000, len=0x01000000
vga_dirty_log_start
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0xE0000000, len=0x01000000
vga_dirty_log_start
vga_dirty_log_start_mapping_map_addr, start=0xF0000000, len=0x01000000
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0xE0000000, len=0x01000000
vga_dirty_log_start
vga_dirty_log_start
vga_dirty_log_start_mapping_map_addr, start=0xF0000000, len=0x01000000
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0xE0000000, len=0x01000000
vga_dirty_log_start
vga_dirty_log_start_mapping_map_addr, start=0xF0000000, len=0x01000000
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0xE0000000, len=0x01000000
--------------------------------------------------------------------------------------
vga_dirty_log_start
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0x000A0000, len=0x00008000
BUG: kvm_dirty_pages_log_change: invalid parameters 00000000000a0000-00000000000a7fff
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0x000A8000, len=0x00008000
BUG: kvm_dirty_pages_log_change: invalid parameters 00000000000a8000-00000000000affff
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0xE0000000, len=0x01000000
vga_dirty_log_start
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0x000A0000, len=0x00008000
BUG: kvm_dirty_pages_log_change: invalid parameters 00000000000a0000-00000000000a7fff
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0x000A8000, len=0x00008000
BUG: kvm_dirty_pages_log_change: invalid parameters 00000000000a8000-00000000000affff
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0xE0000000, len=0x01000000
vga_dirty_log_start
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0x000A0000, len=0x00008000
BUG: kvm_dirty_pages_log_change: invalid parameters 00000000000a0000-00000000000a7fff
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0x000A8000, len=0x00008000
BUG: kvm_dirty_pages_log_change: invalid parameters 00000000000a8000-00000000000affff
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0xE0000000, len=0x01000000
vga_dirty_log_start
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0x000A0000, len=0x00008000
BUG: kvm_dirty_pages_log_change: invalid parameters 00000000000a0000-00000000000a7fff
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0x000A8000, len=0x00008000
BUG: kvm_dirty_pages_log_change: invalid parameters 00000000000a8000-00000000000affff
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0xE0000000, len=0x01000000
vga_dirty_log_start
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0x000A0000, len=0x00008000
BUG: kvm_dirty_pages_log_change: invalid parameters 00000000000a0000-00000000000a7fff
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0x000A8000, len=0x00008000
BUG: kvm_dirty_pages_log_change: invalid parameters 00000000000a8000-00000000000affff
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0xE0000000, len=0x01000000
vga_dirty_log_start
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0x000A0000, len=0x00008000
BUG: kvm_dirty_pages_log_change: invalid parameters 00000000000a0000-00000000000a7fff
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0x000A8000, len=0x00008000
BUG: kvm_dirty_pages_log_change: invalid parameters 00000000000a8000-00000000000affff
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0xE0000000, len=0x01000000
vga_dirty_log_start
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0x000A0000, len=0x00008000
BUG: kvm_dirty_pages_log_change: invalid parameters 00000000000a0000-00000000000a7fff
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0x000A8000, len=0x00008000
BUG: kvm_dirty_pages_log_change: invalid parameters 00000000000a8000-00000000000affff
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0xE0000000, len=0x01000000
vga_dirty_log_start
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0x000A0000, len=0x00008000
BUG: kvm_dirty_pages_log_change: invalid parameters 00000000000a0000-00000000000a7fff
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0x000A8000, len=0x00008000
BUG: kvm_dirty_pages_log_change: invalid parameters 00000000000a8000-00000000000affff
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0xE0000000, len=0x01000000
vga_dirty_log_start
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0x000A0000, len=0x00008000
BUG: kvm_dirty_pages_log_change: invalid parameters 00000000000a0000-00000000000a7fff
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0x000A8000, len=0x00008000
BUG: kvm_dirty_pages_log_change: invalid parameters 00000000000a8000-00000000000affff
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0xE0000000, len=0x01000000
vga_dirty_log_start
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0x000A0000, len=0x00008000
BUG: kvm_dirty_pages_log_change: invalid parameters 00000000000a0000-00000000000a7fff
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0x000A8000, len=0x00008000
BUG: kvm_dirty_pages_log_change: invalid parameters 00000000000a8000-00000000000affff
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0xE0000000, len=0x01000000
vga_dirty_log_start
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0x000A0000, len=0x00008000
BUG: kvm_dirty_pages_log_change: invalid parameters 00000000000a0000-00000000000a7fff
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0x000A8000, len=0x00008000
BUG: kvm_dirty_pages_log_change: invalid parameters 00000000000a8000-00000000000affff
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0xE0000000, len=0x01000000
vga_dirty_log_start
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0x000A0000, len=0x00008000
BUG: kvm_dirty_pages_log_change: invalid parameters 00000000000a0000-00000000000a7fff
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0x000A8000, len=0x00008000
BUG: kvm_dirty_pages_log_change: invalid parameters 00000000000a8000-00000000000affff
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0xE0000000, len=0x01000000
vga_dirty_log_start
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0x000A0000, len=0x00008000
BUG: kvm_dirty_pages_log_change: invalid parameters 00000000000a0000-00000000000a7fff
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0x000A8000, len=0x00008000
BUG: kvm_dirty_pages_log_change: invalid parameters 00000000000a8000-00000000000affff
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0xE0000000, len=0x01000000
vga_dirty_log_start
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0x000A0000, len=0x00008000
BUG: kvm_dirty_pages_log_change: invalid parameters 00000000000a0000-00000000000a7fff
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0x000A8000, len=0x00008000
BUG: kvm_dirty_pages_log_change: invalid parameters 00000000000a8000-00000000000affff
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0xE0000000, len=0x01000000
vga_dirty_log_start
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0x000A0000, len=0x00008000
BUG: kvm_dirty_pages_log_change: invalid parameters 00000000000a0000-00000000000a7fff
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0x000A8000, len=0x00008000
BUG: kvm_dirty_pages_log_change: invalid parameters 00000000000a8000-00000000000affff
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0xE0000000, len=0x01000000
vga_dirty_log_start
vga_dirty_log_start_mapping_map_addr, start=0xF0000000, len=0x01000000
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0x000A0000, len=0x00008000
BUG: kvm_dirty_pages_log_change: invalid parameters 00000000000a0000-00000000000a7fff
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0x000A8000, len=0x00008000
BUG: kvm_dirty_pages_log_change: invalid parameters 00000000000a8000-00000000000affff
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0xE0000000, len=0x01000000
vga_dirty_log_start
BUG: kvm_dirty_pages_log_change: invalid parameters 00000000000a0000-00000000000a7fff
BUG: kvm_dirty_pages_log_change: invalid parameters 00000000000a8000-00000000000affff
vga_dirty_log_start
vga_dirty_log_start_mapping_map_addr, start=0xF0000000, len=0x01000000
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0x000A0000, len=0x00008000
BUG: kvm_dirty_pages_log_change: invalid parameters 00000000000a0000-00000000000a7fff
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0x000A8000, len=0x00008000
BUG: kvm_dirty_pages_log_change: invalid parameters 00000000000a8000-00000000000affff
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0xE0000000, len=0x01000000
BUG: kvm_dirty_pages_log_change: invalid parameters 00000000000a0000-00000000000a7fff
BUG: kvm_dirty_pages_log_change: invalid parameters 00000000000a8000-00000000000affff
vga_dirty_log_start
vga_dirty_log_start_mapping_map_addr, start=0xF0000000, len=0x01000000
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0x000A0000, len=0x00008000
BUG: kvm_dirty_pages_log_change: invalid parameters 00000000000a0000-00000000000a7fff
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0x000A8000, len=0x00008000
BUG: kvm_dirty_pages_log_change: invalid parameters 00000000000a8000-00000000000affff
vga_dirty_log_start_mapping_lfb_vram_mapped, start=0xE0000000, len=0x01000000
Avi Kivity - May 12, 2010, 6:39 a.m.
On 05/12/2010 09:14 AM, Gerhard Wiesinger wrote:
> On Mon, 10 May 2010, Avi Kivity wrote:
>
>> On 05/09/2010 10:35 PM, Gerhard Wiesinger wrote:
>>>>>
>>
>> For 256 color more the first priority is to find out why direct 
>> mapping is not used.  I'd suggest tracing the code that makes this 
>> decision (in hw/*vga.c) and seeing if it's right or not.
>
> I think this is because A000 is not initialized for KVM (see log below 
> and logging patch attached).

Why isn't it initialized?

Did the guest configure things such as it is impossible to map it 
directly?  Or does the configuration allow direct mapping and qemu 
incorrectly decides that it cannot direct map?

Best would be to print out all the configuration registers and interpret 
them according to the specification.


>
> vga_dirty_log_start
> vga_dirty_log_start_mapping_lfb_vram_mapped, start=0x000A0000, 
> len=0x00008000
> BUG: kvm_dirty_pages_log_change: invalid parameters 
> 00000000000a0000-00000000000a7fff

Why does this happen?
Gerhard Wiesinger - Feb. 18, 2011, 7:32 a.m.
Hello,

Some update on this issue, archive: 
http://www.mail-archive.com/kvm@vger.kernel.org/msg32600.html

Seems to be that cirrus VGA is now ok (>1000MB/s up to 2000MB/s). But 
cirrus has only 320x200x256colors (Mode 13h) mode implemented in VESA 
BIOS.

VMWare and std VGA still have the performance issue.

I guess improvement is related to the following commit:
http://git.kernel.org/?p=virt/kvm/qemu-kvm.git;a=commitdiff;h=0d14905b5eb8aa1c2e195e13478bb7c74e1776db
Especially i guess the change in hw/cirrus_vga.c.

Any idea how to fix:
1.) More VESA modes in cirrus VGA (is VESA emulation done by Seabios or by 
KVM cirrus BIOS?) 
2.) fix in VMWare and std VGA modes the performance, too

Versions are latest dev versions of KVM user part and Seabios from GIT.

Thnx.

Ciao,
Gerhard

--
http://www.wiesinger.com/


On Wed, 12 May 2010, Avi Kivity wrote:

> On 05/12/2010 09:14 AM, Gerhard Wiesinger wrote:
>> On Mon, 10 May 2010, Avi Kivity wrote:
>> 
>>> On 05/09/2010 10:35 PM, Gerhard Wiesinger wrote:
>>>>>> 
>>> 
>>> For 256 color more the first priority is to find out why direct mapping is 
>>> not used.  I'd suggest tracing the code that makes this decision (in 
>>> hw/*vga.c) and seeing if it's right or not.
>> 
>> I think this is because A000 is not initialized for KVM (see log below and 
>> logging patch attached).
>
> Why isn't it initialized?
>
> Did the guest configure things such as it is impossible to map it directly? 
> Or does the configuration allow direct mapping and qemu incorrectly decides 
> that it cannot direct map?
>
> Best would be to print out all the configuration registers and interpret them 
> according to the specification.
>
>
>> 
>> vga_dirty_log_start
>> vga_dirty_log_start_mapping_lfb_vram_mapped, start=0x000A0000, 
>> len=0x00008000
>> BUG: kvm_dirty_pages_log_change: invalid parameters 
>> 00000000000a0000-00000000000a7fff
>
> Why does this happen?
>
> -- 
> Do not meddle in the internals of kernels, for they are subtle and quick to 
> panic.
>
>
>

Patch

diff --git a/hw/cirrus_vga.c b/hw/cirrus_vga.c

index 571044f..68c6083 100644

--- a/hw/cirrus_vga.c

+++ b/hw/cirrus_vga.c

@@ -2581,6 +2581,7 @@  static void map_linear_vram(CirrusVGAState *s)

         cpu_register_physical_memory(isa_mem_base + 0xa8000, 0x8000,
                                     (s->vga.vram_offset + s->cirrus_bank_base[1]) | IO_MEM_RAM);
 
+	printf("Cirrus VGA: lfb_vram_mapped=1\n");

         s->vga.lfb_vram_mapped = 1;
     }
     else {
diff --git a/hw/vga.c b/hw/vga.c

index a5e2387..cb8a209 100644

--- a/hw/vga.c

+++ b/hw/vga.c

@@ -1612,15 +1612,19 @@  static void mark_dirty(target_phys_addr_t start, target_phys_addr_t len)

 
 void vga_dirty_log_start(VGACommonState *s)
 {
+    printf("vga_dirty_log_start\n");

     if (kvm_enabled() && s->map_addr)
         if (!s1) {
+            printf("vga_dirty_log_start_mapping_map_addr, start=0x%08X, len=0x%08X\n", s->map_addr, s->map_end - s->map_addr);

             kvm_log_start(s->map_addr, s->map_end - s->map_addr);
             mark_dirty(s->map_addr, s->map_end - s->map_addr);
             s1 = 1;
         }
     if (kvm_enabled() && s->lfb_vram_mapped) {
         if (!s2) {
+            printf("vga_dirty_log_start_mapping_lfb_vram_mapped, start=0x%08X, len=0x%08X\n", (unsigned int)(isa_mem_base + 0xa0000), 0x8000);

             kvm_log_start(isa_mem_base + 0xa0000, 0x8000);
+            printf("vga_dirty_log_start_mapping_lfb_vram_mapped, start=0x%08X, len=0x%08X\n", (unsigned int)(isa_mem_base + 0xa8000), 0x8000);

             kvm_log_start(isa_mem_base + 0xa8000, 0x8000);
             mark_dirty(isa_mem_base + 0xa0000, 0x10000);
         }
@@ -1630,6 +1634,7 @@  void vga_dirty_log_start(VGACommonState *s)

 #ifdef CONFIG_BOCHS_VBE
     if (kvm_enabled() && s->vbe_mapped) {
         if (!s3) {
+            printf("vga_dirty_log_start_mapping_lfb_vram_mapped, start=0x%08X, len=0x%08X\n", VBE_DISPI_LFB_PHYSICAL_ADDRESS, s->vram_size);

             kvm_log_start(VBE_DISPI_LFB_PHYSICAL_ADDRESS, s->vram_size);
         }
         s3 = 1;
@@ -1965,6 +1970,7 @@  void vga_common_reset(VGACommonState *s)

     s->map_addr = 0;
     s->map_end = 0;
     s->lfb_vram_mapped = 0;
+//    s->lfb_vram_mapped = 1;

     s->bios_offset = 0;
     s->bios_size = 0;
     s->sr_index = 0;