* [PATCH] memory: Log access direction for invalid accesses
@ 2021-10-11 17:32 BALATON Zoltan
2021-10-11 17:47 ` David Hildenbrand
2021-10-11 21:56 ` Richard Henderson
0 siblings, 2 replies; 3+ messages in thread
From: BALATON Zoltan @ 2021-10-11 17:32 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-trivial, Paolo Bonzini, Michael S. Tsirkin, Peter Xu,
David Hildenbrand
In memory_region_access_valid() invalid accesses are logged to help
debugging but the log message does not say if it was a read or write.
Log that too to better identify the access causing the problem.
Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
---
softmmu/memory.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/softmmu/memory.c b/softmmu/memory.c
index db182e5d3d..e5826faa0c 100644
--- a/softmmu/memory.c
+++ b/softmmu/memory.c
@@ -1378,17 +1378,17 @@ 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 access at addr "
- "0x%" HWADDR_PRIX ", size %u, "
- "region '%s', reason: rejected\n",
+ qemu_log_mask(LOG_GUEST_ERROR, "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;
}
if (!mr->ops->valid.unaligned && (addr & (size - 1))) {
- qemu_log_mask(LOG_GUEST_ERROR, "Invalid access at addr "
- "0x%" HWADDR_PRIX ", size %u, "
- "region '%s', reason: unaligned\n",
+ qemu_log_mask(LOG_GUEST_ERROR, "Invalid %s at addr 0x%" HWADDR_PRIX
+ ", size %u, region '%s', reason: unaligned\n",
+ is_write ? "write" : "read",
addr, size, memory_region_name(mr));
return false;
}
@@ -1400,10 +1400,10 @@ bool memory_region_access_valid(MemoryRegion *mr,
if (size > mr->ops->valid.max_access_size
|| size < mr->ops->valid.min_access_size) {
- qemu_log_mask(LOG_GUEST_ERROR, "Invalid access at addr "
- "0x%" HWADDR_PRIX ", size %u, "
- "region '%s', reason: invalid size "
- "(min:%u max:%u)\n",
+ qemu_log_mask(LOG_GUEST_ERROR, "Invalid %s at addr 0x%" HWADDR_PRIX
+ ", size %u, region '%s', reason: invalid size "
+ "(min:%u max:%u)\n",
+ is_write ? "write" : "read",
addr, size, memory_region_name(mr),
mr->ops->valid.min_access_size,
mr->ops->valid.max_access_size);
--
2.21.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] memory: Log access direction for invalid accesses
2021-10-11 17:32 [PATCH] memory: Log access direction for invalid accesses BALATON Zoltan
@ 2021-10-11 17:47 ` David Hildenbrand
2021-10-11 21:56 ` Richard Henderson
1 sibling, 0 replies; 3+ messages in thread
From: David Hildenbrand @ 2021-10-11 17:47 UTC (permalink / raw)
To: BALATON Zoltan, qemu-devel
Cc: qemu-trivial, Paolo Bonzini, Peter Xu, Michael S. Tsirkin
On 11.10.21 19:32, BALATON Zoltan wrote:
> In memory_region_access_valid() invalid accesses are logged to help
> debugging but the log message does not say if it was a read or write.
> Log that too to better identify the access causing the problem.
>
> Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
> ---
> softmmu/memory.c | 20 ++++++++++----------
> 1 file changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/softmmu/memory.c b/softmmu/memory.c
> index db182e5d3d..e5826faa0c 100644
> --- a/softmmu/memory.c
> +++ b/softmmu/memory.c
> @@ -1378,17 +1378,17 @@ 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 access at addr "
> - "0x%" HWADDR_PRIX ", size %u, "
> - "region '%s', reason: rejected\n",
> + qemu_log_mask(LOG_GUEST_ERROR, "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;
> }
>
> if (!mr->ops->valid.unaligned && (addr & (size - 1))) {
> - qemu_log_mask(LOG_GUEST_ERROR, "Invalid access at addr "
> - "0x%" HWADDR_PRIX ", size %u, "
> - "region '%s', reason: unaligned\n",
> + qemu_log_mask(LOG_GUEST_ERROR, "Invalid %s at addr 0x%" HWADDR_PRIX
> + ", size %u, region '%s', reason: unaligned\n",
> + is_write ? "write" : "read",
> addr, size, memory_region_name(mr));
> return false;
> }
> @@ -1400,10 +1400,10 @@ bool memory_region_access_valid(MemoryRegion *mr,
>
> if (size > mr->ops->valid.max_access_size
> || size < mr->ops->valid.min_access_size) {
> - qemu_log_mask(LOG_GUEST_ERROR, "Invalid access at addr "
> - "0x%" HWADDR_PRIX ", size %u, "
> - "region '%s', reason: invalid size "
> - "(min:%u max:%u)\n",
> + qemu_log_mask(LOG_GUEST_ERROR, "Invalid %s at addr 0x%" HWADDR_PRIX
> + ", size %u, region '%s', reason: invalid size "
> + "(min:%u max:%u)\n",
> + is_write ? "write" : "read",
> addr, size, memory_region_name(mr),
> mr->ops->valid.min_access_size,
> mr->ops->valid.max_access_size);
>
Reviewed-by: David Hildenbrand <david@redhat.com>
--
Thanks,
David / dhildenb
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] memory: Log access direction for invalid accesses
2021-10-11 17:32 [PATCH] memory: Log access direction for invalid accesses BALATON Zoltan
2021-10-11 17:47 ` David Hildenbrand
@ 2021-10-11 21:56 ` Richard Henderson
1 sibling, 0 replies; 3+ messages in thread
From: Richard Henderson @ 2021-10-11 21:56 UTC (permalink / raw)
To: BALATON Zoltan, qemu-devel
Cc: qemu-trivial, Paolo Bonzini, David Hildenbrand, Peter Xu,
Michael S. Tsirkin
On 10/11/21 10:32 AM, BALATON Zoltan wrote:
> In memory_region_access_valid() invalid accesses are logged to help
> debugging but the log message does not say if it was a read or write.
> Log that too to better identify the access causing the problem.
>
> Signed-off-by: BALATON Zoltan<balaton@eik.bme.hu>
> ---
> softmmu/memory.c | 20 ++++++++++----------
> 1 file changed, 10 insertions(+), 10 deletions(-)
Thanks, queued for tcg-next.
r~
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-10-11 21:58 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-11 17:32 [PATCH] memory: Log access direction for invalid accesses BALATON Zoltan
2021-10-11 17:47 ` David Hildenbrand
2021-10-11 21:56 ` Richard Henderson
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).