From nobody Sun Feb 8 15:08:01 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1629164335906208.9324045487557; Mon, 16 Aug 2021 18:38:55 -0700 (PDT) Received: from localhost ([::1]:54232 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mFo46-0001cm-MT for importer@patchew.org; Mon, 16 Aug 2021 21:38:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35086) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mFo1L-0007ED-A1 for qemu-devel@nongnu.org; Mon, 16 Aug 2021 21:36:03 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:51386) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mFo1J-0001Mh-6r for qemu-devel@nongnu.org; Mon, 16 Aug 2021 21:36:03 -0400 Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-483-hMTeL5b0OSKOmFOMVWA4bQ-1; Mon, 16 Aug 2021 21:35:59 -0400 Received: by mail-qv1-f72.google.com with SMTP id a3-20020a0cb3430000b02903432d100232so14225311qvf.16 for ; Mon, 16 Aug 2021 18:35:59 -0700 (PDT) Received: from t490s.redhat.com ([2607:fea8:56a3:500::d413]) by smtp.gmail.com with ESMTPSA id b15sm391867qka.107.2021.08.16.18.35.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Aug 2021 18:35:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629164160; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CyN5t6FRrtEr1W6zSY24aiaw29UMXAfpZzaauaF0otA=; b=LAV1wh/e5DgfDrj5nVLg6fAZfWiow1XUbgKs94PHCiOAjul5qqhKLN7M80GlguFRT6M8xj Swd5upJS0UP7g1su+/btXH/DSk2cb0hLYPxwyIfWP4/yPKFjNvII/Z6v7AeejYanR/oCVp WY93Mc0YqaGjeeeLYeVVJJbvLmij5DQ= X-MC-Unique: hMTeL5b0OSKOmFOMVWA4bQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CyN5t6FRrtEr1W6zSY24aiaw29UMXAfpZzaauaF0otA=; b=FwCz75LfJP93jUp8X1W7EOetpKX7TMXfNf02XyVShAgS42BTLUKEmqHU9AXcKTW0C4 XMh4s30DV/JX4cXxIUdYQV06KpEvxOA3kalDxa07wDOqtchAG70wTJuzcnCeK5cKiTt2 A2dYUX3cB7pR/OdrHu5Nj/ft9VD3CQUVmQDJlQwU2iwaHnCjtpeRu2CIZYqPKJW+v5BC HkQlMRyOBGdlf6E6MPDqpLggNKjB84m0c2S1uP18lrOFsXJ4m6OQMz7oE5Do5YuReekn +an4TWZXtYZJTzx+FFGhGofiBJyz/LH8jDuxAnsfr8xOOdN10IPriEz+T0UJgYXR5u+u kz4w== X-Gm-Message-State: AOAM5337Q0G6D3uF7NnZVcD/tzb89ZkJeZROORUfsIA+txDZf0w0VeL/ 4idjprXfvTbTV2yHIAFADvhS9G9yPhQvs5tHXQ8oZ3dK8Tg7e7iopjNeDXbMjJY51E8g+qHdow6 gUmII2lvlPg8Lkc/GgNsXpH636brUgI22mOZQHLLQq4CxsAkNXZcQD5bNeT4q4wk4 X-Received: by 2002:a05:620a:f91:: with SMTP id b17mr1346816qkn.107.1629164157796; Mon, 16 Aug 2021 18:35:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx2FFm4CJtYCZY/sMsJDi3maENGPCJaVkzVkQ2q6M9h+uTc/Nvms9tVU48eQo1QHD2n9dZ6Cg== X-Received: by 2002:a05:620a:f91:: with SMTP id b17mr1346793qkn.107.1629164157469; Mon, 16 Aug 2021 18:35:57 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Subject: [PATCH RESEND 1/2] memory: Name all the memory listeners Date: Mon, 16 Aug 2021 21:35:52 -0400 Message-Id: <20210817013553.30584-2-peterx@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210817013553.30584-1-peterx@redhat.com> References: <20210817013553.30584-1-peterx@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=peterx@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.698, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Dr . David Alan Gilbert" , peterx@redhat.com, David Hildenbrand Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1629164336344100003 Content-Type: text/plain; charset="utf-8" Provide a name field for all the memory listeners. It can be used to ident= ify which memory listener is which. Signed-off-by: Peter Xu Reviewed-by: David Hildenbrand --- accel/hvf/hvf-accel-ops.c | 1 + accel/kvm/kvm-all.c | 7 +++++-- hw/i386/xen/xen-hvm.c | 2 ++ hw/intc/openpic_kvm.c | 1 + hw/remote/proxy-memory-listener.c | 1 + hw/vfio/common.c | 1 + hw/vfio/spapr.c | 1 + hw/virtio/vhost-vdpa.c | 1 + hw/virtio/vhost.c | 2 ++ hw/virtio/virtio.c | 1 + hw/xen/xen_pt.c | 2 ++ include/exec/memory.h | 8 ++++++++ include/sysemu/kvm_int.h | 2 +- softmmu/physmem.c | 1 + target/arm/kvm.c | 1 + target/i386/hax/hax-mem.c | 1 + target/i386/kvm/kvm.c | 2 +- target/i386/nvmm/nvmm-all.c | 1 + target/i386/whpx/whpx-all.c | 1 + 19 files changed, 33 insertions(+), 4 deletions(-) diff --git a/accel/hvf/hvf-accel-ops.c b/accel/hvf/hvf-accel-ops.c index d1691be989..ecd48337b4 100644 --- a/accel/hvf/hvf-accel-ops.c +++ b/accel/hvf/hvf-accel-ops.c @@ -291,6 +291,7 @@ static void hvf_region_del(MemoryListener *listener, } =20 static MemoryListener hvf_memory_listener =3D { + .name =3D "hvf", .priority =3D 10, .region_add =3D hvf_region_add, .region_del =3D hvf_region_del, diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index 0125c17edb..3d6f44cb4d 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -1129,6 +1129,7 @@ static void kvm_coalesce_pio_del(MemoryListener *list= ener, } =20 static MemoryListener kvm_coalesced_pio_listener =3D { + .name =3D "kvm-coalesced-pio", .coalesced_io_add =3D kvm_coalesce_pio_add, .coalesced_io_del =3D kvm_coalesce_pio_del, }; @@ -1633,7 +1634,7 @@ static void kvm_io_ioeventfd_del(MemoryListener *list= ener, } =20 void kvm_memory_listener_register(KVMState *s, KVMMemoryListener *kml, - AddressSpace *as, int as_id) + AddressSpace *as, int as_id, const char = *name) { int i; =20 @@ -1649,6 +1650,7 @@ void kvm_memory_listener_register(KVMState *s, KVMMem= oryListener *kml, kml->listener.log_start =3D kvm_log_start; kml->listener.log_stop =3D kvm_log_stop; kml->listener.priority =3D 10; + kml->listener.name =3D name; =20 if (s->kvm_dirty_ring_size) { kml->listener.log_sync_global =3D kvm_log_sync_global; @@ -1669,6 +1671,7 @@ void kvm_memory_listener_register(KVMState *s, KVMMem= oryListener *kml, } =20 static MemoryListener kvm_io_listener =3D { + .name =3D "kvm-io", .eventfd_add =3D kvm_io_ioeventfd_add, .eventfd_del =3D kvm_io_ioeventfd_del, .priority =3D 10, @@ -2579,7 +2582,7 @@ static int kvm_init(MachineState *ms) s->memory_listener.listener.coalesced_io_del =3D kvm_uncoalesce_mmio_r= egion; =20 kvm_memory_listener_register(s, &s->memory_listener, - &address_space_memory, 0); + &address_space_memory, 0, "kvm-memory"); if (kvm_eventfds_allowed) { memory_listener_register(&kvm_io_listener, &address_space_io); diff --git a/hw/i386/xen/xen-hvm.c b/hw/i386/xen/xen-hvm.c index 9b432773f0..e3d3d5cf89 100644 --- a/hw/i386/xen/xen-hvm.c +++ b/hw/i386/xen/xen-hvm.c @@ -721,6 +721,7 @@ static void xen_log_global_stop(MemoryListener *listene= r) } =20 static MemoryListener xen_memory_listener =3D { + .name =3D "xen-memory", .region_add =3D xen_region_add, .region_del =3D xen_region_del, .log_start =3D xen_log_start, @@ -732,6 +733,7 @@ static MemoryListener xen_memory_listener =3D { }; =20 static MemoryListener xen_io_listener =3D { + .name =3D "xen-io", .region_add =3D xen_io_add, .region_del =3D xen_io_del, .priority =3D 10, diff --git a/hw/intc/openpic_kvm.c b/hw/intc/openpic_kvm.c index 21da680389..557dd0c2bf 100644 --- a/hw/intc/openpic_kvm.c +++ b/hw/intc/openpic_kvm.c @@ -234,6 +234,7 @@ static void kvm_openpic_realize(DeviceState *dev, Error= **errp) =20 opp->mem_listener.region_add =3D kvm_openpic_region_add; opp->mem_listener.region_del =3D kvm_openpic_region_del; + opp->mem_listener.name =3D "openpic-kvm"; memory_listener_register(&opp->mem_listener, &address_space_memory); =20 /* indicate pic capabilities */ diff --git a/hw/remote/proxy-memory-listener.c b/hw/remote/proxy-memory-lis= tener.c index 901dbf1357..882c9b4854 100644 --- a/hw/remote/proxy-memory-listener.c +++ b/hw/remote/proxy-memory-listener.c @@ -219,6 +219,7 @@ void proxy_memory_listener_configure(ProxyMemoryListene= r *proxy_listener, proxy_listener->listener.region_add =3D proxy_memory_listener_region_a= ddnop; proxy_listener->listener.region_nop =3D proxy_memory_listener_region_a= ddnop; proxy_listener->listener.priority =3D 10; + proxy_listener->listener.name =3D "proxy"; =20 memory_listener_register(&proxy_listener->listener, &address_space_memory); diff --git a/hw/vfio/common.c b/hw/vfio/common.c index 8728d4d5c2..3476170067 100644 --- a/hw/vfio/common.c +++ b/hw/vfio/common.c @@ -1434,6 +1434,7 @@ static void vfio_listener_log_sync(MemoryListener *li= stener, } =20 static const MemoryListener vfio_memory_listener =3D { + .name =3D "vfio", .region_add =3D vfio_listener_region_add, .region_del =3D vfio_listener_region_del, .log_global_start =3D vfio_listener_log_global_start, diff --git a/hw/vfio/spapr.c b/hw/vfio/spapr.c index ea3f70bd2f..04c6e67f8f 100644 --- a/hw/vfio/spapr.c +++ b/hw/vfio/spapr.c @@ -136,6 +136,7 @@ static void vfio_prereg_listener_region_del(MemoryListe= ner *listener, } =20 const MemoryListener vfio_prereg_listener =3D { + .name =3D "vfio-pre-reg", .region_add =3D vfio_prereg_listener_region_add, .region_del =3D vfio_prereg_listener_region_del, }; diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index 4fa414feea..1ee17b9e9b 100644 --- a/hw/virtio/vhost-vdpa.c +++ b/hw/virtio/vhost-vdpa.c @@ -234,6 +234,7 @@ static void vhost_vdpa_listener_region_del(MemoryListen= er *listener, * depends on the addnop(). */ static const MemoryListener vhost_vdpa_memory_listener =3D { + .name =3D "vhost-vdpa", .begin =3D vhost_vdpa_listener_begin, .commit =3D vhost_vdpa_listener_commit, .region_add =3D vhost_vdpa_listener_region_add, diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index e8f85a5d2d..6efcfc8faf 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -1341,6 +1341,7 @@ int vhost_dev_init(struct vhost_dev *hdev, void *opaq= ue, hdev->features =3D features; =20 hdev->memory_listener =3D (MemoryListener) { + .name =3D "vhost", .begin =3D vhost_begin, .commit =3D vhost_commit, .region_add =3D vhost_region_addnop, @@ -1356,6 +1357,7 @@ int vhost_dev_init(struct vhost_dev *hdev, void *opaq= ue, }; =20 hdev->iommu_listener =3D (MemoryListener) { + .name =3D "vhost-iommu", .region_add =3D vhost_iommu_region_add, .region_del =3D vhost_iommu_region_del, }; diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 874377f37a..0dbf968c9b 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -3671,6 +3671,7 @@ static void virtio_device_realize(DeviceState *dev, E= rror **errp) } =20 vdev->listener.commit =3D virtio_memory_listener_commit; + vdev->listener.name =3D "virtio"; memory_listener_register(&vdev->listener, vdev->dma_as); } =20 diff --git a/hw/xen/xen_pt.c b/hw/xen/xen_pt.c index 232482d65f..ca0a98187e 100644 --- a/hw/xen/xen_pt.c +++ b/hw/xen/xen_pt.c @@ -689,12 +689,14 @@ static void xen_pt_io_region_del(MemoryListener *l, M= emoryRegionSection *sec) } =20 static const MemoryListener xen_pt_memory_listener =3D { + .name =3D "xen-pt-mem", .region_add =3D xen_pt_region_add, .region_del =3D xen_pt_region_del, .priority =3D 10, }; =20 static const MemoryListener xen_pt_io_listener =3D { + .name =3D "xen-pt-io", .region_add =3D xen_pt_io_region_add, .region_del =3D xen_pt_io_region_del, .priority =3D 10, diff --git a/include/exec/memory.h b/include/exec/memory.h index c3d417d317..ac79fee250 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -979,6 +979,14 @@ struct MemoryListener { */ unsigned priority; =20 + /** + * @name: + * + * Name of the listener. It can be used in contexts where we'd like to + * identify one memory listener with the rest. + */ + const char *name; + /* private: */ AddressSpace *address_space; QTAILQ_ENTRY(MemoryListener) link; diff --git a/include/sysemu/kvm_int.h b/include/sysemu/kvm_int.h index c788452cd9..1f5487d9b7 100644 --- a/include/sysemu/kvm_int.h +++ b/include/sysemu/kvm_int.h @@ -37,7 +37,7 @@ typedef struct KVMMemoryListener { } KVMMemoryListener; =20 void kvm_memory_listener_register(KVMState *s, KVMMemoryListener *kml, - AddressSpace *as, int as_id); + AddressSpace *as, int as_id, const char = *name); =20 void kvm_set_max_memslot_size(hwaddr max_slot_size); =20 diff --git a/softmmu/physmem.c b/softmmu/physmem.c index 3c1912a1a0..3729f2537d 100644 --- a/softmmu/physmem.c +++ b/softmmu/physmem.c @@ -756,6 +756,7 @@ void cpu_address_space_init(CPUState *cpu, int asidx, if (tcg_enabled()) { newas->tcg_as_listener.log_global_after_sync =3D tcg_log_global_af= ter_sync; newas->tcg_as_listener.commit =3D tcg_commit; + newas->tcg_as_listener.name =3D "tcg"; memory_listener_register(&newas->tcg_as_listener, as); } } diff --git a/target/arm/kvm.c b/target/arm/kvm.c index d8381ba224..97ec88a587 100644 --- a/target/arm/kvm.c +++ b/target/arm/kvm.c @@ -330,6 +330,7 @@ static void kvm_arm_devlistener_del(MemoryListener *lis= tener, } =20 static MemoryListener devlistener =3D { + .name =3D "kvm-arm", .region_add =3D kvm_arm_devlistener_add, .region_del =3D kvm_arm_devlistener_del, }; diff --git a/target/i386/hax/hax-mem.c b/target/i386/hax/hax-mem.c index 8d44edbffd..a226d174d8 100644 --- a/target/i386/hax/hax-mem.c +++ b/target/i386/hax/hax-mem.c @@ -285,6 +285,7 @@ static void hax_log_sync(MemoryListener *listener, } =20 static MemoryListener hax_memory_listener =3D { + .name =3D "hax", .begin =3D hax_transaction_begin, .commit =3D hax_transaction_commit, .region_add =3D hax_region_add, diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index e69abe48e3..771b06b39e 100644 --- a/target/i386/kvm/kvm.c +++ b/target/i386/kvm/kvm.c @@ -2227,7 +2227,7 @@ static void register_smram_listener(Notifier *n, void= *unused) =20 address_space_init(&smram_address_space, &smram_as_root, "KVM-SMRAM"); kvm_memory_listener_register(kvm_state, &smram_listener, - &smram_address_space, 1); + &smram_address_space, 1, "kvm-smram"); } =20 int kvm_arch_init(MachineState *ms, KVMState *s) diff --git a/target/i386/nvmm/nvmm-all.c b/target/i386/nvmm/nvmm-all.c index dfa690d65d..5a3f6d69c3 100644 --- a/target/i386/nvmm/nvmm-all.c +++ b/target/i386/nvmm/nvmm-all.c @@ -1125,6 +1125,7 @@ nvmm_log_sync(MemoryListener *listener, MemoryRegionS= ection *section) } =20 static MemoryListener nvmm_memory_listener =3D { + .name =3D "nvmm", .begin =3D nvmm_transaction_begin, .commit =3D nvmm_transaction_commit, .region_add =3D nvmm_region_add, diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c index f832f286ac..ded096261f 100644 --- a/target/i386/whpx/whpx-all.c +++ b/target/i386/whpx/whpx-all.c @@ -1600,6 +1600,7 @@ static void whpx_log_sync(MemoryListener *listener, } =20 static MemoryListener whpx_memory_listener =3D { + .name =3D "whpx", .begin =3D whpx_transaction_begin, .commit =3D whpx_transaction_commit, .region_add =3D whpx_region_add, --=20 2.31.1 From nobody Sun Feb 8 15:08:01 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1629164333822533.4199039870898; Mon, 16 Aug 2021 18:38:53 -0700 (PDT) Received: from localhost ([::1]:54088 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mFo44-0001Ww-DE for importer@patchew.org; Mon, 16 Aug 2021 21:38:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35280) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mFo2U-0000A6-LH for qemu-devel@nongnu.org; Mon, 16 Aug 2021 21:37:15 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:40408) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mFo2T-00023q-5o for qemu-devel@nongnu.org; Mon, 16 Aug 2021 21:37:14 -0400 Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-136-Db5Cekk0Nsa5Tq9DUNv-og-1; Mon, 16 Aug 2021 21:37:09 -0400 Received: by mail-qt1-f199.google.com with SMTP id w19-20020ac87e930000b029025a2609eb04so10255191qtj.17 for ; Mon, 16 Aug 2021 18:37:09 -0700 (PDT) Received: from t490s.redhat.com ([2607:fea8:56a3:500::d413]) by smtp.gmail.com with ESMTPSA id 187sm417983qke.32.2021.08.16.18.37.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Aug 2021 18:37:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629164231; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aVYRVMH8WHd91fY4Jdw5KkQgHnOwpylUSfTTbNBS2vA=; b=Nd8J9uYW4dctVGClCZTki+9lZ3b+738a4B5DT6p0BGW5b/KiW2kx6x3I+scCiHwZUsOJN3 9ObFDM6LDri8z/dB3uPmTpNJIA/lPmLnEQOSm7IvZE8SLFbxjyf9Fi2/RqoZSjYPlbpBXk JVFT3Bth5QxyVbFI7MXL6MDwTmOojFw= X-MC-Unique: Db5Cekk0Nsa5Tq9DUNv-og-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=aVYRVMH8WHd91fY4Jdw5KkQgHnOwpylUSfTTbNBS2vA=; b=HNExn2culH7pcivI9sOm8CW134XRi7yaQEl/ibEC5D5nvQiezaVV8+XJv8cJPRVVJc hcOgOjXM40AU+nOlRrtmQ0tMXb+Ap5nRKZ/M+sHZEjOQfMOSDkKanLR69dyJSpRomq1k 3yeZ0ruChmOD+giol3iHLM6Kqd3YgOV+3EMjTo6UCF1SVRlzbbaXCa/BVxHKnlqsCBct yl/Ff5ZwQi96iHXkHhHWC8L8jfjgEIXne8vvHo7nEjqmfjCxvfSW7UR7Iw84h1UymD3B i+i84CA9lC/6gUfDucBs+Fc4+fTapBoekYO2RV32+qsjMqop5ipJnHG+8642XDzW2lNp IHKg== X-Gm-Message-State: AOAM530CZ2AO8Nmdu45bmVtZ25Dycdc+uFK8ON2rUHDIUsCuxXZ/zzZL mkKfeN+IASIo0tgA5dqYmcYJ1E6KDwvtsK3ebIKHg/6ahJodFFXzrIF7Uct35UbSo/94I4UwbhZ 49n2EXeIobFvD/Y73Rh50hs6iGYv/WL5zAkPdhZoxenkV0lSkT9FdXVerq8ivnqrj X-Received: by 2002:a05:622a:13c8:: with SMTP id p8mr878987qtk.238.1629164228472; Mon, 16 Aug 2021 18:37:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwUzqBGthsDEdgMMqtsdxwPLfDbJWFA8QiBYnwdSp6dilAIwE74G2476lE/VOH+NS2UQf5drQ== X-Received: by 2002:a05:622a:13c8:: with SMTP id p8mr878973qtk.238.1629164228201; Mon, 16 Aug 2021 18:37:08 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Subject: [PATCH RESEND 2/2] memory: Add tracepoint for dirty sync Date: Mon, 16 Aug 2021 21:37:06 -0400 Message-Id: <20210817013706.30986-1-peterx@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210817013553.30584-1-peterx@redhat.com> References: <20210817013553.30584-1-peterx@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=peterx@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.698, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Dr . David Alan Gilbert" , peterx@redhat.com, David Hildenbrand Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1629164334378100001 Content-Type: text/plain; charset="utf-8" Trace at memory_region_sync_dirty_bitmap() for log_sync() or global_log_syn= c() on memory regions. One trace line should suffice when it finishes, so as to estimate the time used for each log sync process. Signed-off-by: Peter Xu --- softmmu/memory.c | 2 ++ softmmu/trace-events | 1 + 2 files changed, 3 insertions(+) diff --git a/softmmu/memory.c b/softmmu/memory.c index bfedaf9c4d..f0c5817b97 100644 --- a/softmmu/memory.c +++ b/softmmu/memory.c @@ -2149,6 +2149,7 @@ static void memory_region_sync_dirty_bitmap(MemoryReg= ion *mr) } } flatview_unref(view); + trace_memory_region_sync_dirty(mr ? mr->name : "(all)", listen= er->name, 0); } else if (listener->log_sync_global) { /* * No matter whether MR is specified, what we can do here @@ -2156,6 +2157,7 @@ static void memory_region_sync_dirty_bitmap(MemoryReg= ion *mr) * sync in a finer granularity. */ listener->log_sync_global(listener); + trace_memory_region_sync_dirty(mr ? mr->name : "(all)", listen= er->name, 1); } } } diff --git a/softmmu/trace-events b/softmmu/trace-events index 7b278590a0..bf1469990e 100644 --- a/softmmu/trace-events +++ b/softmmu/trace-events @@ -15,6 +15,7 @@ memory_region_subpage_read(int cpu_index, void *mr, uint6= 4_t offset, uint64_t va memory_region_subpage_write(int cpu_index, void *mr, uint64_t offset, uint= 64_t value, unsigned size) "cpu %d mr %p offset 0x%"PRIx64" value 0x%"PRIx6= 4" size %u" memory_region_ram_device_read(int cpu_index, void *mr, uint64_t addr, uint= 64_t value, unsigned size) "cpu %d mr %p addr 0x%"PRIx64" value 0x%"PRIx64"= size %u" memory_region_ram_device_write(int cpu_index, void *mr, uint64_t addr, uin= t64_t value, unsigned size) "cpu %d mr %p addr 0x%"PRIx64" value 0x%"PRIx64= " size %u" +memory_region_sync_dirty(const char *mr, const char *listener, int global)= "mr '%s' listener '%s' synced (global=3D%d)" flatview_new(void *view, void *root) "%p (root %p)" flatview_destroy(void *view, void *root) "%p (root %p)" flatview_destroy_rcu(void *view, void *root) "%p (root %p)" --=20 2.31.1