Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp877935pxb; Thu, 5 Nov 2020 15:51:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJzxVVDv5QLllKUkgk2wD9q7PtyYz2ybOXhCcY1lpjciR+76YJs5nll1MKIHHGpGms4Q9jey X-Received: by 2002:a17:906:3a8c:: with SMTP id y12mr4610632ejd.531.1604620262506; Thu, 05 Nov 2020 15:51:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604620262; cv=none; d=google.com; s=arc-20160816; b=t+yMrTw9p/nwH/F0VPRYr/Eh3rooWhH2V78arIBXgYMufZNWc2PqGCRWvJIWugqvc3 b8X/vOUbqHUCd/qfyz7Rtbg8003Xcwlt3XE9ja4Re+TdfPx/pNtXLlBcJJsRqHj8f0mo dwU4aQwda30BbOnQk0PDSMDLzG+B+dAzBKxrDo3TbO+YyD8qTO659GcbfME/WweEkVT8 uzRPF/AeJRRgFr4H7Y3i8RcP7C8HQ07yTYRtsrD4cs9EC/LuJ+D3qfaJU52neeLw1TpY pzpg4hVHTLgPpBDGYcMmPqW9ipvXwezPvOW8Gg9ijiTTYCOsTMAjj6noQfEaGOWFJoA3 tZyw== 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=Cq6EN7dBmqXQPpYbYMq0xy1BCd3fQaUyW1MsZEymsyQ=; b=q+UHSHvsCcoF63jP0Xgeqkxo9XNrdB5s/hz4dH4gIjS8M7eFvxdeadi90AM7o+AWrJ nWQNq4KbmQ7X6SakgNtFlUktefVBx3E0nVSe6ydmermwt1V49IDF/FureEK6EF1dkP9g /Mf4EBKL6jG483WkyZ1YWI7SvMOBfn6j3IRxOHesaxT0xkMQ9dAE3IXi9dq7Alc1JkqZ blQl72WFj2f5dmVKQr9H8zxsWXC56mXopgYpZHuptm1VgBWt4YFFo+SqdKHRuWFAgINU w1PL26kw2hEopO3cE8anPSp3EWbO/ZmJx0b6IzEygeugERKSIecLChzkevNwn9uFmOkf 6HxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=O6MABRMa; 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 n18si2178453eje.443.2020.11.05.15.50.40; Thu, 05 Nov 2020 15:51:02 -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=O6MABRMa; 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 S1732181AbgKEXsn (ORCPT + 99 others); Thu, 5 Nov 2020 18:48:43 -0500 Received: from mail.kernel.org ([198.145.29.99]:45970 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732706AbgKEXr1 (ORCPT ); Thu, 5 Nov 2020 18:47:27 -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 F1C5822227; 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=1604620047; bh=3glb+/dk0Hzr4EQkQdK4DKED+51XAdBnO9GYI/Isp64=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O6MABRMaVxRJ6vvGec3RkRNJkSd/wCgQDIOVS9MZOdXgdYZ51EgG3m/I1zHgCwfM5 tsKr/4ebP4VglShW98gWqNhjFf7s3jbfUvhwFVPjlwuO7rSZb2x2I7+F1pbvS7lesN C7REWVHz32PxBuT6ufcsb5ddoF6/BWyCXib/zIxk= 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 14/28] locktorture: Prevent hangs for invalid arguments Date: Thu, 5 Nov 2020 15:47:05 -0800 Message-Id: <20201105234719.23307-14-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 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 --- kernel/locking/locktorture.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/kernel/locking/locktorture.c b/kernel/locking/locktorture.c index 046ea2d..79fbd97 100644 --- a/kernel/locking/locktorture.c +++ b/kernel/locking/locktorture.c @@ -29,6 +29,7 @@ #include #include #include +#include MODULE_LICENSE("GPL"); MODULE_AUTHOR("Paul E. McKenney "); @@ -1041,6 +1042,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.9.5