From patchwork Mon Feb 5 19:28:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 869510 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="mQvgzT9u"; dkim-atps=neutral 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 3zZz0F4g9Hz9sRV for ; Tue, 6 Feb 2018 06:57:49 +1100 (AEDT) Received: from localhost ([::1]:54968 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eimtf-0005Im-Jx for incoming@patchwork.ozlabs.org; Mon, 05 Feb 2018 14:57:47 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44956) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eimSW-0004iy-PL for qemu-devel@nongnu.org; Mon, 05 Feb 2018 14:29:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eimSW-000572-0u for qemu-devel@nongnu.org; Mon, 05 Feb 2018 14:29:44 -0500 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:38691) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eimSV-00056r-Ps for qemu-devel@nongnu.org; Mon, 05 Feb 2018 14:29:43 -0500 Received: by mail-wm0-x242.google.com with SMTP id 141so27959696wme.3 for ; Mon, 05 Feb 2018 11:29:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=BEIbBrMt0Q7AOi3hQXLUmv/BeFE+PR4W1+CZ+LeGXrM=; b=mQvgzT9uSkDuGquTLlNBECrSA8ZXAXUuSDJZCOgy44WAKRCDiutor16GFt+jNyGjmE IO+v97ctrMablMrztYlWvPgC6fCeorpRTAOEqiN1XEMjU/mkQTLA83jN6gos1MTLGGYD 6DByXHJcFf0yENBfRy0Yj5iba6p3QGln9BOl1JDVqXz6p5aJrxbbHPGyGCdv5NcJRG9y sRgALGG2+l9Fq4mU2V/rzRLOx1NG7mba2eUPAnf531osgOT+r2n8Tk3Mxw7xtQNtzn4k MdtjkNaGC7ayThXSKXJBLTfTip3Q286iaBCCidSBRTUDIIfZjFW9jwVC8knB/hACsUxC NiYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=BEIbBrMt0Q7AOi3hQXLUmv/BeFE+PR4W1+CZ+LeGXrM=; b=svUMn7t6SjgtnAtSQCfEK9+ianpdZS00yKx1X2UZwy9qDAFg1+VLHiQUxdaVnp/XcT xdV0R0XTZbBW+iuu6Yx3F51j0KxLoMIOkVIYMUWbfiA/j5TOUbp+LlHzO3EFVfWD8VLh Y/akCpZybc/XV9Lhwr+5OoCF9FuL/iMbuBrpdP4pXR3gIIepBNOh2Bq+rR8n6EpDBpQu XYBU39sbhOqQEfHbTK6hbr8Wr0OfOInGDY36HlgEheEzqXRYmxBrPMqCC8TcMHaR1YO/ /y5joLqB5wmSmslgnKjdfZrSs+W7OUy0hEsVdTn3hPYjWjbXaG47ZnsTcT0jADVZMHWJ 7b2A== X-Gm-Message-State: APf1xPDIlyL+c1iuLB34H5V48hqSmrsGfx471F04EpxrNcymmMzPQ+10 OaFTEpVRjDcETHQYPKzWPL/71j/H X-Google-Smtp-Source: AH8x2250rHrmb8x1P6D/cRBVimXhCfePuXWMAm3oT7osi+5LuXvOKjz5c+b7hoPWGszscq/NZ/XV/g== X-Received: by 10.28.147.196 with SMTP id v187mr359141wmd.128.1517858982469; Mon, 05 Feb 2018 11:29:42 -0800 (PST) Received: from 640k.lan ([82.84.122.246]) by smtp.gmail.com with ESMTPSA id g8sm20029891wra.18.2018.02.05.11.29.41 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Feb 2018 11:29:41 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 5 Feb 2018 20:28:46 +0100 Message-Id: <1517858941-5538-33-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1517858941-5538-1-git-send-email-pbonzini@redhat.com> References: <1517858941-5538-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::242 Subject: [Qemu-devel] [PULL 32/47] cpus: dummy: unregister thread with RCU, exit loop on unplug X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 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" Signed-off-by: Paolo Bonzini --- cpus.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cpus.c b/cpus.c index 1063dac..190ad5a 100644 --- a/cpus.c +++ b/cpus.c @@ -1234,7 +1234,7 @@ static void *qemu_dummy_cpu_thread_fn(void *arg) cpu->created = true; qemu_cond_signal(&qemu_cpu_cond); - while (1) { + do { qemu_mutex_unlock_iothread(); do { int sig; @@ -1246,8 +1246,9 @@ static void *qemu_dummy_cpu_thread_fn(void *arg) } qemu_mutex_lock_iothread(); qemu_wait_io_event(cpu); - } + } while (!cpu->unplug); + rcu_unregister_thread(); return NULL; #endif }