From: "Nicholas Piggin" <npiggin@gmail.com>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>, qemu-devel@nongnu.org
Cc: "Alex Bennée" <alex.bennee@linaro.org>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Peter Xu" <peterx@redhat.com>,
"David Hildenbrand" <david@redhat.com>
Subject: Re: [PATCH 2/2] memory: suppress INVALID_MEM logs caused by debug access
Date: Mon, 17 Mar 2025 20:41:25 +1000 [thread overview]
Message-ID: <D8IH81HZG5OJ.Y5UEA1WLU4DL@gmail.com> (raw)
In-Reply-To: <4be1fdc1-3c50-4e20-aaf5-f6831a944246@linaro.org>
On Mon Mar 17, 2025 at 7:03 PM AEST, Philippe Mathieu-Daudé wrote:
> On 14/3/25 08:41, Nicholas Piggin wrote:
>> Debugger-driven invalid memory accesses are not guest errors, so should
>> not cause these error logs.
>>
>> Debuggers can access memory wildly, including access to addresses not
>> specified by the user (e.g., gdb it might try to walk the stack or load
>> target addresses to display disassembly). Failure is reported
>> synchronously by the GDB protcol so the user can be notified via the
>> debugger client.
>>
>> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
>> ---
>> system/memory.c | 37 ++++++++++++++++++++++---------------
>> 1 file changed, 22 insertions(+), 15 deletions(-)
>>
>> diff --git a/system/memory.c b/system/memory.c
>> index 4c829793a0a..960f66e8d7e 100644
>> --- a/system/memory.c
>> +++ b/system/memory.c
>> @@ -1412,18 +1412,23 @@ bool memory_region_access_valid(MemoryRegion *mr,
>> {
>
> Alternatively:
>
> int invalid_mem_mask = attrs.debug ? LOG_INVALID_MEM : 0;
Oh that's a thing? Would save a level of indent and might look
nicer. (I guess you have x : y expressions reversed)
Thanks,
Nick
>
>> if (mr->ops->valid.accepts
>> && !mr->ops->valid.accepts(mr->opaque, addr, size, is_write, attrs)) {
>> - qemu_log_mask(LOG_INVALID_MEM, "Invalid %s at addr 0x%" HWADDR_PRIX
>> - ", size %u, region '%s', reason: rejected\n",
>> - is_write ? "write" : "read",
>> - addr, size, memory_region_name(mr));
>> + if (attrs.debug) {
>> + /* Don't log memory errors due to debugger accesses */
>> + qemu_log_mask(LOG_INVALID_MEM, "Invalid %s at addr 0x%" HWADDR_PRIX
>> + ", size %u, region '%s', reason: rejected\n",
>> + is_write ? "write" : "read",
>> + addr, size, memory_region_name(mr));
>> + }
>> return false;
>> }
next prev parent reply other threads:[~2025-03-17 10:42 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-14 7:41 [PATCH 0/2] gdb invalid memory access handling improvements Nicholas Piggin
2025-03-14 7:41 ` [PATCH 1/2] gdbstub: Add phys_memory_rw_debug for physical memory access Nicholas Piggin
2025-03-14 21:19 ` Richard Henderson
2025-03-17 4:57 ` Nicholas Piggin
2025-03-14 7:41 ` [PATCH 2/2] memory: suppress INVALID_MEM logs caused by debug access Nicholas Piggin
2025-03-14 15:24 ` Philippe Mathieu-Daudé
2025-03-14 21:22 ` Richard Henderson
2025-03-17 9:03 ` Philippe Mathieu-Daudé
2025-03-17 10:41 ` Nicholas Piggin [this message]
2025-03-14 21:57 ` [PATCH 0/2] gdb invalid memory access handling improvements David Hildenbrand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=D8IH81HZG5OJ.Y5UEA1WLU4DL@gmail.com \
--to=npiggin@gmail.com \
--cc=alex.bennee@linaro.org \
--cc=david@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).