From patchwork Wed Mar 16 12:48:33 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alon Levy X-Patchwork-Id: 87249 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id CDFCEB6FA8 for ; Thu, 17 Mar 2011 00:07:07 +1100 (EST) Received: from localhost ([127.0.0.1]:49884 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PzqRH-0000cJ-HH for incoming@patchwork.ozlabs.org; Wed, 16 Mar 2011 09:06:59 -0400 Received: from [140.186.70.92] (port=51142 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PzqOI-0007Pl-9h for qemu-devel@nongnu.org; Wed, 16 Mar 2011 09:03:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pzq9x-0006zd-Br for qemu-devel@nongnu.org; Wed, 16 Mar 2011 08:49:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:61678) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pzq9x-0006zO-0q for qemu-devel@nongnu.org; Wed, 16 Mar 2011 08:49:05 -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 p2GCn4ld014265 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 16 Mar 2011 08:49:04 -0400 Received: from playa.tlv.redhat.com (dhcp-3-110.tlv.redhat.com [10.35.3.110]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p2GCmusj026509; Wed, 16 Mar 2011 08:49:02 -0400 From: Alon Levy To: qemu-devel@nongnu.org Date: Wed, 16 Mar 2011 14:48:33 +0200 Message-Id: <1300279714-24721-4-git-send-email-alevy@redhat.com> In-Reply-To: <1300279714-24721-1-git-send-email-alevy@redhat.com> References: <1300279714-24721-1-git-send-email-alevy@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: hdegoede@redhat.com, uril@redhat.com, gleb@redhat.com Subject: [Qemu-devel] [PATCH v2 3/4] qxl/spice: remove qemu_mutex_{un, }lock_iothread around dispatcher X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org with the previous patch making sure get_command no longer needs to lock, there is no reason to drop the qemu iothread mutex in qxl.c and in ui/spice-display.c The only location where the lock remains are the cursor related callbacks, that path is currently broken. It is only triggered if running spice and sdl, which is broken already before that. --- hw/qxl.c | 8 -------- ui/spice-display.c | 11 ++--------- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/hw/qxl.c b/hw/qxl.c index 2419236..72f204b 100644 --- a/hw/qxl.c +++ b/hw/qxl.c @@ -707,10 +707,8 @@ static void qxl_hard_reset(PCIQXLDevice *d, int loadvm) dprint(d, 1, "%s: start%s\n", __FUNCTION__, loadvm ? " (loadvm)" : ""); - qemu_mutex_unlock_iothread(); d->ssd.worker->reset_cursor(d->ssd.worker); d->ssd.worker->reset_image_cache(d->ssd.worker); - qemu_mutex_lock_iothread(); qxl_reset_surfaces(d); qxl_reset_memslots(d); @@ -840,9 +838,7 @@ static void qxl_reset_surfaces(PCIQXLDevice *d) { dprint(d, 1, "%s:\n", __FUNCTION__); d->mode = QXL_MODE_UNDEFINED; - qemu_mutex_unlock_iothread(); d->ssd.worker->destroy_surfaces(d->ssd.worker); - qemu_mutex_lock_iothread(); memset(&d->guest_surfaces.cmds, 0, sizeof(d->guest_surfaces.cmds)); } @@ -911,9 +907,7 @@ static void qxl_destroy_primary(PCIQXLDevice *d) dprint(d, 1, "%s\n", __FUNCTION__); d->mode = QXL_MODE_UNDEFINED; - qemu_mutex_unlock_iothread(); d->ssd.worker->destroy_primary_surface(d->ssd.worker, 0); - qemu_mutex_lock_iothread(); } static void qxl_set_mode(PCIQXLDevice *d, int modenr, int loadvm) @@ -983,10 +977,8 @@ static void ioport_write(void *opaque, uint32_t addr, uint32_t val) case QXL_IO_UPDATE_AREA: { QXLRect update = d->ram->update_area; - qemu_mutex_unlock_iothread(); d->ssd.worker->update_area(d->ssd.worker, d->ram->update_surface, &update, NULL, 0, 0); - qemu_mutex_lock_iothread(); break; } case QXL_IO_NOTIFY_CMD: diff --git a/ui/spice-display.c b/ui/spice-display.c index a9ecee0..f3dfba8 100644 --- a/ui/spice-display.c +++ b/ui/spice-display.c @@ -78,9 +78,7 @@ SimpleSpiceUpdate *qemu_spice_create_update(SimpleSpiceDisplay *ssd) uint8_t *src, *dst; int by, bw, bh; - qemu_mutex_lock_iothread(); if (qemu_spice_rect_is_empty(&ssd->dirty)) { - qemu_mutex_unlock_iothread(); return NULL; }; @@ -141,7 +139,6 @@ SimpleSpiceUpdate *qemu_spice_create_update(SimpleSpiceDisplay *ssd) cmd->data = (intptr_t)drawable; memset(&ssd->dirty, 0, sizeof(ssd->dirty)); - qemu_mutex_unlock_iothread(); return update; } @@ -169,6 +166,7 @@ void qemu_spice_create_host_memslot(SimpleSpiceDisplay *ssd) ssd->worker->add_memslot(ssd->worker, &memslot); } +/* called from iothread (main) or a vcpu-thread */ void qemu_spice_create_host_primary(SimpleSpiceDisplay *ssd) { QXLDevSurfaceCreate surface; @@ -186,18 +184,14 @@ void qemu_spice_create_host_primary(SimpleSpiceDisplay *ssd) surface.mem = (intptr_t)ssd->buf; surface.group_id = MEMSLOT_GROUP_HOST; - qemu_mutex_unlock_iothread(); ssd->worker->create_primary_surface(ssd->worker, 0, &surface); - qemu_mutex_lock_iothread(); } void qemu_spice_destroy_host_primary(SimpleSpiceDisplay *ssd) { dprint(1, "%s:\n", __FUNCTION__); - qemu_mutex_unlock_iothread(); ssd->worker->destroy_primary_surface(ssd->worker, 0); - qemu_mutex_lock_iothread(); } void qemu_spice_vm_change_state_handler(void *opaque, int running, int reason) @@ -207,9 +201,7 @@ void qemu_spice_vm_change_state_handler(void *opaque, int running, int reason) if (running) { ssd->worker->start(ssd->worker); } else { - qemu_mutex_unlock_iothread(); ssd->worker->stop(ssd->worker); - qemu_mutex_lock_iothread(); } ssd->running = running; } @@ -233,6 +225,7 @@ void qemu_spice_display_update(SimpleSpiceDisplay *ssd, qemu_spice_rect_union(&ssd->dirty, &update_area); } +/* called only from iothread (main) */ void qemu_spice_display_resize(SimpleSpiceDisplay *ssd) { dprint(1, "%s:\n", __FUNCTION__);