Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O4p6d-0006UX-ML for qemu-devel@nongnu.org; Thu, 22 Apr 2010 01:37:43 -0400 Received: from [140.186.70.92] (port=60194 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O4p6b-0006Tb-FE for qemu-devel@nongnu.org; Thu, 22 Apr 2010 01:37:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O4p6Y-0006rD-Vr for qemu-devel@nongnu.org; Thu, 22 Apr 2010 01:37:39 -0400 Received: from chello084112167138.7.11.vie.surfer.at ([84.112.167.138]:49707 helo=wiesinger.com) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O4p6Y-0006r4-K3 for qemu-devel@nongnu.org; Thu, 22 Apr 2010 01:37:38 -0400 Date: Thu, 22 Apr 2010 07:37:11 +0200 (CEST) From: Gerhard Wiesinger Subject: Re: [Qemu-devel] Re: QEMU-KVM and video performance In-Reply-To: <4BCF64E9.4090909@redhat.com> Message-ID: References: <4BCEBE5C.4020404@redhat.com> <20100421100840.GF13114@shareable.org> <4BCED82C.9020702@redhat.com> <4BCF64E9.4090909@redhat.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Avi Kivity Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org 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)? >> >> 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? ... Where is the trap from KVM to QEMU? Thnx. Ciao, Gerhard -- http://www.wiesinger.com/