[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 22/25] linux-user: log page table changes under -d page
From: |
Alex Bennée |
Subject: |
[PULL 22/25] linux-user: log page table changes under -d page |
Date: |
Thu, 19 Dec 2019 10:49:31 +0000 |
The CPU_LOG_PAGE flag is woefully underused and could stand to do
extra duty tracking page changes. If the user doesn't want to see the
details as things change they still have the tracepoints available.
We push the locking into log_page_dump and pass a reason for the
banner text.
Signed-off-by: Alex Bennée <address@hidden>
Reviewed-by: Richard Henderson <address@hidden>
Reviewed-by: Laurent Vivier <address@hidden>
Message-Id: <address@hidden>
diff --git a/include/exec/log.h b/include/exec/log.h
index 9bd1e4aa20b..fcc7b9e00ba 100644
--- a/include/exec/log.h
+++ b/include/exec/log.h
@@ -69,15 +69,14 @@ static inline void log_disas(void *code, unsigned long size)
#if defined(CONFIG_USER_ONLY)
/* page_dump() output to the log file: */
-static inline void log_page_dump(void)
+static inline void log_page_dump(const char *operation)
{
- QemuLogFile *logfile;
- rcu_read_lock();
- logfile = atomic_rcu_read(&qemu_logfile);
+ FILE *logfile = qemu_log_lock();
if (logfile) {
- page_dump(logfile->fd);
+ qemu_log("page layout changed following %s\n", operation);
+ page_dump(logfile);
}
- rcu_read_unlock();
+ qemu_log_unlock(logfile);
}
#endif
#endif
diff --git a/bsd-user/main.c b/bsd-user/main.c
index 470a8bf79ed..7f4e3cd6271 100644
--- a/bsd-user/main.c
+++ b/bsd-user/main.c
@@ -963,7 +963,7 @@ int main(int argc, char **argv)
if (qemu_loglevel_mask(CPU_LOG_PAGE)) {
qemu_log("guest_base 0x%lx\n", guest_base);
- log_page_dump();
+ log_page_dump("binary load");
qemu_log("start_brk 0x" TARGET_ABI_FMT_lx "\n", info->start_brk);
qemu_log("end_code 0x" TARGET_ABI_FMT_lx "\n", info->end_code);
diff --git a/linux-user/main.c b/linux-user/main.c
index 6ff7851e86f..8718d03ee21 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -826,7 +826,7 @@ int main(int argc, char **argv, char **envp)
if (qemu_loglevel_mask(CPU_LOG_PAGE)) {
qemu_log("guest_base 0x%lx\n", guest_base);
- log_page_dump();
+ log_page_dump("binary load");
qemu_log("start_brk 0x" TARGET_ABI_FMT_lx "\n", info->start_brk);
qemu_log("end_code 0x" TARGET_ABI_FMT_lx "\n", info->end_code);
diff --git a/linux-user/mmap.c b/linux-user/mmap.c
index 0b1b43ac3c0..3d90fa459ca 100644
--- a/linux-user/mmap.c
+++ b/linux-user/mmap.c
@@ -18,6 +18,7 @@
*/
#include "qemu/osdep.h"
#include "trace.h"
+#include "exec/log.h"
#include "qemu.h"
//#define DEBUG_MMAP
@@ -539,10 +540,9 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int
prot,
page_set_flags(start, start + len, prot | PAGE_VALID);
the_end:
trace_target_mmap_complete(start);
-#ifdef DEBUG_MMAP
- page_dump(stdout);
- printf("\n");
-#endif
+ if (qemu_loglevel_mask(CPU_LOG_PAGE)) {
+ log_page_dump(__func__);
+ }
tb_invalidate_phys_range(start, start + len);
mmap_unlock();
return start;
--
2.20.1
- [PULL 18/25] travis.yml: Remove the redundant clang-with-MAIN_SOFTMMU_TARGETS entry, (continued)
- [PULL 18/25] travis.yml: Remove the redundant clang-with-MAIN_SOFTMMU_TARGETS entry, Alex Bennée, 2019/12/19
- [PULL 21/25] linux-user: add target_mmap_complete tracepoint, Alex Bennée, 2019/12/19
- [PULL 15/25] Add use of RCU for qemu_logfile., Alex Bennée, 2019/12/19
- [PULL 20/25] linux-user: convert target_mmap debug to tracepoint, Alex Bennée, 2019/12/19
- [PULL 17/25] docker: gtester is no longer used, Alex Bennée, 2019/12/19
- [PULL 19/25] linux-user: convert target_mprotect debug to tracepoint, Alex Bennée, 2019/12/19
- [PULL 16/25] Added tests for close and change of logfile., Alex Bennée, 2019/12/19
- [PULL 25/25] tests/tcg: ensure we re-configure if configure.sh is updated, Alex Bennée, 2019/12/19
- [PULL 24/25] trace: replace hand-crafted pattern_glob with g_pattern_match_simple, Alex Bennée, 2019/12/19
- [PULL 23/25] linux-user: convert target_munmap debug to a tracepoint, Alex Bennée, 2019/12/19
- [PULL 22/25] linux-user: log page table changes under -d page,
Alex Bennée <=
- [PULL 14/25] qemu_log_lock/unlock now preserves the qemu_logfile handle., Alex Bennée, 2019/12/19
- Re: [PULL 00/25] testing and logging updates, Peter Maydell, 2019/12/20