From patchwork Thu May 9 00:40:22 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: pingfan liu X-Patchwork-Id: 242689 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 229EE2C00ED for ; Thu, 9 May 2013 10:41:47 +1000 (EST) Received: from localhost ([::1]:57845 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UaEvZ-0006uh-Cv for incoming@patchwork.ozlabs.org; Wed, 08 May 2013 20:41:45 -0400 Received: from eggs.gnu.org ([208.118.235.92]:51165) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UaEuX-0006BK-D9 for qemu-devel@nongnu.org; Wed, 08 May 2013 20:40:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UaEuW-0000gv-CO for qemu-devel@nongnu.org; Wed, 08 May 2013 20:40:41 -0400 Received: from mail-pd0-f172.google.com ([209.85.192.172]:39408) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UaEuW-0000gj-3b for qemu-devel@nongnu.org; Wed, 08 May 2013 20:40:40 -0400 Received: by mail-pd0-f172.google.com with SMTP id 6so1592040pdd.3 for ; Wed, 08 May 2013 17:40:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=PEzDl38qFXLnnlhLN9CXSTeyLHTIhIYQAe1x0tp42tA=; b=Z1fqH+B0KjiQ8IdrrWYd72yJ6ubRgNDc+jqJNfye3axDw5y/mr8rZOPCBJhT68hsb8 HZcHdUmz8o/VUNuac9D7hO9QjqK6A/555FP87uY7EJjJ0y8iEg7ZT+fhkOxaSkrCkDz6 pYr2kpeTLHtL4WamPiRONVDaTOCmHOm2+jfbgHl1VUi20ABqX/MokY2XM2x98dAucmQ8 +NVDgySPs6Z9GcIJ8GzcbvA3yEDZQuUPDPbZnwWtnJJwb8jIhZsWUV/6k9SoO1xLJ+L9 AhPMZdBMrecU8Vg9bDxqnxrc+o4C/3fivPtfvFR+CLx4omAAKc51yAJwOwO4xL2dZwhe RgPA== X-Received: by 10.66.222.228 with SMTP id qp4mr10569026pac.113.1368060039219; Wed, 08 May 2013 17:40:39 -0700 (PDT) Received: from localhost ([111.194.213.199]) by mx.google.com with ESMTPSA id br2sm649020pbc.46.2013.05.08.17.40.35 for (version=TLSv1.1 cipher=RC4-SHA bits=128/128); Wed, 08 May 2013 17:40:38 -0700 (PDT) From: Liu Ping Fan To: qemu-devel@nongnu.org Date: Thu, 9 May 2013 08:40:22 +0800 Message-Id: <1368060022-16911-2-git-send-email-qemulist@gmail.com> X-Mailer: git-send-email 1.7.4.4 In-Reply-To: <1368060022-16911-1-git-send-email-qemulist@gmail.com> References: <1368060022-16911-1-git-send-email-qemulist@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.192.172 Cc: Peter Maydell , Anthony Liguori , "Michael S. Tsirkin" , Jan Kiszka , Stefan Hajnoczi , Paolo Bonzini Subject: [Qemu-devel] [PATCH 2/2] mem: highlight the listener's priority as enum X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Liu Ping Fan It will make the priority prominent, when new listener added. All the priority's value are kept unchanged, except for vhost and hostmem.(Changes introduced by prev patch) Signed-off-by: Liu Ping Fan --- exec.c | 4 ++-- hw/virtio/dataplane/hostmem.c | 2 +- hw/virtio/vhost.c | 2 +- include/exec/memory.h | 12 +++++++++++- kvm-all.c | 4 ++-- xen-all.c | 2 +- 6 files changed, 18 insertions(+), 8 deletions(-) diff --git a/exec.c b/exec.c index 19725db..aef0349 100644 --- a/exec.c +++ b/exec.c @@ -1766,13 +1766,13 @@ static MemoryListener core_memory_listener = { .begin = core_begin, .log_global_start = core_log_global_start, .log_global_stop = core_log_global_stop, - .priority = 1, + .priority = PRI_CORE, }; static MemoryListener io_memory_listener = { .region_add = io_region_add, .region_del = io_region_del, - .priority = 0, + .priority = PRI_DEFAULT, }; static MemoryListener tcg_memory_listener = { diff --git a/hw/virtio/dataplane/hostmem.c b/hw/virtio/dataplane/hostmem.c index 67cbce1..6be182c 100644 --- a/hw/virtio/dataplane/hostmem.c +++ b/hw/virtio/dataplane/hostmem.c @@ -158,7 +158,7 @@ void hostmem_init(HostMem *hostmem) .eventfd_del = hostmem_listener_eventfd_dummy, .coalesced_mmio_add = hostmem_listener_coalesced_mmio_dummy, .coalesced_mmio_del = hostmem_listener_coalesced_mmio_dummy, - .priority = 9, + .priority = PRI_VRING, }; memory_listener_register(&hostmem->listener, &address_space_memory); diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index 91c313b..df6d8c5 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -856,7 +856,7 @@ int vhost_dev_init(struct vhost_dev *hdev, int devfd, const char *devpath, .log_global_stop = vhost_log_global_stop, .eventfd_add = vhost_eventfd_add, .eventfd_del = vhost_eventfd_del, - .priority = 9 + .priority = PRI_VRING }; hdev->mem = g_malloc0(offsetof(struct vhost_memory, regions)); hdev->n_mem_sections = 0; diff --git a/include/exec/memory.h b/include/exec/memory.h index 9e88320..77e0d40 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -192,6 +192,16 @@ struct MemoryRegionSection { typedef struct MemoryListener MemoryListener; +/* The list of priority, ex, vhost should have higher priority (less num) than + * kvm, ie PRI_VRING < PRI_HYPV + */ +typedef enum { + PRI_DEFAULT = 0, + PRI_CORE = 1, + PRI_VRING = 9, + PRI_HYPERV = 10, +} MemListenerPriority; + /** * MemoryListener: callbacks structure for updates to the physical memory map * @@ -218,7 +228,7 @@ struct MemoryListener { void (*coalesced_mmio_del)(MemoryListener *listener, MemoryRegionSection *section, hwaddr addr, hwaddr len); /* Lower = earlier (during add), later (during del) */ - unsigned priority; + MemListenerPriority priority; AddressSpace *address_space_filter; QTAILQ_ENTRY(MemoryListener) link; }; diff --git a/kvm-all.c b/kvm-all.c index 3a31602..2794dee 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -875,13 +875,13 @@ static MemoryListener kvm_memory_listener = { .eventfd_del = kvm_mem_ioeventfd_del, .coalesced_mmio_add = kvm_coalesce_mmio_region, .coalesced_mmio_del = kvm_uncoalesce_mmio_region, - .priority = 10, + .priority = PRI_HYPERV, }; static MemoryListener kvm_io_listener = { .eventfd_add = kvm_io_ioeventfd_add, .eventfd_del = kvm_io_ioeventfd_del, - .priority = 10, + .priority = PRI_HYPERV, }; static void kvm_handle_interrupt(CPUState *cpu, int mask) diff --git a/xen-all.c b/xen-all.c index 539a154..7062420 100644 --- a/xen-all.c +++ b/xen-all.c @@ -562,7 +562,7 @@ static MemoryListener xen_memory_listener = { .log_sync = xen_log_sync, .log_global_start = xen_log_global_start, .log_global_stop = xen_log_global_stop, - .priority = 10, + .priority = PRI_HYPERV, }; void qmp_xen_set_global_dirty_log(bool enable, Error **errp)