qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL 0/8] Tracing patches
@ 2016-09-28 21:31 Stefan Hajnoczi
  2016-09-28 21:31 ` [Qemu-devel] [PULL 1/8] trace: move util/buffer.c trace points into correct file Stefan Hajnoczi
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: Stefan Hajnoczi @ 2016-09-28 21:31 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Stefan Hajnoczi

The following changes since commit 25930ed60aad49f1fdd7de05272317c86ce1275b:

  Merge remote-tracking branch 'remotes/ehabkost/tags/x86-pull-request' into staging (2016-09-27 23:10:12 +0100)

are available in the git repository at:

  git://github.com/stefanha/qemu.git tags/tracing-pull-request

for you to fetch changes up to 43e21e4907a009d87f6aef44663d9e1f7b181b8d:

  trace: Document the execution mode of guest events (2016-09-28 19:17:55 +0100)

----------------------------------------------------------------

----------------------------------------------------------------

Daniel P. Berrange (4):
  trace: move util/buffer.c trace points into correct file
  trace: move util/qemu-coroutine*.c trace points into correct file
  trace: move hw/mem/pc-dimm.c trace points into correct file
  trace: move hw/virtio/virtio-balloon.c trace points into correct file

Lluís Vilanova (4):
  trace: Properly initialize dynamic event states in hot-plugged vCPUs
  trace: Add event "guest_cpu_enter"
  trace: Add event "guest_cpu_reset"
  trace: Document the execution mode of guest events

 Makefile.objs          |  1 +
 bsd-user/main.c        |  1 -
 hw/i386/trace-events   |  4 ----
 hw/mem/trace-events    |  5 +++++
 hw/virtio/trace-events |  5 +++++
 io/trace-events        |  6 ------
 linux-user/main.c      |  1 -
 qom/cpu.c              |  6 ++++++
 stubs/trace-control.c  |  6 ++++++
 trace-events           | 33 ++++++++++++++++-----------------
 trace/control-target.c | 40 ++++++++++++++++++++++++++++++++++++++++
 trace/control.c        | 19 -------------------
 trace/control.h        | 19 ++++++++-----------
 util/trace-events      | 19 +++++++++++++++++++
 vl.c                   |  1 -
 15 files changed, 106 insertions(+), 60 deletions(-)
 create mode 100644 hw/mem/trace-events

-- 
2.7.4

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Qemu-devel] [PULL 1/8] trace: move util/buffer.c trace points into correct file
  2016-09-28 21:31 [Qemu-devel] [PULL 0/8] Tracing patches Stefan Hajnoczi
@ 2016-09-28 21:31 ` Stefan Hajnoczi
  2016-09-28 21:31 ` [Qemu-devel] [PULL 2/8] trace: move util/qemu-coroutine*.c " Stefan Hajnoczi
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Stefan Hajnoczi @ 2016-09-28 21:31 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Daniel P. Berrange, Stefan Hajnoczi

From: "Daniel P. Berrange" <berrange@redhat.com>

The trace points for util/buffer.c were mistakenly put
in the io/trace-events file, instead of util/trace-events
in

  commit 892bd32ea38bbe9709ff0b6db3053bdf06eec9fb
  Author: Daniel P. Berrange <berrange@redhat.com>
  Date:   Thu Jun 16 09:39:50 2016 +0100

    trace: split out trace events for io/ directory

    Move all trace-events for files in the io/ directory to

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 1473872624-23285-2-git-send-email-berrange@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 io/trace-events   | 6 ------
 util/trace-events | 6 ++++++
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/io/trace-events b/io/trace-events
index d064665..e31b596 100644
--- a/io/trace-events
+++ b/io/trace-events
@@ -1,11 +1,5 @@
 # See docs/tracing.txt for syntax documentation.
 
-# io/buffer.c
-buffer_resize(const char *buf, size_t olen, size_t len) "%s: old %zd, new %zd"
-buffer_move_empty(const char *buf, size_t len, const char *from) "%s: %zd bytes from %s"
-buffer_move(const char *buf, size_t len, const char *from) "%s: %zd bytes from %s"
-buffer_free(const char *buf, size_t len) "%s: capacity %zd"
-
 # io/task.c
 qio_task_new(void *task, void *source, void *func, void *opaque) "Task new task=%p source=%p func=%p opaque=%p"
 qio_task_complete(void *task) "Task complete task=%p"
diff --git a/util/trace-events b/util/trace-events
index 747e6ba..9114654 100644
--- a/util/trace-events
+++ b/util/trace-events
@@ -1,5 +1,11 @@
 # See docs/tracing.txt for syntax documentation.
 
+# util/buffer.c
+buffer_resize(const char *buf, size_t olen, size_t len) "%s: old %zd, new %zd"
+buffer_move_empty(const char *buf, size_t len, const char *from) "%s: %zd bytes from %s"
+buffer_move(const char *buf, size_t len, const char *from) "%s: %zd bytes from %s"
+buffer_free(const char *buf, size_t len) "%s: capacity %zd"
+
 # util/oslib-win32.c
 # util/oslib-posix.c
 qemu_memalign(size_t alignment, size_t size, void *ptr) "alignment %zu size %zu ptr %p"
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Qemu-devel] [PULL 2/8] trace: move util/qemu-coroutine*.c trace points into correct file
  2016-09-28 21:31 [Qemu-devel] [PULL 0/8] Tracing patches Stefan Hajnoczi
  2016-09-28 21:31 ` [Qemu-devel] [PULL 1/8] trace: move util/buffer.c trace points into correct file Stefan Hajnoczi
@ 2016-09-28 21:31 ` Stefan Hajnoczi
  2016-09-28 21:31 ` [Qemu-devel] [PULL 3/8] trace: move hw/mem/pc-dimm.c " Stefan Hajnoczi
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Stefan Hajnoczi @ 2016-09-28 21:31 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Daniel P. Berrange, Stefan Hajnoczi

From: "Daniel P. Berrange" <berrange@redhat.com>

The trace points for util/qemu-coroutine*.c were mistakenly left
in the top level trace-events file, instead of util/trace-events
in

  commit 492bb2dd651e780c0723580880acbedb5661e5ad
  Author: Daniel P. Berrange <berrange@redhat.com>
  Date:   Thu Jun 16 09:39:48 2016 +0100

    trace: split out trace events for util/ directory

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 1473872624-23285-3-git-send-email-berrange@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 trace-events      | 13 -------------
 util/trace-events | 13 +++++++++++++
 2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/trace-events b/trace-events
index 1cb9d37..55bef8c 100644
--- a/trace-events
+++ b/trace-events
@@ -83,19 +83,6 @@ xen_map_cache(uint64_t phys_addr) "want %#"PRIx64
 xen_remap_bucket(uint64_t index) "index %#"PRIx64
 xen_map_cache_return(void* ptr) "%p"
 
-# qemu-coroutine.c
-qemu_coroutine_enter(void *from, void *to, void *opaque) "from %p to %p opaque %p"
-qemu_coroutine_yield(void *from, void *to) "from %p to %p"
-qemu_coroutine_terminate(void *co) "self %p"
-
-# qemu-coroutine-lock.c
-qemu_co_queue_run_restart(void *co) "co %p"
-qemu_co_queue_next(void *nxt) "next %p"
-qemu_co_mutex_lock_entry(void *mutex, void *self) "mutex %p self %p"
-qemu_co_mutex_lock_return(void *mutex, void *self) "mutex %p self %p"
-qemu_co_mutex_unlock_entry(void *mutex, void *self) "mutex %p self %p"
-qemu_co_mutex_unlock_return(void *mutex, void *self) "mutex %p self %p"
-
 # monitor.c
 handle_qmp_command(void *mon, const char *cmd_name) "mon %p cmd_name \"%s\""
 monitor_protocol_event_handler(uint32_t event, void *qdict) "event=%d data=%p"
diff --git a/util/trace-events b/util/trace-events
index 9114654..ed06aee 100644
--- a/util/trace-events
+++ b/util/trace-events
@@ -6,6 +6,19 @@ buffer_move_empty(const char *buf, size_t len, const char *from) "%s: %zd bytes
 buffer_move(const char *buf, size_t len, const char *from) "%s: %zd bytes from %s"
 buffer_free(const char *buf, size_t len) "%s: capacity %zd"
 
+# util/qemu-coroutine.c
+qemu_coroutine_enter(void *from, void *to, void *opaque) "from %p to %p opaque %p"
+qemu_coroutine_yield(void *from, void *to) "from %p to %p"
+qemu_coroutine_terminate(void *co) "self %p"
+
+# util/qemu-coroutine-lock.c
+qemu_co_queue_run_restart(void *co) "co %p"
+qemu_co_queue_next(void *nxt) "next %p"
+qemu_co_mutex_lock_entry(void *mutex, void *self) "mutex %p self %p"
+qemu_co_mutex_lock_return(void *mutex, void *self) "mutex %p self %p"
+qemu_co_mutex_unlock_entry(void *mutex, void *self) "mutex %p self %p"
+qemu_co_mutex_unlock_return(void *mutex, void *self) "mutex %p self %p"
+
 # util/oslib-win32.c
 # util/oslib-posix.c
 qemu_memalign(size_t alignment, size_t size, void *ptr) "alignment %zu size %zu ptr %p"
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Qemu-devel] [PULL 3/8] trace: move hw/mem/pc-dimm.c trace points into correct file
  2016-09-28 21:31 [Qemu-devel] [PULL 0/8] Tracing patches Stefan Hajnoczi
  2016-09-28 21:31 ` [Qemu-devel] [PULL 1/8] trace: move util/buffer.c trace points into correct file Stefan Hajnoczi
  2016-09-28 21:31 ` [Qemu-devel] [PULL 2/8] trace: move util/qemu-coroutine*.c " Stefan Hajnoczi
@ 2016-09-28 21:31 ` Stefan Hajnoczi
  2016-09-28 21:31 ` [Qemu-devel] [PULL 4/8] trace: move hw/virtio/virtio-balloon.c " Stefan Hajnoczi
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Stefan Hajnoczi @ 2016-09-28 21:31 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Daniel P. Berrange, Stefan Hajnoczi

From: "Daniel P. Berrange" <berrange@redhat.com>

The trace points for hw/mem/pc-dimm.c were mistakenly put
in the hw/i386/trace-events file, instead of hw/mem/trace-events
in

  commit 5eb76e480b42206d3640c1aab8a376ba350f70bb
  Author: Daniel P. Berrange <berrange@redhat.com>
  Date:   Thu Jun 16 09:40:10 2016 +0100

    trace: split out trace events for hw/i386/ directory

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 1473872624-23285-4-git-send-email-berrange@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 Makefile.objs        | 1 +
 hw/i386/trace-events | 4 ----
 hw/mem/trace-events  | 5 +++++
 3 files changed, 6 insertions(+), 4 deletions(-)
 create mode 100644 hw/mem/trace-events

diff --git a/Makefile.objs b/Makefile.objs
index 7301544..571ac11 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -142,6 +142,7 @@ trace-events-y += hw/dma/trace-events
 trace-events-y += hw/sparc/trace-events
 trace-events-y += hw/sd/trace-events
 trace-events-y += hw/isa/trace-events
+trace-events-y += hw/mem/trace-events
 trace-events-y += hw/i386/trace-events
 trace-events-y += hw/9pfs/trace-events
 trace-events-y += hw/ppc/trace-events
diff --git a/hw/i386/trace-events b/hw/i386/trace-events
index 1938b98..d2b4973 100644
--- a/hw/i386/trace-events
+++ b/hw/i386/trace-events
@@ -7,10 +7,6 @@ xen_platform_log(char *s) "xen platform: %s"
 xen_pv_mmio_read(uint64_t addr) "WARNING: read from Xen PV Device MMIO space (address %"PRIx64")"
 xen_pv_mmio_write(uint64_t addr) "WARNING: write to Xen PV Device MMIO space (address %"PRIx64")"
 
-# hw/i386/pc.c
-mhp_pc_dimm_assigned_slot(int slot) "%d"
-mhp_pc_dimm_assigned_address(uint64_t addr) "0x%"PRIx64
-
 # hw/i386/x86-iommu.c
 x86_iommu_iec_notify(bool global, uint32_t index, uint32_t mask) "Notify IEC invalidation: global=%d index=%" PRIu32 " mask=%" PRIu32
 
diff --git a/hw/mem/trace-events b/hw/mem/trace-events
new file mode 100644
index 0000000..323c3c1
--- /dev/null
+++ b/hw/mem/trace-events
@@ -0,0 +1,5 @@
+# See docs/trace-events.txt for syntax documentation.
+
+# hw/mem/pc-dimm.c
+mhp_pc_dimm_assigned_slot(int slot) "%d"
+mhp_pc_dimm_assigned_address(uint64_t addr) "0x%"PRIx64
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Qemu-devel] [PULL 4/8] trace: move hw/virtio/virtio-balloon.c trace points into correct file
  2016-09-28 21:31 [Qemu-devel] [PULL 0/8] Tracing patches Stefan Hajnoczi
                   ` (2 preceding siblings ...)
  2016-09-28 21:31 ` [Qemu-devel] [PULL 3/8] trace: move hw/mem/pc-dimm.c " Stefan Hajnoczi
@ 2016-09-28 21:31 ` Stefan Hajnoczi
  2016-09-28 21:31 ` [Qemu-devel] [PULL 5/8] trace: Properly initialize dynamic event states in hot-plugged vCPUs Stefan Hajnoczi
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Stefan Hajnoczi @ 2016-09-28 21:31 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Daniel P. Berrange, Stefan Hajnoczi

From: "Daniel P. Berrange" <berrange@redhat.com>

The trace points for hw/virtio/virtio-balloon.c were mistakenly put
in the top level trace-events file, instead of util/trace-events in

  commit 270ab88f7c1112389a02cee0e3e03b20fcc7547e
  Author: Daniel P. Berrange <berrange@redhat.com>
  Date:   Thu Jun 16 09:39:57 2016 +0100

    trace: split out trace events for hw/virtio/ directory

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 1473872624-23285-5-git-send-email-berrange@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 hw/virtio/trace-events | 5 +++++
 trace-events           | 4 ----
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/hw/virtio/trace-events b/hw/virtio/trace-events
index 55184d3..8756cef 100644
--- a/hw/virtio/trace-events
+++ b/hw/virtio/trace-events
@@ -14,3 +14,8 @@ virtio_rng_guest_not_ready(void *rng) "rng %p: guest not ready"
 virtio_rng_pushed(void *rng, size_t len) "rng %p: %zd bytes pushed"
 virtio_rng_request(void *rng, size_t size, unsigned quota) "rng %p: %zd bytes requested, %u bytes quota left"
 
+# hw/virtio/virtio-balloon.c
+virtio_balloon_handle_output(const char *name, uint64_t gpa) "section name: %s gpa: %"PRIx64
+virtio_balloon_get_config(uint32_t num_pages, uint32_t actual) "num_pages: %d actual: %d"
+virtio_balloon_set_config(uint32_t actual, uint32_t oldactual) "actual: %d oldactual: %d"
+virtio_balloon_to_target(uint64_t target, uint32_t num_pages) "balloon target: %"PRIx64" num_pages: %d"
diff --git a/trace-events b/trace-events
index 55bef8c..a45dc56 100644
--- a/trace-events
+++ b/trace-events
@@ -37,10 +37,6 @@ cpu_out(unsigned int addr, char size, unsigned int val) "addr %#x(%c) value %u"
 # balloon.c
 # Since requests are raised via monitor, not many tracepoints are needed.
 balloon_event(void *opaque, unsigned long addr) "opaque %p addr %lu"
-virtio_balloon_handle_output(const char *name, uint64_t gpa) "section name: %s gpa: %"PRIx64
-virtio_balloon_get_config(uint32_t num_pages, uint32_t actual) "num_pages: %d actual: %d"
-virtio_balloon_set_config(uint32_t actual, uint32_t oldactual) "actual: %d oldactual: %d"
-virtio_balloon_to_target(uint64_t target, uint32_t num_pages) "balloon target: %"PRIx64" num_pages: %d"
 
 # vl.c
 vm_state_notify(int running, int reason) "running %d reason %d"
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Qemu-devel] [PULL 5/8] trace: Properly initialize dynamic event states in hot-plugged vCPUs
  2016-09-28 21:31 [Qemu-devel] [PULL 0/8] Tracing patches Stefan Hajnoczi
                   ` (3 preceding siblings ...)
  2016-09-28 21:31 ` [Qemu-devel] [PULL 4/8] trace: move hw/virtio/virtio-balloon.c " Stefan Hajnoczi
@ 2016-09-28 21:31 ` Stefan Hajnoczi
  2016-09-28 21:31 ` [Qemu-devel] [PULL 6/8] trace: Add event "guest_cpu_enter" Stefan Hajnoczi
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Stefan Hajnoczi @ 2016-09-28 21:31 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Lluís Vilanova, Stefan Hajnoczi

From: Lluís Vilanova <vilanova@ac.upc.edu>

Every time a vCPU is hot-plugged, it will "inherit" its tracing state
from the global state array. That is, if *any* existing vCPU has an
event enabled, new vCPUs will have too.

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Message-id: 147428970768.15111.7664565956870423529.stgit@fimbulvetr.bsc.es
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 bsd-user/main.c        |  1 -
 linux-user/main.c      |  1 -
 qom/cpu.c              |  3 +++
 stubs/trace-control.c  |  6 ++++++
 trace/control-target.c | 37 +++++++++++++++++++++++++++++++++++++
 trace/control.c        | 19 -------------------
 trace/control.h        | 19 ++++++++-----------
 vl.c                   |  1 -
 8 files changed, 54 insertions(+), 33 deletions(-)

diff --git a/bsd-user/main.c b/bsd-user/main.c
index 0fb08e4..f58bb43 100644
--- a/bsd-user/main.c
+++ b/bsd-user/main.c
@@ -1133,7 +1133,6 @@ int main(int argc, char **argv)
         gdbserver_start (gdbstub_port);
         gdb_handlesig(cpu, 0);
     }
-    trace_init_vcpu_events();
     cpu_loop(env);
     /* never exits */
     return 0;
diff --git a/linux-user/main.c b/linux-user/main.c
index 8daebe0..424f2b6 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -4800,7 +4800,6 @@ int main(int argc, char **argv, char **envp)
         }
         gdb_handlesig(cpu, 0);
     }
-    trace_init_vcpu_events();
     cpu_loop(env);
     /* never exits */
     return 0;
diff --git a/qom/cpu.c b/qom/cpu.c
index f783b5a..f87fffa 100644
--- a/qom/cpu.c
+++ b/qom/cpu.c
@@ -333,6 +333,9 @@ static void cpu_common_realizefn(DeviceState *dev, Error **errp)
         cpu_synchronize_post_init(cpu);
         cpu_resume(cpu);
     }
+
+    /* NOTE: latest generic point where the cpu is fully realized */
+    trace_init_vcpu(cpu);
 }
 
 static void cpu_common_initfn(Object *obj)
diff --git a/stubs/trace-control.c b/stubs/trace-control.c
index 2dfcd9f..f765a02 100644
--- a/stubs/trace-control.c
+++ b/stubs/trace-control.c
@@ -44,3 +44,9 @@ void trace_event_set_vcpu_state_dynamic(CPUState *vcpu,
     /* should never be called on non-target binaries */
     abort();
 }
+
+void trace_init_vcpu(CPUState *vcpu)
+{
+    /* should never be called on non-target binaries */
+    abort();
+}
diff --git a/trace/control-target.c b/trace/control-target.c
index 72081e2..3b7d99b 100644
--- a/trace/control-target.c
+++ b/trace/control-target.c
@@ -81,3 +81,40 @@ void trace_event_set_vcpu_state_dynamic(CPUState *vcpu,
         }
     }
 }
+
+static bool adding_first_cpu(void)
+{
+    CPUState *cpu;
+    size_t count = 0;
+    CPU_FOREACH(cpu) {
+        count++;
+        if (count > 1) {
+            return false;
+        }
+    }
+    return true;
+}
+
+void trace_init_vcpu(CPUState *vcpu)
+{
+    TraceEvent *ev = NULL;
+
+    while ((ev = trace_event_pattern("*", ev)) != NULL) {
+        if (trace_event_is_vcpu(ev) &&
+            trace_event_get_state_static(ev) &&
+            trace_event_get_state_dynamic(ev)) {
+            TraceEventID id = trace_event_get_id(ev);
+            if (adding_first_cpu()) {
+                /* check preconditions */
+                assert(trace_events_dstate[id] == 1);
+                /* disable early-init state ... */
+                trace_events_dstate[id] = 0;
+                trace_events_enabled_count--;
+                /* ... and properly re-enable */
+                trace_event_set_vcpu_state_dynamic(vcpu, ev, true);
+            } else {
+                trace_event_set_vcpu_state_dynamic(vcpu, ev, true);
+            }
+        }
+    }
+}
diff --git a/trace/control.c b/trace/control.c
index 05d85ac..10b3e9b 100644
--- a/trace/control.c
+++ b/trace/control.c
@@ -269,22 +269,3 @@ char *trace_opt_parse(const char *optarg)
 
     return trace_file;
 }
-
-void trace_init_vcpu_events(void)
-{
-    TraceEvent *ev = NULL;
-    while ((ev = trace_event_pattern("*", ev)) != NULL) {
-        if (trace_event_is_vcpu(ev) &&
-            trace_event_get_state_static(ev) &&
-            trace_event_get_state_dynamic(ev)) {
-            TraceEventID id = trace_event_get_id(ev);
-            /* check preconditions */
-            assert(trace_events_dstate[id] == 1);
-            /* disable early-init state ... */
-            trace_events_dstate[id] = 0;
-            trace_events_enabled_count--;
-            /* ... and properly re-enable */
-            trace_event_set_state_dynamic(ev, true);
-        }
-    }
-}
diff --git a/trace/control.h b/trace/control.h
index 27a16fc..a22d112 100644
--- a/trace/control.h
+++ b/trace/control.h
@@ -239,6 +239,14 @@ bool trace_init_backends(void);
 void trace_init_file(const char *file);
 
 /**
+ * trace_init_vcpu:
+ * @vcpu: Added vCPU.
+ *
+ * Set initial dynamic event state for a hot-plugged vCPU.
+ */
+void trace_init_vcpu(CPUState *vcpu);
+
+/**
  * trace_list_events:
  *
  * List all available events.
@@ -269,17 +277,6 @@ extern QemuOptsList qemu_trace_opts;
  */
 char *trace_opt_parse(const char *optarg);
 
-/**
- * trace_init_vcpu_events:
- *
- * Re-synchronize initial event state with vCPUs (which can be created after
- * trace_init_events()).
- *
- * Precondition: event states won't be changed between trace_enable_events() and
- * trace_init_vcpu_events() (e.g., through QMP).
- */
-void trace_init_vcpu_events(void);
-
 
 #include "trace/control-internal.h"
 
diff --git a/vl.c b/vl.c
index eafda8d..04fc172 100644
--- a/vl.c
+++ b/vl.c
@@ -4658,7 +4658,6 @@ int main(int argc, char **argv, char **envp)
 
     os_setup_post();
 
-    trace_init_vcpu_events();
     main_loop();
     replay_disable_events();
     iothread_stop_all();
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Qemu-devel] [PULL 6/8] trace: Add event "guest_cpu_enter"
  2016-09-28 21:31 [Qemu-devel] [PULL 0/8] Tracing patches Stefan Hajnoczi
                   ` (4 preceding siblings ...)
  2016-09-28 21:31 ` [Qemu-devel] [PULL 5/8] trace: Properly initialize dynamic event states in hot-plugged vCPUs Stefan Hajnoczi
@ 2016-09-28 21:31 ` Stefan Hajnoczi
  2016-09-28 21:31 ` [Qemu-devel] [PULL 7/8] trace: Add event "guest_cpu_reset" Stefan Hajnoczi
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Stefan Hajnoczi @ 2016-09-28 21:31 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Lluís Vilanova, Stefan Hajnoczi

From: Lluís Vilanova <vilanova@ac.upc.edu>

Signals the hot-plugging of a new virtual (guest) CPU.

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Message-id: 147428971313.15111.18023030883528426840.stgit@fimbulvetr.bsc.es
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 trace-events           | 8 ++++++++
 trace/control-target.c | 3 +++
 2 files changed, 11 insertions(+)

diff --git a/trace-events b/trace-events
index a45dc56..0492c96 100644
--- a/trace-events
+++ b/trace-events
@@ -140,6 +140,14 @@ colo_filter_rewriter_conn_offset(uint32_t offset) ": offset=%u\n"
 
 ### Guest events, keep at bottom
 
+
+## vCPU
+
+# Hot-plug a new virtual (guest) CPU
+#
+# Targets: all
+vcpu guest_cpu_enter(void)
+
 # @vaddr: Access' virtual address.
 # @info : Access' information (see below).
 #
diff --git a/trace/control-target.c b/trace/control-target.c
index 3b7d99b..52fcce5 100644
--- a/trace/control-target.c
+++ b/trace/control-target.c
@@ -9,6 +9,7 @@
 
 #include "qemu/osdep.h"
 #include "cpu.h"
+#include "trace.h"
 #include "trace/control.h"
 #include "translate-all.h"
 
@@ -117,4 +118,6 @@ void trace_init_vcpu(CPUState *vcpu)
             }
         }
     }
+
+    trace_guest_cpu_enter(vcpu);
 }
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Qemu-devel] [PULL 7/8] trace: Add event "guest_cpu_reset"
  2016-09-28 21:31 [Qemu-devel] [PULL 0/8] Tracing patches Stefan Hajnoczi
                   ` (5 preceding siblings ...)
  2016-09-28 21:31 ` [Qemu-devel] [PULL 6/8] trace: Add event "guest_cpu_enter" Stefan Hajnoczi
@ 2016-09-28 21:31 ` Stefan Hajnoczi
  2016-09-28 21:31 ` [Qemu-devel] [PULL 8/8] trace: Document the execution mode of guest events Stefan Hajnoczi
  2016-09-29 18:47 ` [Qemu-devel] [PULL 0/8] Tracing patches Peter Maydell
  8 siblings, 0 replies; 10+ messages in thread
From: Stefan Hajnoczi @ 2016-09-28 21:31 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Lluís Vilanova, Stefan Hajnoczi

From: Lluís Vilanova <vilanova@ac.upc.edu>

Signals the reset of the state a virtual (guest) CPU.

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Message-id: 147428971851.15111.8799439252178273840.stgit@fimbulvetr.bsc.es
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 qom/cpu.c    | 3 +++
 trace-events | 5 +++++
 2 files changed, 8 insertions(+)

diff --git a/qom/cpu.c b/qom/cpu.c
index f87fffa..484c493 100644
--- a/qom/cpu.c
+++ b/qom/cpu.c
@@ -29,6 +29,7 @@
 #include "qemu/error-report.h"
 #include "sysemu/sysemu.h"
 #include "hw/qdev-properties.h"
+#include "trace.h"
 
 bool cpu_exists(int64_t id)
 {
@@ -245,6 +246,8 @@ void cpu_reset(CPUState *cpu)
     if (klass->reset != NULL) {
         (*klass->reset)(cpu);
     }
+
+    trace_guest_cpu_reset(cpu);
 }
 
 static void cpu_common_reset(CPUState *cpu)
diff --git a/trace-events b/trace-events
index 0492c96..fb96f6c 100644
--- a/trace-events
+++ b/trace-events
@@ -148,6 +148,11 @@ colo_filter_rewriter_conn_offset(uint32_t offset) ": offset=%u\n"
 # Targets: all
 vcpu guest_cpu_enter(void)
 
+# Reset the state of a virtual (guest) CPU
+#
+# Targets: all
+vcpu guest_cpu_reset(void)
+
 # @vaddr: Access' virtual address.
 # @info : Access' information (see below).
 #
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Qemu-devel] [PULL 8/8] trace: Document the execution mode of guest events
  2016-09-28 21:31 [Qemu-devel] [PULL 0/8] Tracing patches Stefan Hajnoczi
                   ` (6 preceding siblings ...)
  2016-09-28 21:31 ` [Qemu-devel] [PULL 7/8] trace: Add event "guest_cpu_reset" Stefan Hajnoczi
@ 2016-09-28 21:31 ` Stefan Hajnoczi
  2016-09-29 18:47 ` [Qemu-devel] [PULL 0/8] Tracing patches Peter Maydell
  8 siblings, 0 replies; 10+ messages in thread
From: Stefan Hajnoczi @ 2016-09-28 21:31 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Lluís Vilanova, Stefan Hajnoczi

From: Lluís Vilanova <vilanova@ac.upc.edu>

Explicitly state in which execution mode (user, softmmu, all) are guest
events available for tracing.

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Message-id: 147456962135.11114.6146034359114598596.stgit@fimbulvetr.bsc.es
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 trace-events | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/trace-events b/trace-events
index fb96f6c..1a4e092 100644
--- a/trace-events
+++ b/trace-events
@@ -169,6 +169,7 @@ vcpu guest_cpu_reset(void)
 #     bool    store      : 1; /* wheter it's a store operation */
 # };
 #
+# Mode: user, softmmu
 # Targets: TCG(all)
 disable vcpu tcg guest_mem_before(TCGv vaddr, uint8_t info) "info=%d", "vaddr=0x%016"PRIx64" info=%d"
 
@@ -177,6 +178,7 @@ disable vcpu tcg guest_mem_before(TCGv vaddr, uint8_t info) "info=%d", "vaddr=0x
 #
 # Start executing a guest system call in syscall emulation mode.
 #
+# Mode: user
 # Targets: TCG(all)
 disable vcpu guest_user_syscall(uint64_t num, uint64_t arg1, uint64_t arg2, uint64_t arg3, uint64_t arg4, uint64_t arg5, uint64_t arg6, uint64_t arg7, uint64_t arg8) "num=0x%016"PRIx64" arg1=0x%016"PRIx64" arg2=0x%016"PRIx64" arg3=0x%016"PRIx64" arg4=0x%016"PRIx64" arg5=0x%016"PRIx64" arg6=0x%016"PRIx64" arg7=0x%016"PRIx64" arg8=0x%016"PRIx64
 
@@ -185,5 +187,6 @@ disable vcpu guest_user_syscall(uint64_t num, uint64_t arg1, uint64_t arg2, uint
 #
 # Finish executing a guest system call in syscall emulation mode.
 #
+# Mode: user
 # Targets: TCG(all)
 disable vcpu guest_user_syscall_ret(uint64_t num, uint64_t ret) "num=0x%016"PRIx64" ret=0x%016"PRIx64
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] [PULL 0/8] Tracing patches
  2016-09-28 21:31 [Qemu-devel] [PULL 0/8] Tracing patches Stefan Hajnoczi
                   ` (7 preceding siblings ...)
  2016-09-28 21:31 ` [Qemu-devel] [PULL 8/8] trace: Document the execution mode of guest events Stefan Hajnoczi
@ 2016-09-29 18:47 ` Peter Maydell
  8 siblings, 0 replies; 10+ messages in thread
From: Peter Maydell @ 2016-09-29 18:47 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: QEMU Developers

On 28 September 2016 at 14:31, Stefan Hajnoczi <stefanha@redhat.com> wrote:
> The following changes since commit 25930ed60aad49f1fdd7de05272317c86ce1275b:
>
>   Merge remote-tracking branch 'remotes/ehabkost/tags/x86-pull-request' into staging (2016-09-27 23:10:12 +0100)
>
> are available in the git repository at:
>
>   git://github.com/stefanha/qemu.git tags/tracing-pull-request
>
> for you to fetch changes up to 43e21e4907a009d87f6aef44663d9e1f7b181b8d:
>
>   trace: Document the execution mode of guest events (2016-09-28 19:17:55 +0100)
>
> ----------------------------------------------------------------
>

Applied, thanks.

-- PMM

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2016-09-29 18:48 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-28 21:31 [Qemu-devel] [PULL 0/8] Tracing patches Stefan Hajnoczi
2016-09-28 21:31 ` [Qemu-devel] [PULL 1/8] trace: move util/buffer.c trace points into correct file Stefan Hajnoczi
2016-09-28 21:31 ` [Qemu-devel] [PULL 2/8] trace: move util/qemu-coroutine*.c " Stefan Hajnoczi
2016-09-28 21:31 ` [Qemu-devel] [PULL 3/8] trace: move hw/mem/pc-dimm.c " Stefan Hajnoczi
2016-09-28 21:31 ` [Qemu-devel] [PULL 4/8] trace: move hw/virtio/virtio-balloon.c " Stefan Hajnoczi
2016-09-28 21:31 ` [Qemu-devel] [PULL 5/8] trace: Properly initialize dynamic event states in hot-plugged vCPUs Stefan Hajnoczi
2016-09-28 21:31 ` [Qemu-devel] [PULL 6/8] trace: Add event "guest_cpu_enter" Stefan Hajnoczi
2016-09-28 21:31 ` [Qemu-devel] [PULL 7/8] trace: Add event "guest_cpu_reset" Stefan Hajnoczi
2016-09-28 21:31 ` [Qemu-devel] [PULL 8/8] trace: Document the execution mode of guest events Stefan Hajnoczi
2016-09-29 18:47 ` [Qemu-devel] [PULL 0/8] Tracing patches Peter Maydell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).