mirror of https://github.com/xemu-project/xemu.git
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:
parent
09a65bec38
commit
bf619eae2e
|
@ -15,15 +15,10 @@
|
||||||
*/
|
*/
|
||||||
static inline void log_cpu_state(CPUState *cpu, int flags)
|
static inline void log_cpu_state(CPUState *cpu, int flags)
|
||||||
{
|
{
|
||||||
QemuLogFile *logfile;
|
FILE *f = qemu_log_trylock();
|
||||||
|
if (f) {
|
||||||
if (qemu_log_enabled()) {
|
cpu_dump_state(cpu, f, flags);
|
||||||
rcu_read_lock();
|
qemu_log_unlock(f);
|
||||||
logfile = qatomic_rcu_read(&qemu_logfile);
|
|
||||||
if (logfile) {
|
|
||||||
cpu_dump_state(cpu, logfile->fd, flags);
|
|
||||||
}
|
|
||||||
rcu_read_unlock();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue