Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp726524rwb; Thu, 27 Jul 2023 21:38:16 -0700 (PDT) X-Google-Smtp-Source: APBJJlGZVA8dc3TyYk/R6ZUApdLHP0irW6GCOUmRONkisojNa1PFm182zfx0uSTC8yvkGkql7CD0 X-Received: by 2002:a17:907:a07a:b0:988:b61e:4219 with SMTP id ia26-20020a170907a07a00b00988b61e4219mr1488596ejc.29.1690519096194; Thu, 27 Jul 2023 21:38:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690519096; cv=none; d=google.com; s=arc-20160816; b=BGmueTpTC5QeS+w0KXxS0DO0pk4sZRrHkPD5mQrNk9gZAViJwNrcLjeTo1N5PotRDq h8WcYwab1fO6k5yKW9wm2G1qbl6CNpieEJ0Y5k8EGxyFNaQKbBpYXdVmI7dswcHqB/rT uh9mEU22Qcva8zFRmgQfzFhnzhHPTE9zoT9HQqIInvyChHy0E+3rWwEDS+PnThOm1TXC maWs21nhDl/YcLdVkVOyBZDhI2GEJEyFFyA+PtR484Pv3GBoYET8YbQ1xwRyHh2AGTJv fEhfremDHwE2nEy315b3o5inHFlUMV8siKbKOHC84C13masgUIT88TTJfJSPdG2xm+KC aUZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=eJe9wy9OuXtBkdKCy2gs4SWXPkjoPB5nXYgy8OPgQZA=; fh=+6SS9+sPKx2/jCReCJL9vk5CEA0Em9eT7ErpbawzEjo=; b=IyDBMFfwDFTrJs+EQZUBuJmiz44vynWZ43ZZIc38TRScMAJGHc5fxMpADC0t0kbfOF W3x9nkDK9x3ndLpy1sS9YSenrqwMQuoUyYXIGQAelu4r+ExzXq3ZA52V+Fea28zim9p9 IfnUX74g8evuqXgXJsk4DpNm6E2ZVTFRfmNtjjf63a/IDmpF98Gayw2TrcFSmQcdlhDu pQoiis5NnpeYB2wdW2QYRINI0WSxKLu7SILalWyH4Eh0RMUcjvJ2b/wwdT67Zb2xyZvH 1olotJy/KStw9NiEp9OeO9zNZjoRcysmlO0kKNkWHuzKek92wS6slbE53V5Yjkw3k9zu Yl0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BpTQ1L2X; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s11-20020a170906a18b00b00992b6af11f0si1195897ejy.362.2023.07.27.21.37.51; Thu, 27 Jul 2023 21:38:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BpTQ1L2X; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233046AbjG1DWk (ORCPT + 99 others); Thu, 27 Jul 2023 23:22:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232398AbjG1DWg (ORCPT ); Thu, 27 Jul 2023 23:22:36 -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 56ABA26B8; Thu, 27 Jul 2023 20:22:35 -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 CB76661FBA; Fri, 28 Jul 2023 03:22:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 249FFC433C9; Fri, 28 Jul 2023 03:22:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690514554; bh=XhxDNdSW5b0BQGhJcLfTJp+gYFmz7jQ7UbyAr8zcZ34=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BpTQ1L2XEf5TRXvzLIiG3wk/gUVdV6IUiyl8OIVEZhuYMqbLRi60PpvAapVTod5kg ShuZsxPPMfhU2t7UTNw2Pk4aLhk5PihxSTrqW9VPm8HR4mIXNKUYNt7k8nfIKtDRLE s0b5HuOm5bvH7UAGJkRgAxjWBVDJwIcWpOZh+oGjEf51/RAnOy8WrVXXJWgHoqSUbs sQz/frTniTkS0Ejt6DA9qsaKDuUcSAuDqu4jIA+yL/xb1uVKiA7KMS8paE6UQtCXPS vM1/fjnYwUFqIapEKZdt1n80snTMCJQ2CsnOsn4hfJi2IpG8OEkRongjt1fYWwpxGu bdLTnFbq3tFjw== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id C2FDACE0AE0; Thu, 27 Jul 2023 20:22:33 -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 2/2] torture: Add lock_torture writer_fifo module parameter Date: Thu, 27 Jul 2023 20:22:32 -0700 Message-Id: <20230728032232.816584-2-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <12d34340-6c94-4bfd-aa16-3c39026070d8@paulmck-laptop> References: <12d34340-6c94-4bfd-aa16-3c39026070d8@paulmck-laptop> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dietmar Eggemann This commit adds a module parameter that causes the locktorture writer to run at real-time priority. To use it: insmod /lib/modules/torture.ko random_shuffle=1 insmod /lib/modules/locktorture.ko torture_type=mutex_lock rt_boost=1 rt_boost_factor=50 nested_locks=3 writer_fifo=1 ^^^^^^^^^^^^^ A predecessor to this patch has been helpful to uncover issues with the proxy-execution series. [ paulmck: Remove locktorture-specific code from kernel/torture.c. ] 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 --- Documentation/admin-guide/kernel-parameters.txt | 4 ++++ kernel/locking/locktorture.c | 12 +++++++----- kernel/torture.c | 3 ++- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index a1457995fd41..7b94455e9ae2 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -2918,6 +2918,10 @@ locktorture.torture_type= [KNL] Specify the locking implementation to test. + locktorture.writer_fifo= [KNL] + Run the write-side locktorture kthreads at + sched_set_fifo() real-time priority. + locktorture.verbose= [KNL] Enable additional printk() statements. diff --git a/kernel/locking/locktorture.c b/kernel/locking/locktorture.c index 949d3deae506..270c7f80ce84 100644 --- a/kernel/locking/locktorture.c +++ b/kernel/locking/locktorture.c @@ -45,6 +45,7 @@ torture_param(int, stutter, 5, "Number of jiffies to run/halt test, 0=disable"); torture_param(int, rt_boost, 2, "Do periodic rt-boost. 0=Disable, 1=Only for rt_mutex, 2=For all lock types."); torture_param(int, rt_boost_factor, 50, "A factor determining how often rt-boost happens."); +torture_param(int, writer_fifo, 0, "Run writers at sched_set_fifo() priority"); torture_param(int, verbose, 1, "Enable verbose debugging printk()s"); torture_param(int, nested_locks, 0, "Number of nested locks (max = 8)"); /* Going much higher trips "BUG: MAX_LOCKDEP_CHAIN_HLOCKS too low!" errors */ @@ -809,7 +810,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) @@ -1015,8 +1017,7 @@ static void lock_torture_cleanup(void) if (writer_tasks) { for (i = 0; i < cxt.nrealwriters_stress; i++) - torture_stop_kthread(lock_torture_writer, - writer_tasks[i]); + torture_stop_kthread(lock_torture_writer, writer_tasks[i]); kfree(writer_tasks); writer_tasks = NULL; } @@ -1244,8 +1245,9 @@ static int __init lock_torture_init(void) goto create_reader; /* Create writer. */ - firsterr = torture_create_kthread(lock_torture_writer, &cxt.lwsa[i], - writer_tasks[i]); + firsterr = torture_create_kthread_cb(lock_torture_writer, &cxt.lwsa[i], + writer_tasks[i], + writer_fifo ? sched_set_fifo : NULL); if (torture_init_error(firsterr)) goto unwind; diff --git a/kernel/torture.c b/kernel/torture.c index b88a1a86d9da..a1ac493488e2 100644 --- a/kernel/torture.c +++ b/kernel/torture.c @@ -37,6 +37,7 @@ #include #include #include +#include #include "rcu/rcu.h" MODULE_LICENSE("GPL"); @@ -734,7 +735,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; } -- 2.40.1