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=ham 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 EAD11C433E9 for ; Wed, 23 Dec 2020 02:52:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D022A2256F for ; Wed, 23 Dec 2020 02:52:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729595AbgLWCv7 (ORCPT ); Tue, 22 Dec 2020 21:51:59 -0500 Received: from mail.kernel.org ([198.145.29.99]:49802 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729384AbgLWCVg (ORCPT ); Tue, 22 Dec 2020 21:21:36 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6C20B22573; Wed, 23 Dec 2020 02:21:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1608690080; bh=v/RGvbYdL0QfbNs59gzH9WoddAy6wt8HotbgZ1ngixY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jyVkXD8l6A+RcqmEn4CNOfaX0d89wF8ACYgtgkrge7KUnDXTQH6xExT9cyF16B1y4 SuEX86DrFfia2B7j62gNxv/zIe+LCC+eaP80nEerLB7CnQCRPj4GpJDYZugVuhPzpX R9xrekYjUEm8YuHvO+6dO2hJTRws0X4A4dDl/CHtMsl4YuSWHlxibRs4goQQ25CWtD YoKe/fh2wRKMiIvBNP4kVCQAKnmzT+hU8wG7kinOiH4rGneXq6CSBfG/K/U+ut6joT KHNQtK1RB00u95IynmI3tfIgdOuGWSrHF3fW8QB4y9bgWZxlXcIUX2AzePxZI9FXgA u8Zm0zXsSBN8Q== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: "Paul E. McKenney" , Sasha Levin , rcu@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH AUTOSEL 4.19 13/87] torture: Prevent jitter processes from delaying failed run Date: Tue, 22 Dec 2020 21:19:49 -0500 Message-Id: <20201223022103.2792705-13-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-kselftest@vger.kernel.org From: "Paul E. McKenney" [ Upstream commit c64659ef29e3901be0900ec6fb0485fa3dbdcfd8 ] Even when the kernel panics and qemu dies, runs with jitter enabled will continue uselessly until the jitter.sh processes terminate. This can be annoying if a planned one-hour run instead dies during boot. This commit therefore kills the jitter.sh processes when the run ends more than one minute prior to the termination time specified by the kvm.sh --duration argument or its default. Signed-off-by: Paul E. McKenney Signed-off-by: Sasha Levin --- .../selftests/rcutorture/bin/kvm-test-1-run.sh | 14 ++++++++++++++ tools/testing/selftests/rcutorture/bin/kvm.sh | 5 ++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh b/tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh index f7247ee00514d..73cba8d13179c 100755 --- a/tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh +++ b/tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh @@ -216,6 +216,20 @@ do echo "ps -fp $killpid" >> $resdir/Warnings 2>&1 ps -fp $killpid >> $resdir/Warnings 2>&1 fi + # Reduce probability of PID reuse by allowing a one-minute buffer + if test $((kruntime + 60)) -lt $seconds && test -s "$resdir/../jitter_pids" + then + awk < "$resdir/../jitter_pids" ' + NF > 0 { + pidlist = pidlist " " $1; + n++; + } + END { + if (n > 0) { + print "kill " pidlist; + } + }' | sh + fi else echo ' ---' `date`: "Kernel done" fi diff --git a/tools/testing/selftests/rcutorture/bin/kvm.sh b/tools/testing/selftests/rcutorture/bin/kvm.sh index 5a7a62d76a50b..02fd8a19fa7ea 100755 --- a/tools/testing/selftests/rcutorture/bin/kvm.sh +++ b/tools/testing/selftests/rcutorture/bin/kvm.sh @@ -401,8 +401,11 @@ function dump(first, pastlast, batchnum) print "if test -n \"$needqemurun\"" print "then" print "\techo ---- Starting kernels. `date` | tee -a " rd "log"; - for (j = 0; j < njitter; j++) + print "\techo > " rd "jitter_pids" + for (j = 0; j < njitter; j++) { print "\tjitter.sh " j " " dur " " ja[2] " " ja[3] "&" + print "\techo $! >> " rd "jitter_pids" + } print "\twait" print "\techo ---- All kernel runs complete. `date` | tee -a " rd "log"; print "else" -- 2.27.0