Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp8964978rwb; Tue, 13 Dec 2022 12:53:16 -0800 (PST) X-Google-Smtp-Source: AA0mqf6qliO22ncNW6lQL5MnRd3LT348fCrumFHFMDvoP7aHBe3NV9byzDPW71rKwiCDSsNElzR3 X-Received: by 2002:a17:90a:f312:b0:21a:c4d:3a54 with SMTP id ca18-20020a17090af31200b0021a0c4d3a54mr21730853pjb.24.1670964796015; Tue, 13 Dec 2022 12:53:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670964795; cv=none; d=google.com; s=arc-20160816; b=uTJyATC51zALGjCy4aEgR96rSUEjqs3vpX4OoOzgYhVl75JeV9EMkoMGwnr+oNmHZf rhGknAzatI5Aq32ZR8+dib9MgUoJlG1DbfVXVdq65hgdyJGwvT1az/f/eMcg+JTZpwIv UT6R7nP8aD4KWhVUZ5qAPFG1wmic9VqlK0aK45Lt566JwZZck0gLvfN7R8pr61Qw/Vh1 GIErU//F9sfoFhghvOiPPDvhBZe86Ty1/FP9kMnzZRm5Q0cRRwu4+DcJml9noiUVmnus 3gaJ+BApN0bRr0KUDI1bXY7d4tUe6caZlcljIFkVWeUYpgFhM1AKVK9M8htLFLAqPpUW SSjw== 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=1/mAzkHKq4wIiV8zGJG5Z4ta1NtZeQngWYqtEq72j8s=; b=DR/bBC7orwpfnzEBe41sC+Zl9CpcL0Z0jxBGcy9O1oBed0NScqQhzzCIFV/z/kwVWq 5gwozXOF7+23cqHWzXFGYSmIOIduHunjlva5wBVfAIu8RB7cxY8oFJYriyVJk4ZuCdzl mssWZkczdFKbxDzzl4P3PpaUlN/wg8hHuw+F/NzQLDUII55LMQAhkVlXT3TmKAdoZ/JV wG638a5oK8LkRz5vxrIbiX286m0SAxsB33QOCCr2guOVGZAM3OXmvr1y51ZAyERNxifX /XTrXEmtIkjDsQ/3rwxUo7hjr3SKz7E8ltCjWsR877mtFuBhXo9LUzuS6Zh7NnTOA6FK Pzcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=Nmlbcj+l; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v22-20020a636116000000b004779fb6a525si13464707pgb.559.2022.12.13.12.53.06; Tue, 13 Dec 2022 12:53:15 -0800 (PST) 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=@joelfernandes.org header.s=google header.b=Nmlbcj+l; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236613AbiLMUs5 (ORCPT + 73 others); Tue, 13 Dec 2022 15:48:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236678AbiLMUsr (ORCPT ); Tue, 13 Dec 2022 15:48:47 -0500 Received: from mail-qv1-xf2f.google.com (mail-qv1-xf2f.google.com [IPv6:2607:f8b0:4864:20::f2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E7EF193C2 for ; Tue, 13 Dec 2022 12:48:46 -0800 (PST) Received: by mail-qv1-xf2f.google.com with SMTP id o12so11225974qvn.3 for ; Tue, 13 Dec 2022 12:48:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1/mAzkHKq4wIiV8zGJG5Z4ta1NtZeQngWYqtEq72j8s=; b=Nmlbcj+lt1FKvUbPHui2UR4Mnuw5qu7mvQV+fIvRKu/SfijMrqYl6GYbfIwUBm9zpX rroQnWImlKdXex5c6VrW5fSJsXFQFjmPZW9miwqosak2X2kLhTlSMit6XCsu98i0sIjQ 78yxgnE8I3sDlCHFMhVVqCiSzIkmPoGsKVBYc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1/mAzkHKq4wIiV8zGJG5Z4ta1NtZeQngWYqtEq72j8s=; b=EGIuIczpLv0LwDsjujslsz65QiKCzpdM7q72CBdBmdfJZ9gQ/l0njjOO185pr4s8j4 cd9M4LHuufWQFXtgr3gZXXxhzigsVIBVl6qVL40WOiX2cFs5KSisZrzT6uc6ELaTvBiE 6U0wXgb7MxscyYKJVnkWXVnWr8vkGK2/mFdzqlfk/VR4oJ4J2EzTrGC1vshJEq4iks3v cSY8wpO0b7gmnjlSmyBP2lyyf4TwpGhzrNX4EtMqZLZSsNrYTaL73XqS6cdnwCwl4Z6L VsLP9S+gKrRgAf/nf+J8oo0RBBlzVzFcyFGSZ5zLqZGWCdE9QQnNNPQN6JdKgnSx5Ku7 7GLw== X-Gm-Message-State: ANoB5pnmuF+ur/+fNYVzIUzn9GBpfBpxRA1Y8FWuHv0TeL0ryIObxaTH GkibyHiBkPXLyVJc9T6x9/+jViCCnIVdnbh2 X-Received: by 2002:a05:6214:14a6:b0:4c6:fa63:60ed with SMTP id bo6-20020a05621414a600b004c6fa6360edmr26313085qvb.47.1670964524781; Tue, 13 Dec 2022 12:48:44 -0800 (PST) Received: from joelboxx.c.googlers.com.com (228.221.150.34.bc.googleusercontent.com. [34.150.221.228]) by smtp.gmail.com with ESMTPSA id h3-20020a05620a400300b006fc447eebe5sm8562757qko.27.2022.12.13.12.48.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Dec 2022 12:48:43 -0800 (PST) From: "Joel Fernandes (Google)" To: linux-kernel@vger.kernel.org Cc: "Joel Fernandes (Google)" , Davidlohr Bueso , Josh Triplett , "Paul E. McKenney" , rcu@vger.kernel.org, connoro@google.com Subject: [PATCH v3 rcu/dev 2/2] locktorture: Make the rt_boost factor a tunable Date: Tue, 13 Dec 2022 20:48:39 +0000 Message-Id: <20221213204839.321027-2-joel@joelfernandes.org> X-Mailer: git-send-email 2.39.0.314.g84b9a713c41-goog In-Reply-To: <20221213204839.321027-1-joel@joelfernandes.org> References: <20221213204839.321027-1-joel@joelfernandes.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 The rt boosting in locktorture has a factor variable s currently large enough that boosting only happens once every minute or so. Add a tunable to reduce the factor so that boosting happens more often, to test paths and arrive at failure modes earlier. With this change, I can set the factor to like 50 and have the boosting happens every 10 seconds or so. Tested with boot parameters: locktorture.torture_type=mutex_lock locktorture.onoff_interval=1 locktorture.nwriters_stress=8 locktorture.stutter=0 locktorture.rt_boost=1 locktorture.rt_boost_factor=50 locktorture.nlocks=3 [ Apply Davidlohr Bueso feedback on quoting rt_boost_factor. ] Signed-off-by: Joel Fernandes (Google) --- kernel/locking/locktorture.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/kernel/locking/locktorture.c b/kernel/locking/locktorture.c index e2271e8fc302..87e861da0ad5 100644 --- a/kernel/locking/locktorture.c +++ b/kernel/locking/locktorture.c @@ -48,6 +48,7 @@ torture_param(int, stat_interval, 60, 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, verbose, 1, "Enable verbose debugging printk()s"); @@ -131,12 +132,12 @@ static void torture_lock_busted_write_unlock(int tid __maybe_unused) static void __torture_rt_boost(struct torture_random_state *trsp) { - const unsigned int factor = 50000; /* yes, quite arbitrary */ + const unsigned int factor = rt_boost_factor; if (!rt_task(current)) { /* - * Boost priority once every ~50k operations. When the - * task tries to take the lock, the rtmutex it will account + * Boost priority once every 'rt_boost_factor' operations. When + * the task tries to take the lock, the rtmutex it will account * for the new priority, and do any corresponding pi-dance. */ if (trsp && !(torture_random(trsp) % @@ -146,8 +147,9 @@ static void __torture_rt_boost(struct torture_random_state *trsp) return; } else { /* - * The task will remain boosted for another ~500k operations, - * then restored back to its original prio, and so forth. + * The task will remain boosted for another 10 * 'rt_boost_factor' + * operations, then restored back to its original prio, and so + * forth. * * When @trsp is nil, we want to force-reset the task for * stopping the kthread. -- 2.39.0.314.g84b9a713c41-goog