From patchwork Thu Jan 27 12:41:24 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alon Levy X-Patchwork-Id: 80672 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 DD14FB712D for ; Thu, 27 Jan 2011 23:52:58 +1100 (EST) Received: from localhost ([127.0.0.1]:47759 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PiRLM-0007mG-Bs for incoming@patchwork.ozlabs.org; Thu, 27 Jan 2011 07:52:56 -0500 Received: from [140.186.70.92] (port=37108 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PiRAI-0005U8-9T for qemu-devel@nongnu.org; Thu, 27 Jan 2011 07:41:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PiRAG-00025W-FS for qemu-devel@nongnu.org; Thu, 27 Jan 2011 07:41:30 -0500 Received: from mx1.redhat.com ([209.132.183.28]:36476) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PiRAG-00025H-8m for qemu-devel@nongnu.org; Thu, 27 Jan 2011 07:41:28 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id p0RCfQah022798 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 27 Jan 2011 07:41:26 -0500 Received: from playa.tlv.redhat.com (dhcp-3-210.tlv.redhat.com [10.35.3.210]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p0RCfPbF007991 for ; Thu, 27 Jan 2011 07:41:26 -0500 From: Alon Levy To: qemu-devel@nongnu.org Date: Thu, 27 Jan 2011 14:41:24 +0200 Message-Id: <1296132084-24764-1-git-send-email-alevy@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Subject: [Qemu-devel] [RFC] hw/qxl: three more unlocks 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 --- Basically, anything that does a: kvm_main_cpu io exit write to red_worker pipe wait on read from red_worker pipe should relingquish the lock during that wait, no? Anyway, I had a lockup, saw it was in this situation with gdb, didn't record which function exactly, and it was solved by adding these three locks (so one of them helped..) hw/qxl.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/hw/qxl.c b/hw/qxl.c index 00c31c7..6ebb634 100644 --- a/hw/qxl.c +++ b/hw/qxl.c @@ -803,14 +803,18 @@ static void qxl_add_memslot(PCIQXLDevice *d, uint32_t slot_id, uint64_t delta) static void qxl_del_memslot(PCIQXLDevice *d, uint32_t slot_id) { dprint(d, 1, "%s: slot %d\n", __FUNCTION__, slot_id); + qxl_unlock_iothread(&d->ssd); d->ssd.worker->del_memslot(d->ssd.worker, MEMSLOT_GROUP_HOST, slot_id); + qxl_lock_iothread(&d->ssd); d->guest_slots[slot_id].active = 0; } static void qxl_reset_memslots(PCIQXLDevice *d) { dprint(d, 1, "%s:\n", __FUNCTION__); + qxl_unlock_iothread(&d->ssd); d->ssd.worker->reset_memslots(d->ssd.worker); + qxl_lock_iothread(&d->ssd); memset(&d->guest_slots, 0, sizeof(d->guest_slots)); } @@ -874,7 +878,9 @@ static void qxl_create_guest_primary(PCIQXLDevice *qxl, int loadvm) qxl->mode = QXL_MODE_NATIVE; qxl->cmdflags = 0; + qxl_unlock_iothread(&qxl->ssd); qxl->ssd.worker->create_primary_surface(qxl->ssd.worker, 0, &surface); + qxl_lock_iothread(&qxl->ssd); /* for local rendering */ qxl_render_resize(qxl);