monitor: Check whether TCG is enabled before running the "info jit" code
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
@@ -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
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.Signed-off-by Thomas Huth <[email protected]>--- monitor.c | 5 +++++ 1 file changed, 5 insertions(+)monitor.c +0
-0@@ -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
-0static 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
Peter Maydell
Tested-byQuoted 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.Signed-off-by Thomas Huth <[email protected]>--- monitor.c | 5 +++++ 1 file changed, 5 insertions(+)monitor.c +0
-0@@ -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
-0static 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_enabledchecks tcg_ctx.code_gen_buffer != NULLcode_gen_bufferis set bycode_gen_alloccode_gen_allocdoes aqemu_mutex_initoftb_lockand the previous problem was an uninitialisedtb_lock.
Quoted 5 lines
So:
Reviewed-by Dr. David Alan Gilbert <[email protected]>Peter: Does this fix the hmp test for you?
Yes, it does.
-- PMM
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.Signed-off-by Thomas Huth <[email protected]>--- monitor.c | 5 +++++ 1 file changed, 5 insertions(+)monitor.c +0
-0@@ -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
-0static 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_enabledchecks tcg_ctx.code_gen_buffer != NULLcode_gen_bufferis set bycode_gen_alloccode_gen_allocdoes aqemu_mutex_initoftb_lockand the previous problem was an uninitialisedtb_lock.So:
Reviewed-by Dr. David Alan Gilbert <[email protected]>
Quoted 5 lines
Quoted 1 line
Peter: Does this fix the hmp test for you?
Yes, it does.
Tested-by Peter Maydell <[email protected]>
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