Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp696091rwb; Thu, 27 Jul 2023 20:57:27 -0700 (PDT) X-Google-Smtp-Source: APBJJlHjgjyQB+UmGl9oVYi/pm3oi5gaNJ+t5ZEKfV7eASE/LqSSflVyO6I8HvsufUBPyXbGbj5H X-Received: by 2002:a05:6a20:2587:b0:130:7ef2:ff21 with SMTP id k7-20020a056a20258700b001307ef2ff21mr763434pzd.19.1690516647411; Thu, 27 Jul 2023 20:57:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690516647; cv=none; d=google.com; s=arc-20160816; b=W7GehXUl797GADm2EO6VRtpzNZpchSMIIeDKN39aWWamATpbQe8054gpBeAJSyCqoC fu+DtTF+Qz3X5B1y70rHn6VUVHuQlr1ZVvhYyq1xBaH3hFs/niiJjJ9SSJQY/u5WL4dN K63e6Hv6y7wk78LxweeCJrP/o3F0zL8qEwWccSH0bpIQb8cKqk+TqrlblJoH0Q1ZoNP9 TT+gyTErm8UD522db8Ir5Buz7B/F1Izxd11OsceL+W6ytAD0TdEOSIxU/7mZHdMbSFNu bMVJ/6DCZvPlmVVf7D5h0j0G8OX7TKe8d2CKig7t5EIKtzYhA9a1T/A2JQgwbgPC1+pL tB2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=GZS7uf5OjdXmRqGW/1h8vlzXxdLtIa+ggUkVcqze4Us=; fh=11kugG6XsIl+4cdioM19I6qPXuiaK1vjrTUNr4fretQ=; b=hurFQ9rFYcK6E6GeeFzkgkzUP8PRc+7doz90WA+xNTSMuEo7aF5LPa47w8QXvY0exl iXtSKD6ILfSwd0IyyAAVQGcaSFmHkUXKNUqHjN8xtOKt/DN4/apWbuok5yQOyh6mR6PX l7Fp2tWs7c2ipjn4VEaQM4hOWzl5ojl0WCz+pkOLluDV3j/l6HwMXBAFIdCvT+DakYSf GvqbWQLDnVbztwMXYB/AKJ3RjBwO1GxQ+Sz/pPVFGHH5/YWTr7Vv88ImnaU9I5Z1NEW1 GrbhqVPg6KhlK2cojtWaTfwkFU/yNxz58aZ79G24cW02DFSe6JKvPfjYQmfG3th4mlvP 9ZDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ZgNThzMN; 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 z19-20020a63e113000000b00553a50c5d85si2281753pgh.510.2023.07.27.20.57.14; Thu, 27 Jul 2023 20:57:27 -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=ZgNThzMN; 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 S232716AbjG1DWL (ORCPT + 99 others); Thu, 27 Jul 2023 23:22:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231546AbjG1DWJ (ORCPT ); Thu, 27 Jul 2023 23:22:09 -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 19F1926AE; Thu, 27 Jul 2023 20:22:08 -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 A30D161FBA; Fri, 28 Jul 2023 03:22:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0ABD7C433C8; Fri, 28 Jul 2023 03:22:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690514527; bh=pePRLhloPz4DGnxJGIgPUrkXOZW3z9f15MMNigCf+AE=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=ZgNThzMN2+YVZIpTDtIJk1ju7SvUJq7OeeMMUiGKAZksuIHYr42ZrgSTuFsI3nr8H Ny/2mioMaJz8spo/ukf+try9J4nILwWrmePuAXvhdQht0LV5+ySPW3dxOdhbDa3KAJ ZURdd+1GO70TLoQTP4Bl/Px0N/2TMMeGnyA/87HkrMk4my8YCGqJL557N9nWUvtFVz 3Sy4TS3h1+n2lFn9wU381HhEKeTiMY1kFx1Rtsohmj01gaeh4ck6QkW3Yv87Lm+zjF kvzPBdawV27OzWPLTaljNmjSKOnN9WRcRCRS8MycZs+dAAMtavhjimoAa7xHqfJgBK Sp6JvgYfXi0dQ== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 9F6BBCE0AD7; Thu, 27 Jul 2023 20:22:06 -0700 (PDT) Date: Thu, 27 Jul 2023 20:22:06 -0700 From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, Dietmar Eggemann , Josh Triplett , Joel Fernandes , Juri Lelli , Valentin Schneider , kernel-team@android.com, John Stultz , Davidlohr Bueso Subject: Re: [PATCH rcu 3/9] torture: Add lock_torture_writer_fifo module param Message-ID: <12d34340-6c94-4bfd-aa16-3c39026070d8@paulmck-laptop> Reply-To: paulmck@kernel.org References: <20230717182042.1098651-3-paulmck@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230717182042.1098651-3-paulmck@kernel.org> 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 On Mon, Jul 17, 2023 at 11:20:36AM -0700, Paul E. McKenney wrote: > 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); I replaced this with a callback function in order to confine locktorture-specific code to kernel/locking/locktorture.c. I will reply with the following two patches. 1. Add a kthread-creation callback to _torture_create_kthread(). 2. Add lock_torture writer_fifo module parameter, courtesy of Dietmar Eggemann. Please let me know if you have objections to this change. Thanx, Paul ------------------------------------------------------------------------ b/Documentation/admin-guide/kernel-parameters.txt | 4 ++++ b/include/linux/torture.h | 7 +++++-- b/kernel/locking/locktorture.c | 12 +++++++----- b/kernel/torture.c | 6 +++++- kernel/torture.c | 3 ++- 5 files changed, 23 insertions(+), 9 deletions(-)