qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] Re: [PATCH v2][uqmaster] kvm: Flush coalesced MMIO buffer p


From: Alexander Graf
Subject: [Qemu-devel] Re: [PATCH v2][uqmaster] kvm: Flush coalesced MMIO buffer periodly
Date: Tue, 26 Jan 2010 10:59:17 +0100

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.
> 
> 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.
> 
> 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.
> 
> 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.
> 
> Signed-off-by: Sheng Yang <address@hidden>
> ---
> cpu-all.h |    2 ++
> exec.c    |    6 ++++++
> kvm-all.c |   21 +++++++++++++--------
> kvm.h     |    1 +
> vl.c      |    2 ++
> 5 files changed, 24 insertions(+), 8 deletions(-)
> 
> 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);
> 
> void qemu_unregister_coalesced_mmio(target_phys_addr_t addr, ram_addr_t size);
> 
> +void qemu_flush_coalesced_mmio_buffer(void);
> +
> /*******************************************/
> /* host CPU ticks (if available) */
> 
> 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);
> }
> 
> +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



reply via email to

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