diff options
author | Richard Henderson <richard.henderson@linaro.org> | 2022-04-17 11:29:47 -0700 |
---|---|---|
committer | Richard Henderson <richard.henderson@linaro.org> | 2022-04-20 10:51:11 -0700 |
commit | c60f599bcb9bf9256eb87c1c60add55d23f76de3 (patch) | |
tree | 826787db9c46fdd8c85f1e766e789ae186312e23 /accel/tcg | |
parent | c59fe6e536adfb2d6f3410f19d592496933f68de (diff) | |
download | qemu-c60f599bcb9bf9256eb87c1c60add55d23f76de3.zip qemu-c60f599bcb9bf9256eb87c1c60add55d23f76de3.tar.gz qemu-c60f599bcb9bf9256eb87c1c60add55d23f76de3.tar.bz2 |
util/log: Rename qemu_log_lock to qemu_log_trylock
This function can fail, which makes it more like ftrylockfile
or pthread_mutex_trylock than flockfile or pthread_mutex_lock,
so rename it.
To closer match the other trylock functions, release rcu_read_lock
along the failure path, so that qemu_log_unlock need not be called
on failure.
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20220417183019.755276-8-richard.henderson@linaro.org>
Diffstat (limited to 'accel/tcg')
-rw-r--r-- | accel/tcg/cpu-exec.c | 2 | ||||
-rw-r--r-- | accel/tcg/translate-all.c | 2 | ||||
-rw-r--r-- | accel/tcg/translator.c | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 083ada7..f61b056 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -214,7 +214,7 @@ 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_lock(); + FILE *logfile = qemu_log_trylock(); int flags = 0; if (qemu_loglevel_mask(CPU_LOG_TB_FPU)) { diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index a6e03c1..5937d6b 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -1527,7 +1527,7 @@ TranslationBlock *tb_gen_code(CPUState *cpu, #ifdef DEBUG_DISAS if (qemu_loglevel_mask(CPU_LOG_TB_OUT_ASM) && qemu_log_in_addr_range(tb->pc)) { - FILE *logfile = qemu_log_lock(); + FILE *logfile = qemu_log_trylock(); int code_size, data_size; const tcg_target_ulong *rx_data_gen_ptr; size_t chunk_start; diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c index f06c314..1506755 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -139,7 +139,7 @@ void translator_loop(const TranslatorOps *ops, DisasContextBase *db, #ifdef DEBUG_DISAS if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM) && qemu_log_in_addr_range(db->pc_first)) { - FILE *logfile = qemu_log_lock(); + FILE *logfile = qemu_log_trylock(); qemu_log("----------------\n"); ops->disas_log(db, cpu); qemu_log("\n"); |