Skip to contentSkip to conversation

monitor: Check whether TCG is enabled before running the "info jit" code

PATCH In review Thomas Huth 3 participants 4 messages Apr 26, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 monitor: Check whether TCG is enabled before running the "info jit" code

The "info jit" command currently aborts on Mac OS X with the message "qemu_mutex_lock: Invalid argument" when running with "-M accel=qtest". We should only call into the TCG code here if TCG has really been enabled and initialized.

---
 monitor.c | 5 +++++
 1 file changed, 5 insertions(+)
monitor.c +5 -0
index be282ec..3e0979d 100644
@@ -1086,6 +1086,11 @@ static void hmp_info_registers(Monitor *mon, const QDict *qdict)
 
 static void hmp_info_jit(Monitor *mon, const QDict *qdict)
 {
+    if (!tcg_enabled()) {
+        error_report("JIT information is only available with accel=tcg");
+        return;
+    }
+
     dump_exec_info((FILE *)mon, monitor_fprintf);
     dump_drift_info((FILE *)mon, monitor_fprintf);
 }
Signature · 1 line
1.8.3.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 16 lines · * Thomas Huth ([email protected]) wrote:

The "info jit" command currently aborts on Mac OS X with the message "qemu_mutex_lock: Invalid argument" when running with "-M accel=qtest". We should only call into the TCG code here if TCG has really been enabled and initialized.

---
 monitor.c | 5 +++++
 1 file changed, 5 insertions(+)
monitor.c +0 -0
index be282ec..3e0979d 100644
@@ -1086,6 +1086,11 @@ static void hmp_info_registers(Monitor *mon, const QDict *qdict)
 

monitor.c static void hmp_info_registers(Monitor *mon, const QDict *qdict) · line 1096

Quoted 10 lines
monitor.c +5 -0
 static void hmp_info_jit(Monitor *mon, const QDict *qdict)
 {
+    if (!tcg_enabled()) {
+        error_report("JIT information is only available with accel=tcg");
+        return;
+    }
+
     dump_exec_info((FILE *)mon, monitor_fprintf);
     dump_drift_info((FILE *)mon, monitor_fprintf);
 }

so tcg_enabled checks tcg_ctx.code_gen_buffer != NULL code_gen_buffer is set by code_gen_alloc code_gen_alloc does a qemu_mutex_init of tb_lock and the previous problem was an uninitialised tb_lock.

So:

Peter: Does this fix the hmp test for you?

Dave

Quoted 3 lines
Signature · 1 line
1.8.3.1

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

Tested-by
#2 lore raw
Quoted 33 lines · Dr. David Alan Gilbert
Quoted 16 lines · * Thomas Huth ([email protected]) wrote:

The "info jit" command currently aborts on Mac OS X with the message "qemu_mutex_lock: Invalid argument" when running with "-M accel=qtest". We should only call into the TCG code here if TCG has really been enabled and initialized.

---
 monitor.c | 5 +++++
 1 file changed, 5 insertions(+)
monitor.c +0 -0
index be282ec..3e0979d 100644
@@ -1086,6 +1086,11 @@ static void hmp_info_registers(Monitor *mon, const QDict *qdict)
 

monitor.c static void hmp_info_registers(Monitor *mon, const QDict *qdict) · line 1096

Quoted 10 lines
monitor.c +5 -0
 static void hmp_info_jit(Monitor *mon, const QDict *qdict)
 {
+    if (!tcg_enabled()) {
+        error_report("JIT information is only available with accel=tcg");
+        return;
+    }
+
     dump_exec_info((FILE *)mon, monitor_fprintf);
     dump_drift_info((FILE *)mon, monitor_fprintf);
 }

so tcg_enabled checks tcg_ctx.code_gen_buffer != NULL code_gen_buffer is set by code_gen_alloc code_gen_alloc does a qemu_mutex_init of tb_lock and the previous problem was an uninitialised tb_lock.

Quoted 5 lines

So:

Peter: Does this fix the hmp test for you?

Yes, it does.

-- PMM

#3 lore raw
Quoted 38 lines · * Peter Maydell ([email protected]) wrote:
Quoted 37 lines · Dr. David Alan Gilbert
Quoted 16 lines · * Thomas Huth ([email protected]) wrote:

The "info jit" command currently aborts on Mac OS X with the message "qemu_mutex_lock: Invalid argument" when running with "-M accel=qtest". We should only call into the TCG code here if TCG has really been enabled and initialized.

---
 monitor.c | 5 +++++
 1 file changed, 5 insertions(+)
monitor.c +0 -0
index be282ec..3e0979d 100644
@@ -1086,6 +1086,11 @@ static void hmp_info_registers(Monitor *mon, const QDict *qdict)
 

monitor.c static void hmp_info_registers(Monitor *mon, const QDict *qdict) · line 1096

Quoted 10 lines
monitor.c +5 -0
 static void hmp_info_jit(Monitor *mon, const QDict *qdict)
 {
+    if (!tcg_enabled()) {
+        error_report("JIT information is only available with accel=tcg");
+        return;
+    }
+
     dump_exec_info((FILE *)mon, monitor_fprintf);
     dump_drift_info((FILE *)mon, monitor_fprintf);
 }

so tcg_enabled checks tcg_ctx.code_gen_buffer != NULL code_gen_buffer is set by code_gen_alloc code_gen_alloc does a qemu_mutex_init of tb_lock and the previous problem was an uninitialised tb_lock.

So:

Quoted 5 lines
Quoted 1 line

Peter: Does this fix the hmp test for you?

Yes, it does.

OK, I'll cook a new version of the HMP pull later with this in it.

Dave

Quoted 1 line

-- PMM

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK