Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp877652pxb; Thu, 5 Nov 2020 15:50:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJzDk0unm8BGnt/RFfpWg6vgV3J73F42yscqA8N0Z9Qjr68UCuifwAnt1k9wjh25nKd6oVZr X-Received: by 2002:a17:906:26c6:: with SMTP id u6mr5010119ejc.349.1604620222273; Thu, 05 Nov 2020 15:50:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604620222; cv=none; d=google.com; s=arc-20160816; b=0IUmzOqfidJgD1D6fNgJQvV7y0cZfvzTg4u6DXNlinRuS3GPKOVLWY1S3Ud0xdeHhf esPrAGDrTaS1Y9qM6vyJlew285aHxF7oKnn5/M26/3f483rhaRj5vXl+6BjK+mlxbncU SBkUgBk64knH4Ic5KAe4mS3M5BRRAJvn3maG9HMvgSW7scJmn3+vWv/KX2a+pGks7NYi 5g6Ngd5S5p96O14dm6iAEAfqr1TSafOnAak5ibmEy+AT74tR6mMUSlfOx8plB46Z1nwh IW5NVT7EyTgQrJvRwWHhEUlfsaNrS6BRv0RtEHiY5aty52roOOL0GuRxekrl0HW8G0Uh 2VbA== 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=vq5eulgaS0pIZXKgtgixZ9Ap3DasJvlyGTK4IMByeCg=; b=DGBAqH40kS8ySxXWHHfkNU0rHBuTVawilATbG5gUooT3aU/coM8plxaWgITwa2q2d0 /N474wlZjPoN4eSLoZWl6Bj+VXp4OQvqejOxHOvmTDxaGM0RxiAGS4B/kTFTNapfxN6c Kh4J82X9RB4uHFkeWAETeVIklxCQuPuWDfEdhsHhujKmGC/XiL2qPVANp4ILDCO8jBp2 dTUdBDQgX7JdxDcck5SxrJkj1MFFh8UZVnDttlscMAfdAtaiXJ4So+0h7psxbj5UuOka rvkmYdBn79mZGqUNNJDd6xAgzvHiTheaVQtsHADKBSVj/+p19DV+Y55svhOTaM5L6WXO WSkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DMzOi11C; 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 s16si1801009edt.488.2020.11.05.15.49.59; Thu, 05 Nov 2020 15:50:22 -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=DMzOi11C; 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 S1732838AbgKEXrd (ORCPT + 99 others); Thu, 5 Nov 2020 18:47:33 -0500 Received: from mail.kernel.org ([198.145.29.99]:45930 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732662AbgKEXr0 (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 E83C221D7F; Thu, 5 Nov 2020 23:47:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604620046; bh=8azQavPFGi7GMu8r6hLPKds3co+YnYbetjXLxIyZtOM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DMzOi11CU8o1kFvyQtUfGveIsKZ5TCO2wC+IOW7+JYZZeEywfvCZJp8ey9l73JyIQ zPVyUqB5n7BzeO42ddu906+TSarCq8qmZLM+BTeo87GmYQExOpawc/JHlJ85GAjmga tEvDrWvUoBpg9QkF5S8cJv46SL6hZLp68nEED7iE= 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 10/28] rcuscale: Prevent hangs for invalid arguments Date: Thu, 5 Nov 2020 15:47:01 -0800 Message-Id: <20201105234719.23307-10-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 rcuscale 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 rcu_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/rcuscale.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kernel/rcu/rcuscale.c b/kernel/rcu/rcuscale.c index c42f240..06491d5 100644 --- a/kernel/rcu/rcuscale.c +++ b/kernel/rcu/rcuscale.c @@ -802,7 +802,6 @@ rcu_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_SCALE_TEST)); firsterr = -EINVAL; cur_ops = NULL; goto unwind; @@ -876,6 +875,10 @@ rcu_scale_init(void) unwind: torture_init_end(); rcu_scale_cleanup(); + if (shutdown) { + WARN_ON(!IS_MODULE(CONFIG_RCU_SCALE_TEST)); + kernel_power_off(); + } return firsterr; } -- 2.9.5