From patchwork Thu Sep 22 12:33:46 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alon Levy X-Patchwork-Id: 115947 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id E712FB6F83 for ; Thu, 22 Sep 2011 22:36:16 +1000 (EST) Received: from localhost ([::1]:55383 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R6iVY-0005aY-Nx for incoming@patchwork.ozlabs.org; Thu, 22 Sep 2011 08:36:04 -0400 Received: from eggs.gnu.org ([140.186.70.92]:43929) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R6iVT-0005aO-At for qemu-devel@nongnu.org; Thu, 22 Sep 2011 08:36:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R6iVS-0003SP-2t for qemu-devel@nongnu.org; Thu, 22 Sep 2011 08:35:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34677) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R6iVR-0003SJ-SA for qemu-devel@nongnu.org; Thu, 22 Sep 2011 08:35:58 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p8MCZuRu000428 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 22 Sep 2011 08:35:56 -0400 Received: from bow.tlv.redhat.com (dhcp-3-110.tlv.redhat.com [10.35.3.110]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p8MCZsZ9008156; Thu, 22 Sep 2011 08:35:55 -0400 From: Alon Levy To: qemu-devel@nongnu.org Date: Thu, 22 Sep 2011 15:33:46 +0300 Message-Id: <1316694826-20568-1-git-send-email-alevy@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 209.132.183.28 Cc: kraxel@redhat.com Subject: [Qemu-devel] [PATCH] qxl: create slots on post_load in any state (fix RHBZ 740547) X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org If we migrate when the device is not in a native state the guest still believes the slots are created, and will cause operations that reference the slots, causing a "panic: virtual address out of range" on the first of them. Easy to see by migrating in vga mode (with a driver loaded, for instance windows cmd window in full screen mode) and then exiting vga mode back to native mode will cause said panic. Fixed by doing the slot recreation unconditionally at post_load Signed-off-by: Alon Levy --- hw/qxl.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/hw/qxl.c b/hw/qxl.c index 6db2f1a..c5204d8 100644 --- a/hw/qxl.c +++ b/hw/qxl.c @@ -1684,6 +1684,12 @@ static int qxl_post_load(void *opaque, int version) qxl_mode_to_string(d->mode)); newmode = d->mode; d->mode = QXL_MODE_UNDEFINED; + for (i = 0; i < NUM_MEMSLOTS; i++) { + if (!d->guest_slots[i].active) { + continue; + } + qxl_add_memslot(d, i, 0, QXL_SYNC); + } switch (newmode) { case QXL_MODE_UNDEFINED: break; @@ -1691,12 +1697,6 @@ static int qxl_post_load(void *opaque, int version) qxl_enter_vga_mode(d); break; case QXL_MODE_NATIVE: - for (i = 0; i < NUM_MEMSLOTS; i++) { - if (!d->guest_slots[i].active) { - continue; - } - qxl_add_memslot(d, i, 0, QXL_SYNC); - } qxl_create_guest_primary(d, 1, QXL_SYNC); /* replay surface-create and cursor-set commands */