All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v8 0/7] trace: [tcg] Optimize per-vCPU tracing states
@ 2017-06-09  2:25 Emilio G. Cota
  2017-06-09  2:25 ` [Qemu-devel] [PATCH v8 1/7] exec: [tcg] Refactor flush of per-CPU virtual TB cache Emilio G. Cota
                   ` (6 more replies)
  0 siblings, 7 replies; 17+ messages in thread
From: Emilio G. Cota @ 2017-06-09  2:25 UTC (permalink / raw)
  To: qemu-devel; +Cc: Richard Henderson, Lluís Vilanova, Stefan Hajnoczi

This is my own respin of Lluís' v7:
  https://lists.gnu.org/archive/html/qemu-devel/2017-01/msg02741.html

Changes from v7:

- Ported to current dev tree.

- Allocate cpu->trace_dstate statically. This
  * allows us to drop the event_count inline patch.
  * simplifies and improves the performance of accessing cpu->trace_dstate:
    we just need to dereference, instead of going through bitmap_copy and
    an intermediate unsigned long.

- If we try to register more CPU events than the max we support (there's a constant
  for it), drop the event and tell the user with error_report. But really this
  is a bug, since we control what CPU events are traceable. Should we abort()
  as well?

- Added rth's R-b tag

- Addressed my own comments:
  * rename tb->trace_vcpu_dstate to the shorter tb->trace_ds
  * use uint32_t for tb->trace_ds instead of a typedef
  * add BUILD_BUG_ON check to make sure tb->trace_ds is big enough
  * fix xxhash

- Do not add trace_dstate to tb_htable_lookup, since we can grab it from
  cpu->trace_dstate.

This patchset applies cleanly on top of rth's tcg-next (a01792e1e).

Thanks,

		Emilio

Emilio G. Cota (1):
  cpu: allocate cpu->trace_dstate in place

Lluís Vilanova (6):
  exec: [tcg] Refactor flush of per-CPU virtual TB cache
  trace: [tcg] Delay changes to dynamic state when translating
  exec: [tcg] Use different TBs according to the vCPU's dynamic tracing
    state
  trace: [tcg] Do not generate TCG code to trace dinamically-disabled
    events
  trace: [tcg, trivial] Re-align generated code
  trace: [trivial] Statically enable all guest events

 cpu-exec.c                               |  8 ++++++--
 cputlb.c                                 |  2 +-
 include/exec/exec-all.h                  |  9 +++++++++
 include/exec/tb-hash-xx.h                |  7 +++++--
 include/exec/tb-hash.h                   |  5 +++--
 include/qom/cpu.h                        | 12 ++++++------
 qom/cpu.c                                |  8 --------
 scripts/tracetool/__init__.py            |  3 ++-
 scripts/tracetool/backend/dtrace.py      |  4 ++--
 scripts/tracetool/backend/ftrace.py      | 20 ++++++++++----------
 scripts/tracetool/backend/log.py         | 19 ++++++++++---------
 scripts/tracetool/backend/simple.py      |  4 ++--
 scripts/tracetool/backend/syslog.py      |  6 +++---
 scripts/tracetool/backend/ust.py         |  4 ++--
 scripts/tracetool/format/h.py            | 26 +++++++++++++++++++-------
 scripts/tracetool/format/tcg_h.py        | 21 +++++++++++++++++----
 scripts/tracetool/format/tcg_helper_c.py |  5 +++--
 tcg-runtime.c                            |  3 ++-
 tests/qht-bench.c                        |  2 +-
 trace-events                             |  6 +++---
 trace/control-target.c                   | 22 +++++++++++++++++++---
 trace/control.c                          |  9 ++++++++-
 trace/control.h                          |  3 +++
 translate-all.c                          | 25 ++++++++++++++++++-------
 24 files changed, 154 insertions(+), 79 deletions(-)

-- 
2.7.4

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

* [Qemu-devel] [PATCH v8 1/7] exec: [tcg] Refactor flush of per-CPU virtual TB cache
  2017-06-09  2:25 [Qemu-devel] [PATCH v8 0/7] trace: [tcg] Optimize per-vCPU tracing states Emilio G. Cota
@ 2017-06-09  2:25 ` Emilio G. Cota
  2017-06-09  2:25 ` [Qemu-devel] [PATCH v8 2/7] cpu: allocate cpu->trace_dstate in place Emilio G. Cota
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 17+ messages in thread
From: Emilio G. Cota @ 2017-06-09  2:25 UTC (permalink / raw)
  To: qemu-devel; +Cc: Richard Henderson, Lluís Vilanova, Stefan Hajnoczi

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

The function is reused in later patches.

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Emilio G. Cota <cota@braap.org>
---
 cputlb.c                |  2 +-
 include/exec/exec-all.h |  6 ++++++
 translate-all.c         | 15 ++++++++++-----
 3 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/cputlb.c b/cputlb.c
index 743776a..6a2b762 100644
--- a/cputlb.c
+++ b/cputlb.c
@@ -118,7 +118,7 @@ static void tlb_flush_nocheck(CPUState *cpu)
 
     memset(env->tlb_table, -1, sizeof(env->tlb_table));
     memset(env->tlb_v_table, -1, sizeof(env->tlb_v_table));
-    memset(cpu->tb_jmp_cache, 0, sizeof(cpu->tb_jmp_cache));
+    tb_flush_jmp_cache_all(cpu);
 
     env->vtlb_index = 0;
     env->tlb_flush_addr = -1;
diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h
index 724ec73..b0281b0 100644
--- a/include/exec/exec-all.h
+++ b/include/exec/exec-all.h
@@ -366,6 +366,12 @@ struct TranslationBlock {
 };
 
 void tb_free(TranslationBlock *tb);
+/**
+ * tb_flush_jmp_cache_all:
+ *
+ * Flush the virtual translation block cache.
+ */
+void tb_flush_jmp_cache_all(CPUState *env);
 void tb_flush(CPUState *cpu);
 void tb_phys_invalidate(TranslationBlock *tb, tb_page_addr_t page_addr);
 TranslationBlock *tb_htable_lookup(CPUState *cpu, target_ulong pc,
diff --git a/translate-all.c b/translate-all.c
index 966747a..8a5dc19 100644
--- a/translate-all.c
+++ b/translate-all.c
@@ -931,11 +931,7 @@ static void do_tb_flush(CPUState *cpu, run_on_cpu_data tb_flush_count)
     }
 
     CPU_FOREACH(cpu) {
-        int i;
-
-        for (i = 0; i < TB_JMP_CACHE_SIZE; ++i) {
-            atomic_set(&cpu->tb_jmp_cache[i], NULL);
-        }
+        tb_flush_jmp_cache_all(cpu);
     }
 
     tcg_ctx.tb_ctx.nb_tbs = 0;
@@ -1733,6 +1729,15 @@ void tb_check_watchpoint(CPUState *cpu)
     }
 }
 
+void tb_flush_jmp_cache_all(CPUState *cpu)
+{
+    int i;
+
+    for (i = 0; i < TB_JMP_CACHE_SIZE; ++i) {
+        atomic_set(&cpu->tb_jmp_cache[i], NULL);
+    }
+}
+
 #ifndef CONFIG_USER_ONLY
 /* in deterministic execution mode, instructions doing device I/Os
  * must be at the end of the TB.
-- 
2.7.4

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

* [Qemu-devel] [PATCH v8 2/7] cpu: allocate cpu->trace_dstate in place
  2017-06-09  2:25 [Qemu-devel] [PATCH v8 0/7] trace: [tcg] Optimize per-vCPU tracing states Emilio G. Cota
  2017-06-09  2:25 ` [Qemu-devel] [PATCH v8 1/7] exec: [tcg] Refactor flush of per-CPU virtual TB cache Emilio G. Cota
@ 2017-06-09  2:25 ` Emilio G. Cota
  2017-06-11 12:36   ` Lluís Vilanova
  2017-06-09  2:25 ` [Qemu-devel] [PATCH v8 3/7] trace: [tcg] Delay changes to dynamic state when translating Emilio G. Cota
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 17+ messages in thread
From: Emilio G. Cota @ 2017-06-09  2:25 UTC (permalink / raw)
  To: qemu-devel; +Cc: Richard Henderson, Lluís Vilanova, Stefan Hajnoczi

There's little point in dynamically allocating the bitmap if we
know at compile-time the max number of events we want to support.
Thus, make room in the struct for the bitmap, which will make things
easier later: this paves the way for upcoming changes, in which
we'll use a u32 to fully capture cpu->trace_dstate.

This change also increases performance by saving a dereference and
improving locality--note that this is important since upcoming work
makes reading this bitmap fairly common.

Signed-off-by: Emilio G. Cota <cota@braap.org>
---
 include/qom/cpu.h | 9 +++------
 qom/cpu.c         | 8 --------
 trace/control.c   | 9 ++++++++-
 3 files changed, 11 insertions(+), 15 deletions(-)

diff --git a/include/qom/cpu.h b/include/qom/cpu.h
index 89ddb68..bc6e20f 100644
--- a/include/qom/cpu.h
+++ b/include/qom/cpu.h
@@ -259,6 +259,7 @@ typedef void (*run_on_cpu_func)(CPUState *cpu, run_on_cpu_data data);
 struct qemu_work_item;
 
 #define CPU_UNSET_NUMA_NODE_ID -1
+#define CPU_TRACE_DSTATE_MAX_EVENTS 32
 
 /**
  * CPUState:
@@ -373,12 +374,8 @@ struct CPUState {
     struct KVMState *kvm_state;
     struct kvm_run *kvm_run;
 
-    /*
-     * Used for events with 'vcpu' and *without* the 'disabled' properties.
-     * Dynamically allocated based on bitmap requried to hold up to
-     * trace_get_vcpu_event_count() entries.
-     */
-    unsigned long *trace_dstate;
+    /* Used for events with 'vcpu' and *without* the 'disabled' properties */
+    DECLARE_BITMAP(trace_dstate, CPU_TRACE_DSTATE_MAX_EVENTS);
 
     /* TODO Move common fields from CPUArchState here. */
     int cpu_index; /* used by alpha TCG */
diff --git a/qom/cpu.c b/qom/cpu.c
index 5069876..69fbb9c 100644
--- a/qom/cpu.c
+++ b/qom/cpu.c
@@ -382,7 +382,6 @@ static void cpu_common_unrealizefn(DeviceState *dev, Error **errp)
 
 static void cpu_common_initfn(Object *obj)
 {
-    uint32_t count;
     CPUState *cpu = CPU(obj);
     CPUClass *cc = CPU_GET_CLASS(obj);
 
@@ -397,18 +396,11 @@ static void cpu_common_initfn(Object *obj)
     QTAILQ_INIT(&cpu->breakpoints);
     QTAILQ_INIT(&cpu->watchpoints);
 
-    count = trace_get_vcpu_event_count();
-    if (count) {
-        cpu->trace_dstate = bitmap_new(count);
-    }
-
     cpu_exec_initfn(cpu);
 }
 
 static void cpu_common_finalize(Object *obj)
 {
-    CPUState *cpu = CPU(obj);
-    g_free(cpu->trace_dstate);
 }
 
 static int64_t cpu_common_get_arch_id(CPUState *cpu)
diff --git a/trace/control.c b/trace/control.c
index 9b157b0..83740aa 100644
--- a/trace/control.c
+++ b/trace/control.c
@@ -65,8 +65,15 @@ void trace_event_register_group(TraceEvent **events)
     size_t i;
     for (i = 0; events[i] != NULL; i++) {
         events[i]->id = next_id++;
-        if (events[i]->vcpu_id != TRACE_VCPU_EVENT_NONE) {
+        if (events[i]->vcpu_id == TRACE_VCPU_EVENT_NONE) {
+            continue;
+        }
+
+        if (likely(next_vcpu_id < CPU_TRACE_DSTATE_MAX_EVENTS)) {
             events[i]->vcpu_id = next_vcpu_id++;
+        } else {
+            error_report("WARNING: too many vcpu trace events; dropping '%s'",
+                         events[i]->name);
         }
     }
     event_groups = g_renew(TraceEventGroup, event_groups, nevent_groups + 1);
-- 
2.7.4

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

* [Qemu-devel] [PATCH v8 3/7] trace: [tcg] Delay changes to dynamic state when translating
  2017-06-09  2:25 [Qemu-devel] [PATCH v8 0/7] trace: [tcg] Optimize per-vCPU tracing states Emilio G. Cota
  2017-06-09  2:25 ` [Qemu-devel] [PATCH v8 1/7] exec: [tcg] Refactor flush of per-CPU virtual TB cache Emilio G. Cota
  2017-06-09  2:25 ` [Qemu-devel] [PATCH v8 2/7] cpu: allocate cpu->trace_dstate in place Emilio G. Cota
@ 2017-06-09  2:25 ` Emilio G. Cota
  2017-06-09  2:25 ` [Qemu-devel] [PATCH v8 4/7] exec: [tcg] Use different TBs according to the vCPU's dynamic tracing state Emilio G. Cota
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 17+ messages in thread
From: Emilio G. Cota @ 2017-06-09  2:25 UTC (permalink / raw)
  To: qemu-devel; +Cc: Richard Henderson, Lluís Vilanova, Stefan Hajnoczi

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

This keeps consistency across all decisions taken during translation
when the dynamic state of a vCPU is changed in the middle of translating
some guest code.

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Reviewed-by: Richard Henderson <rth@twiddle.net>
[cota: use CPU_TRACE_DSTATE_MAX_EVENTS instead of trace_get_vcpu_event_count()]
Signed-off-by: Emilio G. Cota <cota@braap.org>
---
 include/qom/cpu.h      |  3 +++
 trace/control-target.c | 21 ++++++++++++++++++---
 2 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/include/qom/cpu.h b/include/qom/cpu.h
index bc6e20f..29f4a32 100644
--- a/include/qom/cpu.h
+++ b/include/qom/cpu.h
@@ -303,6 +303,8 @@ struct qemu_work_item;
  * @kvm_fd: vCPU file descriptor for KVM.
  * @work_mutex: Lock to prevent multiple access to queued_work_*.
  * @queued_work_first: First asynchronous work pending.
+ * @trace_dstate_delayed: Delayed changes to trace_dstate (includes all changes
+ *                        to @trace_dstate).
  * @trace_dstate: Dynamic tracing state of events for this vCPU (bitmask).
  *
  * State of one CPU core or thread.
@@ -375,6 +377,7 @@ struct CPUState {
     struct kvm_run *kvm_run;
 
     /* Used for events with 'vcpu' and *without* the 'disabled' properties */
+    DECLARE_BITMAP(trace_dstate_delayed, CPU_TRACE_DSTATE_MAX_EVENTS);
     DECLARE_BITMAP(trace_dstate, CPU_TRACE_DSTATE_MAX_EVENTS);
 
     /* TODO Move common fields from CPUArchState here. */
diff --git a/trace/control-target.c b/trace/control-target.c
index 6266e63..416d14e 100644
--- a/trace/control-target.c
+++ b/trace/control-target.c
@@ -1,13 +1,14 @@
 /*
  * Interface for configuring and controlling the state of tracing events.
  *
- * Copyright (C) 2014-2016 Lluís Vilanova <vilanova@ac.upc.edu>
+ * Copyright (C) 2014-2017 Lluís Vilanova <vilanova@ac.upc.edu>
  *
  * This work is licensed under the terms of the GNU GPL, version 2 or later.
  * See the COPYING file in the top-level directory.
  */
 
 #include "qemu/osdep.h"
+#include "qom/cpu.h"
 #include "cpu.h"
 #include "trace-root.h"
 #include "trace/control.h"
@@ -34,6 +35,13 @@ void trace_event_set_state_dynamic_init(TraceEvent *ev, bool state)
     }
 }
 
+static void trace_event_synchronize_vcpu_state_dynamic(
+    CPUState *vcpu, run_on_cpu_data ignored)
+{
+    bitmap_copy(vcpu->trace_dstate, vcpu->trace_dstate_delayed,
+                CPU_TRACE_DSTATE_MAX_EVENTS);
+}
+
 void trace_event_set_state_dynamic(TraceEvent *ev, bool state)
 {
     CPUState *vcpu;
@@ -69,13 +77,20 @@ void trace_event_set_vcpu_state_dynamic(CPUState *vcpu,
     if (state_pre != state) {
         if (state) {
             trace_events_enabled_count++;
-            set_bit(vcpu_id, vcpu->trace_dstate);
+            set_bit(vcpu_id, vcpu->trace_dstate_delayed);
             (*ev->dstate)++;
         } else {
             trace_events_enabled_count--;
-            clear_bit(vcpu_id, vcpu->trace_dstate);
+            clear_bit(vcpu_id, vcpu->trace_dstate_delayed);
             (*ev->dstate)--;
         }
+        /*
+         * Delay changes until next TB; we want all TBs to be built from a
+         * single set of dstate values to ensure consistency of generated
+         * tracing code.
+         */
+        async_run_on_cpu(vcpu, trace_event_synchronize_vcpu_state_dynamic,
+                         RUN_ON_CPU_NULL);
     }
 }
 
-- 
2.7.4

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

* [Qemu-devel] [PATCH v8 4/7] exec: [tcg] Use different TBs according to the vCPU's dynamic tracing state
  2017-06-09  2:25 [Qemu-devel] [PATCH v8 0/7] trace: [tcg] Optimize per-vCPU tracing states Emilio G. Cota
                   ` (2 preceding siblings ...)
  2017-06-09  2:25 ` [Qemu-devel] [PATCH v8 3/7] trace: [tcg] Delay changes to dynamic state when translating Emilio G. Cota
@ 2017-06-09  2:25 ` Emilio G. Cota
  2017-06-09  2:25 ` [Qemu-devel] [PATCH v8 5/7] trace: [tcg] Do not generate TCG code to trace dinamically-disabled events Emilio G. Cota
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 17+ messages in thread
From: Emilio G. Cota @ 2017-06-09  2:25 UTC (permalink / raw)
  To: qemu-devel; +Cc: Richard Henderson, Lluís Vilanova, Stefan Hajnoczi

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

Every vCPU now uses a separate set of TBs for each set of dynamic
tracing event state values. Each set of TBs can be used by any number of
vCPUs to maximize TB reuse when vCPUs have the same tracing state.

This feature is later used by tracetool to optimize tracing of guest
code events.

The maximum number of TB sets is defined as 2^E, where E is the number
of events that have the 'vcpu' property (their state is stored in
CPUState->trace_dstate).

For this to work, a change on the dynamic tracing state of a vCPU will
force it to flush its virtual TB cache (which is only indexed by
address), and fall back to the physical TB cache (which now contains the
vCPU's dynamic tracing state as part of the hashing function).

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Reviewed-by: Richard Henderson <rth@twiddle.net>
[cota:
 - rename tb->trace_vcpu_dstate to the shorter tb->trace_ds
 - use uint32_t for tb->trace_ds instead of a typedef
 - add BUILD_BUG_ON check to make sure tb->trace_ds is big enough
 - fix xxhash
 - directly dereference cpu->trace_dstate instead of using bitmap_copy etc.
 - drop trace_dstate parameter from tb_htable_lookup; grab it directly from cpu.
]
Signed-off-by: Emilio G. Cota <cota@braap.org>
---
 cpu-exec.c                |  8 ++++++--
 include/exec/exec-all.h   |  3 +++
 include/exec/tb-hash-xx.h |  7 +++++--
 include/exec/tb-hash.h    |  5 +++--
 tcg-runtime.c             |  3 ++-
 tests/qht-bench.c         |  2 +-
 trace/control-target.c    |  1 +
 trace/control.h           |  3 +++
 translate-all.c           | 10 ++++++++--
 9 files changed, 32 insertions(+), 10 deletions(-)

diff --git a/cpu-exec.c b/cpu-exec.c
index 5b181c1..b6679d9 100644
--- a/cpu-exec.c
+++ b/cpu-exec.c
@@ -280,6 +280,7 @@ struct tb_desc {
     CPUArchState *env;
     tb_page_addr_t phys_page1;
     uint32_t flags;
+    uint32_t trace_ds;
 };
 
 static bool tb_cmp(const void *p, const void *d)
@@ -291,6 +292,7 @@ static bool tb_cmp(const void *p, const void *d)
         tb->page_addr[0] == desc->phys_page1 &&
         tb->cs_base == desc->cs_base &&
         tb->flags == desc->flags &&
+        tb->trace_ds == desc->trace_ds &&
         !atomic_read(&tb->invalid)) {
         /* check next page if needed */
         if (tb->page_addr[1] == -1) {
@@ -319,10 +321,11 @@ TranslationBlock *tb_htable_lookup(CPUState *cpu, target_ulong pc,
     desc.env = (CPUArchState *)cpu->env_ptr;
     desc.cs_base = cs_base;
     desc.flags = flags;
+    desc.trace_ds = *cpu->trace_dstate;
     desc.pc = pc;
     phys_pc = get_page_addr_code(desc.env, pc);
     desc.phys_page1 = phys_pc & TARGET_PAGE_MASK;
-    h = tb_hash_func(phys_pc, pc, flags);
+    h = tb_hash_func(phys_pc, pc, flags, *cpu->trace_dstate);
     return qht_lookup(&tcg_ctx.tb_ctx.htable, tb_cmp, &desc, h);
 }
 
@@ -342,7 +345,8 @@ static inline TranslationBlock *tb_find(CPUState *cpu,
     cpu_get_tb_cpu_state(env, &pc, &cs_base, &flags);
     tb = atomic_rcu_read(&cpu->tb_jmp_cache[tb_jmp_cache_hash_func(pc)]);
     if (unlikely(!tb || tb->pc != pc || tb->cs_base != cs_base ||
-                 tb->flags != flags)) {
+                 tb->flags != flags ||
+                 tb->trace_ds != *cpu->trace_dstate)) {
         tb = tb_htable_lookup(cpu, pc, cs_base, flags);
         if (!tb) {
 
diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h
index b0281b0..6bdc6e5 100644
--- a/include/exec/exec-all.h
+++ b/include/exec/exec-all.h
@@ -324,6 +324,9 @@ struct TranslationBlock {
 #define CF_USE_ICOUNT  0x20000
 #define CF_IGNORE_ICOUNT 0x40000 /* Do not generate icount code */
 
+    /* Tracing Dynamic State (hence '_ds') used to generate this TB */
+    uint32_t trace_ds;
+
     uint16_t invalid;
 
     void *tc_ptr;    /* pointer to the translated code */
diff --git a/include/exec/tb-hash-xx.h b/include/exec/tb-hash-xx.h
index 2c40b5c..6cd3022 100644
--- a/include/exec/tb-hash-xx.h
+++ b/include/exec/tb-hash-xx.h
@@ -49,7 +49,7 @@
  * contiguous in memory.
  */
 static inline
-uint32_t tb_hash_func5(uint64_t a0, uint64_t b0, uint32_t e)
+uint32_t tb_hash_func6(uint64_t a0, uint64_t b0, uint32_t e, uint32_t f)
 {
     uint32_t v1 = TB_HASH_XX_SEED + PRIME32_1 + PRIME32_2;
     uint32_t v2 = TB_HASH_XX_SEED + PRIME32_2;
@@ -78,11 +78,14 @@ uint32_t tb_hash_func5(uint64_t a0, uint64_t b0, uint32_t e)
     v4 *= PRIME32_1;
 
     h32 = rol32(v1, 1) + rol32(v2, 7) + rol32(v3, 12) + rol32(v4, 18);
-    h32 += 20;
+    h32 += 24;
 
     h32 += e * PRIME32_3;
     h32  = rol32(h32, 17) * PRIME32_4;
 
+    h32 += f * PRIME32_3;
+    h32  = rol32(h32, 17) * PRIME32_4;
+
     h32 ^= h32 >> 15;
     h32 *= PRIME32_2;
     h32 ^= h32 >> 13;
diff --git a/include/exec/tb-hash.h b/include/exec/tb-hash.h
index b1fe2d0..d64c2d9 100644
--- a/include/exec/tb-hash.h
+++ b/include/exec/tb-hash.h
@@ -58,9 +58,10 @@ static inline unsigned int tb_jmp_cache_hash_func(target_ulong pc)
 #endif /* CONFIG_SOFTMMU */
 
 static inline
-uint32_t tb_hash_func(tb_page_addr_t phys_pc, target_ulong pc, uint32_t flags)
+uint32_t tb_hash_func(tb_page_addr_t phys_pc, target_ulong pc, uint32_t flags,
+                      uint32_t trace_ds)
 {
-    return tb_hash_func5(phys_pc, pc, flags);
+    return tb_hash_func6(phys_pc, pc, flags, trace_ds);
 }
 
 #endif
diff --git a/tcg-runtime.c b/tcg-runtime.c
index 7fa90ce..71d8956 100644
--- a/tcg-runtime.c
+++ b/tcg-runtime.c
@@ -155,9 +155,10 @@ void *HELPER(lookup_tb_ptr)(CPUArchState *env, target_ulong addr)
     if (likely(tb)) {
         cpu_get_tb_cpu_state(env, &pc, &cs_base, &flags);
         if (likely(tb->pc == addr && tb->cs_base == cs_base &&
-                   tb->flags == flags)) {
+                   tb->flags == flags && tb->trace_ds == *cpu->trace_dstate)) {
             goto found;
         }
+
         tb = tb_htable_lookup(cpu, addr, cs_base, flags);
         if (likely(tb)) {
             atomic_set(&cpu->tb_jmp_cache[tb_jmp_cache_hash_func(addr)], tb);
diff --git a/tests/qht-bench.c b/tests/qht-bench.c
index 2afa09d..11c1cec 100644
--- a/tests/qht-bench.c
+++ b/tests/qht-bench.c
@@ -103,7 +103,7 @@ static bool is_equal(const void *obj, const void *userp)
 
 static inline uint32_t h(unsigned long v)
 {
-    return tb_hash_func5(v, 0, 0);
+    return tb_hash_func6(v, 0, 0, 0);
 }
 
 /*
diff --git a/trace/control-target.c b/trace/control-target.c
index 416d14e..ce7347e 100644
--- a/trace/control-target.c
+++ b/trace/control-target.c
@@ -40,6 +40,7 @@ static void trace_event_synchronize_vcpu_state_dynamic(
 {
     bitmap_copy(vcpu->trace_dstate, vcpu->trace_dstate_delayed,
                 CPU_TRACE_DSTATE_MAX_EVENTS);
+    tb_flush_jmp_cache_all(vcpu);
 }
 
 void trace_event_set_state_dynamic(TraceEvent *ev, bool state)
diff --git a/trace/control.h b/trace/control.h
index 4ea53e2..b931824 100644
--- a/trace/control.h
+++ b/trace/control.h
@@ -165,6 +165,9 @@ void trace_event_set_state_dynamic(TraceEvent *ev, bool state);
  * Set the dynamic tracing state of an event for the given vCPU.
  *
  * Pre-condition: trace_event_get_vcpu_state_static(ev) == true
+ *
+ * Note: Changes for execution-time events with the 'tcg' property will not be
+ *       propagated until the next TB is executed (iff executing in TCG mode).
  */
 void trace_event_set_vcpu_state_dynamic(CPUState *vcpu,
                                         TraceEvent *ev, bool state);
diff --git a/translate-all.c b/translate-all.c
index 8a5dc19..42beea2 100644
--- a/translate-all.c
+++ b/translate-all.c
@@ -53,6 +53,7 @@
 #include "exec/cputlb.h"
 #include "exec/tb-hash.h"
 #include "translate-all.h"
+#include "qemu/error-report.h"
 #include "qemu/bitmap.h"
 #include "qemu/timer.h"
 #include "qemu/main-loop.h"
@@ -112,6 +113,10 @@ typedef struct PageDesc {
 #define V_L2_BITS 10
 #define V_L2_SIZE (1 << V_L2_BITS)
 
+/* Make sure all possible CPU event bits fit in tb->trace_ds */
+QEMU_BUILD_BUG_ON(CPU_TRACE_DSTATE_MAX_EVENTS >
+                  sizeof(((TranslationBlock *)0)->trace_ds) * BITS_PER_BYTE);
+
 uintptr_t qemu_host_page_size;
 intptr_t qemu_host_page_mask;
 
@@ -1096,7 +1101,7 @@ void tb_phys_invalidate(TranslationBlock *tb, tb_page_addr_t page_addr)
 
     /* remove the TB from the hash list */
     phys_pc = tb->page_addr[0] + (tb->pc & ~TARGET_PAGE_MASK);
-    h = tb_hash_func(phys_pc, tb->pc, tb->flags);
+    h = tb_hash_func(phys_pc, tb->pc, tb->flags, tb->trace_ds);
     qht_remove(&tcg_ctx.tb_ctx.htable, tb, h);
 
     /* remove the TB from the page list */
@@ -1241,7 +1246,7 @@ static void tb_link_page(TranslationBlock *tb, tb_page_addr_t phys_pc,
     }
 
     /* add in the hash table */
-    h = tb_hash_func(phys_pc, tb->pc, tb->flags);
+    h = tb_hash_func(phys_pc, tb->pc, tb->flags, tb->trace_ds);
     qht_insert(&tcg_ctx.tb_ctx.htable, tb, h);
 
 #ifdef DEBUG_TB_CHECK
@@ -1286,6 +1291,7 @@ TranslationBlock *tb_gen_code(CPUState *cpu,
     tb->cs_base = cs_base;
     tb->flags = flags;
     tb->cflags = cflags;
+    tb->trace_ds = *cpu->trace_dstate;
 
 #ifdef CONFIG_PROFILER
     tcg_ctx.tb_count1++; /* includes aborted translations because of
-- 
2.7.4

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

* [Qemu-devel] [PATCH v8 5/7] trace: [tcg] Do not generate TCG code to trace dinamically-disabled events
  2017-06-09  2:25 [Qemu-devel] [PATCH v8 0/7] trace: [tcg] Optimize per-vCPU tracing states Emilio G. Cota
                   ` (3 preceding siblings ...)
  2017-06-09  2:25 ` [Qemu-devel] [PATCH v8 4/7] exec: [tcg] Use different TBs according to the vCPU's dynamic tracing state Emilio G. Cota
@ 2017-06-09  2:25 ` Emilio G. Cota
  2017-06-09  2:25 ` [Qemu-devel] [PATCH v8 6/7] trace: [tcg, trivial] Re-align generated code Emilio G. Cota
  2017-06-09  2:25 ` [Qemu-devel] [PATCH v8 7/7] trace: [trivial] Statically enable all guest events Emilio G. Cota
  6 siblings, 0 replies; 17+ messages in thread
From: Emilio G. Cota @ 2017-06-09  2:25 UTC (permalink / raw)
  To: qemu-devel; +Cc: Richard Henderson, Lluís Vilanova, Stefan Hajnoczi

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

If an event is dynamically disabled, the TCG code that calls the
execution-time tracer is not generated.

Removes the overheads of execution-time tracers for dynamically disabled
events. As a bonus, also avoids checking the event state when the
execution-time tracer is called from TCG-generated code (since otherwise
TCG would simply not call it).

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Signed-off-by: Emilio G. Cota <cota@braap.org>
---
 scripts/tracetool/__init__.py            |  3 ++-
 scripts/tracetool/format/h.py            | 26 +++++++++++++++++++-------
 scripts/tracetool/format/tcg_h.py        | 21 +++++++++++++++++----
 scripts/tracetool/format/tcg_helper_c.py |  5 +++--
 4 files changed, 41 insertions(+), 14 deletions(-)

diff --git a/scripts/tracetool/__init__.py b/scripts/tracetool/__init__.py
index 1ffbc1d..d4c204a 100644
--- a/scripts/tracetool/__init__.py
+++ b/scripts/tracetool/__init__.py
@@ -6,7 +6,7 @@ Machinery for generating tracing-related intermediate files.
 """
 
 __author__     = "Lluís Vilanova <vilanova@ac.upc.edu>"
-__copyright__  = "Copyright 2012-2016, Lluís Vilanova <vilanova@ac.upc.edu>"
+__copyright__  = "Copyright 2012-2017, Lluís Vilanova <vilanova@ac.upc.edu>"
 __license__    = "GPL version 2 or (at your option) any later version"
 
 __maintainer__ = "Stefan Hajnoczi"
@@ -268,6 +268,7 @@ class Event(object):
         return self._FMT.findall(self.fmt)
 
     QEMU_TRACE               = "trace_%(name)s"
+    QEMU_TRACE_NOCHECK       = "_nocheck__" + QEMU_TRACE
     QEMU_TRACE_TCG           = QEMU_TRACE + "_tcg"
     QEMU_DSTATE              = "_TRACE_%(NAME)s_DSTATE"
     QEMU_EVENT               = "_TRACE_%(NAME)s_EVENT"
diff --git a/scripts/tracetool/format/h.py b/scripts/tracetool/format/h.py
index 3682f4e..aecf249 100644
--- a/scripts/tracetool/format/h.py
+++ b/scripts/tracetool/format/h.py
@@ -6,7 +6,7 @@ trace/generated-tracers.h
 """
 
 __author__     = "Lluís Vilanova <vilanova@ac.upc.edu>"
-__copyright__  = "Copyright 2012-2016, Lluís Vilanova <vilanova@ac.upc.edu>"
+__copyright__  = "Copyright 2012-2017, Lluís Vilanova <vilanova@ac.upc.edu>"
 __license__    = "GPL version 2 or (at your option) any later version"
 
 __maintainer__ = "Stefan Hajnoczi"
@@ -49,6 +49,19 @@ def generate(events, backend, group):
     backend.generate_begin(events, group)
 
     for e in events:
+        # tracer without checks
+        out('',
+            'static inline void %(api)s(%(args)s)',
+            '{',
+            api=e.api(e.QEMU_TRACE_NOCHECK),
+            args=e.args)
+
+        if "disable" not in e.properties:
+            backend.generate(e, group)
+
+        out('}')
+
+        # tracer wrapper with checks (per-vCPU tracing)
         if "vcpu" in e.properties:
             trace_cpu = next(iter(e.args))[1]
             cond = "trace_event_get_vcpu_state(%(cpu)s,"\
@@ -63,16 +76,15 @@ def generate(events, backend, group):
             'static inline void %(api)s(%(args)s)',
             '{',
             '    if (%(cond)s) {',
+            '        %(api_nocheck)s(%(names)s);',
+            '    }',
+            '}',
             api=e.api(),
+            api_nocheck=e.api(e.QEMU_TRACE_NOCHECK),
             args=e.args,
+            names=", ".join(e.args.names()),
             cond=cond)
 
-        if "disable" not in e.properties:
-            backend.generate(e, group)
-
-        out('    }',
-            '}')
-
     backend.generate_end(events, group)
 
     out('#endif /* TRACE_%s_GENERATED_TRACERS_H */' % group.upper())
diff --git a/scripts/tracetool/format/tcg_h.py b/scripts/tracetool/format/tcg_h.py
index db55f52..1651cc3 100644
--- a/scripts/tracetool/format/tcg_h.py
+++ b/scripts/tracetool/format/tcg_h.py
@@ -6,7 +6,7 @@ Generate .h file for TCG code generation.
 """
 
 __author__     = "Lluís Vilanova <vilanova@ac.upc.edu>"
-__copyright__  = "Copyright 2012-2016, Lluís Vilanova <vilanova@ac.upc.edu>"
+__copyright__  = "Copyright 2012-2017, Lluís Vilanova <vilanova@ac.upc.edu>"
 __license__    = "GPL version 2 or (at your option) any later version"
 
 __maintainer__ = "Stefan Hajnoczi"
@@ -46,7 +46,7 @@ def generate(events, backend, group):
 
     for e in events:
         # just keep one of them
-        if "tcg-trans" not in e.properties:
+        if "tcg-exec" not in e.properties:
             continue
 
         out('static inline void %(name_tcg)s(%(args)s)',
@@ -58,12 +58,25 @@ def generate(events, backend, group):
             args_trans = e.original.event_trans.args
             args_exec = tracetool.vcpu.transform_args(
                 "tcg_helper_c", e.original.event_exec, "wrapper")
+            if "vcpu" in e.properties:
+                trace_cpu = e.args.names()[0]
+                cond = "trace_event_get_vcpu_state(%(cpu)s,"\
+                       " TRACE_%(id)s)"\
+                       % dict(
+                           cpu=trace_cpu,
+                           id=e.original.event_exec.name.upper())
+            else:
+                cond = "true"
+
             out('    %(name_trans)s(%(argnames_trans)s);',
-                '    gen_helper_%(name_exec)s(%(argnames_exec)s);',
+                '    if (%(cond)s) {',
+                '        gen_helper_%(name_exec)s(%(argnames_exec)s);',
+                '    }',
                 name_trans=e.original.event_trans.api(e.QEMU_TRACE),
                 name_exec=e.original.event_exec.api(e.QEMU_TRACE),
                 argnames_trans=", ".join(args_trans.names()),
-                argnames_exec=", ".join(args_exec.names()))
+                argnames_exec=", ".join(args_exec.names()),
+                cond=cond)
 
         out('}')
 
diff --git a/scripts/tracetool/format/tcg_helper_c.py b/scripts/tracetool/format/tcg_helper_c.py
index ec7acbe..bbbd6ad 100644
--- a/scripts/tracetool/format/tcg_helper_c.py
+++ b/scripts/tracetool/format/tcg_helper_c.py
@@ -6,7 +6,7 @@ Generate trace/generated-helpers.c.
 """
 
 __author__     = "Lluís Vilanova <vilanova@ac.upc.edu>"
-__copyright__  = "Copyright 2012-2016, Lluís Vilanova <vilanova@ac.upc.edu>"
+__copyright__  = "Copyright 2012-2017, Lluís Vilanova <vilanova@ac.upc.edu>"
 __license__    = "GPL version 2 or (at your option) any later version"
 
 __maintainer__ = "Stefan Hajnoczi"
@@ -71,10 +71,11 @@ def generate(events, backend, group):
 
         out('void %(name_tcg)s(%(args_api)s)',
             '{',
+            # NOTE: the check was already performed at TCG-generation time
             '    %(name)s(%(args_call)s);',
             '}',
             name_tcg="helper_%s_proxy" % e.api(),
-            name=e.api(),
+            name=e.api(e.QEMU_TRACE_NOCHECK),
             args_api=e_args_api,
             args_call=", ".join(e_args_call.casted()),
             )
-- 
2.7.4

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

* [Qemu-devel] [PATCH v8 6/7] trace: [tcg, trivial] Re-align generated code
  2017-06-09  2:25 [Qemu-devel] [PATCH v8 0/7] trace: [tcg] Optimize per-vCPU tracing states Emilio G. Cota
                   ` (4 preceding siblings ...)
  2017-06-09  2:25 ` [Qemu-devel] [PATCH v8 5/7] trace: [tcg] Do not generate TCG code to trace dinamically-disabled events Emilio G. Cota
@ 2017-06-09  2:25 ` Emilio G. Cota
  2017-06-09  2:25 ` [Qemu-devel] [PATCH v8 7/7] trace: [trivial] Statically enable all guest events Emilio G. Cota
  6 siblings, 0 replies; 17+ messages in thread
From: Emilio G. Cota @ 2017-06-09  2:25 UTC (permalink / raw)
  To: qemu-devel; +Cc: Richard Henderson, Lluís Vilanova, Stefan Hajnoczi

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

Last patch removed a nesting level in generated code. Re-align all code
generated by backends to be 4-column aligned.

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Signed-off-by: Emilio G. Cota <cota@braap.org>
---
 scripts/tracetool/backend/dtrace.py |  4 ++--
 scripts/tracetool/backend/ftrace.py | 20 ++++++++++----------
 scripts/tracetool/backend/log.py    | 19 ++++++++++---------
 scripts/tracetool/backend/simple.py |  4 ++--
 scripts/tracetool/backend/syslog.py |  6 +++---
 scripts/tracetool/backend/ust.py    |  4 ++--
 6 files changed, 29 insertions(+), 28 deletions(-)

diff --git a/scripts/tracetool/backend/dtrace.py b/scripts/tracetool/backend/dtrace.py
index c469cbd..c6812b7 100644
--- a/scripts/tracetool/backend/dtrace.py
+++ b/scripts/tracetool/backend/dtrace.py
@@ -6,7 +6,7 @@ DTrace/SystemTAP backend.
 """
 
 __author__     = "Lluís Vilanova <vilanova@ac.upc.edu>"
-__copyright__  = "Copyright 2012-2016, Lluís Vilanova <vilanova@ac.upc.edu>"
+__copyright__  = "Copyright 2012-2017, Lluís Vilanova <vilanova@ac.upc.edu>"
 __license__    = "GPL version 2 or (at your option) any later version"
 
 __maintainer__ = "Stefan Hajnoczi"
@@ -46,6 +46,6 @@ def generate_h_begin(events, group):
 
 
 def generate_h(event, group):
-    out('        QEMU_%(uppername)s(%(argnames)s);',
+    out('    QEMU_%(uppername)s(%(argnames)s);',
         uppername=event.name.upper(),
         argnames=", ".join(event.args.names()))
diff --git a/scripts/tracetool/backend/ftrace.py b/scripts/tracetool/backend/ftrace.py
index db9fe7a..dd0eda4 100644
--- a/scripts/tracetool/backend/ftrace.py
+++ b/scripts/tracetool/backend/ftrace.py
@@ -29,17 +29,17 @@ def generate_h(event, group):
     if len(event.args) > 0:
         argnames = ", " + argnames
 
-    out('        {',
-        '            char ftrace_buf[MAX_TRACE_STRLEN];',
-        '            int unused __attribute__ ((unused));',
-        '            int trlen;',
-        '            if (trace_event_get_state(%(event_id)s)) {',
-        '                trlen = snprintf(ftrace_buf, MAX_TRACE_STRLEN,',
-        '                                 "%(name)s " %(fmt)s "\\n" %(argnames)s);',
-        '                trlen = MIN(trlen, MAX_TRACE_STRLEN - 1);',
-        '                unused = write(trace_marker_fd, ftrace_buf, trlen);',
-        '            }',
+    out('    {',
+        '        char ftrace_buf[MAX_TRACE_STRLEN];',
+        '        int unused __attribute__ ((unused));',
+        '        int trlen;',
+        '        if (trace_event_get_state(%(event_id)s)) {',
+        '            trlen = snprintf(ftrace_buf, MAX_TRACE_STRLEN,',
+        '                             "%(name)s " %(fmt)s "\\n" %(argnames)s);',
+        '            trlen = MIN(trlen, MAX_TRACE_STRLEN - 1);',
+        '            unused = write(trace_marker_fd, ftrace_buf, trlen);',
         '        }',
+        '    }',
         name=event.name,
         args=event.args,
         event_id="TRACE_" + event.name.upper(),
diff --git a/scripts/tracetool/backend/log.py b/scripts/tracetool/backend/log.py
index 4f4a4d3..54f0a69 100644
--- a/scripts/tracetool/backend/log.py
+++ b/scripts/tracetool/backend/log.py
@@ -6,7 +6,7 @@ Stderr built-in backend.
 """
 
 __author__     = "Lluís Vilanova <vilanova@ac.upc.edu>"
-__copyright__  = "Copyright 2012-2016, Lluís Vilanova <vilanova@ac.upc.edu>"
+__copyright__  = "Copyright 2012-2017, Lluís Vilanova <vilanova@ac.upc.edu>"
 __license__    = "GPL version 2 or (at your option) any later version"
 
 __maintainer__ = "Stefan Hajnoczi"
@@ -35,14 +35,15 @@ def generate_h(event, group):
     else:
         cond = "trace_event_get_state(%s)" % ("TRACE_" + event.name.upper())
 
-    out('        if (%(cond)s) {',
-        '            struct timeval _now;',
-        '            gettimeofday(&_now, NULL);',
-        '            qemu_log_mask(LOG_TRACE, "%%d@%%zd.%%06zd:%(name)s " %(fmt)s "\\n",',
-        '                          getpid(),',
-        '                          (size_t)_now.tv_sec, (size_t)_now.tv_usec',
-        '                          %(argnames)s);',
-        '        }',
+    out('    if (%(cond)s) {',
+        '        struct timeval _now;',
+        '        gettimeofday(&_now, NULL);',
+        '        qemu_log_mask(LOG_TRACE,',
+        '                      "%%d@%%zd.%%06zd:%(name)s " %(fmt)s "\\n",',
+        '                      getpid(),',
+        '                      (size_t)_now.tv_sec, (size_t)_now.tv_usec',
+        '                      %(argnames)s);',
+        '    }',
         cond=cond,
         name=event.name,
         fmt=event.fmt.rstrip("\n"),
diff --git a/scripts/tracetool/backend/simple.py b/scripts/tracetool/backend/simple.py
index 4acc06e..f983670 100644
--- a/scripts/tracetool/backend/simple.py
+++ b/scripts/tracetool/backend/simple.py
@@ -6,7 +6,7 @@ Simple built-in backend.
 """
 
 __author__     = "Lluís Vilanova <vilanova@ac.upc.edu>"
-__copyright__  = "Copyright 2012-2014, Lluís Vilanova <vilanova@ac.upc.edu>"
+__copyright__  = "Copyright 2012-2017, Lluís Vilanova <vilanova@ac.upc.edu>"
 __license__    = "GPL version 2 or (at your option) any later version"
 
 __maintainer__ = "Stefan Hajnoczi"
@@ -37,7 +37,7 @@ def generate_h_begin(events, group):
 
 
 def generate_h(event, group):
-    out('        _simple_%(api)s(%(args)s);',
+    out('    _simple_%(api)s(%(args)s);',
         api=event.api(),
         args=", ".join(event.args.names()))
 
diff --git a/scripts/tracetool/backend/syslog.py b/scripts/tracetool/backend/syslog.py
index b8ff279..1ce627f 100644
--- a/scripts/tracetool/backend/syslog.py
+++ b/scripts/tracetool/backend/syslog.py
@@ -35,9 +35,9 @@ def generate_h(event, group):
     else:
         cond = "trace_event_get_state(%s)" % ("TRACE_" + event.name.upper())
 
-    out('        if (%(cond)s) {',
-        '            syslog(LOG_INFO, "%(name)s " %(fmt)s %(argnames)s);',
-        '        }',
+    out('    if (%(cond)s) {',
+        '        syslog(LOG_INFO, "%(name)s " %(fmt)s %(argnames)s);',
+        '    }',
         cond=cond,
         name=event.name,
         fmt=event.fmt.rstrip("\n"),
diff --git a/scripts/tracetool/backend/ust.py b/scripts/tracetool/backend/ust.py
index 52ce892..2adaf54 100644
--- a/scripts/tracetool/backend/ust.py
+++ b/scripts/tracetool/backend/ust.py
@@ -6,7 +6,7 @@ LTTng User Space Tracing backend.
 """
 
 __author__     = "Lluís Vilanova <vilanova@ac.upc.edu>"
-__copyright__  = "Copyright 2012-2016, Lluís Vilanova <vilanova@ac.upc.edu>"
+__copyright__  = "Copyright 2012-2017, Lluís Vilanova <vilanova@ac.upc.edu>"
 __license__    = "GPL version 2 or (at your option) any later version"
 
 __maintainer__ = "Stefan Hajnoczi"
@@ -35,6 +35,6 @@ def generate_h(event, group):
     if len(event.args) > 0:
         argnames = ", " + argnames
 
-    out('        tracepoint(qemu, %(name)s%(tp_args)s);',
+    out('    tracepoint(qemu, %(name)s%(tp_args)s);',
         name=event.name,
         tp_args=argnames)
-- 
2.7.4

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

* [Qemu-devel] [PATCH v8 7/7] trace: [trivial] Statically enable all guest events
  2017-06-09  2:25 [Qemu-devel] [PATCH v8 0/7] trace: [tcg] Optimize per-vCPU tracing states Emilio G. Cota
                   ` (5 preceding siblings ...)
  2017-06-09  2:25 ` [Qemu-devel] [PATCH v8 6/7] trace: [tcg, trivial] Re-align generated code Emilio G. Cota
@ 2017-06-09  2:25 ` Emilio G. Cota
  2017-06-26  8:28   ` Daniel P. Berrange
  6 siblings, 1 reply; 17+ messages in thread
From: Emilio G. Cota @ 2017-06-09  2:25 UTC (permalink / raw)
  To: qemu-devel; +Cc: Richard Henderson, Lluís Vilanova, Stefan Hajnoczi

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

The optimizations of this series makes it feasible to have them
available on all builds.

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Signed-off-by: Emilio G. Cota <cota@braap.org>
---
 trace-events | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/trace-events b/trace-events
index d7a4d94..b040d7e 100644
--- a/trace-events
+++ b/trace-events
@@ -125,7 +125,7 @@ vcpu guest_cpu_reset(void)
 #
 # 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"
+vcpu tcg guest_mem_before(TCGv vaddr, uint8_t info) "info=%d", "vaddr=0x%016"PRIx64" info=%d"
 
 # @num: System call number.
 # @arg*: System call argument value.
@@ -134,7 +134,7 @@ disable vcpu tcg guest_mem_before(TCGv vaddr, uint8_t info) "info=%d", "vaddr=0x
 #
 # 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
+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
 
 # @num: System call number.
 # @ret: System call result value.
@@ -143,4 +143,4 @@ disable vcpu guest_user_syscall(uint64_t num, uint64_t arg1, uint64_t arg2, uint
 #
 # 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
+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] 17+ messages in thread

* Re: [Qemu-devel] [PATCH v8 2/7] cpu: allocate cpu->trace_dstate in place
  2017-06-09  2:25 ` [Qemu-devel] [PATCH v8 2/7] cpu: allocate cpu->trace_dstate in place Emilio G. Cota
@ 2017-06-11 12:36   ` Lluís Vilanova
  2017-06-25  9:41     ` Lluís Vilanova
  0 siblings, 1 reply; 17+ messages in thread
From: Lluís Vilanova @ 2017-06-11 12:36 UTC (permalink / raw)
  To: Emilio G. Cota; +Cc: qemu-devel, Richard Henderson, Stefan Hajnoczi

Emilio G Cota writes:

> There's little point in dynamically allocating the bitmap if we
> know at compile-time the max number of events we want to support.
> Thus, make room in the struct for the bitmap, which will make things
> easier later: this paves the way for upcoming changes, in which
> we'll use a u32 to fully capture cpu->trace_dstate.

> This change also increases performance by saving a dereference and
> improving locality--note that this is important since upcoming work
> makes reading this bitmap fairly common.

> Signed-off-by: Emilio G. Cota <cota@braap.org>

Reviewed-by: Lluís Vilanova <vilanova@ac.upc.edu>


> ---
>  include/qom/cpu.h | 9 +++------
>  qom/cpu.c         | 8 --------
>  trace/control.c   | 9 ++++++++-
>  3 files changed, 11 insertions(+), 15 deletions(-)

> diff --git a/include/qom/cpu.h b/include/qom/cpu.h
> index 89ddb68..bc6e20f 100644
> --- a/include/qom/cpu.h
> +++ b/include/qom/cpu.h
> @@ -259,6 +259,7 @@ typedef void (*run_on_cpu_func)(CPUState *cpu, run_on_cpu_data data);
>  struct qemu_work_item;
 
>  #define CPU_UNSET_NUMA_NODE_ID -1
> +#define CPU_TRACE_DSTATE_MAX_EVENTS 32
 
>  /**
>   * CPUState:
> @@ -373,12 +374,8 @@ struct CPUState {
>      struct KVMState *kvm_state;
>      struct kvm_run *kvm_run;
 
> -    /*
> -     * Used for events with 'vcpu' and *without* the 'disabled' properties.
> -     * Dynamically allocated based on bitmap requried to hold up to
> -     * trace_get_vcpu_event_count() entries.
> -     */
> -    unsigned long *trace_dstate;
> +    /* Used for events with 'vcpu' and *without* the 'disabled' properties */
> +    DECLARE_BITMAP(trace_dstate, CPU_TRACE_DSTATE_MAX_EVENTS);
 
>      /* TODO Move common fields from CPUArchState here. */
>      int cpu_index; /* used by alpha TCG */
> diff --git a/qom/cpu.c b/qom/cpu.c
> index 5069876..69fbb9c 100644
> --- a/qom/cpu.c
> +++ b/qom/cpu.c
> @@ -382,7 +382,6 @@ static void cpu_common_unrealizefn(DeviceState *dev, Error **errp)
 
>  static void cpu_common_initfn(Object *obj)
>  {
> -    uint32_t count;
>      CPUState *cpu = CPU(obj);
>      CPUClass *cc = CPU_GET_CLASS(obj);
 
> @@ -397,18 +396,11 @@ static void cpu_common_initfn(Object *obj)
>      QTAILQ_INIT(&cpu->breakpoints);
>      QTAILQ_INIT(&cpu->watchpoints);
 
> -    count = trace_get_vcpu_event_count();
> -    if (count) {
> -        cpu->trace_dstate = bitmap_new(count);
> -    }
> -
>      cpu_exec_initfn(cpu);
>  }
 
>  static void cpu_common_finalize(Object *obj)
>  {
> -    CPUState *cpu = CPU(obj);
> -    g_free(cpu->trace_dstate);
>  }
 
>  static int64_t cpu_common_get_arch_id(CPUState *cpu)
> diff --git a/trace/control.c b/trace/control.c
> index 9b157b0..83740aa 100644
> --- a/trace/control.c
> +++ b/trace/control.c
> @@ -65,8 +65,15 @@ void trace_event_register_group(TraceEvent **events)
>      size_t i;
>      for (i = 0; events[i] != NULL; i++) {
>          events[i]->id = next_id++;
> -        if (events[i]->vcpu_id != TRACE_VCPU_EVENT_NONE) {
> +        if (events[i]->vcpu_id == TRACE_VCPU_EVENT_NONE) {
> +            continue;
> +        }
> +
> +        if (likely(next_vcpu_id < CPU_TRACE_DSTATE_MAX_EVENTS)) {
>              events[i]->vcpu_id = next_vcpu_id++;
> +        } else {
> +            error_report("WARNING: too many vcpu trace events; dropping '%s'",
> +                         events[i]->name);
>          }
>      }
>      event_groups = g_renew(TraceEventGroup, event_groups, nevent_groups + 1);
> -- 
> 2.7.4

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

* Re: [Qemu-devel] [PATCH v8 2/7] cpu: allocate cpu->trace_dstate in place
  2017-06-11 12:36   ` Lluís Vilanova
@ 2017-06-25  9:41     ` Lluís Vilanova
  2017-06-26  8:26       ` Daniel P. Berrange
  0 siblings, 1 reply; 17+ messages in thread
From: Lluís Vilanova @ 2017-06-25  9:41 UTC (permalink / raw)
  To: Emilio G. Cota
  Cc: qemu-devel, Richard Henderson, Stefan Hajnoczi, Daniel P. Berrange

Lluís Vilanova writes:

> Emilio G Cota writes:
>> There's little point in dynamically allocating the bitmap if we
>> know at compile-time the max number of events we want to support.
>> Thus, make room in the struct for the bitmap, which will make things
>> easier later: this paves the way for upcoming changes, in which
>> we'll use a u32 to fully capture cpu->trace_dstate.

>> This change also increases performance by saving a dereference and
>> improving locality--note that this is important since upcoming work
>> makes reading this bitmap fairly common.

>> Signed-off-by: Emilio G. Cota <cota@braap.org>

> Reviewed-by: Lluís Vilanova <vilanova@ac.upc.edu>

BTW, I think this partially undoes Daniel's changes in
b7d48952c375842bd669460fd8384d90cc12286c.

You should check with him (CC'ed).

Lluis


>> ---
>> include/qom/cpu.h | 9 +++------
>> qom/cpu.c         | 8 --------
>> trace/control.c   | 9 ++++++++-
>> 3 files changed, 11 insertions(+), 15 deletions(-)

>> diff --git a/include/qom/cpu.h b/include/qom/cpu.h
>> index 89ddb68..bc6e20f 100644
>> --- a/include/qom/cpu.h
>> +++ b/include/qom/cpu.h
>> @@ -259,6 +259,7 @@ typedef void (*run_on_cpu_func)(CPUState *cpu, run_on_cpu_data data);
>> struct qemu_work_item;
 
>> #define CPU_UNSET_NUMA_NODE_ID -1
>> +#define CPU_TRACE_DSTATE_MAX_EVENTS 32
 
>> /**
>> * CPUState:
>> @@ -373,12 +374,8 @@ struct CPUState {
>> struct KVMState *kvm_state;
>> struct kvm_run *kvm_run;
 
>> -    /*
>> -     * Used for events with 'vcpu' and *without* the 'disabled' properties.
>> -     * Dynamically allocated based on bitmap requried to hold up to
>> -     * trace_get_vcpu_event_count() entries.
>> -     */
>> -    unsigned long *trace_dstate;
>> +    /* Used for events with 'vcpu' and *without* the 'disabled' properties */
>> +    DECLARE_BITMAP(trace_dstate, CPU_TRACE_DSTATE_MAX_EVENTS);
 
>> /* TODO Move common fields from CPUArchState here. */
>> int cpu_index; /* used by alpha TCG */
>> diff --git a/qom/cpu.c b/qom/cpu.c
>> index 5069876..69fbb9c 100644
>> --- a/qom/cpu.c
>> +++ b/qom/cpu.c
>> @@ -382,7 +382,6 @@ static void cpu_common_unrealizefn(DeviceState *dev, Error **errp)
 
>> static void cpu_common_initfn(Object *obj)
>> {
>> -    uint32_t count;
>> CPUState *cpu = CPU(obj);
>> CPUClass *cc = CPU_GET_CLASS(obj);
 
>> @@ -397,18 +396,11 @@ static void cpu_common_initfn(Object *obj)
>> QTAILQ_INIT(&cpu->breakpoints);
>> QTAILQ_INIT(&cpu->watchpoints);
 
>> -    count = trace_get_vcpu_event_count();
>> -    if (count) {
>> -        cpu->trace_dstate = bitmap_new(count);
>> -    }
>> -
>> cpu_exec_initfn(cpu);
>> }
 
>> static void cpu_common_finalize(Object *obj)
>> {
>> -    CPUState *cpu = CPU(obj);
>> -    g_free(cpu->trace_dstate);
>> }
 
>> static int64_t cpu_common_get_arch_id(CPUState *cpu)
>> diff --git a/trace/control.c b/trace/control.c
>> index 9b157b0..83740aa 100644
>> --- a/trace/control.c
>> +++ b/trace/control.c
>> @@ -65,8 +65,15 @@ void trace_event_register_group(TraceEvent **events)
>> size_t i;
>> for (i = 0; events[i] != NULL; i++) {
>> events[i]->id = next_id++;
>> -        if (events[i]->vcpu_id != TRACE_VCPU_EVENT_NONE) {
>> +        if (events[i]->vcpu_id == TRACE_VCPU_EVENT_NONE) {
>> +            continue;
>> +        }
>> +
>> +        if (likely(next_vcpu_id < CPU_TRACE_DSTATE_MAX_EVENTS)) {
>> events[i]->vcpu_id = next_vcpu_id++;
>> +        } else {
>> +            error_report("WARNING: too many vcpu trace events; dropping '%s'",
>> +                         events[i]->name);
>> }
>> }
>> event_groups = g_renew(TraceEventGroup, event_groups, nevent_groups + 1);
>> -- 
>> 2.7.4

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

* Re: [Qemu-devel] [PATCH v8 2/7] cpu: allocate cpu->trace_dstate in place
  2017-06-25  9:41     ` Lluís Vilanova
@ 2017-06-26  8:26       ` Daniel P. Berrange
  0 siblings, 0 replies; 17+ messages in thread
From: Daniel P. Berrange @ 2017-06-26  8:26 UTC (permalink / raw)
  To: Emilio G. Cota, qemu-devel, Richard Henderson, Stefan Hajnoczi

On Sun, Jun 25, 2017 at 12:41:57PM +0300, Lluís Vilanova wrote:
> Lluís Vilanova writes:
> 
> > Emilio G Cota writes:
> >> There's little point in dynamically allocating the bitmap if we
> >> know at compile-time the max number of events we want to support.
> >> Thus, make room in the struct for the bitmap, which will make things
> >> easier later: this paves the way for upcoming changes, in which
> >> we'll use a u32 to fully capture cpu->trace_dstate.
> 
> >> This change also increases performance by saving a dereference and
> >> improving locality--note that this is important since upcoming work
> >> makes reading this bitmap fairly common.
> 
> >> Signed-off-by: Emilio G. Cota <cota@braap.org>
> 
> > Reviewed-by: Lluís Vilanova <vilanova@ac.upc.edu>
> 
> BTW, I think this partially undoes Daniel's changes in
> b7d48952c375842bd669460fd8384d90cc12286c.
> 
> You should check with him (CC'ed).

That's ok - I only made those changes in order to remove the reliance on
the generated max vcpu event ID counter. Choosing to hardcode a fixed
limit on number of vcpu events instead is a fine alternative.

> 
> Lluis
> 
> 
> >> ---
> >> include/qom/cpu.h | 9 +++------
> >> qom/cpu.c         | 8 --------
> >> trace/control.c   | 9 ++++++++-
> >> 3 files changed, 11 insertions(+), 15 deletions(-)
> 
> >> diff --git a/include/qom/cpu.h b/include/qom/cpu.h
> >> index 89ddb68..bc6e20f 100644
> >> --- a/include/qom/cpu.h
> >> +++ b/include/qom/cpu.h
> >> @@ -259,6 +259,7 @@ typedef void (*run_on_cpu_func)(CPUState *cpu, run_on_cpu_data data);
> >> struct qemu_work_item;
>  
> >> #define CPU_UNSET_NUMA_NODE_ID -1
> >> +#define CPU_TRACE_DSTATE_MAX_EVENTS 32
>  
> >> /**
> >> * CPUState:
> >> @@ -373,12 +374,8 @@ struct CPUState {
> >> struct KVMState *kvm_state;
> >> struct kvm_run *kvm_run;
>  
> >> -    /*
> >> -     * Used for events with 'vcpu' and *without* the 'disabled' properties.
> >> -     * Dynamically allocated based on bitmap requried to hold up to
> >> -     * trace_get_vcpu_event_count() entries.
> >> -     */
> >> -    unsigned long *trace_dstate;
> >> +    /* Used for events with 'vcpu' and *without* the 'disabled' properties */
> >> +    DECLARE_BITMAP(trace_dstate, CPU_TRACE_DSTATE_MAX_EVENTS);
>  
> >> /* TODO Move common fields from CPUArchState here. */
> >> int cpu_index; /* used by alpha TCG */
> >> diff --git a/qom/cpu.c b/qom/cpu.c
> >> index 5069876..69fbb9c 100644
> >> --- a/qom/cpu.c
> >> +++ b/qom/cpu.c
> >> @@ -382,7 +382,6 @@ static void cpu_common_unrealizefn(DeviceState *dev, Error **errp)
>  
> >> static void cpu_common_initfn(Object *obj)
> >> {
> >> -    uint32_t count;
> >> CPUState *cpu = CPU(obj);
> >> CPUClass *cc = CPU_GET_CLASS(obj);
>  
> >> @@ -397,18 +396,11 @@ static void cpu_common_initfn(Object *obj)
> >> QTAILQ_INIT(&cpu->breakpoints);
> >> QTAILQ_INIT(&cpu->watchpoints);
>  
> >> -    count = trace_get_vcpu_event_count();
> >> -    if (count) {
> >> -        cpu->trace_dstate = bitmap_new(count);
> >> -    }
> >> -
> >> cpu_exec_initfn(cpu);
> >> }
>  
> >> static void cpu_common_finalize(Object *obj)
> >> {
> >> -    CPUState *cpu = CPU(obj);
> >> -    g_free(cpu->trace_dstate);
> >> }
>  
> >> static int64_t cpu_common_get_arch_id(CPUState *cpu)
> >> diff --git a/trace/control.c b/trace/control.c
> >> index 9b157b0..83740aa 100644
> >> --- a/trace/control.c
> >> +++ b/trace/control.c
> >> @@ -65,8 +65,15 @@ void trace_event_register_group(TraceEvent **events)
> >> size_t i;
> >> for (i = 0; events[i] != NULL; i++) {
> >> events[i]->id = next_id++;
> >> -        if (events[i]->vcpu_id != TRACE_VCPU_EVENT_NONE) {
> >> +        if (events[i]->vcpu_id == TRACE_VCPU_EVENT_NONE) {
> >> +            continue;
> >> +        }
> >> +
> >> +        if (likely(next_vcpu_id < CPU_TRACE_DSTATE_MAX_EVENTS)) {
> >> events[i]->vcpu_id = next_vcpu_id++;
> >> +        } else {
> >> +            error_report("WARNING: too many vcpu trace events; dropping '%s'",
> >> +                         events[i]->name);
> >> }

This should be an abort IMHO, as it would be considered a bug to have
added > 32 vcpu events.

I'd also suggest that the top level 'trace-events' file get a comment
added to the effect that we only support 32 events right now.

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

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

* Re: [Qemu-devel] [PATCH v8 7/7] trace: [trivial] Statically enable all guest events
  2017-06-09  2:25 ` [Qemu-devel] [PATCH v8 7/7] trace: [trivial] Statically enable all guest events Emilio G. Cota
@ 2017-06-26  8:28   ` Daniel P. Berrange
  2017-06-26  9:18     ` Lluís Vilanova
  0 siblings, 1 reply; 17+ messages in thread
From: Daniel P. Berrange @ 2017-06-26  8:28 UTC (permalink / raw)
  To: Emilio G. Cota
  Cc: qemu-devel, Lluís Vilanova, Stefan Hajnoczi, Richard Henderson

On Thu, Jun 08, 2017 at 10:25:22PM -0400, Emilio G. Cota wrote:
> From: Lluís Vilanova <vilanova@ac.upc.edu>
> 
> The optimizations of this series makes it feasible to have them
> available on all builds.

I'm not saying you're wrong, but where is the data to backup this
assertion ?

IMHO, this commit message should be describing how performance was
tested and what the results were.

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

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

* Re: [Qemu-devel] [PATCH v8 7/7] trace: [trivial] Statically enable all guest events
  2017-06-26  8:28   ` Daniel P. Berrange
@ 2017-06-26  9:18     ` Lluís Vilanova
  2017-06-26  9:26       ` Daniel P. Berrange
                         ` (2 more replies)
  0 siblings, 3 replies; 17+ messages in thread
From: Lluís Vilanova @ 2017-06-26  9:18 UTC (permalink / raw)
  To: Daniel P. Berrange
  Cc: Emilio G. Cota, qemu-devel, Stefan Hajnoczi, Richard Henderson

Daniel P Berrange writes:

> On Thu, Jun 08, 2017 at 10:25:22PM -0400, Emilio G. Cota wrote:
>> From: Lluís Vilanova <vilanova@ac.upc.edu>
>> 
>> The optimizations of this series makes it feasible to have them
>> available on all builds.

> I'm not saying you're wrong, but where is the data to backup this
> assertion ?

> IMHO, this commit message should be describing how performance was
> tested and what the results were.

I can submit a new series with the performance measurements now that you've
informally OK'ed Emilio's new patch.

Is there some public script to automate that or do I have to cook my own?


Thanks,
  Lluis

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

* Re: [Qemu-devel] [PATCH v8 7/7] trace: [trivial] Statically enable all guest events
  2017-06-26  9:18     ` Lluís Vilanova
@ 2017-06-26  9:26       ` Daniel P. Berrange
  2017-06-26  9:32       ` Laurent Desnogues
  2017-06-26 16:22       ` Lluís Vilanova
  2 siblings, 0 replies; 17+ messages in thread
From: Daniel P. Berrange @ 2017-06-26  9:26 UTC (permalink / raw)
  To: Emilio G. Cota, qemu-devel, Stefan Hajnoczi, Richard Henderson

On Mon, Jun 26, 2017 at 12:18:14PM +0300, Lluís Vilanova wrote:
> Daniel P Berrange writes:
> 
> > On Thu, Jun 08, 2017 at 10:25:22PM -0400, Emilio G. Cota wrote:
> >> From: Lluís Vilanova <vilanova@ac.upc.edu>
> >> 
> >> The optimizations of this series makes it feasible to have them
> >> available on all builds.
> 
> > I'm not saying you're wrong, but where is the data to backup this
> > assertion ?
> 
> > IMHO, this commit message should be describing how performance was
> > tested and what the results were.
> 
> I can submit a new series with the performance measurements now that you've
> informally OK'ed Emilio's new patch.
> 
> Is there some public script to automate that or do I have to cook my own?

I don't think there's anything standardized in this area.

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

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

* Re: [Qemu-devel] [PATCH v8 7/7] trace: [trivial] Statically enable all guest events
  2017-06-26  9:18     ` Lluís Vilanova
  2017-06-26  9:26       ` Daniel P. Berrange
@ 2017-06-26  9:32       ` Laurent Desnogues
  2017-06-26 16:22       ` Lluís Vilanova
  2 siblings, 0 replies; 17+ messages in thread
From: Laurent Desnogues @ 2017-06-26  9:32 UTC (permalink / raw)
  To: Daniel P. Berrange, Emilio G. Cota, qemu-devel, Lluís Vilanova

On Mon, Jun 26, 2017 at 11:18 AM, Lluís Vilanova <vilanova@ac.upc.edu> wrote:
> Daniel P Berrange writes:
>
>> On Thu, Jun 08, 2017 at 10:25:22PM -0400, Emilio G. Cota wrote:
>>> From: Lluís Vilanova <vilanova@ac.upc.edu>
>>>
>>> The optimizations of this series makes it feasible to have them
>>> available on all builds.
>
>> I'm not saying you're wrong, but where is the data to backup this
>> assertion ?
>
>> IMHO, this commit message should be describing how performance was
>> tested and what the results were.
>
> I can submit a new series with the performance measurements now that you've
> informally OK'ed Emilio's new patch.
>
> Is there some public script to automate that or do I have to cook my own?

Emilio proposed this for user mode:

https://github.com/cota/dbt-bench

IIRC he also has a Linux image that boots and shutdowns immediately.

Hope this helps,

Laurent

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

* Re: [Qemu-devel] [PATCH v8 7/7] trace: [trivial] Statically enable all guest events
  2017-06-26  9:18     ` Lluís Vilanova
  2017-06-26  9:26       ` Daniel P. Berrange
  2017-06-26  9:32       ` Laurent Desnogues
@ 2017-06-26 16:22       ` Lluís Vilanova
  2017-06-26 16:26         ` Daniel P. Berrange
  2 siblings, 1 reply; 17+ messages in thread
From: Lluís Vilanova @ 2017-06-26 16:22 UTC (permalink / raw)
  To: Daniel P. Berrange
  Cc: Emilio G. Cota, qemu-devel, Stefan Hajnoczi, Richard Henderson

Lluís Vilanova writes:

> Daniel P Berrange writes:
>> On Thu, Jun 08, 2017 at 10:25:22PM -0400, Emilio G. Cota wrote:
>>> From: Lluís Vilanova <vilanova@ac.upc.edu>
>>> 
>>> The optimizations of this series makes it feasible to have them
>>> available on all builds.

>> I'm not saying you're wrong, but where is the data to backup this
>> assertion ?

>> IMHO, this commit message should be describing how performance was
>> tested and what the results were.

> I can submit a new series with the performance measurements now that you've
> informally OK'ed Emilio's new patch.

> Is there some public script to automate that or do I have to cook my own?

BTW, I just realized that my original cover for v7 did include results:

  https://lists.gnu.org/archive/html/qemu-devel/2017-01/msg02741.html

Do such numbers need to be in this commit or is the cover fine?


Thanks,
  Lluis

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

* Re: [Qemu-devel] [PATCH v8 7/7] trace: [trivial] Statically enable all guest events
  2017-06-26 16:22       ` Lluís Vilanova
@ 2017-06-26 16:26         ` Daniel P. Berrange
  0 siblings, 0 replies; 17+ messages in thread
From: Daniel P. Berrange @ 2017-06-26 16:26 UTC (permalink / raw)
  To: Emilio G. Cota, qemu-devel, Stefan Hajnoczi, Richard Henderson

On Mon, Jun 26, 2017 at 07:22:28PM +0300, Lluís Vilanova wrote:
> Lluís Vilanova writes:
> 
> > Daniel P Berrange writes:
> >> On Thu, Jun 08, 2017 at 10:25:22PM -0400, Emilio G. Cota wrote:
> >>> From: Lluís Vilanova <vilanova@ac.upc.edu>
> >>> 
> >>> The optimizations of this series makes it feasible to have them
> >>> available on all builds.
> 
> >> I'm not saying you're wrong, but where is the data to backup this
> >> assertion ?
> 
> >> IMHO, this commit message should be describing how performance was
> >> tested and what the results were.
> 
> > I can submit a new series with the performance measurements now that you've
> > informally OK'ed Emilio's new patch.
> 
> > Is there some public script to automate that or do I have to cook my own?
> 
> BTW, I just realized that my original cover for v7 did include results:
> 
>   https://lists.gnu.org/archive/html/qemu-devel/2017-01/msg02741.html
> 
> Do such numbers need to be in this commit or is the cover fine?

Please do copy that info to the commit message - when someone looks back
at git history in a year's time, they'll have the commit message right
there, but will rarely think to look through the mailing list for a cover
letter with data.

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

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

end of thread, other threads:[~2017-06-26 16:27 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-09  2:25 [Qemu-devel] [PATCH v8 0/7] trace: [tcg] Optimize per-vCPU tracing states Emilio G. Cota
2017-06-09  2:25 ` [Qemu-devel] [PATCH v8 1/7] exec: [tcg] Refactor flush of per-CPU virtual TB cache Emilio G. Cota
2017-06-09  2:25 ` [Qemu-devel] [PATCH v8 2/7] cpu: allocate cpu->trace_dstate in place Emilio G. Cota
2017-06-11 12:36   ` Lluís Vilanova
2017-06-25  9:41     ` Lluís Vilanova
2017-06-26  8:26       ` Daniel P. Berrange
2017-06-09  2:25 ` [Qemu-devel] [PATCH v8 3/7] trace: [tcg] Delay changes to dynamic state when translating Emilio G. Cota
2017-06-09  2:25 ` [Qemu-devel] [PATCH v8 4/7] exec: [tcg] Use different TBs according to the vCPU's dynamic tracing state Emilio G. Cota
2017-06-09  2:25 ` [Qemu-devel] [PATCH v8 5/7] trace: [tcg] Do not generate TCG code to trace dinamically-disabled events Emilio G. Cota
2017-06-09  2:25 ` [Qemu-devel] [PATCH v8 6/7] trace: [tcg, trivial] Re-align generated code Emilio G. Cota
2017-06-09  2:25 ` [Qemu-devel] [PATCH v8 7/7] trace: [trivial] Statically enable all guest events Emilio G. Cota
2017-06-26  8:28   ` Daniel P. Berrange
2017-06-26  9:18     ` Lluís Vilanova
2017-06-26  9:26       ` Daniel P. Berrange
2017-06-26  9:32       ` Laurent Desnogues
2017-06-26 16:22       ` Lluís Vilanova
2017-06-26 16:26         ` Daniel P. Berrange

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.