From patchwork Mon Jul 23 20:17:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 10540967 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 416CE91E for ; Mon, 23 Jul 2018 20:58:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3018727FA1 for ; Mon, 23 Jul 2018 20:58:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 241CC28387; Mon, 23 Jul 2018 20:58:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C2F2E27FA1 for ; Mon, 23 Jul 2018 20:58:37 +0000 (UTC) Received: from localhost ([::1]:36571 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fhhue-0002Dn-HS for patchwork-qemu-devel@patchwork.kernel.org; Mon, 23 Jul 2018 16:58:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42182) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fhhJl-0002y1-Hs for qemu-devel@nongnu.org; Mon, 23 Jul 2018 16:20:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fhhJk-0004k1-Mr for qemu-devel@nongnu.org; Mon, 23 Jul 2018 16:20:29 -0400 Received: from mail-oi0-x243.google.com ([2607:f8b0:4003:c06::243]:38990) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fhhJk-0004jc-HC; Mon, 23 Jul 2018 16:20:28 -0400 Received: by mail-oi0-x243.google.com with SMTP id d189-v6so3482790oib.6; Mon, 23 Jul 2018 13:20:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=B2Xe/MYL9HdquHUy7rdn5+WCA/XvHWA8evaGwtKwy6M=; b=YQTJPmPJuMuAJcWdrj82sZDuQVdERMC7LRsDv0J3Y3hnJz16ZkBsPOzZWiWMnSJ0Oi puJanFB+FddhJzV1q/hy37SPYNJ+8wf7GIYXtGPHHZQ7pSqth767+ngMDjRpI1BsgX4a 4UCv8oKv3Ll6RM1xgZuA1wzW7zwO678hUBN+uK8S9/EP7I8Y80HH8GNtrsE6VrOwy0D9 v+nYZxaGW/EE/qPp//hvjS4L+Pdz87zQUPa1u7zve4nD95R5321wrir948V189RQXSD8 AYqtRALOFkh4m8XJUsVoWGOITZAWxA2i8HnyinEc5VI+AqNidTTwn5RDeWDdWAoU1vud aHeA== 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:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=B2Xe/MYL9HdquHUy7rdn5+WCA/XvHWA8evaGwtKwy6M=; b=cHhKf9ys49O8TWnJfc1bUhfmEOWS0jLLWDRvXWxuUQY+74BVTfMx6w0XQQ4/+XIht7 BpOvwHOH+K+e56WX+v46bicily3iqhkkXIlesnBw5u5WWe9KmM0yfe7oPLyny5VqOb8z 55zKzcHsJY8e48bcpnq5SbvVcZlN5OBIvKKbcyvWRG7eZuiCAg66VCf40ZmOZpzAUA4g eDuEpwRrFpOp5l4GB64dYfMiMjxQ9qIva/V7PxHX06O3Lk6zSW2HbfDpHLSugayIAOty QxYtRONMzH7PP8KnkRQbcKsp2XaCiS+EECZGHOzvG0slSKCAp9fJz+YJR/GdFTBeWN6A UIoQ== X-Gm-Message-State: AOUpUlE8ijna86VTg/qvWMcDk/YCHh+Hl2bJdUtKEGloccxYgM1tqcor ueiPK/65lP85g3RP8jltPg4s5ZvycFo= X-Google-Smtp-Source: AAOMgpeHiopESvv1Tx3eFsHTtqOm8BO7aK6oIJVTLXb2HcokR5mPCNulKg8S2aQs70MSgCRhq7wtlQ== X-Received: by 2002:aca:b702:: with SMTP id h2-v6mr326185oif.66.1532377227408; Mon, 23 Jul 2018 13:20:27 -0700 (PDT) Received: from localhost (76-251-165-188.lightspeed.austtx.sbcglobal.net. [76.251.165.188]) by smtp.gmail.com with ESMTPSA id d5-v6sm7175889oia.57.2018.07.23.13.20.25 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Jul 2018 13:20:26 -0700 (PDT) From: Michael Roth To: qemu-devel@nongnu.org Date: Mon, 23 Jul 2018 15:17:03 -0500 Message-Id: <20180723201748.25573-55-mdroth@linux.vnet.ibm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180723201748.25573-1-mdroth@linux.vnet.ibm.com> References: <20180723201748.25573-1-mdroth@linux.vnet.ibm.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4003:c06::243 Subject: [Qemu-devel] [PATCH 54/99] cpus: tcg: fix never exiting 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: , Cc: Paolo Bonzini , qemu-stable@nongnu.org, =?utf-8?q?C?= =?utf-8?q?=C3=A9dric_Le_Goater?= Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Cédric Le Goater Commit 9b0605f9837b ("cpus: tcg: unregister thread with RCU, fix exiting of loop on unplug") changed the exit condition of the loop in the vCPU thread function but forgot to remove the beginning 'while (1)' statement. The resulting code : while (1) { ... } while (!cpu->unplug || cpu_can_run(cpu)); is a sequence of two distinct two while() loops, the first not exiting in case of an unplug event. Remove the first while (1) to fix CPU unplug. Signed-off-by: Cédric Le Goater Message-Id: <20180425131828.15604-1-clg@kaod.org> Cc: qemu-stable@nongnu.org Fixes: 9b0605f9837b68fd56c7fc7c96a3a1a3b983687d Signed-off-by: Paolo Bonzini Signed-off-by: Cédric Le Goater (cherry picked from commit 54961aac190df28d311802364d19e18d5cda8bab) Signed-off-by: Michael Roth --- cpus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpus.c b/cpus.c index 38eba8bff3..e1d94038fd 100644 --- a/cpus.c +++ b/cpus.c @@ -1648,7 +1648,7 @@ static void *qemu_tcg_cpu_thread_fn(void *arg) /* process any pending work */ cpu->exit_request = 1; - while (1) { + do { if (cpu_can_run(cpu)) { int r; qemu_mutex_unlock_iothread();