]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
hw/core: Use qemu_log_trylock/unlock in cpu_common_reset_exit
authorRichard Henderson <richard.henderson@linaro.org>
Wed, 27 Aug 2025 05:34:35 +0000 (15:34 +1000)
committerRichard Henderson <richard.henderson@linaro.org>
Fri, 29 Aug 2025 20:59:26 +0000 (06:59 +1000)
Ensure that the "CPU Reset" message won't be separated
from the cpu_dump_state output.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
hw/core/cpu-common.c

index 26321be785c2433c16cdaa27a0a416813ad7ed5d..259cf2a3c36148087ebccb822b00da8f4991040f 100644 (file)
@@ -135,10 +135,15 @@ static void cpu_common_reset_hold(Object *obj, ResetType type)
 static void cpu_common_reset_exit(Object *obj, ResetType type)
 {
     if (qemu_loglevel_mask(CPU_LOG_RESET)) {
-        CPUState *cpu = CPU(obj);
+        FILE *f = qemu_log_trylock();
 
-        qemu_log("CPU Reset (CPU %d)\n", cpu->cpu_index);
-        log_cpu_state(cpu, cpu->cc->reset_dump_flags);
+        if (f) {
+            CPUState *cpu = CPU(obj);
+
+            fprintf(f, "CPU Reset (CPU %d)\n", cpu->cpu_index);
+            cpu_dump_state(cpu, f, cpu->cc->reset_dump_flags);
+            qemu_log_unlock(f);
+        }
     }
 }