From nobody Thu May 2 12:23:22 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 14918943217591003.331148830991; Tue, 11 Apr 2017 00:05:21 -0700 (PDT) Received: from localhost ([::1]:37522 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cxprc-0002z3-LM for importer@patchew.org; Tue, 11 Apr 2017 03:05:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44358) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cxppI-0001XK-So for qemu-devel@nongnu.org; Tue, 11 Apr 2017 03:02:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cxppF-0003Fb-Vy for qemu-devel@nongnu.org; Tue, 11 Apr 2017 03:02:56 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47654) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cxppF-0003F1-OZ for qemu-devel@nongnu.org; Tue, 11 Apr 2017 03:02:53 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A315B7E9DB for ; Tue, 11 Apr 2017 07:02:52 +0000 (UTC) Received: from nilsson.home.kraxel.org (ovpn-116-53.ams2.redhat.com [10.36.116.53]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8AFE17E177; Tue, 11 Apr 2017 07:02:48 +0000 (UTC) Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id 9D0B280B8D; Tue, 11 Apr 2017 09:02:46 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com A315B7E9DB Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=kraxel@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com A315B7E9DB From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Tue, 11 Apr 2017 09:02:42 +0200 Message-Id: <20170411070243.635-2-kraxel@redhat.com> In-Reply-To: <20170411070243.635-1-kraxel@redhat.com> References: <20170411070243.635-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 11 Apr 2017 07:02:52 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 1/2] qxl: switch display on entering VGA X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Marc-Andr=C3=A9 Lureau Since commit cd958edb1fae85d, same size console resize is skipped. This change broke QXL incoming migration in VGA mode, qemu_spice_display_switch() is no longer called during qxl_post_load(), because default message surface is of the same size, and during displaychangelistener registration, PCIQXLDevice.mode is QXL_MODE_UNDEFINED. This triggers a later crash on refresh: =3D=3D2634=3D=3D Invalid read of size 4 =3D=3D3516=3D=3D at 0x65F3050: pixman_image_get_data (in /usr/lib64/libpixm= an-1.so.0.34.0) =3D=3D3516=3D=3D by 0x6F0CEB: qemu_spice_create_update (spice-display.c:215) =3D=3D3516=3D=3D by 0x6F1CC7: qemu_spice_display_refresh (spice-display.c:5= 02) =3D=3D3516=3D=3D by 0x58CF77: display_refresh (qxl.c:1948) =3D=3D3516=3D=3D by 0x6E8084: do_safe_dpy_refresh (console.c:1591) =3D=3D3516=3D=3D by 0x6E80D5: dpy_refresh (console.c:1604) =3D=3D3516=3D=3D by 0x6E4508: gui_update (console.c:201) =3D=3D3516=3D=3D by 0x81898E: timerlist_run_timers (qemu-timer.c:536) =3D=3D3516=3D=3D by 0x8189D6: qemu_clock_run_timers (qemu-timer.c:547) =3D=3D3516=3D=3D by 0x818D98: qemu_clock_run_all_timers (qemu-timer.c:662) =3D=3D3516=3D=3D by 0x81952A: main_loop_wait (main-loop.c:514) =3D=3D3516=3D=3D by 0x4ADD29: main_loop (vl.c:1898) One way to solve this is to explicitely call qemu_spice_display_switch() on entering VGA mode, which is called during qxl_post_load(). Fixes: "null pointer access on migration resume of systemrescuecd boot menu with q= xl-vga" https://bugs.launchpad.net/qemu/+bug/1679126 https://bugzilla.redhat.com/show_bug.cgi?id=3D1438566 Signed-off-by: Marc-Andr=C3=A9 Lureau Message-id: 20170406120513.638-4-marcandre.lureau@redhat.com Signed-off-by: Gerd Hoffmann --- hw/display/qxl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/display/qxl.c b/hw/display/qxl.c index 0d02f0e..c31b293 100644 --- a/hw/display/qxl.c +++ b/hw/display/qxl.c @@ -1146,6 +1146,7 @@ static void qxl_enter_vga_mode(PCIQXLDevice *d) update_displaychangelistener(&d->ssd.dcl, GUI_REFRESH_INTERVAL_DEFAULT= ); qemu_spice_create_host_primary(&d->ssd); d->mode =3D QXL_MODE_VGA; + qemu_spice_display_switch(&d->ssd, d->ssd.ds); vga_dirty_log_start(&d->vga); graphic_hw_update(d->vga.con); } --=20 2.9.3 From nobody Thu May 2 12:23:22 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1491894382843805.5587586973127; Tue, 11 Apr 2017 00:06:22 -0700 (PDT) Received: from localhost ([::1]:37525 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cxpsb-0003Un-Mt for importer@patchew.org; Tue, 11 Apr 2017 03:06:21 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44380) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cxppK-0001XS-AS for qemu-devel@nongnu.org; Tue, 11 Apr 2017 03:02:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cxppG-0003Fl-Bx for qemu-devel@nongnu.org; Tue, 11 Apr 2017 03:02:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44950) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cxppG-0003Em-4d for qemu-devel@nongnu.org; Tue, 11 Apr 2017 03:02:54 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C6AE361BAD; Tue, 11 Apr 2017 07:02:51 +0000 (UTC) Received: from nilsson.home.kraxel.org (ovpn-116-53.ams2.redhat.com [10.36.116.53]) by smtp.corp.redhat.com (Postfix) with ESMTP id DD45018345; Tue, 11 Apr 2017 07:02:50 +0000 (UTC) Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id 8647780BAE; Tue, 11 Apr 2017 09:02:47 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com C6AE361BAD Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=kraxel@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com C6AE361BAD From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Tue, 11 Apr 2017 09:02:43 +0200 Message-Id: <20170411070243.635-3-kraxel@redhat.com> In-Reply-To: <20170411070243.635-1-kraxel@redhat.com> References: <20170411070243.635-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 11 Apr 2017 07:02:51 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 2/2] qxl: add migration blocker to avoid pre-save assert X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Gerd Hoffmann , 1635339@bugs.launchpad.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Cc: 1635339@bugs.launchpad.net Signed-off-by: Gerd Hoffmann Reviewed-by: Marc-Andr=C3=A9 Lureau Message-id: 20170410113131.2585-1-kraxel@redhat.com --- hw/display/qxl.h | 1 + hw/display/qxl.c | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/hw/display/qxl.h b/hw/display/qxl.h index d2d49dd..77e5a36 100644 --- a/hw/display/qxl.h +++ b/hw/display/qxl.h @@ -40,6 +40,7 @@ typedef struct PCIQXLDevice { uint32_t cmdlog; =20 uint32_t guest_bug; + Error *migration_blocker; =20 enum qxl_mode mode; uint32_t cmdflags; diff --git a/hw/display/qxl.c b/hw/display/qxl.c index c31b293..9feae78 100644 --- a/hw/display/qxl.c +++ b/hw/display/qxl.c @@ -26,6 +26,7 @@ #include "qemu/queue.h" #include "qemu/atomic.h" #include "sysemu/sysemu.h" +#include "migration/migration.h" #include "trace.h" =20 #include "qxl.h" @@ -639,6 +640,30 @@ static int interface_get_command(QXLInstance *sin, str= uct QXLCommandExt *ext) qxl->guest_primary.commands++; qxl_track_command(qxl, ext); qxl_log_command(qxl, "cmd", ext); + { + /* + * Windows 8 drivers place qxl commands in the vram + * (instead of the ram) bar. We can't live migrate such a + * guest, so add a migration blocker in case we detect + * this, to avoid triggering the assert in pre_save(). + * + * https://cgit.freedesktop.org/spice/win32/qxl-wddm-dod/commi= t/?id=3Df6e099db39e7d0787f294d5fd0dce328b5210faa + */ + void *msg =3D qxl_phys2virt(qxl, ext->cmd.data, ext->group_id); + if (msg !=3D NULL && ( + msg < (void *)qxl->vga.vram_ptr || + msg > ((void *)qxl->vga.vram_ptr + qxl->vga.vram_size)= )) { + if (!qxl->migration_blocker) { + Error *local_err =3D NULL; + error_setg(&qxl->migration_blocker, + "qxl: guest bug: command not in ram bar"); + migrate_add_blocker(qxl->migration_blocker, &local_err= ); + if (local_err) { + error_report_err(local_err); + } + } + } + } trace_qxl_ring_command_get(qxl->id, qxl_mode_to_string(qxl->mode)); return true; default: @@ -1236,6 +1261,12 @@ static void qxl_hard_reset(PCIQXLDevice *d, int load= vm) qemu_spice_create_host_memslot(&d->ssd); qxl_soft_reset(d); =20 + if (d->migration_blocker) { + migrate_del_blocker(d->migration_blocker); + error_free(d->migration_blocker); + d->migration_blocker =3D NULL; + } + if (startstop) { qemu_spice_display_start(); } --=20 2.9.3