From patchwork Mon Jul 17 18:20:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. McKenney" X-Patchwork-Id: 13316240 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CF90BEB64DC for ; Mon, 17 Jul 2023 18:20:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230464AbjGQSUs (ORCPT ); Mon, 17 Jul 2023 14:20:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231338AbjGQSUr (ORCPT ); Mon, 17 Jul 2023 14:20:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3D9C10D8; Mon, 17 Jul 2023 11:20:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 75742611D4; Mon, 17 Jul 2023 18:20:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D529AC433C7; Mon, 17 Jul 2023 18:20:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689618043; bh=9N1zqkCJH9SNDZWV9ht6RHlfnWm8AY70Ut+G1/Medxg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ntGTK4Mrf1jtLI7Q9eH7uIuHF9R9DVeH/IdbtxBupgd7RiHAmlQ1jYMpPva1d3IEV 57vbKFGHgjGrvxsAyK4Bw/oRn7eIIqgaVpxYEGaLXn12ejGNU8Tp3CP71HdhNt7ROK BQyOKUdZDEkmVHZateVDNVohqzi62Z06/KJVXr+9k2TuPFgFg5Q6WjlkcMrOEgVFBk shLGvrzTfS03ghw9qtZ2d/+JfFGmhiu1uKy2UzoAmAujAHDKUW+W++ixJsvBtF7Zfn lnqsO0Jz8Ik8kAxu4Xf3BTLdz8ZT4kMWgyYfmQievGiwiKTq8QkSBvaJVSdX26SeI1 duixVXVgLvpdg== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 8C099CE03F1; Mon, 17 Jul 2023 11:20:43 -0700 (PDT) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, "Paul E. McKenney" Subject: [PATCH rcu 1/9] rcutorture: Dump grace-period state upon rtort_pipe_count incidents Date: Mon, 17 Jul 2023 11:20:34 -0700 Message-Id: <20230717182042.1098651-1-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: rcu@vger.kernel.org The rtort_pipe_count WARN() indicates that grace periods were unable to invoke all callbacks during a stutter_wait() interval. But it is sometimes helpful to have a bit more information as to why. This commit therefore invokes show_rcu_gp_kthreads() immediately before that WARN() in order to dump out some relevant information. Signed-off-by: Paul E. McKenney --- kernel/rcu/rcutorture.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c index 147551c23baf..d291a1438c30 100644 --- a/kernel/rcu/rcutorture.c +++ b/kernel/rcu/rcutorture.c @@ -1581,6 +1581,7 @@ rcu_torture_writer(void *arg) rcu_access_pointer(rcu_torture_current) != &rcu_tortures[i]) { tracing_off(); + show_rcu_gp_kthreads(); WARN(1, "%s: rtort_pipe_count: %d\n", __func__, rcu_tortures[i].rtort_pipe_count); rcu_ftrace_dump(DUMP_ALL); } From patchwork Mon Jul 17 18:20:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. McKenney" X-Patchwork-Id: 13316242 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CC948C001DF for ; Mon, 17 Jul 2023 18:20:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229718AbjGQSUt (ORCPT ); Mon, 17 Jul 2023 14:20:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231391AbjGQSUs (ORCPT ); Mon, 17 Jul 2023 14:20:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 282608E; Mon, 17 Jul 2023 11:20:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8AC19611E7; Mon, 17 Jul 2023 18:20:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E2389C433C9; Mon, 17 Jul 2023 18:20:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689618043; bh=2Slt+IrSEDPTRvcods8x8gQpC5P9QCC5UcNVjkmH36M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r4JwDIU2WkXnsck6qwzLK6vpNYgskw2MPjWEXN07ysKStgn6bit89R2rMW/er603p Hf885dbVtRykn2Hfodigm5Da9iRLzDgRdmKr1pm3N56kA9VCsXDc5CelNy5EfKMsQu ZRqnOCqVlmSJe41TeRVCWDS3xZlqbdHs/P5/XZOKMYlFSw2k+k1CuuvOUiwgDOe7tS S2ySKhZRZFhJx8UzHTf37vMO+8xSTvB0OCeKbwrZsP9A2Prdx22y4+rqGLxwBl69Li vgtqOkRLA5q6DWJw0Q+apyAG/OA/ck/G9iEnEl8oDT7NyUDP6xrGikkXR15LCHGrsS vc5GebhHI7x6g== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 8DF9ECE04CD; Mon, 17 Jul 2023 11:20:43 -0700 (PDT) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, Connor O'Brien , "Paul E. McKenney" , Josh Triplett , Joel Fernandes , Juri Lelli , Valentin Schneider , Dietmar Eggemann , kernel-team@android.com, John Stultz , Davidlohr Bueso Subject: [PATCH rcu 2/9] torture: Support randomized shuffling for proxy exec testing Date: Mon, 17 Jul 2023 11:20:35 -0700 Message-Id: <20230717182042.1098651-2-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: rcu@vger.kernel.org From: Connor O'Brien Currently shuffling sets the same cpu affinities for all tasks, which makes us less likely to hit paths involving migrating blocked tasks onto a cpu where they can't run. This patch adds an element of randomness to allow affinities of different writer tasks to diverge. This has helped uncover issues in testing with Proxy Execution Cc: "Paul E. McKenney" Cc: Josh Triplett Cc: Joel Fernandes Cc: Juri Lelli Cc: Valentin Schneider Cc: Dietmar Eggemann Cc: kernel-team@android.com Signed-off-by: Connor O'Brien Signed-off-by: John Stultz Acked-by: Davidlohr Bueso Signed-off-by: Paul E. McKenney --- kernel/torture.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/kernel/torture.c b/kernel/torture.c index 1a0519b836ac..8be83fdc6be1 100644 --- a/kernel/torture.c +++ b/kernel/torture.c @@ -54,6 +54,9 @@ module_param(verbose_sleep_frequency, int, 0444); static int verbose_sleep_duration = 1; module_param(verbose_sleep_duration, int, 0444); +static int random_shuffle; +module_param(random_shuffle, int, 0444); + static char *torture_type; static int verbose; @@ -518,6 +521,7 @@ static void torture_shuffle_task_unregister_all(void) */ static void torture_shuffle_tasks(void) { + DEFINE_TORTURE_RANDOM(rand); struct shuffle_task *stp; cpumask_setall(shuffle_tmp_mask); @@ -537,8 +541,10 @@ static void torture_shuffle_tasks(void) cpumask_clear_cpu(shuffle_idle_cpu, shuffle_tmp_mask); mutex_lock(&shuffle_task_mutex); - list_for_each_entry(stp, &shuffle_task_list, st_l) - set_cpus_allowed_ptr(stp->st_t, shuffle_tmp_mask); + list_for_each_entry(stp, &shuffle_task_list, st_l) { + if (!random_shuffle || torture_random(&rand) & 0x1) + set_cpus_allowed_ptr(stp->st_t, shuffle_tmp_mask); + } mutex_unlock(&shuffle_task_mutex); cpus_read_unlock(); From patchwork Mon Jul 17 18:20:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. McKenney" X-Patchwork-Id: 13316243 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 270A7C001DC for ; Mon, 17 Jul 2023 18:20:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230405AbjGQSUv (ORCPT ); Mon, 17 Jul 2023 14:20:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229848AbjGQSUs (ORCPT ); Mon, 17 Jul 2023 14:20:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4EEA5F7; Mon, 17 Jul 2023 11:20:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 97DFB611EB; Mon, 17 Jul 2023 18:20:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F31EFC433C8; Mon, 17 Jul 2023 18:20:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689618044; bh=pE4BWqzV7aB/0f8qofy45VqlKrCym7gg/FrxizK5ypg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XyUAvZde7u8wWUU35mWpc2I0qIsa6NqvdKSCIO6VHJBj47drCQ535vmhgE1cGT4v5 XdLe7pQArfVoJo7626fkN24yd/Lon2OKQ2POTAzTQOAKbXetcUVdmdZvAPFI2XjJhZ BQh27eG9BWYjsDYmatpQfB+fEGTBPpgSEQZtwxp4Q2O7/OcMtZ8Rb0wMNF8O1CV6PT 9oP6CN76aQ74aA1ZkVt0y373rp39HnU66v8m8K40ITVhphtiBBL/H/HJktLJSb53Et uFIk3eBhE7Urg2ScrJsH1Emkm4M276rpk7LeIfQXBfsKmuELZYjcfgXXjG9f+vr9gF gvBLyZTNzeckQ== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 908DFCE0806; Mon, 17 Jul 2023 11:20:43 -0700 (PDT) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, Dietmar Eggemann , "Paul E. McKenney" , Josh Triplett , Joel Fernandes , Juri Lelli , Valentin Schneider , kernel-team@android.com, John Stultz , Davidlohr Bueso Subject: [PATCH rcu 3/9] torture: Add lock_torture_writer_fifo module param Date: Mon, 17 Jul 2023 11:20:36 -0700 Message-Id: <20230717182042.1098651-3-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: rcu@vger.kernel.org From: Dietmar Eggemann Modifies locktorture writer to run as RT task. To use it: insmod /lib/modules/torture.ko random_shuffle=1 lock_torture_writer_fifo=1 ^^^^^^^^^^^^^^^^^^^^^^^^^^ insmod /lib/modules/locktorture.ko torture_type=mutex_lock rt_boost=1 rt_boost_factor=50 nested_locks=3 This patch has been helpful to uncover issues with the proxy-execution series. Cc: "Paul E. McKenney" Cc: Josh Triplett Cc: Joel Fernandes Cc: Juri Lelli Cc: Valentin Schneider Cc: Dietmar Eggemann Cc: kernel-team@android.com Signed-off-by: Dietmar Eggemann [jstultz: Include header change to build, reword commit message] Signed-off-by: John Stultz Acked-by: Davidlohr Bueso Signed-off-by: Paul E. McKenney --- kernel/locking/locktorture.c | 3 ++- kernel/torture.c | 11 ++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/kernel/locking/locktorture.c b/kernel/locking/locktorture.c index 949d3deae506..aac48d323254 100644 --- a/kernel/locking/locktorture.c +++ b/kernel/locking/locktorture.c @@ -809,7 +809,8 @@ static int lock_torture_writer(void *arg) bool skip_main_lock; VERBOSE_TOROUT_STRING("lock_torture_writer task started"); - set_user_nice(current, MAX_NICE); + if (!rt_task(current)) + set_user_nice(current, MAX_NICE); do { if ((torture_random(&rand) & 0xfffff) == 0) diff --git a/kernel/torture.c b/kernel/torture.c index 8be83fdc6be1..db79197e257a 100644 --- a/kernel/torture.c +++ b/kernel/torture.c @@ -37,6 +37,7 @@ #include #include #include +#include #include "rcu/rcu.h" MODULE_LICENSE("GPL"); @@ -57,6 +58,9 @@ module_param(verbose_sleep_duration, int, 0444); static int random_shuffle; module_param(random_shuffle, int, 0444); +static int lock_torture_writer_fifo; +module_param(lock_torture_writer_fifo, int, 0444); + static char *torture_type; static int verbose; @@ -734,7 +738,7 @@ bool stutter_wait(const char *title) cond_resched_tasks_rcu_qs(); spt = READ_ONCE(stutter_pause_test); for (; spt; spt = READ_ONCE(stutter_pause_test)) { - if (!ret) { + if (!ret && !rt_task(current)) { sched_set_normal(current, MAX_NICE); ret = true; } @@ -944,6 +948,11 @@ int _torture_create_kthread(int (*fn)(void *arg), void *arg, char *s, char *m, *tp = NULL; return ret; } + + if (lock_torture_writer_fifo && + !strncmp(s, "lock_torture_writer", strlen(s))) + sched_set_fifo(*tp); + wake_up_process(*tp); // Process is sleeping, so ordering provided. torture_shuffle_task_register(*tp); return ret; From patchwork Mon Jul 17 18:20:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. McKenney" X-Patchwork-Id: 13316239 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 508B3C001DC for ; Mon, 17 Jul 2023 18:20:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231153AbjGQSUs (ORCPT ); Mon, 17 Jul 2023 14:20:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229786AbjGQSUs (ORCPT ); Mon, 17 Jul 2023 14:20:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E8D5A1; Mon, 17 Jul 2023 11:20:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9D2CF611EC; Mon, 17 Jul 2023 18:20:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0864BC433CC; Mon, 17 Jul 2023 18:20:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689618044; bh=iHNmBa5tMI1wuSUKoilqIbnxR2gN+BPPdLAg8CpbuqI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oT+mWmZo0G+GJOjCsxtjOtAnu3MLgCvdPcgj96HKkkxDbsoJPuI4pDIjxhWItNQFV PtcA2oDvnJVDJWxbk6MTWGhqKSIGbtfzXz2dhkFyHIIVCvKFz0l2fnePBTn7OZcDRr 57810WoY+7n7zfMKTZg/a0Yzm9UBZIDSfRbW8I6oZBSgC5AAeQdVVvsIaXsKgdfuR2 /No8QlypXYybViq53nziKVyECTA3ugWtB4XXuiNlAfQuT+u2OI3YBl8IxMLQycQNnk G9h7/j7DI7CGWxbScOAFYY4vt1SlRh49KxByvOCB/u6a1tc5RxfychLZvOtOhuYXq4 b+ZnQIpI6u7cQ== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 93017CE0836; Mon, 17 Jul 2023 11:20:43 -0700 (PDT) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, "Paul E. McKenney" Subject: [PATCH rcu 4/9] torture: Make torture_hrtimeout_*() use TASK_IDLE Date: Mon, 17 Jul 2023 11:20:37 -0700 Message-Id: <20230717182042.1098651-4-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: rcu@vger.kernel.org Given that it is expected that more code will use torture_hrtimeout_*(), including for longer timeouts, make it use TASK_IDLE instead of TASK_UNINTERRUPTIBLE. Signed-off-by: Paul E. McKenney --- kernel/torture.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/torture.c b/kernel/torture.c index db79197e257a..836fefa44373 100644 --- a/kernel/torture.c +++ b/kernel/torture.c @@ -96,7 +96,7 @@ int torture_hrtimeout_ns(ktime_t baset_ns, u32 fuzzt_ns, struct torture_random_s if (trsp) hto += (torture_random(trsp) >> 3) % fuzzt_ns; - set_current_state(TASK_UNINTERRUPTIBLE); + set_current_state(TASK_IDLE); return schedule_hrtimeout(&hto, HRTIMER_MODE_REL); } EXPORT_SYMBOL_GPL(torture_hrtimeout_ns); From patchwork Mon Jul 17 18:20:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. McKenney" X-Patchwork-Id: 13316241 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 606B0C001DE for ; Mon, 17 Jul 2023 18:20:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231304AbjGQSUu (ORCPT ); Mon, 17 Jul 2023 14:20:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231479AbjGQSUs (ORCPT ); Mon, 17 Jul 2023 14:20:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5141A10D9; Mon, 17 Jul 2023 11:20:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B210E611ED; Mon, 17 Jul 2023 18:20:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16608C433D9; Mon, 17 Jul 2023 18:20:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689618044; bh=sBPRM0sRIpbE6zvq9jaA1AWHNVj70yVAkkvNX0VwPQA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y7sDl/2TGu3C45dkI0F4XlyVjTIewa8HrGGM02f8RgU52YHwQIvUdt258iRQNEm07 1FEHY4Sey3+dPfRnWR5l4rBPoEyH35xaoG4NtYBFi05CqQYLYejMMCZtf+WY/pYitY KmBso4AwVMnl3T1YpW4hK6NkH3ifnoMqdq6On8/uluQmg3Ux/jQnZU8r8yi2UbD4Uw Wsr5KU2WVaKk3NRUxAoZ3uYA5U5dkHXP2OiFFSUF+ARnPawDno261V91VCR3zd09Cz X7IiGC4Mw7WexuHXpj2NBMX2f0v0hksb2CJ5D7ZRnOyKcz7qL3qBpVK7hjTYd37MH2 7pt0mQiFgQWUw== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 9510DCE0902; Mon, 17 Jul 2023 11:20:43 -0700 (PDT) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, "Paul E. McKenney" Subject: [PATCH rcu 5/9] torture: Move torture_onoff() timeouts to hrtimers Date: Mon, 17 Jul 2023 11:20:38 -0700 Message-Id: <20230717182042.1098651-5-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: rcu@vger.kernel.org In order to gain better race coverage, move the CPU-hotplug-related timed waits in torture_onoff() to torture_hrtimeout_jiffies(). Signed-off-by: Paul E. McKenney --- kernel/torture.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/torture.c b/kernel/torture.c index 836fefa44373..fc873116a399 100644 --- a/kernel/torture.c +++ b/kernel/torture.c @@ -357,12 +357,12 @@ torture_onoff(void *arg) if (onoff_holdoff > 0) { VERBOSE_TOROUT_STRING("torture_onoff begin holdoff"); - schedule_timeout_interruptible(onoff_holdoff); + torture_hrtimeout_jiffies(onoff_holdoff, &rand); VERBOSE_TOROUT_STRING("torture_onoff end holdoff"); } while (!torture_must_stop()) { if (disable_onoff_at_boot && !rcu_inkernel_boot_has_ended()) { - schedule_timeout_interruptible(HZ / 10); + torture_hrtimeout_jiffies(HZ / 10, &rand); continue; } cpu = (torture_random(&rand) >> 4) % (maxcpu + 1); @@ -372,7 +372,7 @@ torture_onoff(void *arg) torture_online(cpu, &n_online_attempts, &n_online_successes, &sum_online, &min_online, &max_online); - schedule_timeout_interruptible(onoff_interval); + torture_hrtimeout_jiffies(onoff_interval, &rand); } stop: From patchwork Mon Jul 17 18:20:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. McKenney" X-Patchwork-Id: 13316244 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C7E98C001E0 for ; Mon, 17 Jul 2023 18:20:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231732AbjGQSUv (ORCPT ); Mon, 17 Jul 2023 14:20:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231313AbjGQSUu (ORCPT ); Mon, 17 Jul 2023 14:20:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2923E6C; Mon, 17 Jul 2023 11:20:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1095B611AC; Mon, 17 Jul 2023 18:20:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3D958C4339A; Mon, 17 Jul 2023 18:20:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689618044; bh=vYKb+aiy81aGannlId6zaPb2w6tBkokl0Gh0QHY/RfI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QNL1lw22uq5lc7bBxJLhQ1H0YCsOe2FR/akZuVZJix1IRhu8N/6mpjZuyL3HmXNgS sbn+QBg6PoPJrRY52F88YJ0gLgtlP018emk9ACMke/CI9zY8bO3p5Gg4CqnjJ50cSj s0m6X+G5AjIEy7xzwXK8P0qefkIb3FE5wz4R5aV1ql2/L2dGqp9ppbzBEBY+hPt6+W 4bsg/56I1S0EZi8VCDWqKZwYgPrV9R84HyXMB3wZu/qbCYsPTFuWg/GzhmIZPwHF/X 34Z/KGxGh8Dcs8TBRRMq/RFimteNApVTISly5yfGoWyvz0/tt9bnsUL+udM3v9TdhS mG/YtZwjcP+jw== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 971A4CE092F; Mon, 17 Jul 2023 11:20:43 -0700 (PDT) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, "Paul E. McKenney" Subject: [PATCH rcu 6/9] torture: Move torture_shuffle() timeouts to hrtimers Date: Mon, 17 Jul 2023 11:20:39 -0700 Message-Id: <20230717182042.1098651-6-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: rcu@vger.kernel.org In order to gain better race coverage, move the CPU-migration timed waits in torture_shuffle() to torture_hrtimeout_jiffies(). Signed-off-by: Paul E. McKenney --- kernel/torture.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kernel/torture.c b/kernel/torture.c index fc873116a399..3ab4930b9fdb 100644 --- a/kernel/torture.c +++ b/kernel/torture.c @@ -560,9 +560,11 @@ static void torture_shuffle_tasks(void) */ static int torture_shuffle(void *arg) { + DEFINE_TORTURE_RANDOM(rand); + VERBOSE_TOROUT_STRING("torture_shuffle task started"); do { - schedule_timeout_interruptible(shuffle_interval); + torture_hrtimeout_jiffies(shuffle_interval, &rand); torture_shuffle_tasks(); torture_shutdown_absorb("torture_shuffle"); } while (!torture_must_stop()); From patchwork Mon Jul 17 18:20:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. McKenney" X-Patchwork-Id: 13316245 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 16B36C0015E for ; Mon, 17 Jul 2023 18:20:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231688AbjGQSUy (ORCPT ); Mon, 17 Jul 2023 14:20:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231707AbjGQSUv (ORCPT ); Mon, 17 Jul 2023 14:20:51 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2A51E6F; Mon, 17 Jul 2023 11:20:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 14CA1611F2; Mon, 17 Jul 2023 18:20:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 450DCC433A9; Mon, 17 Jul 2023 18:20:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689618044; bh=qqTlwktI6OSX03JOvztECG/JCGyoxYMeQrtOwOhF5Xw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D2yp0RhtxFwUC1EikIEwsrD/o8kGHqjtpCuNiJdG30UGGxELH7ue+o6jEklAGsuWr 7fFTL9JdtyVzXQMRghNxDHag+0q13X4SP+Ii1L++gV3hAD2RiMqF8UOOSTQdlO29L4 oR0Doym/d4Y0v8ECkyJh8TuGuJVPD9+QEJZQG0PbDS6u1lIpiHnn2SkIoH+vhBBjJl 4KKzp9Ji6bDmw4WMX1BFj1eKj1OBY2aHoSxvqLGCFVSOCL08DMIcP3/hkbSVAvnLhE UIH/DwOYPCCDU+LRO4dDpVAKwUhrAwXSPJBkQyzVyguPhUuIh3wmCpcXSXLnepqq2t XXh5v4hO1nrAQ== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 99236CE0930; Mon, 17 Jul 2023 11:20:43 -0700 (PDT) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, "Paul E. McKenney" Subject: [PATCH rcu 7/9] torture: Move stutter_wait() timeouts to hrtimers Date: Mon, 17 Jul 2023 11:20:40 -0700 Message-Id: <20230717182042.1098651-7-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: rcu@vger.kernel.org In order to gain better race coverage, move the test start/stop waits in stutter_wait() to torture_hrtimeout_jiffies(). Signed-off-by: Paul E. McKenney --- kernel/torture.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/torture.c b/kernel/torture.c index 3ab4930b9fdb..92704f04a141 100644 --- a/kernel/torture.c +++ b/kernel/torture.c @@ -745,7 +745,7 @@ bool stutter_wait(const char *title) ret = true; } if (spt == 1) { - schedule_timeout_interruptible(1); + torture_hrtimeout_jiffies(1, NULL); } else if (spt == 2) { while (READ_ONCE(stutter_pause_test)) { if (!(i++ & 0xffff)) @@ -753,7 +753,7 @@ bool stutter_wait(const char *title) cond_resched(); } } else { - schedule_timeout_interruptible(round_jiffies_relative(HZ)); + torture_hrtimeout_jiffies(round_jiffies_relative(HZ), NULL); } torture_shutdown_absorb(title); } From patchwork Mon Jul 17 18:20:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. McKenney" X-Patchwork-Id: 13316247 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D1770C0015E for ; Mon, 17 Jul 2023 18:21:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231842AbjGQSVA (ORCPT ); Mon, 17 Jul 2023 14:21:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231720AbjGQSUv (ORCPT ); Mon, 17 Jul 2023 14:20:51 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9383412A; Mon, 17 Jul 2023 11:20:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 297F6611F9; Mon, 17 Jul 2023 18:20:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4E68BC433AB; Mon, 17 Jul 2023 18:20:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689618044; bh=rjWu88ZInJ4JHuHDuFwXlfJM5irHmICbqQMPaTiPJrc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EEdtDlDdtsm4f4+b40C0oOQzkiSZJU0C/5DEMh5WPQ73XD56n52u3rs8cW9pvRDb7 iF9LnrMCv9gB4K3mqVpe6uvusmeOcCZ5m2QnatwWtv1Qhw0uBguiUI1Jg36qviyygR 05HTvrAk1jm6sjrJOmAiVQjL3+2Hb29TFhX4zT/pzsA4NpQj+mgiLfN8fQdsycfa9e 4O2VI/fJp+8UnPcTPGE/5Y4uXiREqdvwDCTV6GmQZaz+Vqg9ys3ZHcP3XO1fJlfvgT lQ4GHi8fFPuwNaEjGIoHUmIhSmOgXJNPfdnKqCwJLKTlhlOgt7h0M7PxflS/mP48k2 uMIu+Wkzlyz5A== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 9B20ECE093C; Mon, 17 Jul 2023 11:20:43 -0700 (PDT) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, "Paul E. McKenney" Subject: [PATCH rcu 8/9] torture: Stop right-shifting torture_random() return values Date: Mon, 17 Jul 2023 11:20:41 -0700 Message-Id: <20230717182042.1098651-8-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: rcu@vger.kernel.org Now that torture_random() uses swahw32(), its callers no longer see not-so-random low-order bits, as these are now swapped up into the upper 16 bits of the torture_random() function's return value. This commit therefore removes the right-shifting of torture_random() return values. Signed-off-by: Paul E. McKenney --- kernel/torture.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/torture.c b/kernel/torture.c index 92704f04a141..b59eb6048eab 100644 --- a/kernel/torture.c +++ b/kernel/torture.c @@ -95,7 +95,7 @@ int torture_hrtimeout_ns(ktime_t baset_ns, u32 fuzzt_ns, struct torture_random_s ktime_t hto = baset_ns; if (trsp) - hto += (torture_random(trsp) >> 3) % fuzzt_ns; + hto += torture_random(trsp) % fuzzt_ns; set_current_state(TASK_IDLE); return schedule_hrtimeout(&hto, HRTIMER_MODE_REL); } @@ -365,7 +365,7 @@ torture_onoff(void *arg) torture_hrtimeout_jiffies(HZ / 10, &rand); continue; } - cpu = (torture_random(&rand) >> 4) % (maxcpu + 1); + cpu = torture_random(&rand) % (maxcpu + 1); if (!torture_offline(cpu, &n_offline_attempts, &n_offline_successes, &sum_offline, &min_offline, &max_offline)) From patchwork Mon Jul 17 18:20:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. McKenney" X-Patchwork-Id: 13316246 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5B9A1EB64DC for ; Mon, 17 Jul 2023 18:20:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231791AbjGQSUy (ORCPT ); Mon, 17 Jul 2023 14:20:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231296AbjGQSUv (ORCPT ); Mon, 17 Jul 2023 14:20:51 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84939A1; Mon, 17 Jul 2023 11:20:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 21F94611F5; Mon, 17 Jul 2023 18:20:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4C4B6C43395; Mon, 17 Jul 2023 18:20:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689618044; bh=XDuRFq+mHkr5+XpHsV+2nDbFWbS9cEpeXF9JX6lizsE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h0wuZpGJ7JN1bE4+fsoi2u1d+PL8FRvgU4yt0JU5sf6WcLvJHULSxnr3gCQmFdGZ6 xBGkY+hsNjQvzjEc3JYU7cDtdbKeHlhnRAYYZnWD/lX3YGwHNYHv6VXN0PcnWM2Xtf H1PJKsIRf3V97vgU3YHzjFZpYC8mPKOjk4LQ0sLZpd/4ArSr6curreirh3x6haq4lF cmV60F2/THlsq/nOkIpSFdgOOMD4ROjYUmrD3G6eyNof3xt7+x3+tIgK7j4ow0t8+i zjBPt65uOHrtzW1YVxnteQU/qA/z7cZIxzrVwSWOViRB173qvBxq82+v3K+ih6kRNJ LfkBxG3mWJ5tQ== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 9D205CE097F; Mon, 17 Jul 2023 11:20:43 -0700 (PDT) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, "Paul E. McKenney" Subject: [PATCH rcu 9/9] rcutorture: Stop right-shifting torture_random() return values Date: Mon, 17 Jul 2023 11:20:42 -0700 Message-Id: <20230717182042.1098651-9-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: rcu@vger.kernel.org Now that torture_random() uses swahw32(), its callers no longer see not-so-random low-order bits, as these are now swapped up into the upper 16 bits of the torture_random() function's return value. This commit therefore removes the right-shifting of torture_random() return values. Signed-off-by: Paul E. McKenney --- kernel/rcu/rcutorture.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c index d291a1438c30..ade42d6a9d9b 100644 --- a/kernel/rcu/rcutorture.c +++ b/kernel/rcu/rcutorture.c @@ -1877,7 +1877,7 @@ static int rcutorture_extend_mask(int oldmask, struct torture_random_state *trsp) { int mask = rcutorture_extend_mask_max(); - unsigned long randmask1 = torture_random(trsp) >> 8; + unsigned long randmask1 = torture_random(trsp); unsigned long randmask2 = randmask1 >> 3; unsigned long preempts = RCUTORTURE_RDR_PREEMPT | RCUTORTURE_RDR_SCHED; unsigned long preempts_irq = preempts | RCUTORTURE_RDR_IRQ; @@ -1936,7 +1936,7 @@ rcutorture_loop_extend(int *readstate, struct torture_random_state *trsp, if (!((mask - 1) & mask)) return rtrsp; /* Current RCU reader not extendable. */ /* Bias towards larger numbers of loops. */ - i = (torture_random(trsp) >> 3); + i = torture_random(trsp); i = ((i | (i >> 3)) & RCUTORTURE_RDR_MAX_LOOPS) + 1; for (j = 0; j < i; j++) { mask = rcutorture_extend_mask(*readstate, trsp); @@ -2137,7 +2137,7 @@ static int rcu_nocb_toggle(void *arg) toggle_fuzz = NSEC_PER_USEC; do { r = torture_random(&rand); - cpu = (r >> 4) % (maxcpu + 1); + cpu = (r >> 1) % (maxcpu + 1); if (r & 0x1) { rcu_nocb_cpu_offload(cpu); atomic_long_inc(&n_nocb_offload);