diff mbox

[v2,7/7] qemu-log: add nochain option to disable TB chaining

Message ID 1396025007-27592-8-git-send-email-alex.bennee@linaro.org
State New
Headers show

Commit Message

Alex Bennée March 28, 2014, 4:43 p.m. UTC
The current exec and cpu flags only show information when we enter a
TranslationBlock. The blocks will then chain together until there is a
reason to exit which can make things harder to follow. This new option
disables the chaining for debugging purposes.

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

Comments

Alex Bennée March 28, 2014, 5:47 p.m. UTC | #1
Peter Maydell <peter.maydell@linaro.org> writes:

> On 28 March 2014 16:43, Alex Bennée <alex.bennee@linaro.org> wrote:
>> The current exec and cpu flags only show information when we enter a
>> TranslationBlock. The blocks will then chain together until there is a
>> reason to exit which can make things harder to follow. This new option
>> disables the chaining for debugging purposes.
>>
>> +    { CPU_LOG_TB_NOCHAIN, "nochain",
>> +      "disable chaining of translation blocks (better tracing, but slower)" },
>
> I know it's a convenient place to put it, but it's not really
> a tracing option so I'm a bit dubious about putting it in
> the log flags...

Yeah I know, but I didn't really want to make a new tcg opts set of
flags as it's more of logging clarity kinda option. Of course this
glosses over the fact it is also useful for tcg trace-events (when I
send them).

Is it time to expose a set of TCG fiddling variables?

>
> thanks
> -- PMM
diff mbox

Patch

diff --git a/cpu-exec.c b/cpu-exec.c
index abe02b7..c20349c 100644
--- a/cpu-exec.c
+++ b/cpu-exec.c
@@ -620,8 +620,10 @@  int cpu_exec(CPUArchState *env)
                 }
                 /* see if we can patch the calling TB. When the TB
                    spans two pages, we cannot safely do a direct
-                   jump. */
-                if (next_tb != 0 && tb->page_addr[1] == -1) {
+                   jump. It can also complicate tracing so disable if
+                   asked (but be aware this can change behaviour). */
+                if (next_tb != 0 && tb->page_addr[1] == -1 &&
+                    !qemu_loglevel_mask (CPU_LOG_TB_NOCHAIN)) {
                     tb_add_jump((TranslationBlock *)(next_tb & ~TB_EXIT_MASK),
                                 next_tb & TB_EXIT_MASK, tb);
                 }
diff --git a/include/qemu/log.h b/include/qemu/log.h
index f6cef9e..82902b0 100644
--- a/include/qemu/log.h
+++ b/include/qemu/log.h
@@ -40,6 +40,7 @@  static inline bool qemu_log_enabled(void)
 #define CPU_LOG_RESET      (1 << 9)
 #define LOG_UNIMP          (1 << 10)
 #define LOG_GUEST_ERROR    (1 << 11)
+#define CPU_LOG_TB_NOCHAIN (1 << 12)
 
 /* Returns true if a bit is set in the current loglevel mask
  */
diff --git a/qemu-log.c b/qemu-log.c
index a54b332..dc78a93 100644
--- a/qemu-log.c
+++ b/qemu-log.c
@@ -175,6 +175,8 @@  const QEMULogItem qemu_log_items[] = {
     { LOG_GUEST_ERROR, "guest_errors",
       "log when the guest OS does something invalid (eg accessing a\n"
       "non-existent register)" },
+    { CPU_LOG_TB_NOCHAIN, "nochain",
+      "disable chaining of translation blocks (better tracing, but slower)" },
     { 0, NULL, NULL },
 };