[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 23/30] exec: move listener from AddressSpaceDisp
From: |
Jan Kiszka |
Subject: |
Re: [Qemu-devel] [PATCH 23/30] exec: move listener from AddressSpaceDispatch to AddressSpace |
Date: |
Tue, 02 Jul 2013 16:41:14 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666 |
On 2013-06-28 20:26, Paolo Bonzini wrote:
> This will help having two copies of AddressSpaceDispatch during the
> recreation of the radix tree (one being built, and one that is complete
> and accessed under RCU). We do not want to have to unregister and
> re-register the listener.
>
> Signed-off-by: Paolo Bonzini <address@hidden>
> ---
> exec.c | 17 +++++++++--------
> include/exec/memory.h | 2 ++
> 2 files changed, 11 insertions(+), 8 deletions(-)
>
> diff --git a/exec.c b/exec.c
> index f138e56..dffdf23 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -99,7 +99,6 @@ struct AddressSpaceDispatch {
> * The bottom level has pointers to MemoryRegionSections.
> */
> PhysPageEntry phys_map;
> - MemoryListener listener;
> AddressSpace *as;
> };
>
> @@ -855,7 +854,8 @@ static void register_multipage(AddressSpaceDispatch *d,
>
> static void mem_add(MemoryListener *listener, MemoryRegionSection *section)
> {
> - AddressSpaceDispatch *d = container_of(listener, AddressSpaceDispatch,
> listener);
> + AddressSpace *as = container_of(listener, AddressSpace,
> dispatch_listener);
> + AddressSpaceDispatch *d = as->dispatch;
> MemoryRegionSection now = *section, remain = *section;
> Int128 page_size = int128_make64(TARGET_PAGE_SIZE);
>
> @@ -1717,7 +1717,8 @@ static void io_mem_init(void)
>
> static void mem_begin(MemoryListener *listener)
> {
> - AddressSpaceDispatch *d = container_of(listener, AddressSpaceDispatch,
> listener);
> + AddressSpace *as = container_of(listener, AddressSpace,
> dispatch_listener);
> + AddressSpaceDispatch *d = as->dispatch;
>
> d->phys_map.ptr = PHYS_MAP_NODE_NIL;
> }
> @@ -1786,22 +1787,22 @@ void address_space_init_dispatch(AddressSpace *as)
> AddressSpaceDispatch *d = g_new(AddressSpaceDispatch, 1);
>
> d->phys_map = (PhysPageEntry) { .ptr = PHYS_MAP_NODE_NIL, .is_leaf = 0
> };
> - d->listener = (MemoryListener) {
> + d->as = as;
> + as->dispatch = d;
> + as->dispatch_listener = (MemoryListener) {
> .begin = mem_begin,
> .region_add = mem_add,
> .region_nop = mem_add,
> .priority = 0,
> };
> - d->as = as;
> - as->dispatch = d;
> - memory_listener_register(&d->listener, as);
> + memory_listener_register(&as->dispatch_listener, as);
> }
>
> void address_space_destroy_dispatch(AddressSpace *as)
> {
> AddressSpaceDispatch *d = as->dispatch;
You could save this line, but only if you need to touch the patch for
some other reason.
>
> - memory_listener_unregister(&d->listener);
> + memory_listener_unregister(&as->dispatch_listener);
> g_free(d);
> as->dispatch = NULL;
> }
> diff --git a/include/exec/memory.h b/include/exec/memory.h
> index 913ac45..1cd1f50 100644
> --- a/include/exec/memory.h
> +++ b/include/exec/memory.h
> @@ -212,6 +212,8 @@ struct AddressSpace {
> int ioeventfd_nb;
> struct MemoryRegionIoeventfd *ioeventfds;
> struct AddressSpaceDispatch *dispatch;
> + MemoryListener dispatch_listener;
> +
> QTAILQ_ENTRY(AddressSpace) address_spaces_link;
> };
>
>
Reviewed-by: Jan Kiszka <address@hidden>
Jan
--
Siemens AG, Corporate Technology, CT RTC ITP SES-DE
Corporate Competence Center Embedded Linux
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [Qemu-devel] [PATCH 23/30] exec: move listener from AddressSpaceDispatch to AddressSpace,
Jan Kiszka <=