diff mbox series

[v1,2/3] cpus: dump TLB flush counts as trace event

Message ID 20170411105031.28904-3-alex.bennee@linaro.org
State New
Headers show
Series Fix cputlb flush stats and exporting data | expand

Commit Message

Alex Bennée April 11, 2017, 10:50 a.m. UTC
This can be pre-processed later from the trace file.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

---
 cpus.c       | 6 ++++++
 trace-events | 3 +++
 2 files changed, 9 insertions(+)

-- 
2.11.0

Comments

Paolo Bonzini April 14, 2017, 5:18 a.m. UTC | #1
On 11/04/2017 18:50, Alex Bennée wrote:
> This can be pre-processed later from the trace file.


What about skipping this patch, and instead adding five trace points

trace_tlb_flush_self(int vcpu)
trace_tlb_flush_async_schedule(int from, int to)
trace_tlb_flush_async_work(int vcpu)
trace_tlb_flush_synced_schedule(int vcpu)
trace_tlb_flush_synced_work(int vcpu)

The disadvantage is that the TLB flush counts are not emitted in "info
tcg", but the resulting information is finer-grained and the offline
accumulation of tracepoints can provide the same information.

Paolo

> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

> ---

>  cpus.c       | 6 ++++++

>  trace-events | 3 +++

>  2 files changed, 9 insertions(+)

> 

> diff --git a/cpus.c b/cpus.c

> index 740b8dc3f8..fae7344df5 100644

> --- a/cpus.c

> +++ b/cpus.c

> @@ -50,6 +50,8 @@

>  #include "qapi-event.h"

>  #include "hw/nmi.h"

>  #include "sysemu/replay.h"

> +#include "exec/cputlb.h"

> +#include "trace-root.h"

>  

>  #ifdef CONFIG_LINUX

>  

> @@ -1252,6 +1254,10 @@ static int tcg_cpu_exec(CPUState *cpu)

>      int64_t ti;

>  #endif

>  

> +    trace_tlb_flush_stats(tlb_self_flush_count,

> +                          tlb_async_flush_count,

> +                          tlb_synced_flush_count);

> +

>  #ifdef CONFIG_PROFILER

>      ti = profile_getclock();

>  #endif

> diff --git a/trace-events b/trace-events

> index b07a09ba95..fc23e15d25 100644

> --- a/trace-events

> +++ b/trace-events

> @@ -94,6 +94,9 @@ disable exec_tb(void *tb, uintptr_t pc) "tb:%p pc=0x%"PRIxPTR

>  disable exec_tb_nocache(void *tb, uintptr_t pc) "tb:%p pc=0x%"PRIxPTR

>  disable exec_tb_exit(void *last_tb, unsigned int flags) "tb:%p flags=%x"

>  

> +# cpus.c

> +tlb_flush_stats(int self, int async, int synced) "self:%d async:%d synced:%d"

> +

>  # translate-all.c

>  translate_block(void *tb, uintptr_t pc, uint8_t *tb_code) "tb:%p, pc:0x%"PRIxPTR", tb_code:%p"

>  

>
Alex Bennée April 25, 2017, 3:32 p.m. UTC | #2
Paolo Bonzini <pbonzini@redhat.com> writes:

> On 11/04/2017 18:50, Alex Bennée wrote:

>> This can be pre-processed later from the trace file.

>

> What about skipping this patch, and instead adding five trace points

>

> trace_tlb_flush_self(int vcpu)

> trace_tlb_flush_async_schedule(int from, int to)

> trace_tlb_flush_async_work(int vcpu)

> trace_tlb_flush_synced_schedule(int vcpu)

> trace_tlb_flush_synced_work(int vcpu)

>

> The disadvantage is that the TLB flush counts are not emitted in "info

> tcg", but the resulting information is finer-grained and the offline

> accumulation of tracepoints can provide the same information.


In principle I agree. It depends if people find the console based TCG
information useful or not.

I could macro-up something that would use counters when tracing is not
enabled and prompt users to use the tracing interface in the console
when it is.

>

> Paolo

>

>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

>> ---

>>  cpus.c       | 6 ++++++

>>  trace-events | 3 +++

>>  2 files changed, 9 insertions(+)

>>

>> diff --git a/cpus.c b/cpus.c

>> index 740b8dc3f8..fae7344df5 100644

>> --- a/cpus.c

>> +++ b/cpus.c

>> @@ -50,6 +50,8 @@

>>  #include "qapi-event.h"

>>  #include "hw/nmi.h"

>>  #include "sysemu/replay.h"

>> +#include "exec/cputlb.h"

>> +#include "trace-root.h"

>>

>>  #ifdef CONFIG_LINUX

>>

>> @@ -1252,6 +1254,10 @@ static int tcg_cpu_exec(CPUState *cpu)

>>      int64_t ti;

>>  #endif

>>

>> +    trace_tlb_flush_stats(tlb_self_flush_count,

>> +                          tlb_async_flush_count,

>> +                          tlb_synced_flush_count);

>> +

>>  #ifdef CONFIG_PROFILER

>>      ti = profile_getclock();

>>  #endif

>> diff --git a/trace-events b/trace-events

>> index b07a09ba95..fc23e15d25 100644

>> --- a/trace-events

>> +++ b/trace-events

>> @@ -94,6 +94,9 @@ disable exec_tb(void *tb, uintptr_t pc) "tb:%p pc=0x%"PRIxPTR

>>  disable exec_tb_nocache(void *tb, uintptr_t pc) "tb:%p pc=0x%"PRIxPTR

>>  disable exec_tb_exit(void *last_tb, unsigned int flags) "tb:%p flags=%x"

>>

>> +# cpus.c

>> +tlb_flush_stats(int self, int async, int synced) "self:%d async:%d synced:%d"

>> +

>>  # translate-all.c

>>  translate_block(void *tb, uintptr_t pc, uint8_t *tb_code) "tb:%p, pc:0x%"PRIxPTR", tb_code:%p"

>>

>>



--
Alex Bennée
diff mbox series

Patch

diff --git a/cpus.c b/cpus.c
index 740b8dc3f8..fae7344df5 100644
--- a/cpus.c
+++ b/cpus.c
@@ -50,6 +50,8 @@ 
 #include "qapi-event.h"
 #include "hw/nmi.h"
 #include "sysemu/replay.h"
+#include "exec/cputlb.h"
+#include "trace-root.h"
 
 #ifdef CONFIG_LINUX
 
@@ -1252,6 +1254,10 @@  static int tcg_cpu_exec(CPUState *cpu)
     int64_t ti;
 #endif
 
+    trace_tlb_flush_stats(tlb_self_flush_count,
+                          tlb_async_flush_count,
+                          tlb_synced_flush_count);
+
 #ifdef CONFIG_PROFILER
     ti = profile_getclock();
 #endif
diff --git a/trace-events b/trace-events
index b07a09ba95..fc23e15d25 100644
--- a/trace-events
+++ b/trace-events
@@ -94,6 +94,9 @@  disable exec_tb(void *tb, uintptr_t pc) "tb:%p pc=0x%"PRIxPTR
 disable exec_tb_nocache(void *tb, uintptr_t pc) "tb:%p pc=0x%"PRIxPTR
 disable exec_tb_exit(void *last_tb, unsigned int flags) "tb:%p flags=%x"
 
+# cpus.c
+tlb_flush_stats(int self, int async, int synced) "self:%d async:%d synced:%d"
+
 # translate-all.c
 translate_block(void *tb, uintptr_t pc, uint8_t *tb_code) "tb:%p, pc:0x%"PRIxPTR", tb_code:%p"