All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] exec: Fix qemu_ram_block_from_host for Xen
@ 2016-06-09 15:56 Anthony PERARD
  2016-06-13  8:16 ` Paolo Bonzini
  2016-06-13  8:16 ` Paolo Bonzini
  0 siblings, 2 replies; 3+ messages in thread
From: Anthony PERARD @ 2016-06-09 15:56 UTC (permalink / raw)
  To: qemu-devel
  Cc: xen-devel, Stefano Stabellini, Paolo Bonzini, Peter Crosthwaite,
	Richard Henderson, Anthony PERARD

Since f615f39 (exec: remove ram_addr argument from
qemu_ram_block_from_host), migration under Xen is likely to fail, with a
SEGV of QEMU. But the commit only reveal a bug with the calculation of
the offset value in qemu_ram_block_from_host().

This patch calculates the offset from the ram_addr as
qemu_ram_addr_from_host() will later calculate the ram_addr from the
offset.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 exec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/exec.c b/exec.c
index f2c9e37..f13106d 100644
--- a/exec.c
+++ b/exec.c
@@ -1935,7 +1935,7 @@ RAMBlock *qemu_ram_block_from_host(void *ptr, bool round_offset,
         ram_addr = xen_ram_addr_from_mapcache(ptr);
         block = qemu_get_ram_block(ram_addr);
         if (block) {
-            *offset = (host - block->host);
+            *offset = ram_addr - block->offset;
         }
         rcu_read_unlock();
         return block;
-- 
Anthony PERARD

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

* Re: [Qemu-devel] [PATCH] exec: Fix qemu_ram_block_from_host for Xen
  2016-06-09 15:56 [Qemu-devel] [PATCH] exec: Fix qemu_ram_block_from_host for Xen Anthony PERARD
@ 2016-06-13  8:16 ` Paolo Bonzini
  2016-06-13  8:16 ` Paolo Bonzini
  1 sibling, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2016-06-13  8:16 UTC (permalink / raw)
  To: Anthony PERARD, qemu-devel
  Cc: xen-devel, Stefano Stabellini, Peter Crosthwaite, Richard Henderson



On 09/06/2016 17:56, Anthony PERARD wrote:
> Since f615f39 (exec: remove ram_addr argument from
> qemu_ram_block_from_host), migration under Xen is likely to fail, with a
> SEGV of QEMU. But the commit only reveal a bug with the calculation of
> the offset value in qemu_ram_block_from_host().
> 
> This patch calculates the offset from the ram_addr as
> qemu_ram_addr_from_host() will later calculate the ram_addr from the
> offset.
> 
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
> ---
>  exec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/exec.c b/exec.c
> index f2c9e37..f13106d 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -1935,7 +1935,7 @@ RAMBlock *qemu_ram_block_from_host(void *ptr, bool round_offset,
>          ram_addr = xen_ram_addr_from_mapcache(ptr);
>          block = qemu_get_ram_block(ram_addr);
>          if (block) {
> -            *offset = (host - block->host);
> +            *offset = ram_addr - block->offset;
>          }
>          rcu_read_unlock();
>          return block;
> 

Acked-by: Paolo Bonzini <pbonzini@redhat.com>

Feel free to send a pull request yourself!

Thanks, and sorry for the breakage.  Indeed the broken code comes from
commit 422148d3e56c3c9a07c0cf36c1e0a0b76f09c357.

Paolo

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

* Re: [PATCH] exec: Fix qemu_ram_block_from_host for Xen
  2016-06-09 15:56 [Qemu-devel] [PATCH] exec: Fix qemu_ram_block_from_host for Xen Anthony PERARD
  2016-06-13  8:16 ` Paolo Bonzini
@ 2016-06-13  8:16 ` Paolo Bonzini
  1 sibling, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2016-06-13  8:16 UTC (permalink / raw)
  To: Anthony PERARD, qemu-devel
  Cc: Peter Crosthwaite, Stefano Stabellini, Richard Henderson, xen-devel



On 09/06/2016 17:56, Anthony PERARD wrote:
> Since f615f39 (exec: remove ram_addr argument from
> qemu_ram_block_from_host), migration under Xen is likely to fail, with a
> SEGV of QEMU. But the commit only reveal a bug with the calculation of
> the offset value in qemu_ram_block_from_host().
> 
> This patch calculates the offset from the ram_addr as
> qemu_ram_addr_from_host() will later calculate the ram_addr from the
> offset.
> 
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
> ---
>  exec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/exec.c b/exec.c
> index f2c9e37..f13106d 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -1935,7 +1935,7 @@ RAMBlock *qemu_ram_block_from_host(void *ptr, bool round_offset,
>          ram_addr = xen_ram_addr_from_mapcache(ptr);
>          block = qemu_get_ram_block(ram_addr);
>          if (block) {
> -            *offset = (host - block->host);
> +            *offset = ram_addr - block->offset;
>          }
>          rcu_read_unlock();
>          return block;
> 

Acked-by: Paolo Bonzini <pbonzini@redhat.com>

Feel free to send a pull request yourself!

Thanks, and sorry for the breakage.  Indeed the broken code comes from
commit 422148d3e56c3c9a07c0cf36c1e0a0b76f09c357.

Paolo

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

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

end of thread, other threads:[~2016-06-13  8:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-09 15:56 [Qemu-devel] [PATCH] exec: Fix qemu_ram_block_from_host for Xen Anthony PERARD
2016-06-13  8:16 ` Paolo Bonzini
2016-06-13  8:16 ` Paolo Bonzini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.