From patchwork Thu Nov 1 11:48:00 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alon Levy X-Patchwork-Id: 196173 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 613692C02BC for ; Thu, 1 Nov 2012 22:48:15 +1100 (EST) Received: from localhost ([::1]:45437 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TTtFt-0003Jm-Jo for incoming@patchwork.ozlabs.org; Thu, 01 Nov 2012 07:48:13 -0400 Received: from eggs.gnu.org ([208.118.235.92]:52516) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TTtFl-0003Jf-UM for qemu-devel@nongnu.org; Thu, 01 Nov 2012 07:48:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TTtFh-0001G5-NK for qemu-devel@nongnu.org; Thu, 01 Nov 2012 07:48:05 -0400 Received: from mx3-phx2.redhat.com ([209.132.183.24]:36868) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TTtFh-0001Fw-Ea for qemu-devel@nongnu.org; Thu, 01 Nov 2012 07:48:01 -0400 Received: from zmail15.collab.prod.int.phx2.redhat.com (zmail15.collab.prod.int.phx2.redhat.com [10.5.83.17]) by mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id qA1Bm0UX032428; Thu, 1 Nov 2012 07:48:00 -0400 Date: Thu, 1 Nov 2012 07:48:00 -0400 (EDT) From: Alon Levy To: Gerd Hoffmann Message-ID: <1786113489.25327079.1351770480060.JavaMail.root@redhat.com> In-Reply-To: <5092500D.6000907@redhat.com> MIME-Version: 1.0 X-Originating-IP: [10.35.4.71] X-Mailer: Zimbra 7.2.0_GA_2669 (ZimbraWebClient - FF3.0 (Linux)/7.2.0_GA_2669) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 209.132.183.24 Cc: qemu-devel@nongnu.org Subject: Re: [Qemu-devel] [RFC] hw/qxl: inject interrupts in any state 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 > Hi, > > > This prevents a known abort on set_client_capabilities, that > > should be > > fixed in upstream, but it should also be checked against in > > qxl. Checks > > every other location that qxl_send_events is eventually > > possibly called > > Why check in all callers instead of qxl_send_events directly? To point to the faulty function without resorting to the stack. But I guess we can always get that from systemtap if I add a trace event there. commit 02250067a5c7537dd4a22015d9c3fdabeba6404d Author: Alon Levy Date: Tue Oct 30 18:00:33 2012 +0200 hw/qxl: qxl_send_events: nop if stopped Added a trace point for easy logging. RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=870972 Signed-off-by: Alon Levy > > Just print the warning about the spice server bug & possibly lost > events > and go on. With luck the event arrives nevertheless. And if not we > at > least sayed before it can happen ;) > > > +static void spice_server_bug(PCIQXLDevice *qxl, const char *msg, > > ...) > > +{ > > + va_list ap; > > + va_start(ap, msg); > > + fprintf(stderr, "qxl-%d: spice-server bug: ", qxl->id); > > + vfprintf(stderr, msg, ap); > > + fprintf(stderr, "\n"); > > + va_end(ap); > > +} > > + > > +#define SPICE_SERVER_BUG_ONCE(qxl, msg, ...) { \ > > + static int called; \ > > + if (!called) { \ > > + called = 1; \ > > + spice_server_bug(qxl, msg, __VA_ARGS__); \ > > + } \ > > +} > > That feels a bit like overkill too. > > cheers, > Gerd > > > diff --git a/hw/qxl.c b/hw/qxl.c index 7b88a1e..e86e70c 100644 --- a/hw/qxl.c +++ b/hw/qxl.c @@ -1739,7 +1739,11 @@ static void qxl_send_events(PCIQXLDevice *d, uint32_t events) uint32_t le_events = cpu_to_le32(events); trace_qxl_send_events(d->id, events); - assert(qemu_spice_display_is_running(&d->ssd)); + if (!qemu_spice_display_is_running(&d->ssd)) { + fprintf(stderr, "%s: guest stopped, ignoring\n", __func__); + trace_qxl_send_events_vm_stopped(d->id, events); + return; + } old_pending = __sync_fetch_and_or(&d->ram->int_pending, le_events); if ((old_pending & le_events) == le_events) { return; diff --git a/trace-events b/trace-events index 7ee21e5..d308533 100644 --- a/trace-events +++ b/trace-events @@ -994,6 +994,7 @@ qxl_spice_update_area(int qid, uint32_t surface_id, uint32_t left, uint32_t righ qxl_spice_update_area_rest(int qid, uint32_t num_dirty_rects, uint32_t clear_dirty_region) "%d #d=%d clear=%d" qxl_surfaces_dirty(int qid, int surface, int offset, int size) "%d surface=%d offset=%d size=%d" qxl_send_events(int qid, uint32_t events) "%d %d" +qxl_send_events_vm_stopped(int qid, uint32_t events) "%d %d" qxl_set_guest_bug(int qid) "%d" qxl_interrupt_client_monitors_config(int qid, int num_heads, void *heads) "%d %d %p" qxl_client_monitors_config_unsupported_by_guest(int qid, uint32_t int_mask, void *client_monitors_config) "%d %X %p"