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 <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Reviewed-by: Laurent Vivier <[email protected]>
Message-Id: <
20191205122518[email protected]>
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);
#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
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);
*/
#include "qemu/osdep.h"
#include "trace.h"
+#include "exec/log.h"
#include "qemu.h"
//#define DEBUG_MMAP
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;