*: Use fprintf between qemu_log_trylock/unlock

Inside qemu_log, we perform qemu_log_trylock/unlock, which need
not be done if we have already performed the lock beforehand.

Always check the result of qemu_log_trylock -- only checking
qemu_loglevel_mask races with the acquisition of the lock on
the logfile.

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20220417183019.755276-10-richard.henderson@linaro.org>
This commit is contained in:
Richard Henderson 2022-04-17 11:29:49 -07:00
parent 6fef222971
commit 78b548583e
9 changed files with 162 additions and 132 deletions

View file

@ -73,7 +73,7 @@ static inline void log_page_dump(const char *operation)
{
FILE *logfile = qemu_log_trylock();
if (logfile) {
qemu_log("page layout changed following %s\n", operation);
fprintf(logfile, "page layout changed following %s\n", operation);
page_dump(logfile);
}
qemu_log_unlock(logfile);