Received: from eggs.gnu.org ([140.186.70.92]:39419) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QheL0-0000Ni-AP for qemu-devel@nongnu.org; Fri, 15 Jul 2011 05:05:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QheKy-0008PH-8c for qemu-devel@nongnu.org; Fri, 15 Jul 2011 05:05:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:24031) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QheKx-0008PB-Q6 for qemu-devel@nongnu.org; Fri, 15 Jul 2011 05:05:32 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p6F95UsR014424 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 15 Jul 2011 05:05:30 -0400 Date: Fri, 15 Jul 2011 12:05:05 +0300 From: Alon Levy Message-ID: <20110715090505.GK23682@bow.tlv.redhat.com> References: <1310670801-14687-1-git-send-email-alevy@redhat.com> <1310670801-14687-10-git-send-email-alevy@redhat.com> <4E1FF65E.3040701@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4E1FF65E.3040701@redhat.com> Subject: Re: [Qemu-devel] [PATCHv5 09/12] qxl: async io support using new spice api List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: yhalperi@redhat.com, qemu-devel@nongnu.org On Fri, Jul 15, 2011 at 10:12:14AM +0200, Gerd Hoffmann wrote: > > case QXL_IO_DESTROY_PRIMARY: > > if (val != 0) { > >- qxl_guest_bug(d, "QXL_IO_DESTROY_PRIMARY: val != 0"); > >- break; > >+ qxl_guest_bug(d, "QXL_IO_DESTROY_PRIMARY (async=%d): val != 0", > >+ async); > >+ goto cancel_async; > >+ } > >+ dprint(d, 1, "QXL_IO_DESTROY_PRIMARY (async=%d) (%s)\n", async, > >+ qxl_mode_to_string(d->mode)); > >+ qxl_destroy_primary(d, async); > >+#if SPICE_INTERFACE_QXL_MINOR>= 1 > >+ if (d->mode == QXL_MODE_UNDEFINED&& async == QXL_ASYNC) { > >+ dprint(d, 1, "QXL_IO_DESTROY_PRIMARY_ASYNC in %s, ignored\n", > >+ qxl_mode_to_string(d->mode)); > >+ qxl_send_events(d, QXL_INTERRUPT_IO_CMD); > >+ goto cancel_async; > > } > > Hmm? Why this is needed? In this case we don't do any operation (i.e. qxl_destroy_primary is a nop, it checkes d->mode == QXL_MODE_UNDEFINED too) so there will never be an async_complete, so there will never be a qxl_send_events, so we need to send it now. > > > default: > > fprintf(stderr, "%s: ioport=0x%x, abort()\n", __FUNCTION__, io_port); > > abort(); > > } > >+ return; > >+cancel_async: > >+#if SPICE_INTERFACE_QXL_MINOR>= 1 > >+ if (async) { > >+ qemu_mutex_lock(&d->async_lock); > >+ d->current_async = QXL_UNDEFINED_IO; > >+ qemu_mutex_unlock(&d->async_lock); > > Add "qxl_send_events(d, QXL_INTERRUPT_IO_CMD)" here? no, we want that wen the command is actually complete, on async_complete, where it is already done. > > > typedef struct PCIQXLDevice { > > PCIDevice pci; > > SimpleSpiceDisplay ssd; > >@@ -30,6 +32,11 @@ typedef struct PCIQXLDevice { > > int32_t num_memslots; > > int32_t num_surfaces; > > > >+#if SPICE_INTERFACE_QXL_MINOR>= 1 > >+ uint32_t current_async; > >+ QemuMutex async_lock; > >+#endif > > No need to ifdef this. > missed it. > cheers, > Gerd