aboutsummaryrefslogtreecommitdiff
path: root/accel/tcg/cpu-exec.c
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2022-04-17 11:29:49 -0700
committerRichard Henderson <richard.henderson@linaro.org>2022-04-20 10:51:11 -0700
commit78b548583e0725bb7054162a31dac552b01c02a8 (patch)
treee8e56b975713665391fddd1534e8642ed000c29f /accel/tcg/cpu-exec.c
parent6fef222971e1f77d1e7b6c218edce72ceb568126 (diff)
*: Use fprintf between qemu_log_trylock/unlock
Inside qemu_log, we perform qemu_log_trylock/unlock, which need not be done if we have already performed the lock beforehand. Always check the result of qemu_log_trylock -- only checking qemu_loglevel_mask races with the acquisition of the lock on the logfile. Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20220417183019.755276-10-richard.henderson@linaro.org>
Diffstat (limited to 'accel/tcg/cpu-exec.c')
-rw-r--r--accel/tcg/cpu-exec.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
index f61b056571..8b7f9a3065 100644
--- a/accel/tcg/cpu-exec.c
+++ b/accel/tcg/cpu-exec.c
@@ -215,16 +215,18 @@ static inline void log_cpu_exec(target_ulong pc, CPUState *cpu,
#if defined(DEBUG_DISAS)
if (qemu_loglevel_mask(CPU_LOG_TB_CPU)) {
FILE *logfile = qemu_log_trylock();
- int flags = 0;
+ if (logfile) {
+ int flags = 0;
- if (qemu_loglevel_mask(CPU_LOG_TB_FPU)) {
- flags |= CPU_DUMP_FPU;
- }
+ if (qemu_loglevel_mask(CPU_LOG_TB_FPU)) {
+ flags |= CPU_DUMP_FPU;
+ }
#if defined(TARGET_I386)
- flags |= CPU_DUMP_CCOP;
+ flags |= CPU_DUMP_CCOP;
#endif
- log_cpu_state(cpu, flags);
- qemu_log_unlock(logfile);
+ log_cpu_state(cpu, flags);
+ qemu_log_unlock(logfile);
+ }
}
#endif /* DEBUG_DISAS */
}