qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL 0/4] Tracing patches
@ 2017-01-16 13:44 Stefan Hajnoczi
  2017-01-16 13:44 ` [Qemu-devel] [PULL 1/4] trace-events: spelling fix Stefan Hajnoczi
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Stefan Hajnoczi @ 2017-01-16 13:44 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Stefan Hajnoczi

The following changes since commit 2ccede18bd24fce5db83fef3674563a1f256717b:

  Merge remote-tracking branch 'remotes/vivier/tags/m68k-for-2.9-pull-request' into staging (2017-01-16 12:41:35 +0000)

are available in the git repository at:

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

for you to fetch changes up to a47e87151e785977d34e7b726495e7781860ca9f:

  trace: Add event "guest_cpu_exit" (2017-01-16 13:40:56 +0000)

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

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

Lluís Vilanova (3):
  trace: Lock vCPU list when initializing dynamic tracing state
  trace: Fix dynamic event state on vCPU hot-unplug
  trace: Add event "guest_cpu_exit"

Marc-André Lureau (1):
  trace-events: spelling fix

 trace/control.h        |  8 ++++++++
 qom/cpu.c              |  2 ++
 trace/control-target.c | 11 ++++++++++-
 trace/control.c        | 19 +++++++++++++++++++
 trace-events           |  8 +++++++-
 5 files changed, 46 insertions(+), 2 deletions(-)

-- 
2.9.3

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

* [Qemu-devel] [PULL 1/4] trace-events: spelling fix
  2017-01-16 13:44 [Qemu-devel] [PULL 0/4] Tracing patches Stefan Hajnoczi
@ 2017-01-16 13:44 ` Stefan Hajnoczi
  2017-01-16 13:44 ` [Qemu-devel] [PULL 2/4] trace: Lock vCPU list when initializing dynamic tracing state Stefan Hajnoczi
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Stefan Hajnoczi @ 2017-01-16 13:44 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Marc-André Lureau, Stefan Hajnoczi

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-id: 20161212221759.28949-1-marcandre.lureau@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 trace-events | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/trace-events b/trace-events
index 1181486..2c66780 100644
--- a/trace-events
+++ b/trace-events
@@ -53,7 +53,7 @@ qemu_system_shutdown_request(void) ""
 qemu_system_powerdown_request(void) ""
 
 # spice-qemu-char.c
-spice_vmc_write(ssize_t out, int len) "spice wrottn %zd of requested %d"
+spice_vmc_write(ssize_t out, int len) "spice wrote %zd of requested %d"
 spice_vmc_read(int bytes, int len) "spice read %d of requested %d"
 spice_vmc_register_interface(void *scd) "spice vmc registered interface %p"
 spice_vmc_unregister_interface(void *scd) "spice vmc unregistered interface %p"
-- 
2.9.3

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

* [Qemu-devel] [PULL 2/4] trace: Lock vCPU list when initializing dynamic tracing state
  2017-01-16 13:44 [Qemu-devel] [PULL 0/4] Tracing patches Stefan Hajnoczi
  2017-01-16 13:44 ` [Qemu-devel] [PULL 1/4] trace-events: spelling fix Stefan Hajnoczi
@ 2017-01-16 13:44 ` Stefan Hajnoczi
  2017-01-16 13:44 ` [Qemu-devel] [PULL 3/4] trace: Fix dynamic event state on vCPU hot-unplug Stefan Hajnoczi
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Stefan Hajnoczi @ 2017-01-16 13:44 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Lluís Vilanova, Stefan Hajnoczi

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

Fixes potential corruption when a vCPU is hot-(un)plugged while
initializing the current one.

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Message-id: 148278747515.1404.6538173443841279200.stgit@fimbulvetr.bsc.es
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 trace/control-target.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/trace/control-target.c b/trace/control-target.c
index 7ebf6e0..e2e138a 100644
--- a/trace/control-target.c
+++ b/trace/control-target.c
@@ -79,7 +79,7 @@ void trace_event_set_vcpu_state_dynamic(CPUState *vcpu,
     }
 }
 
-static bool adding_first_cpu(void)
+static bool adding_first_cpu1(void)
 {
     CPUState *cpu;
     size_t count = 0;
@@ -92,6 +92,15 @@ static bool adding_first_cpu(void)
     return true;
 }
 
+static bool adding_first_cpu(void)
+{
+    bool res;
+    cpu_list_lock();
+    res = adding_first_cpu1();
+    cpu_list_unlock();
+    return res;
+}
+
 void trace_init_vcpu(CPUState *vcpu)
 {
     TraceEventIter iter;
-- 
2.9.3

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

* [Qemu-devel] [PULL 3/4] trace: Fix dynamic event state on vCPU hot-unplug
  2017-01-16 13:44 [Qemu-devel] [PULL 0/4] Tracing patches Stefan Hajnoczi
  2017-01-16 13:44 ` [Qemu-devel] [PULL 1/4] trace-events: spelling fix Stefan Hajnoczi
  2017-01-16 13:44 ` [Qemu-devel] [PULL 2/4] trace: Lock vCPU list when initializing dynamic tracing state Stefan Hajnoczi
@ 2017-01-16 13:44 ` Stefan Hajnoczi
  2017-01-16 13:44 ` [Qemu-devel] [PULL 4/4] trace: Add event "guest_cpu_exit" Stefan Hajnoczi
  2017-01-19 10:46 ` [Qemu-devel] [PULL 0/4] Tracing patches Peter Maydell
  4 siblings, 0 replies; 6+ messages in thread
From: Stefan Hajnoczi @ 2017-01-16 13:44 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Lluís Vilanova, Stefan Hajnoczi

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

We need to disable per-vCPU events on a vCPU that is hot-unplugged to
keep the dynamic event state global counters consistent.

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

diff --git a/trace/control.h b/trace/control.h
index ccaeac8..4ea53e2 100644
--- a/trace/control.h
+++ b/trace/control.h
@@ -202,6 +202,14 @@ void trace_init_file(const char *file);
 void trace_init_vcpu(CPUState *vcpu);
 
 /**
+ * trace_fini_vcpu:
+ * @vcpu: Removed vCPU.
+ *
+ * Disable dynamic event state for a hot-unplugged vCPU.
+ */
+void trace_fini_vcpu(CPUState *vcpu);
+
+/**
  * trace_list_events:
  *
  * List all available events.
diff --git a/qom/cpu.c b/qom/cpu.c
index 03d9190..93e4105 100644
--- a/qom/cpu.c
+++ b/qom/cpu.c
@@ -348,6 +348,8 @@ static void cpu_common_realizefn(DeviceState *dev, Error **errp)
 static void cpu_common_unrealizefn(DeviceState *dev, Error **errp)
 {
     CPUState *cpu = CPU(dev);
+    /* NOTE: latest generic point before the cpu is fully unrealized */
+    trace_fini_vcpu(cpu);
     cpu_exec_unrealizefn(cpu);
 }
 
diff --git a/trace/control.c b/trace/control.c
index 1a7bee6..cb79bb1 100644
--- a/trace/control.c
+++ b/trace/control.c
@@ -259,6 +259,22 @@ void trace_init_file(const char *file)
 #endif
 }
 
+void trace_fini_vcpu(CPUState *vcpu)
+{
+    TraceEventIter iter;
+    TraceEvent *ev;
+
+    trace_event_iter_init(&iter, NULL);
+    while ((ev = trace_event_iter_next(&iter)) != NULL) {
+        if (trace_event_is_vcpu(ev) &&
+            trace_event_get_state_static(ev) &&
+            trace_event_get_vcpu_state_dynamic(vcpu, ev)) {
+            /* must disable to affect the global counter */
+            trace_event_set_vcpu_state_dynamic(vcpu, ev, false);
+        }
+    }
+}
+
 bool trace_init_backends(void)
 {
 #ifdef CONFIG_TRACE_SIMPLE
-- 
2.9.3

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

* [Qemu-devel] [PULL 4/4] trace: Add event "guest_cpu_exit"
  2017-01-16 13:44 [Qemu-devel] [PULL 0/4] Tracing patches Stefan Hajnoczi
                   ` (2 preceding siblings ...)
  2017-01-16 13:44 ` [Qemu-devel] [PULL 3/4] trace: Fix dynamic event state on vCPU hot-unplug Stefan Hajnoczi
@ 2017-01-16 13:44 ` Stefan Hajnoczi
  2017-01-19 10:46 ` [Qemu-devel] [PULL 0/4] Tracing patches Peter Maydell
  4 siblings, 0 replies; 6+ messages in thread
From: Stefan Hajnoczi @ 2017-01-16 13:44 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-unplugging of a virtual (guest) CPU.

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

diff --git a/trace/control.c b/trace/control.c
index cb79bb1..56a2632 100644
--- a/trace/control.c
+++ b/trace/control.c
@@ -26,6 +26,7 @@
 #include "qemu/error-report.h"
 #include "qemu/config-file.h"
 #include "monitor/monitor.h"
+#include "trace.h"
 
 int trace_events_enabled_count;
 
@@ -264,6 +265,8 @@ void trace_fini_vcpu(CPUState *vcpu)
     TraceEventIter iter;
     TraceEvent *ev;
 
+    trace_guest_cpu_exit(vcpu);
+
     trace_event_iter_init(&iter, NULL);
     while ((ev = trace_event_iter_next(&iter)) != NULL) {
         if (trace_event_is_vcpu(ev) &&
diff --git a/trace-events b/trace-events
index 2c66780..839a9d0 100644
--- a/trace-events
+++ b/trace-events
@@ -141,6 +141,12 @@ memory_region_ram_device_write(int cpu_index, void *mr, uint64_t addr, uint64_t
 # Targets: all
 vcpu guest_cpu_enter(void)
 
+# Hot-unplug a virtual (guest) CPU
+#
+# Mode: user, softmmu
+# Targets: all
+vcpu guest_cpu_exit(void)
+
 # Reset the state of a virtual (guest) CPU
 #
 # Mode: user, softmmu
-- 
2.9.3

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

* Re: [Qemu-devel] [PULL 0/4] Tracing patches
  2017-01-16 13:44 [Qemu-devel] [PULL 0/4] Tracing patches Stefan Hajnoczi
                   ` (3 preceding siblings ...)
  2017-01-16 13:44 ` [Qemu-devel] [PULL 4/4] trace: Add event "guest_cpu_exit" Stefan Hajnoczi
@ 2017-01-19 10:46 ` Peter Maydell
  4 siblings, 0 replies; 6+ messages in thread
From: Peter Maydell @ 2017-01-19 10:46 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: QEMU Developers

On 16 January 2017 at 13:44, Stefan Hajnoczi <stefanha@redhat.com> wrote:
> The following changes since commit 2ccede18bd24fce5db83fef3674563a1f256717b:
>
>   Merge remote-tracking branch 'remotes/vivier/tags/m68k-for-2.9-pull-request' into staging (2017-01-16 12:41:35 +0000)
>
> are available in the git repository at:
>
>   git://github.com/stefanha/qemu.git tags/tracing-pull-request
>
> for you to fetch changes up to a47e87151e785977d34e7b726495e7781860ca9f:
>
>   trace: Add event "guest_cpu_exit" (2017-01-16 13:40:56 +0000)
>
> ----------------------------------------------------------------
>
> ----------------------------------------------------------------
>

Applied, thanks.

-- PMM

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

end of thread, other threads:[~2017-01-19 10:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-16 13:44 [Qemu-devel] [PULL 0/4] Tracing patches Stefan Hajnoczi
2017-01-16 13:44 ` [Qemu-devel] [PULL 1/4] trace-events: spelling fix Stefan Hajnoczi
2017-01-16 13:44 ` [Qemu-devel] [PULL 2/4] trace: Lock vCPU list when initializing dynamic tracing state Stefan Hajnoczi
2017-01-16 13:44 ` [Qemu-devel] [PULL 3/4] trace: Fix dynamic event state on vCPU hot-unplug Stefan Hajnoczi
2017-01-16 13:44 ` [Qemu-devel] [PULL 4/4] trace: Add event "guest_cpu_exit" Stefan Hajnoczi
2017-01-19 10:46 ` [Qemu-devel] [PULL 0/4] 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).