From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 20020C4361A for ; Wed, 23 Dec 2020 02:49:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 027502333D for ; Wed, 23 Dec 2020 02:49:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729549AbgLWCWF (ORCPT ); Tue, 22 Dec 2020 21:22:05 -0500 Received: from mail.kernel.org ([198.145.29.99]:51036 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729523AbgLWCV7 (ORCPT ); Tue, 22 Dec 2020 21:21:59 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5EBEA225AB; Wed, 23 Dec 2020 02:21:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1608690078; bh=AWB3fBIxOOZko5pmH/7QKJJ2paRNHqJiZMSHHNVBwdc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=op3QxiPlJZkG1t7pCcwuoKPMUeMdfYcjHdstj8w9HIzuqubevkHrewR0dOzM+b9/5 Fp2B/BZjOPIA8GK8i9XOnrlG1EmGFexzuaVxZvCQrfTdaGgeD10dfpimjk2LDf4JJP 0eR7cnfqbnmN/9TrJMDNN7bbzsdvUySR71fgy0SjypKTsqIylgd1862WwUE1Eusx6H z+ZgXL3udFpkACrHGxu2PHPVNZQgC6R7+Kh/304ONc8MZntmFCqFldXC51yN7kD49q GPW5+gm0vJls/O/3kGDfKS2lRl//WUUO7N3orhtpPt0Vt4SBIb7SHujgHKckPD3zKp JUz80xoK59FFg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: "Paul E. McKenney" , Sasha Levin Subject: [PATCH AUTOSEL 4.19 12/87] locktorture: Prevent hangs for invalid arguments Date: Tue, 22 Dec 2020 21:19:48 -0500 Message-Id: <20201223022103.2792705-12-sashal@kernel.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20201223022103.2792705-1-sashal@kernel.org> References: <20201223022103.2792705-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "Paul E. McKenney" [ Upstream commit 6b74fa0a776e3715d385b23d29db469179c825b0 ] If an locktorture 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 lock_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 Signed-off-by: Sasha Levin --- kernel/locking/locktorture.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/kernel/locking/locktorture.c b/kernel/locking/locktorture.c index 95395ef5922ac..89e3ae2262e59 100644 --- a/kernel/locking/locktorture.c +++ b/kernel/locking/locktorture.c @@ -43,6 +43,7 @@ #include #include #include +#include MODULE_LICENSE("GPL"); MODULE_AUTHOR("Paul E. McKenney "); @@ -1055,6 +1056,10 @@ static int __init lock_torture_init(void) unwind: torture_init_end(); lock_torture_cleanup(); + if (shutdown_secs) { + WARN_ON(!IS_MODULE(CONFIG_LOCK_TORTURE_TEST)); + kernel_power_off(); + } return firsterr; } -- 2.27.0