From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35039) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bB2LB-0002Ov-5p for qemu-devel@nongnu.org; Thu, 09 Jun 2016 11:57:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bB2L6-0004qP-Do for qemu-devel@nongnu.org; Thu, 09 Jun 2016 11:57:53 -0400 Received: from smtp02.citrix.com ([66.165.176.63]:35816) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bB2L6-0004oC-6Q for qemu-devel@nongnu.org; Thu, 09 Jun 2016 11:57:48 -0400 From: Anthony PERARD Date: Thu, 9 Jun 2016 16:56:17 +0100 Message-ID: <20160609155617.6650-1-anthony.perard@citrix.com> MIME-Version: 1.0 Content-Type: text/plain Subject: [Qemu-devel] [PATCH] exec: Fix qemu_ram_block_from_host for Xen List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: xen-devel@lists.xen.org, 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 --- 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