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>
This commit is contained in:
Richard Henderson 2022-04-17 11:30:04 -07:00
parent 09a65bec38
commit bf619eae2e
1 changed files with 4 additions and 9 deletions

View File

@ -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);
}
}