From patchwork Thu Jan 27 10:12:28 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 80625 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 AC12AB7124 for ; Thu, 27 Jan 2011 21:24:54 +1100 (EST) Received: from localhost ([127.0.0.1]:44775 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PiP23-0003DU-Hs for incoming@patchwork.ozlabs.org; Thu, 27 Jan 2011 05:24:51 -0500 Received: from [140.186.70.92] (port=32936 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PiOqJ-0006wy-Hg for qemu-devel@nongnu.org; Thu, 27 Jan 2011 05:12:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PiOqF-0005Uu-So for qemu-devel@nongnu.org; Thu, 27 Jan 2011 05:12:43 -0500 Received: from mx1.redhat.com ([209.132.183.28]:30835) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PiOqF-0005Uc-Je for qemu-devel@nongnu.org; Thu, 27 Jan 2011 05:12:39 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id p0RACcgi008923 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 27 Jan 2011 05:12:39 -0500 Received: from rincewind.home.kraxel.org (vpn2-8-106.ams2.redhat.com [10.36.8.106]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p0RACaQx024378; Thu, 27 Jan 2011 05:12:37 -0500 Received: by rincewind.home.kraxel.org (Postfix, from userid 500) id B387041A19; Thu, 27 Jan 2011 11:12:31 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Thu, 27 Jan 2011 11:12:28 +0100 Message-Id: <1296123150-11599-7-git-send-email-kraxel@redhat.com> In-Reply-To: <1296123150-11599-1-git-send-email-kraxel@redhat.com> References: <1296123150-11599-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Cc: Gerd Hoffmann Subject: [Qemu-devel] [PATCH 6/8] qxl: locking fixes 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 Two spice worker calls lack the unlock/relock calls, which may lead to deadlocks, add them. [ v2: add unlock/lock to one more place, found by Alon Levy ] Signed-off-by: Gerd Hoffmann --- hw/qxl.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/hw/qxl.c b/hw/qxl.c index dcea65d..ac3e87e 100644 --- a/hw/qxl.c +++ b/hw/qxl.c @@ -770,7 +770,9 @@ static void qxl_add_memslot(PCIQXLDevice *d, uint32_t slot_id, uint64_t delta) __FUNCTION__, memslot.slot_id, memslot.virt_start, memslot.virt_end); + qemu_mutex_unlock_iothread(); d->ssd.worker->add_memslot(d->ssd.worker, &memslot); + qemu_mutex_lock_iothread(); d->guest_slots[slot_id].ptr = (void*)memslot.virt_start; d->guest_slots[slot_id].size = memslot.virt_end - memslot.virt_start; d->guest_slots[slot_id].delta = delta; @@ -866,7 +868,9 @@ 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)