From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NZiCo-0001xX-KX for qemu-devel@nongnu.org; Tue, 26 Jan 2010 04:59:30 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NZiCl-0001v4-0u for qemu-devel@nongnu.org; Tue, 26 Jan 2010 04:59:30 -0500 Received: from [199.232.76.173] (port=44105 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NZiCk-0001ux-Qa for qemu-devel@nongnu.org; Tue, 26 Jan 2010 04:59:26 -0500 Received: from cantor.suse.de ([195.135.220.2]:59153 helo=mx1.suse.de) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NZiCk-0003at-62 for qemu-devel@nongnu.org; Tue, 26 Jan 2010 04:59:26 -0500 Mime-Version: 1.0 (Apple Message framework v1077) Content-Type: text/plain; charset=us-ascii From: Alexander Graf In-Reply-To: <1264498913-23655-1-git-send-email-sheng@linux.intel.com> Date: Tue, 26 Jan 2010 10:59:17 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: <366919FC-E282-4A23-8D9C-595D8583C97F@suse.de> References: <1264498913-23655-1-git-send-email-sheng@linux.intel.com> Subject: [Qemu-devel] Re: [PATCH v2][uqmaster] kvm: Flush coalesced MMIO buffer periodly List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Sheng Yang Cc: qemu-devel@nongnu.org, Marcelo Tosatti , Avi Kivity , kvm@vger.kernel.org On 26.01.2010, at 10:41, Sheng Yang wrote: > The default action of coalesced MMIO is, cache the writing in buffer, = until: > 1. The buffer is full. > 2. Or the exit to QEmu due to other reasons. >=20 > But this would result in a very late writing in some condition. > 1. The each time write to MMIO content is small. > 2. The writing interval is big. > 3. No need for input or accessing other devices frequently. >=20 > This issue was observed in a experimental embbed system. The test = image > simply print "test" every 1 seconds. The output in QEmu meets = expectation, > but the output in KVM is delayed for seconds. >=20 > Per Avi's suggestion, I hooked flushing coalesced MMIO buffer in VGA = update > handler. By this way, We don't need vcpu explicit exit to QEmu to > handle this issue. >=20 > Signed-off-by: Sheng Yang > --- > cpu-all.h | 2 ++ > exec.c | 6 ++++++ > kvm-all.c | 21 +++++++++++++-------- > kvm.h | 1 + > vl.c | 2 ++ > 5 files changed, 24 insertions(+), 8 deletions(-) >=20 > diff --git a/cpu-all.h b/cpu-all.h > index 57b69f8..1ccc9a8 100644 > --- a/cpu-all.h > +++ b/cpu-all.h > @@ -915,6 +915,8 @@ void = qemu_register_coalesced_mmio(target_phys_addr_t addr, ram_addr_t size); >=20 > void qemu_unregister_coalesced_mmio(target_phys_addr_t addr, = ram_addr_t size); >=20 > +void qemu_flush_coalesced_mmio_buffer(void); > + > /*******************************************/ > /* host CPU ticks (if available) */ >=20 > diff --git a/exec.c b/exec.c > index 1190591..6875370 100644 > --- a/exec.c > +++ b/exec.c > @@ -2406,6 +2406,12 @@ void = qemu_unregister_coalesced_mmio(target_phys_addr_t addr, ram_addr_t size) > kvm_uncoalesce_mmio_region(addr, size); > } >=20 > +void qemu_flush_coalesced_mmio_buffer(void) > +{ > + if (kvm_enabled()) > + kvm_flush_coalesced_mmio_buffer(); > +} > + > ram_addr_t qemu_ram_alloc(ram_addr_t size) > { > RAMBlock *new_block; > diff --git a/kvm-all.c b/kvm-all.c > index 15ec38e..889fc42 100644 > --- a/kvm-all.c > +++ b/kvm-all.c > @@ -59,6 +59,7 @@ struct KVMState > int vmfd; > int regs_modified; > int coalesced_mmio; > + struct kvm_coalesced_mmio_ring *coalesced_mmio_ring; I guess this needs to be guarded by an #ifdef? Alex=