[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 3/9] memory: Add global-locking property to memo
From: |
Fam Zheng |
Subject: |
Re: [Qemu-devel] [PATCH 3/9] memory: Add global-locking property to memory regions |
Date: |
Tue, 23 Jun 2015 16:51:21 +0800 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
On Thu, 06/18 18:47, Paolo Bonzini wrote:
> From: Jan Kiszka <address@hidden>
>
> This introduces the memory region property "global_locking". It is true
> by default. By setting it to false, a device model can request BQL-free
> dispatching of region accesses to its r/w handlers. The actual BQL
> break-up will be provided in a separate patch.
>
> Signed-off-by: Jan Kiszka <address@hidden>
> Signed-off-by: Paolo Bonzini <address@hidden>
> ---
> include/exec/memory.h | 26 ++++++++++++++++++++++++++
> memory.c | 11 +++++++++++
> 2 files changed, 37 insertions(+)
>
> diff --git a/include/exec/memory.h b/include/exec/memory.h
> index b61c84f..61791f8 100644
> --- a/include/exec/memory.h
> +++ b/include/exec/memory.h
> @@ -180,6 +180,7 @@ struct MemoryRegion {
> bool rom_device;
> bool warning_printed; /* For reservations */
> bool flush_coalesced_mmio;
> + bool global_locking;
> MemoryRegion *alias;
> hwaddr alias_offset;
> int32_t priority;
> @@ -812,6 +813,31 @@ void memory_region_set_flush_coalesced(MemoryRegion *mr);
> void memory_region_clear_flush_coalesced(MemoryRegion *mr);
>
> /**
> + * memory_region_set_global_locking: Declares the access processing requires
> + * QEMU's global lock.
> + *
> + * When this is invoked, access to this memory regions will be processed
> while
> + * holding the global lock of QEMU. This is the default behavior of memory
> + * regions.
> + *
> + * @mr: the memory region to be updated.
> + */
> +void memory_region_set_global_locking(MemoryRegion *mr);
> +
> +/**
> + * memory_region_clear_global_locking: Declares that access processing does
> + * not depend on the QEMU global lock.
> + *
> + * By clearing this property, accesses to the memory region will be processed
> + * outside of QEMU's global lock (unless the lock is held on when issuing the
> + * access request). In this case, the device model implementing the access
> + * handlers is responsible for synchronization of concurrency.
> + *
> + * @mr: the memory region to be updated.
> + */
> +void memory_region_clear_global_locking(MemoryRegion *mr);
> +
> +/**
> * memory_region_add_eventfd: Request an eventfd to be triggered when a word
> * is written to a location.
> *
> diff --git a/memory.c b/memory.c
> index 03c536b..6b77354 100644
> --- a/memory.c
> +++ b/memory.c
> @@ -1004,6 +1004,7 @@ static void memory_region_initfn(Object *obj)
> mr->ops = &unassigned_mem_ops;
> mr->enabled = true;
> mr->romd_mode = true;
> + mr->global_locking = true;
> mr->destructor = memory_region_destructor_none;
> QTAILQ_INIT(&mr->subregions);
> QTAILQ_INIT(&mr->coalesced);
> @@ -1627,6 +1628,16 @@ void memory_region_clear_flush_coalesced(MemoryRegion
> *mr)
> }
> }
>
> +void memory_region_set_global_locking(MemoryRegion *mr)
> +{
> + mr->global_locking = true;
> +}
> +
> +void memory_region_clear_global_locking(MemoryRegion *mr)
> +{
> + mr->global_locking = false;
> +}
> +
> void memory_region_add_eventfd(MemoryRegion *mr,
> hwaddr addr,
> unsigned size,
> --
> 1.8.3.1
>
>
>
Reviewed-by: Fam Zheng <address@hidden>
[Qemu-devel] [PATCH 6/9] kvm: First step to push iothread lock out of inner run loop, Paolo Bonzini, 2015/06/18