Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp79605rdg; Tue, 10 Oct 2023 05:02:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGz5Z7CaDax7s1qBd72gquZJmOaJSpiBXReF+Q3jQz4wbf7bcA1bzlGLFk/QZoOK1FxSKDz X-Received: by 2002:a17:903:22c8:b0:1c1:d4f4:cd3c with SMTP id y8-20020a17090322c800b001c1d4f4cd3cmr17100584plg.31.1696939340992; Tue, 10 Oct 2023 05:02:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696939340; cv=none; d=google.com; s=arc-20160816; b=F8wCav7btATTlgX5cXy1miNhwTKAG5rGgw4Cn+dsurud5JYqcBFoYxCngYwF958Zlv CCvK18YLyP1pxmpKkpf783RJwJXXhjKcK5ZAzFXSDLOE+d67uGGqYmDdMJ7TyqhZ6XNY Upr1TRmTo2XUp0tXhambuqH4LgloDKRzxqEC/neSLbyRtwOQTtJlntTVqhFGrkagFqQk 26xdVqGZWIvQuZ8CTK+uP16Qdnek5q+DmtXPL+ymFCF8Q4hhJnJQLDwjGLTSrelD0OsU /GK1i0R442r8UviKaQmlSrJ3dNf9U53dERNKAadTO5UJimEgqWl3OVnHVy04chdOYR6A Odig== 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=qrATuWnU4NLQYgiffkU8FcezTvpdH7QvZkY4gkLqn44=; fh=QyKVx5sQ6a0Rye+jmuSl6ocZCOg2PmQ9bDVx4c3R8jE=; b=KZwcUwtRfVC/vUAGPiB8B7ct1ZvLWycI6H7UCUQg7TDnJiBHdv/TLZ3kmrjZr8DyHV +DrHhxrW5YFvePFGNyzbt4iY2SWMuw36jIQv6MCytw+g1HcjPC11TxOMvRri4fBw81Ep h90VTyfhWhlSKSQq+e7TWq+YNMyH4YMz/TL1S+BGx1y+t+QvfyKyK7Zs+3GYLlguvBWR K8MrGaYEpxJlFlFbUY6RKs0YS39FnpZf38+A1Wqx8EGCn/1DT84IhWFdIlhixqziI9fm uNuvVTICYa6TWXG9GtlCQBGqxia5UaYdeypwmPx+l4orhR/20uxIcw1779OqJZtvdFyB D+pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rK1w8HDc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id b10-20020a170902d50a00b001bf1d1d99b0si12910777plg.568.2023.10.10.05.02.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 05:02:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rK1w8HDc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 18CDE816688D; Tue, 10 Oct 2023 05:01:47 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231904AbjJJMBm (ORCPT + 99 others); Tue, 10 Oct 2023 08:01:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231907AbjJJMBG (ORCPT ); Tue, 10 Oct 2023 08:01:06 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 282E5134; Tue, 10 Oct 2023 05:00:30 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A969CC433D9; Tue, 10 Oct 2023 12:00:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696939230; bh=SnsQJBzy5Sum4OSbj5ASIkNn9fJzznr2FBfCStBhfp8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rK1w8HDcpJRzF2UpaCBAi8ddw1YfpGgZdzCIXIEdNuLaLZNd+IQBa9AaES3CZdNaG MFRaSiKxJnJqA2LkPv+7mdOvSfrXTqo+xA75YGLBTuE+E1SbrbExgU1pBEs+401W4L V0FdNJ8nYRZf2o/VRRASoFcaqsLaaQRBSGkwArzVkruvpJjoCRsnbBaG9FzOCynxnw PKB2rvRVRHm/8t8+BWkO8ZwtB01kYC8sR6TsEB9qmgnYyNZz2ATsEoPsVTCZBJy8kv J3zYeghvwdtH128NRWez+hJGs3nxaYrZ0eT5JIixzPCPv6lF4Yv0vTIR+vBlnCkQ4H JPb/+5CMYW1wA== From: Frederic Weisbecker To: LKML Cc: "Joel Fernandes (Google)" , Boqun Feng , Josh Triplett , Mathieu Desnoyers , Neeraj Upadhyay , "Paul E . McKenney" , Steven Rostedt , Uladzislau Rezki , rcu , Frederic Weisbecker Subject: [PATCH 20/23] rcutorture: Replace schedule_timeout*() 1-jiffy waits with HZ/20 Date: Tue, 10 Oct 2023 13:59:18 +0200 Message-Id: <20231010115921.988766-21-frederic@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231010115921.988766-1-frederic@kernel.org> References: <20231010115921.988766-1-frederic@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 10 Oct 2023 05:01:47 -0700 (PDT) From: "Joel Fernandes (Google)" In the past, spinning on schedule_timeout* with a wait of 1 jiffy has hung the kernel. See for example d52d3a2bf408 ("torture: Fix hang during kthread shutdown phase"). This issue recently recurred in torture's stutter code. The result is that the function instantly returns and never goes to sleep, preempting whatever might otherwise make useful forward progress. To prevent future issues, apply the commit-d52d3a2bf408 fix throughout rcutorture, moving from a 1-jiffy wait to a 50-millisecond wait. Signed-off-by: Joel Fernandes (Google) Signed-off-by: Paul E. McKenney Signed-off-by: Frederic Weisbecker --- kernel/rcu/rcutorture.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c index 7e82fb887d09..8136fec0310b 100644 --- a/kernel/rcu/rcutorture.c +++ b/kernel/rcu/rcutorture.c @@ -1149,7 +1149,7 @@ static int rcu_torture_boost(void *arg) mutex_unlock(&boost_mutex); break; } - schedule_timeout_uninterruptible(1); + schedule_timeout_uninterruptible(HZ / 20); } /* Go do the stutter. */ @@ -1160,7 +1160,7 @@ checkwait: if (stutter_wait("rcu_torture_boost")) /* Clean up and exit. */ while (!kthread_should_stop()) { torture_shutdown_absorb("rcu_torture_boost"); - schedule_timeout_uninterruptible(1); + schedule_timeout_uninterruptible(HZ / 20); } torture_kthread_stopping("rcu_torture_boost"); return 0; @@ -1183,7 +1183,7 @@ rcu_torture_fqs(void *arg) fqs_resume_time = jiffies + fqs_stutter * HZ; while (time_before(jiffies, fqs_resume_time) && !kthread_should_stop()) { - schedule_timeout_interruptible(1); + schedule_timeout_interruptible(HZ / 20); } fqs_burst_remaining = fqs_duration; while (fqs_burst_remaining > 0 && @@ -2899,7 +2899,7 @@ static int rcu_torture_fwd_prog(void *args) WRITE_ONCE(rcu_fwd_seq, rcu_fwd_seq + 1); } else { while (READ_ONCE(rcu_fwd_seq) == oldseq && !torture_must_stop()) - schedule_timeout_interruptible(1); + schedule_timeout_interruptible(HZ / 20); oldseq = READ_ONCE(rcu_fwd_seq); } pr_alert("%s: Starting forward-progress test %d\n", __func__, rfp->rcu_fwd_id); @@ -3200,7 +3200,7 @@ static int rcu_torture_read_exit_child(void *trsp_in) set_user_nice(current, MAX_NICE); // Minimize time between reading and exiting. while (!kthread_should_stop()) - schedule_timeout_uninterruptible(1); + schedule_timeout_uninterruptible(HZ / 20); (void)rcu_torture_one_read(trsp, -1); return 0; } @@ -3248,7 +3248,7 @@ static int rcu_torture_read_exit(void *unused) smp_mb(); // Store before wakeup. wake_up(&read_exit_wq); while (!torture_must_stop()) - schedule_timeout_uninterruptible(1); + schedule_timeout_uninterruptible(HZ / 20); torture_kthread_stopping("rcu_torture_read_exit"); return 0; } -- 2.34.1