From patchwork Thu Jun 9 15:56:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony PERARD X-Patchwork-Id: 9167365 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9207560467 for ; Thu, 9 Jun 2016 15:59:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 83C93264F4 for ; Thu, 9 Jun 2016 15:59:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 78B7E28342; Thu, 9 Jun 2016 15:59:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0E000264F4 for ; Thu, 9 Jun 2016 15:59:45 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bB2L8-0000yx-9z; Thu, 09 Jun 2016 15:57:50 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bB2L6-0000yg-FX for xen-devel@lists.xen.org; Thu, 09 Jun 2016 15:57:48 +0000 Received: from [85.158.137.68] by server-15.bemta-3.messagelabs.com id BA/DE-04455-BF199575; Thu, 09 Jun 2016 15:57:47 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmphkeJIrShJLcpLzFFi42JxWrrBXvf3xMh wg44XnBZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa8aL5/fYC06zV3zYc5O5gbGJrYuRk0NCwF/i 5P9lTCA2m4CBxIrpVxlBbBEBaYn+Oe3sXYxcHMwC3xglVrV+ACsSFrCW2L5xImsXIwcHi4CKR ONvC5Awr4CtxLeju5ghZspJTF58CWyOkICaxI2Fy1ggagQlTs58AmYzC0hIHHzxghlkjIQAt8 TfbvsJjDyzkFTNQlK1gJFpFaNGcWpRWWqRrqGhXlJRZnpGSW5iZo6uoYGxXm5qcXFiempOYlK xXnJ+7iZGYIgwAMEOxtW/nQ4xSnIwKYnyCvZEhgvxJeWnVGYkFmfEF5XmpBYfYpTh4FCS4D0x ASgnWJSanlqRlpkDDFaYtAQHj5II72KQNG9xQWJucWY6ROoUoy7Hgh+31zIJseTl56VKifP6g RQJgBRllObBjYBFziVGWSlhXkago4R4ClKLcjNLUOVfMYpzMCoJ81aDTOHJzCuB2/QK6AgmoC OWHwkHOaIkESEl1cBoOPGst+wa6Yvmkva73ug0xJYuz4gqWhIr+L7GOuV7rZ/xf3lryYxZx30 mfV6YWz3z82chme93N0xMy9p6ln1NMMfFg+9+aR7PNa7OnvD9cZLS/AXe69elnv2T4XmzW6ek SfRr9getqAl2vKtObdH992m75eFJR78Lbnxm9d1BKjZjp86Faq6PSizFGYmGWsxFxYkAFswNl JcCAAA= X-Env-Sender: prvs=9614ae01b=anthony.perard@citrix.com X-Msg-Ref: server-2.tower-31.messagelabs.com!1465487865!44589378!1 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 8.46; banners=-,-,- X-VirusChecked: Checked Received: (qmail 2462 invoked from network); 9 Jun 2016 15:57:46 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-2.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 9 Jun 2016 15:57:46 -0000 X-IronPort-AV: E=Sophos;i="5.26,445,1459814400"; d="scan'208";a="366292136" From: Anthony PERARD To: Date: Thu, 9 Jun 2016 16:56:17 +0100 Message-ID: <20160609155617.6650-1-anthony.perard@citrix.com> X-Mailer: git-send-email 2.8.3 MIME-Version: 1.0 X-DLP: MIA1 Cc: Stefano Stabellini , Peter Crosthwaite , xen-devel@lists.xen.org, Anthony PERARD , Paolo Bonzini , Richard Henderson Subject: [Xen-devel] [PATCH] exec: Fix qemu_ram_block_from_host for Xen X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 Acked-by: Paolo Bonzini --- 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;