qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/2] log: Add separate debug option for logging invalid memor


From: BALATON Zoltan
Subject: Re: [PATCH 1/2] log: Add separate debug option for logging invalid memory accesses
Date: Mon, 13 Feb 2023 15:32:44 +0100 (CET)

On Mon, 13 Feb 2023, Philippe Mathieu-Daudé wrote:
On 19/1/23 22:40, BALATON Zoltan wrote:
Currently -d guest_errors enables logging of different invalid actions
by the guest such as misusing hardware, accessing missing features or
invalid memory areas. The memory access logging can be quite verbose
which obscures the other messages enabled by this debug switch so
separate it by adding a new -d memaccess option to make it possible to
control it independently of other guest error logs.

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
---
  include/qemu/log.h | 1 +
  softmmu/memory.c   | 6 +++---
  softmmu/physmem.c  | 2 +-
  util/log.c         | 2 ++
  4 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/include/qemu/log.h b/include/qemu/log.h
index c5643d8dd5..4bf0a65a85 100644
--- a/include/qemu/log.h
+++ b/include/qemu/log.h
@@ -35,6 +35,7 @@ bool qemu_log_separate(void);
  /* LOG_STRACE is used for user-mode strace logging. */
  #define LOG_STRACE         (1 << 19)
  #define LOG_PER_THREAD     (1 << 20)
+#define LOG_MEM_ACCESS     (1 << 21)
    /* Lock/unlock output. */
  diff --git a/softmmu/memory.c b/softmmu/memory.c
index 9d64efca26..0a9fa67d32 100644
--- a/softmmu/memory.c
+++ b/softmmu/memory.c
@@ -1379,7 +1379,7 @@ bool memory_region_access_valid(MemoryRegion *mr,
  {
      if (mr->ops->valid.accepts
&& !mr->ops->valid.accepts(mr->opaque, addr, size, is_write, attrs)) { - qemu_log_mask(LOG_GUEST_ERROR, "Invalid %s at addr 0x%" HWADDR_PRIX
+        qemu_log_mask(LOG_MEM_ACCESS, "Invalid %s at addr 0x%" HWADDR_PRIX

Can we use LOG_GUEST_ERROR|LOG_MEM_ACCESS to keep current behavior?

No, the point is that I don't want the current behaviour getting mem access logs when I want to see guest error logs as it's littering the output and the real guest error logs are then lost in the lot of unintresting mem accesses. You can still use -d guest_errors,memaccess for the current behaviour if you prefer that but without this patch I have no option for the other behaviour I prefer.

Regards,
BALATON Zoltan

reply via email to

[Prev in Thread] Current Thread [Next in Thread]