diff options
author | Richard Henderson <richard.henderson@linaro.org> | 2022-04-17 11:30:04 -0700 |
---|---|---|
committer | Richard Henderson <richard.henderson@linaro.org> | 2022-04-20 10:51:11 -0700 |
commit | bf619eae2eed3bde9f7c003c09bf29bdcc908b08 (patch) | |
tree | bcabd53d6842a6a600049dcb1caa927438acdea5 /include/exec | |
parent | 09a65bec3810671068d2533ed49797d2ac070904 (diff) |
include/exec/log: Do not reference QemuLogFile directly
Use qemu_log_trylock/unlock instead of the raw rcu_read.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20220417183019.755276-25-richard.henderson@linaro.org>
Diffstat (limited to 'include/exec')
-rw-r--r-- | include/exec/log.h | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/include/exec/log.h b/include/exec/log.h index ad0a40cfeb..4a7375a45f 100644 --- a/include/exec/log.h +++ b/include/exec/log.h @@ -15,15 +15,10 @@ */ static inline void log_cpu_state(CPUState *cpu, int flags) { - QemuLogFile *logfile; - - if (qemu_log_enabled()) { - rcu_read_lock(); - logfile = qatomic_rcu_read(&qemu_logfile); - if (logfile) { - cpu_dump_state(cpu, logfile->fd, flags); - } - rcu_read_unlock(); + FILE *f = qemu_log_trylock(); + if (f) { + cpu_dump_state(cpu, f, flags); + qemu_log_unlock(f); } } |