qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] Re: QEMU-KVM and video performance


From: Avi Kivity
Subject: Re: [Qemu-devel] Re: QEMU-KVM and video performance
Date: Thu, 22 Apr 2010 09:57:43 +0300
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100330 Fedora/3.0.4-1.fc12 Thunderbird/3.0.4

On 04/22/2010 08:37 AM, Gerhard Wiesinger wrote:
On Wed, 21 Apr 2010, Avi Kivity wrote:

On 04/21/2010 09:14 PM, Gerhard Wiesinger wrote:

Can you explain which code files/functions of KVM is involved in handling VGA memory window and page switching through the port write to the VGA window register (or is that part handled through QEMU), so a little bit architecture explaination would be nice?

qemu hw/vga.c and hw/cirrus_vga.c. Boring functions like vbe_ioport_write_data() and vga_ioport_write().


Yes, I was already in that code part and that are very simple functions as already explained and are therefore in QEMU only very fast. But I ment: How is the calling path from KVM guest OS to hw/vga.c for memory and I/O accesses, and which parts are done in hardware directly (to understand the speed gap and maybe to find a solution)?

The speed gap is mostly due to hardware constraints (it takes ~2000 cycles for an exit from guest mode, plus we need to switch a few msrs to get to userspace).

See vmx_vcpu_run(), the vmresume instruction is where an exit starts.



BTW: In which KVM code parts is decided where "direct code" or an "emulated device code" is used?


Same place. Look for calls to cpu_register_physical_memory(). If the last argument was obtained by a call to cpu_register_io_memory(), then all writes trap. Otherwise, it was obtained by qemu_ram_alloc() and writes will not trap (except the first write to a page in a 30ms window, used to note that the page is dirty and needs redrawing).

Ok, that finally ends in:
cpu_register_physical_memory_offset()
...
// 0.12.3
    if (kvm_enabled())
        kvm_set_phys_mem(start_addr, size, phys_offset);
// KVM
    cpu_notify_set_memory(start_addr, size, phys_offset);
...

I/O is always done through:
cpu_register_io_memory => cpu_register_io_memory_fixed
cpu_register_io_memory_fixed()
...
No call to KVM?

kvm_set_phys_mem() is a call to kvm.

...

Where is the trap from KVM to QEMU?

See kvm_cpu_exec().

--
error compiling committee.c: too many arguments to function





reply via email to

[Prev in Thread] Current Thread [Next in Thread]