qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] watch_mem_write: implement 8-byte accesses
@ 2017-10-17 12:17 Paolo Bonzini
  2017-10-17 16:50 ` Richard Henderson
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Paolo Bonzini @ 2017-10-17 12:17 UTC (permalink / raw)
  To: qemu-devel; +Cc: Andrew.Baumann, rth

Aligned 8-byte memory writes by a 64-bit target on a 64-bit host should
always turn into atomic 8-byte writes on the host, however a write
write watchpoint would end up tearing the 8-byte write into two 4-byte
writes in access_with_adjusted_size().

Reported-by: Andrew Baumann <Andrew.Baumann@microsoft.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 exec.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/exec.c b/exec.c
index b58bc4eff7..db5ae23118 100644
--- a/exec.c
+++ b/exec.c
@@ -2503,6 +2503,9 @@ static MemTxResult watch_mem_read(void *opaque, hwaddr addr, uint64_t *pdata,
     case 4:
         data = address_space_ldl(as, addr, attrs, &res);
         break;
+    case 8:
+        data = address_space_ldq(as, addr, attrs, &res);
+        break;
     default: abort();
     }
     *pdata = data;
@@ -2528,6 +2531,9 @@ static MemTxResult watch_mem_write(void *opaque, hwaddr addr,
     case 4:
         address_space_stl(as, addr, val, attrs, &res);
         break;
+    case 8:
+        address_space_stq(as, addr, val, attrs, &res);
+        break;
     default: abort();
     }
     return res;
@@ -2537,6 +2543,16 @@ static const MemoryRegionOps watch_mem_ops = {
     .read_with_attrs = watch_mem_read,
     .write_with_attrs = watch_mem_write,
     .endianness = DEVICE_NATIVE_ENDIAN,
+    .valid = {
+        .min_access_size = 1,
+        .max_access_size = 8,
+        .unaligned = false,
+    },
+    .impl = {
+        .min_access_size = 1,
+        .max_access_size = 8,
+        .unaligned = false,
+    },
 };
 
 static MemTxResult flatview_write(FlatView *fv, hwaddr addr, MemTxAttrs attrs,
-- 
2.14.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] watch_mem_write: implement 8-byte accesses
  2017-10-17 12:17 [Qemu-devel] [PATCH] watch_mem_write: implement 8-byte accesses Paolo Bonzini
@ 2017-10-17 16:50 ` Richard Henderson
  2017-10-18 21:20 ` Emilio G. Cota
  2017-10-18 21:25 ` Philippe Mathieu-Daudé
  2 siblings, 0 replies; 4+ messages in thread
From: Richard Henderson @ 2017-10-17 16:50 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: Andrew.Baumann, rth

On 10/17/2017 05:17 AM, Paolo Bonzini wrote:
> Aligned 8-byte memory writes by a 64-bit target on a 64-bit host should
> always turn into atomic 8-byte writes on the host, however a write
> write watchpoint would end up tearing the 8-byte write into two 4-byte
> writes in access_with_adjusted_size().
> 
> Reported-by: Andrew Baumann <Andrew.Baumann@microsoft.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  exec.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] watch_mem_write: implement 8-byte accesses
  2017-10-17 12:17 [Qemu-devel] [PATCH] watch_mem_write: implement 8-byte accesses Paolo Bonzini
  2017-10-17 16:50 ` Richard Henderson
@ 2017-10-18 21:20 ` Emilio G. Cota
  2017-10-18 21:25 ` Philippe Mathieu-Daudé
  2 siblings, 0 replies; 4+ messages in thread
From: Emilio G. Cota @ 2017-10-18 21:20 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-devel, Andrew.Baumann, rth

On Tue, Oct 17, 2017 at 14:17:14 +0200, Paolo Bonzini wrote:
> Aligned 8-byte memory writes by a 64-bit target on a 64-bit host should
> always turn into atomic 8-byte writes on the host, however a write
> write watchpoint would end up tearing the 8-byte write into two 4-byte

s/write\nwrite/write/

> writes in access_with_adjusted_size().
> 
> Reported-by: Andrew Baumann <Andrew.Baumann@microsoft.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Reviewed-by: Emilio G. Cota <cota@braap.org>

		E.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] watch_mem_write: implement 8-byte accesses
  2017-10-17 12:17 [Qemu-devel] [PATCH] watch_mem_write: implement 8-byte accesses Paolo Bonzini
  2017-10-17 16:50 ` Richard Henderson
  2017-10-18 21:20 ` Emilio G. Cota
@ 2017-10-18 21:25 ` Philippe Mathieu-Daudé
  2 siblings, 0 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2017-10-18 21:25 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: Andrew.Baumann, rth

On 10/17/2017 09:17 AM, Paolo Bonzini wrote:
> Aligned 8-byte memory writes by a 64-bit target on a 64-bit host should
> always turn into atomic 8-byte writes on the host, however a write
> write watchpoint would end up tearing the 8-byte write into two 4-byte
> writes in access_with_adjusted_size().
> 
> Reported-by: Andrew Baumann <Andrew.Baumann@microsoft.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

> ---
>  exec.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/exec.c b/exec.c
> index b58bc4eff7..db5ae23118 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -2503,6 +2503,9 @@ static MemTxResult watch_mem_read(void *opaque, hwaddr addr, uint64_t *pdata,
>      case 4:
>          data = address_space_ldl(as, addr, attrs, &res);
>          break;
> +    case 8:
> +        data = address_space_ldq(as, addr, attrs, &res);
> +        break;
>      default: abort();
>      }
>      *pdata = data;
> @@ -2528,6 +2531,9 @@ static MemTxResult watch_mem_write(void *opaque, hwaddr addr,
>      case 4:
>          address_space_stl(as, addr, val, attrs, &res);
>          break;
> +    case 8:
> +        address_space_stq(as, addr, val, attrs, &res);
> +        break;
>      default: abort();
>      }
>      return res;
> @@ -2537,6 +2543,16 @@ static const MemoryRegionOps watch_mem_ops = {
>      .read_with_attrs = watch_mem_read,
>      .write_with_attrs = watch_mem_write,
>      .endianness = DEVICE_NATIVE_ENDIAN,
> +    .valid = {
> +        .min_access_size = 1,
> +        .max_access_size = 8,
> +        .unaligned = false,
> +    },
> +    .impl = {
> +        .min_access_size = 1,
> +        .max_access_size = 8,
> +        .unaligned = false,
> +    },
>  };
>  
>  static MemTxResult flatview_write(FlatView *fv, hwaddr addr, MemTxAttrs attrs,
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-10-18 21:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-17 12:17 [Qemu-devel] [PATCH] watch_mem_write: implement 8-byte accesses Paolo Bonzini
2017-10-17 16:50 ` Richard Henderson
2017-10-18 21:20 ` Emilio G. Cota
2017-10-18 21:25 ` Philippe Mathieu-Daudé

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).