From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1OBCJZ-00071V-A7 for qemu-devel@nongnu.org; Sun, 09 May 2010 15:37:25 -0400 Received: from [140.186.70.92] (port=40027 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OBCJY-00071J-3Z for qemu-devel@nongnu.org; Sun, 09 May 2010 15:37:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OBCJW-00070g-3O for qemu-devel@nongnu.org; Sun, 09 May 2010 15:37:23 -0400 Received: from chello084112167138.7.11.vie.surfer.at ([84.112.167.138]:33120 helo=wiesinger.com) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OBCJV-0006tF-Hx for qemu-devel@nongnu.org; Sun, 09 May 2010 15:37:22 -0400 Date: Sun, 9 May 2010 21:35:22 +0200 (CEST) From: Gerhard Wiesinger Subject: Re: [Qemu-devel] Re: QEMU-KVM and video performance In-Reply-To: <4BCFF4B5.7010302@redhat.com> Message-ID: References: <4BCEBE5C.4020404@redhat.com> <20100421183357.GK27575@shareable.org> <4BCF6699.2060201@redhat.com> <4BCFF4B5.7010302@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 Thu, 22 Apr 2010, Avi Kivity wrote: > On 04/22/2010 09:04 AM, Gerhard Wiesinger wrote: >> On Wed, 21 Apr 2010, Avi Kivity wrote: >> >>> On 04/21/2010 09:50 PM, Gerhard Wiesinger wrote: >>>>>> I don't think changing VGA window is a problem because there are >>>>>> 500.000-1Mio changes/s possible. >>>>> >>>>> 1MB/s, 500k-1M changes/s.... Coincidence? Is it taking a page fault >>>>> or trap on every write? >>>> >>>> >>>> To clarify: >>>> Memory Performance writing to segmen A000 is about 1MB/st. >>> >>> That indicates a fault every write (assuming 8-16 bit writes). If you're >>> using 256 color vga and not switching banks, this indicates a bug. >>> >> >> Yes, 256 color VGA and no bank switches involved. >> >>>> Calling INT 10 set/get window function with different windows (e.g. >>>> toggling between window page 0 and 1) is about 500.000 to 1Mio function >>>> calls per second. >>> >>> That's suprisingly fast. I'd expect 100-200k/sec. >>> >> >> Sorry, I mixed up the numbers: >> 1.) QEMU-KVM: ~111k >> 2.) QEMU only: 500k-1Mio >> >>> Please run kvm_stat and report output for both tests to confirm. >>> >> >> See below. 2nd column is per second statistic when running the test. > > efer_reload 0 0 > exits 18470836 554582 > fpu_reload 2147833 3469 > halt_exits 2083 0 > halt_wakeup 2047 0 > host_state_reload 2148186 3470 > hypercalls 0 0 > insn_emulation 7688203 554244 > > This indicates that kvm is emulating instead of direct mapping. That's > probably a bug. If you fix it, performance will increase dramatically. Where can I start here? Any ideas how to? One of my ideas: Move hw/vga.c functions vga_mem_readb vga_mem_readw vga_mem_readl vga_mem_writeb vga_mem_writew vga_mem_writel to KVM to avoid switching from KVM to QEMU (I can write C code even kernel but I'm not comfortable with KVM). Howto? >>>> To get real good VGA performance both parameters should be: >>>> About >50MB/s for writes to segment A000 >>>> ~500.000 bank switches per second. >>> >>> First should be doable easily, second is borderline. >>> >>>> I think this is very easy to distingish: >>>> 1.) VGA Segment A000 is legacy and should be handled through QEMU and not >>>> through KVM (because it is much more faster). Also 16 color modes should >>>> be fast enough there. >>>> 2.) All other flat PCI memory accesses should be handled through KVM >>>> (there is a specialized driver loaded for that PCI device in the non >>>> legacy OS). >>>> >>>> Is that easily possible? >>> >>> No. Code can run in either qemu or kvm, not both. You can switch between >>> them based on access statistics (early versions of qemu-kvm did that, >>> without the statistics part), but this isn't trivial. >> >> Hmmm. Ok, 2 different opinions about the memory write performance: >> Easily or not possible? > > Switching between tcg and kvm is hard, but not needed. For 256 color modes, > direct map is possible and should yield good performance. Bank switching can > be improved perhaps 3x, but will never be fast. Where can I start for KVM performance for the bank switching (256 color mode)? (e.g. BIOS writes to VGA window I/O port to switch the bank) Any ideas how to improve (architecture for the change)? Thnx and sorry for long delay, was busy. Ciao, Gerhard -- http://www.wiesinger.com/