* [PATCH 0/2] accel/tcg: Trace tb_flush() and tb_gen_code() buffer overflow
@ 2025-09-25 3:56 Philippe Mathieu-Daudé
2025-09-25 3:56 ` [PATCH 1/2] accel/tcg: Trace tb_flush() calls Philippe Mathieu-Daudé
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-09-25 3:56 UTC (permalink / raw)
To: qemu-devel
Cc: Pierrick Bouvier, Richard Henderson, Paolo Bonzini,
Philippe Mathieu-Daudé
Add trace events to better understand the changes introduced
by the "accel/tcg: Improve tb_flush usage" series recently
merged.
Philippe Mathieu-Daudé (2):
accel/tcg: Trace tb_flush() calls
accel/tcg: Trace tb_gen_code() buffer overflow
accel/tcg/tb-maint.c | 3 ++-
accel/tcg/translate-all.c | 3 +++
accel/tcg/trace-events | 4 ++++
3 files changed, 9 insertions(+), 1 deletion(-)
--
2.51.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] accel/tcg: Trace tb_flush() calls
2025-09-25 3:56 [PATCH 0/2] accel/tcg: Trace tb_flush() and tb_gen_code() buffer overflow Philippe Mathieu-Daudé
@ 2025-09-25 3:56 ` Philippe Mathieu-Daudé
2025-09-25 3:56 ` [PATCH 2/2] accel/tcg: Trace tb_gen_code() buffer overflow Philippe Mathieu-Daudé
2025-10-29 17:56 ` [PATCH 0/2] accel/tcg: Trace tb_flush() and " Philippe Mathieu-Daudé
2 siblings, 0 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-09-25 3:56 UTC (permalink / raw)
To: qemu-devel
Cc: Pierrick Bouvier, Richard Henderson, Paolo Bonzini,
Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
accel/tcg/tb-maint.c | 3 ++-
accel/tcg/trace-events | 3 +++
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/accel/tcg/tb-maint.c b/accel/tcg/tb-maint.c
index 5a8d0784e7a..cd7c32361bb 100644
--- a/accel/tcg/tb-maint.c
+++ b/accel/tcg/tb-maint.c
@@ -40,7 +40,7 @@
#else
#include "system/runstate.h"
#endif
-
+#include "trace.h"
/* List iterators for lists of tagged pointers in TranslationBlock. */
#define TB_FOR_EACH_TAGGED(head, tb, n, field) \
@@ -771,6 +771,7 @@ void tb_flush__exclusive_or_serial(void)
{
CPUState *cpu;
+ trace_tb_flush();
assert(tcg_enabled());
/* Note that cpu_in_serial_context checks cpu_in_exclusive_context. */
assert(!runstate_is_running() ||
diff --git a/accel/tcg/trace-events b/accel/tcg/trace-events
index 14f638810c6..121d6b5081b 100644
--- a/accel/tcg/trace-events
+++ b/accel/tcg/trace-events
@@ -24,3 +24,6 @@ store_atom2_fallback(uint32_t memop, uintptr_t ra) "mop:0x%"PRIx32", ra:0x%"PRIx
store_atom4_fallback(uint32_t memop, uintptr_t ra) "mop:0x%"PRIx32", ra:0x%"PRIxPTR""
store_atom8_fallback(uint32_t memop, uintptr_t ra) "mop:0x%"PRIx32", ra:0x%"PRIxPTR""
store_atom16_fallback(uint32_t memop, uintptr_t ra) "mop:0x%"PRIx32", ra:0x%"PRIxPTR""
+
+# tb-maint.c
+tb_flush(void) ""
--
2.51.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] accel/tcg: Trace tb_gen_code() buffer overflow
2025-09-25 3:56 [PATCH 0/2] accel/tcg: Trace tb_flush() and tb_gen_code() buffer overflow Philippe Mathieu-Daudé
2025-09-25 3:56 ` [PATCH 1/2] accel/tcg: Trace tb_flush() calls Philippe Mathieu-Daudé
@ 2025-09-25 3:56 ` Philippe Mathieu-Daudé
2025-10-29 17:56 ` [PATCH 0/2] accel/tcg: Trace tb_flush() and " Philippe Mathieu-Daudé
2 siblings, 0 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-09-25 3:56 UTC (permalink / raw)
To: qemu-devel
Cc: Pierrick Bouvier, Richard Henderson, Paolo Bonzini,
Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
accel/tcg/translate-all.c | 3 +++
accel/tcg/trace-events | 1 +
2 files changed, 4 insertions(+)
diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
index da9d7f16752..fba4e9dc21c 100644
--- a/accel/tcg/translate-all.c
+++ b/accel/tcg/translate-all.c
@@ -290,6 +290,7 @@ TranslationBlock *tb_gen_code(CPUState *cpu, TCGTBCPUState s)
if (unlikely(!tb)) {
/* flush must be done */
if (cpu_in_serial_context(cpu)) {
+ trace_tb_gen_code_buffer_overflow("tcg_tb_alloc");
tb_flush__exclusive_or_serial();
goto buffer_overflow;
}
@@ -325,6 +326,7 @@ TranslationBlock *tb_gen_code(CPUState *cpu, TCGTBCPUState s)
if (unlikely(gen_code_size < 0)) {
switch (gen_code_size) {
case -1:
+ trace_tb_gen_code_buffer_overflow("setjmp_gen_code");
/*
* Overflow of code_gen_buffer, or the current slice of it.
*
@@ -389,6 +391,7 @@ TranslationBlock *tb_gen_code(CPUState *cpu, TCGTBCPUState s)
search_size = encode_search(tb, (void *)gen_code_buf + gen_code_size);
if (unlikely(search_size < 0)) {
+ trace_tb_gen_code_buffer_overflow("encode_search");
tb_unlock_pages(tb);
goto buffer_overflow;
}
diff --git a/accel/tcg/trace-events b/accel/tcg/trace-events
index 121d6b5081b..0816cafd336 100644
--- a/accel/tcg/trace-events
+++ b/accel/tcg/trace-events
@@ -12,6 +12,7 @@ memory_notdirty_set_dirty(uint64_t vaddr) "0x%" PRIx64
# translate-all.c
translate_block(void *tb, uintptr_t pc, const void *tb_code) "tb:%p, pc:0x%"PRIxPTR", tb_code:%p"
+tb_gen_code_buffer_overflow(const char *reason) "reason: %s"
# ldst_atomicity
load_atom2_fallback(uint32_t memop, uintptr_t ra) "mop:0x%"PRIx32", ra:0x%"PRIxPTR""
--
2.51.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 0/2] accel/tcg: Trace tb_flush() and tb_gen_code() buffer overflow
2025-09-25 3:56 [PATCH 0/2] accel/tcg: Trace tb_flush() and tb_gen_code() buffer overflow Philippe Mathieu-Daudé
2025-09-25 3:56 ` [PATCH 1/2] accel/tcg: Trace tb_flush() calls Philippe Mathieu-Daudé
2025-09-25 3:56 ` [PATCH 2/2] accel/tcg: Trace tb_gen_code() buffer overflow Philippe Mathieu-Daudé
@ 2025-10-29 17:56 ` Philippe Mathieu-Daudé
2 siblings, 0 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-29 17:56 UTC (permalink / raw)
To: qemu-devel; +Cc: Pierrick Bouvier, Richard Henderson, Paolo Bonzini
On 25/9/25 05:56, Philippe Mathieu-Daudé wrote:
> Add trace events to better understand the changes introduced
> by the "accel/tcg: Improve tb_flush usage" series recently
> merged.
>
> Philippe Mathieu-Daudé (2):
> accel/tcg: Trace tb_flush() calls
> accel/tcg: Trace tb_gen_code() buffer overflow
>
> accel/tcg/tb-maint.c | 3 ++-
> accel/tcg/translate-all.c | 3 +++
> accel/tcg/trace-events | 4 ++++
> 3 files changed, 9 insertions(+), 1 deletion(-)
>
ping?
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-10-29 17:58 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-25 3:56 [PATCH 0/2] accel/tcg: Trace tb_flush() and tb_gen_code() buffer overflow Philippe Mathieu-Daudé
2025-09-25 3:56 ` [PATCH 1/2] accel/tcg: Trace tb_flush() calls Philippe Mathieu-Daudé
2025-09-25 3:56 ` [PATCH 2/2] accel/tcg: Trace tb_gen_code() buffer overflow Philippe Mathieu-Daudé
2025-10-29 17:56 ` [PATCH 0/2] accel/tcg: Trace tb_flush() and " Philippe Mathieu-Daudé
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).