Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp877216pxb; Thu, 5 Nov 2020 15:49:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJzfIEp7VccpWNm1yh2116KJ/o9kp3/mULIUx5GKxpPCFPBXVXdoX4uOQNX7tknYBcx2bhHi X-Received: by 2002:aa7:de89:: with SMTP id j9mr5363726edv.363.1604620164000; Thu, 05 Nov 2020 15:49:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604620163; cv=none; d=google.com; s=arc-20160816; b=gzpNGa2W+ifZSY1p/2Cxm09Ymv7cL+8gst2pOJIp3OdxCwfbVPWscHRJzo5R+LryaV UiOeIs3YdZHwjcPmYq+gAnx5kGk/ljjxY5Gh3KEW85WKHWILUPNVGa0HGM8H/DXajcTW ovItuiwA/KVUURcsfNl2pP+uhr9iMEqKZhTYs/vmESvz7a3SD1kj6yirVZa/03pkXizJ 9oTcoOLFhUbYG1BEW1hYPNGMd3+ZIq7ER/RUaTxyDZnu7nWPsB/mUWZZc2w2XYqfkklj sSgWkB6KzbllYcxWtzw4ikT2NCPBK6F8cj4azCn57DWwA4rn5fFFzWaZpwipdd8IAYkA BDFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=1str00urASa8y7FcLWPA7PjfTs6xWZJwhrIqJLzISlQ=; b=QHr8bGujZ+1NMW9Nbwr3P2H5PVyPW5mr4gDoQtu0X+C56zpiDhDvfFCTAQZNvCkXi5 Czy+lBbOyCcXMdSIJizNDEHQF2Qd4k+h9H2/aeNjoflSgeEY7SRZ3uWnMjU0koJnB6NX 4VEt2yCYSOnt78HFT2mSmV3T1+gCGLnq/9NyZaIobYOTqKBydAGQbYcJjS9CthC7EI4t 382hVVozpU84wzSfoFCYFytLI54LmWRzqtPC5IpEvucAMFaodh2k33sDezIhPxV+Fl9E lYtEFp8oD+VQedn1CWzFWrufQlIyD4sJgNo8b/NYhdlrdfkF68t7GhzfTqt+XNu7yKgB hcMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=QfDGAGKN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e26si3049135edr.55.2020.11.05.15.49.01; Thu, 05 Nov 2020 15:49:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=QfDGAGKN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732874AbgKEXrf (ORCPT + 99 others); Thu, 5 Nov 2020 18:47:35 -0500 Received: from mail.kernel.org ([198.145.29.99]:46124 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732672AbgKEXr0 (ORCPT ); Thu, 5 Nov 2020 18:47:26 -0500 Received: from paulmck-ThinkPad-P72.home (50-39-104-11.bvtn.or.frontiernet.net [50.39.104.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3823422203; Thu, 5 Nov 2020 23:47:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604620046; bh=Pb07ru45V3MFom76tDtD8Jd0DGP2IJZetTbJEU3yTAM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QfDGAGKNf8cYru36Wh7/plhr9yKpfel7v6SGmsPSwmjKn1AAepa1n99ALmJ1XkA0b KsBGe+Ti8lVjVvbLWrVjQHwhbhjtO81czsqHKa+SuRzn4xm/wXGLa64QwG7CmTT1aX mQrtT8x1D7gi/uKYQOYv/06O75QAoLBF6RSlL0s4= From: paulmck@kernel.org To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@fb.com, mingo@kernel.org, jiangshanlai@gmail.com, akpm@linux-foundation.org, mathieu.desnoyers@efficios.com, josh@joshtriplett.org, tglx@linutronix.de, peterz@infradead.org, rostedt@goodmis.org, dhowells@redhat.com, edumazet@google.com, fweisbec@gmail.com, oleg@redhat.com, joel@joelfernandes.org, "Paul E. McKenney" Subject: [PATCH tip/core/rcu 11/28] refscale: Prevent hangs for invalid arguments Date: Thu, 5 Nov 2020 15:47:02 -0800 Message-Id: <20201105234719.23307-11-paulmck@kernel.org> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20201105234658.GA23142@paulmck-ThinkPad-P72> References: <20201105234658.GA23142@paulmck-ThinkPad-P72> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "Paul E. McKenney" If an refscale torture-test run is given a bad kvm.sh argument, the test will complain to the console, which is good. What is bad is that from the user's perspective, it will just hang for the time specified by the --duration argument. This commit therefore forces an immediate kernel shutdown if a ref_scale_init()-time error occurs, thus avoiding the appearance of a hang. It also forces a console splat in this case to clearly indicate the presence of an error. Signed-off-by: Paul E. McKenney --- kernel/rcu/refscale.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kernel/rcu/refscale.c b/kernel/rcu/refscale.c index fb5f20d..23ff36a 100644 --- a/kernel/rcu/refscale.c +++ b/kernel/rcu/refscale.c @@ -658,7 +658,6 @@ ref_scale_init(void) for (i = 0; i < ARRAY_SIZE(scale_ops); i++) pr_cont(" %s", scale_ops[i]->name); pr_cont("\n"); - WARN_ON(!IS_MODULE(CONFIG_RCU_REF_SCALE_TEST)); firsterr = -EINVAL; cur_ops = NULL; goto unwind; @@ -718,6 +717,10 @@ ref_scale_init(void) unwind: torture_init_end(); ref_scale_cleanup(); + if (shutdown) { + WARN_ON(!IS_MODULE(CONFIG_RCU_REF_SCALE_TEST)); + kernel_power_off(); + } return firsterr; } -- 2.9.5