From patchwork Wed Feb 11 17:14:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 438905 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 1BB6B14007D for ; Thu, 12 Feb 2015 04:17:01 +1100 (AEDT) Received: from localhost ([::1]:46243 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLauJ-0006Fa-7w for incoming@patchwork.ozlabs.org; Wed, 11 Feb 2015 12:16:59 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43049) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLasH-0002zf-S5 for qemu-devel@nongnu.org; Wed, 11 Feb 2015 12:15:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YLas8-0002y8-R3 for qemu-devel@nongnu.org; Wed, 11 Feb 2015 12:14:53 -0500 Received: from mail-wg0-x236.google.com ([2a00:1450:400c:c00::236]:61100) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLas8-0002y1-Jx for qemu-devel@nongnu.org; Wed, 11 Feb 2015 12:14:44 -0500 Received: by mail-wg0-f54.google.com with SMTP id y19so4796139wgg.13 for ; Wed, 11 Feb 2015 09:14:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=QGZ1vamv9Vb1JEwSnTIdOW4EmEfioC2JeluQAb+FsBk=; b=go5P/Nf6SmLiFeL0MJN/2re09uHhL7X9S238CP27KTI1YyBaLGzVEDVwj1S1UZK5/H uOxXNZPaSnRiTswJehGUoB90sXOBaboeIcjuldbczgTVhxKdYLJkw/uDuWxtmsdUa7mh TQledDipZnNAoiJ5CpF5laq/2hfdl1FXsZ2ZrPvdrylx9hlExkGmG45e1bD3G5Vs6vvr iP4RYJYJFLa3+o9dEh/J58iMzY3nZ4dhC+24Ai46AJyaoxKc+2h6umKhxZzVvT8LKGCD xRnw/cKImfdwEFS0RJ2S7yokkfHeIj8S63lQ9ufWdvlwrYsmPbzhhKaZJtbdmXoTTWDy 2KAg== X-Received: by 10.194.185.15 with SMTP id ey15mr66165738wjc.3.1423674884119; Wed, 11 Feb 2015 09:14:44 -0800 (PST) Received: from playground.station (net-93-66-105-136.cust.vodafonedsl.it. [93.66.105.136]) by mx.google.com with ESMTPSA id fo9sm9257930wib.16.2015.02.11.09.14.41 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Feb 2015 09:14:42 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 11 Feb 2015 18:14:31 +0100 Message-Id: <1423674872-10676-3-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1423674872-10676-1-git-send-email-pbonzini@redhat.com> References: <1423674872-10676-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c00::236 Cc: mdroth@linux.vnet.ibm.com Subject: [Qemu-devel] [PATCH 2/3] rcu: run RCU callbacks under the BQL 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 This needs to go away sooner or later, but one complication is the complex VFIO data structures that are modified in instance_finalize. Take a shortcut for now. Signed-off-by: Paolo Bonzini --- tests/Makefile | 2 +- util/rcu.c | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/Makefile b/tests/Makefile index d5df168..e11bfe7 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -257,7 +257,7 @@ tests/test-x86-cpuid$(EXESUF): tests/test-x86-cpuid.o tests/test-xbzrle$(EXESUF): tests/test-xbzrle.o migration/xbzrle.o page_cache.o libqemuutil.a tests/test-cutils$(EXESUF): tests/test-cutils.o util/cutils.o tests/test-int128$(EXESUF): tests/test-int128.o -tests/rcutorture$(EXESUF): tests/rcutorture.o libqemuutil.a +tests/rcutorture$(EXESUF): tests/rcutorture.o libqemuutil.a libqemustub.a tests/test-qdev-global-props$(EXESUF): tests/test-qdev-global-props.o \ hw/core/qdev.o hw/core/qdev-properties.o hw/core/hotplug.o\ diff --git a/util/rcu.c b/util/rcu.c index 486d7b6..bd73b8e 100644 --- a/util/rcu.c +++ b/util/rcu.c @@ -35,6 +35,7 @@ #include "qemu/rcu.h" #include "qemu/atomic.h" #include "qemu/thread.h" +#include "qemu/main-loop.h" /* * Global grace period counter. Bit 0 is always one in rcu_gp_ctr. @@ -237,20 +238,24 @@ static void *call_rcu_thread(void *opaque) atomic_sub(&rcu_call_count, n); synchronize_rcu(); + qemu_mutex_lock_iothread(); while (n > 0) { node = try_dequeue(); while (!node) { + qemu_mutex_unlock_iothread(); qemu_event_reset(&rcu_call_ready_event); node = try_dequeue(); if (!node) { qemu_event_wait(&rcu_call_ready_event); node = try_dequeue(); } + qemu_mutex_lock_iothread(); } n--; node->func(node); } + qemu_mutex_unlock_iothread(); } abort(); }