Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp877959pxb; Thu, 5 Nov 2020 15:51:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJz2W1E2sVeJtinEL0rhyzCe3PSPFc/xYbhrbqoj+jJLu0BAaXEok73kDQUE6NHEsqWQx3MX X-Received: by 2002:a17:906:2512:: with SMTP id i18mr5088166ejb.184.1604620266446; Thu, 05 Nov 2020 15:51:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604620266; cv=none; d=google.com; s=arc-20160816; b=xYuo/XzC3xkb9rdNvuGUIjCuD9AdmQwShYShP2iSkuKc651Z0wEiLyBPWF21zjVi+U 8CvIjrh3on25LfegX+DQz0ZV3zI6rKD8BJ+DzfPY8YaJM90CV4p9d/xgU1NEC3katiFD DOjYiKD5BF40uD+CZDO1Nta6hZ8RepGJDxXPkM631B+4VVuQtNhpwvASusVV3M952awP oEVrZGblw+L/ppDdzfyjPTvtFgnGiSFZB3nggWVqYo0xJuHNsoXbAIygkxQ/yGjkloKy 47sZ+6bCa9RJOgx2fVa0SGNYDR+pAph2U1JxVTwyFSDQ5nS+Fq23FF+naRAIKU096EUT tgHA== 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=LsiXDKNIwO2MY2kqsCiIQAOsYev7N+ezD7v9bSjOw54=; b=hA+v6LylaZkeuyeI/3ulC67Ul17HW00Binih+kuBSJEHixqeHDAmB0bNvAvhOA4dtd k4MptzWewSXApGn0kFTqM1S7xXu0evxXIczBg/MNA01pXHONAlDHY4wc1LckD5JZ8SxA Fi1j91YU2sgf7+EFMmLrRhAgn4p8seecMhlQbqiFpOx8o8OCHmLwrwcE87KjTZexQXb+ yyYupXlLjqdwYcOpSh4nj8++XeOXrNYa8eUSYfjU4H8yaP1sSk4mKP1ucrV3SB9sjR8E 3wzjCHJAJn+EfPqfzjxoZT3Ixgc0KRMRrTy9e3k7j+3BPKm9RQTTCkNTiLOCmf1XWqtI Uzdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=mlGcXM6Y; 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 a11si2146653ejx.432.2020.11.05.15.50.43; Thu, 05 Nov 2020 15:51:06 -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=mlGcXM6Y; 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 S1733083AbgKEXsl (ORCPT + 99 others); Thu, 5 Nov 2020 18:48:41 -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 S1732736AbgKEXr2 (ORCPT ); Thu, 5 Nov 2020 18:47:28 -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 96F0C22243; Thu, 5 Nov 2020 23:47:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604620047; bh=GfZoepYjbI7O2ZKGaf1CxnYko+7T+e9pzRWEl1F3Rqw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mlGcXM6YMOFSp6FXhnGKLWfCCK1d+XwfAqp6gpP/JnfNE1EIISBy5tIdPbEZB8xlD PjjAip/4QrSG6C8JJZntgZB0mcrNAEbHWWOowmEsk/w1ERrscTJg7iWFcgdMzJkMtx DbU5lYHHtmWOQoan4wtjVq932j8BntZSFHdjx6HM= 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 16/28] rcutorture: Prevent hangs for invalid arguments Date: Thu, 5 Nov 2020 15:47:07 -0800 Message-Id: <20201105234719.23307-16-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 rcutorture 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_torture_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/rcutorture.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c index 916ea4f..db37671 100644 --- a/kernel/rcu/rcutorture.c +++ b/kernel/rcu/rcutorture.c @@ -2647,7 +2647,6 @@ rcu_torture_init(void) for (i = 0; i < ARRAY_SIZE(torture_ops); i++) pr_cont(" %s", torture_ops[i]->name); pr_cont("\n"); - WARN_ON(!IS_MODULE(CONFIG_RCU_TORTURE_TEST)); firsterr = -EINVAL; cur_ops = NULL; goto unwind; @@ -2815,6 +2814,10 @@ rcu_torture_init(void) unwind: torture_init_end(); rcu_torture_cleanup(); + if (shutdown_secs) { + WARN_ON(!IS_MODULE(CONFIG_RCU_TORTURE_TEST)); + kernel_power_off(); + } return firsterr; } -- 2.9.5