From patchwork Wed Jan 3 19:29:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. McKenney" X-Patchwork-Id: 184825 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp5220212dyb; Wed, 3 Jan 2024 11:30:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IH0rXvfTaGZv37e85RZ/BNaweVFGRPn840OlqLS9ndgeYP/iiCj2IKSco/HYp6aivNcTak5 X-Received: by 2002:a17:903:247:b0:1d4:ce:edbc with SMTP id j7-20020a170903024700b001d400ceedbcmr21362674plh.11.1704310220312; Wed, 03 Jan 2024 11:30:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704310220; cv=none; d=google.com; s=arc-20160816; b=vYK4BnRoqYm50Fp34Cjy4feJgeHjvl6JaFv6MXYp/9BU5P1r5bIhdcskHyaIepJyH8 i3IDpQ0cJjHVqd/qPjBw6QfyNQr8kMW1aPk8mScfXj+nY7bdIanD2LQi+149Rk04mCrT VXsW0L/3EjmnqK5XJBhxrKRWb3NsHFDYH237wSe0/QcDni5D294mEHjFGMK1x8j+vwYB MV7DaFb3cBrhEX9I/efljb9ob/ThupcARTQPKjxxZrlUdbfCPXCGTRHcZwmrOopIG3mz y5e9OJc1DfDiGrn4Kohsj42B6PCi+QHhcZGpomY5ED9TdSVjSUxd31kRyYFWut493Mws LDkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-disposition:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=r4WonXh2TW2pUeGdcdhmWCQtMS4DevwM90f3GogkdD0=; fh=LCL/ACy2Wt4hF880rplFy1yv0BtnYFZp7eUyRRHyEA0=; b=GeRPfXJnUMePApU8NDjM3v7XIWNKtC0wdlOtGZzj2r6ir0iuwiLx939rsdk5nPRgXx hnveQ6miJqyYpePgexfJ3WDWrVYAWyz/ZPAwaagaVcPn9l34NimShYOEPTqhnKg5j/CU tKIkh7zeE8ErJPiLP+75Wg/V/31MfHrPeVgcUvrua+CSClnbUup2AicoyhSxUqZczZ2O gx8kycg0XkJDij9tTtdz77qPNOqZn34ayDc7bDviBMiiKxdwOaBBCaPQQDC9NffFiQye FTOzQPKjHwnNpbjmsLOhVeyv741j+KrHIRjaJdLsd05i+ayPibcvAj68idrmNrxSIrPm 9Lkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=a7TVXpZr; spf=pass (google.com: domain of linux-kernel+bounces-15913-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15913-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id y10-20020a170902b48a00b001d4208ea89bsi19857564plr.147.2024.01.03.11.30.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jan 2024 11:30:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-15913-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=a7TVXpZr; spf=pass (google.com: domain of linux-kernel+bounces-15913-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15913-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 14D5AB23C2D for ; Wed, 3 Jan 2024 19:30:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7D1D91CFB6; Wed, 3 Jan 2024 19:29:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="a7TVXpZr" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D81B31CF82 for ; Wed, 3 Jan 2024 19:29:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5768AC433C8; Wed, 3 Jan 2024 19:29:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1704310188; bh=Unr4OY0Hx42q1pzNznUCuug80mRkrj/aXFvZHPSqafo=; h=Date:From:To:Cc:Subject:Reply-To:From; b=a7TVXpZrmMPVW+N9r64ybQlcCK17O9AndoUM3kYIJkOHrzb6JV3zyDtEZ4OsRnxXu 6lv9sYBzzgjpsOqS+/9dkiJPYhcZj7ssJ/0S/jGPigO+1cbKaWygnOXr5QTRbyhII4 hHytQVLC3OtTMwDFO2XUXb3kFsPkwJVeW48TlZrIH85PvbpxD7f4u+3k3C9O/Ph+l6 8NB+hI2DKKrhFQItSGWs5RrjQb7M+H+tTiPjzRzoYPfEnldW+oEvYN+rvb5V4+1/zS slgFUYPs3moQWEhyMnT77fZpFOfSTHtttRDO20xtfXeoNntpHkaWb0pM3rXxC9wD8B 4GaxU5Fuxdnpw== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id DB2CACE09BD; Wed, 3 Jan 2024 11:29:47 -0800 (PST) Date: Wed, 3 Jan 2024 11:29:47 -0800 From: "Paul E. McKenney" To: Frederic Weisbecker Cc: linux-kernel@vger.kernel.org Subject: Prototype patch to avoid TREE07 rcu_torture_writer() stalls Message-ID: Reply-To: paulmck@kernel.org Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787098793814861679 X-GMAIL-MSGID: 1787098793814861679 Hello, Frederic, You mentioned rcu_torture_writer() stall issues on TREE07. Does the patch shown below help? If so, I predict that your bisection will converge on commit af19a2526cba9 ("rcutorture: Add mid-sized stall to TREE07"). Thanx, Paul ------------------------------------------------------------------------ commit 7e9794bb7017593da427f555e4e23da2d42744e5 Author: Paul E. McKenney Date: Wed Jan 3 10:59:25 2024 -0800 rcutorture: Suppress rtort_pipe_count warnings until after stalls Currently, if rcu_torture_writer() sees fewer than ten grace periods having elapsed during a call to stutter_wait() that actually waited, the rtort_pipe_count warning is emitted. This has worked well for a long time. Except that the rcutorture TREE07 scenario now does a short-term 14-second RCU CPU stall, which can most definitely case false-positive rtort_pipe_count warnings. This commit therefore changes rcu_torture_writer() to compute the full expected holdoff and stall duration, and to refuse to report any rtort_pipe_count warnings until after all stalls have completed. Signed-off-by: Paul E. McKenney Cc: Frederic Weisbecker diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c index 50ac86a34876..b4317ef1b092 100644 --- a/kernel/rcu/rcutorture.c +++ b/kernel/rcu/rcutorture.c @@ -1372,9 +1372,13 @@ rcu_torture_writer(void *arg) struct rcu_torture *rp; struct rcu_torture *old_rp; static DEFINE_TORTURE_RANDOM(rand); + unsigned long stallsdone = jiffies; bool stutter_waited; unsigned long ulo[NUM_ACTIVE_RCU_POLL_OLDSTATE]; + // If a new stall test is added, this must be adjusted. + if (stall_cpu_holdoff + stall_gp_kthread + stall_cpu) + stallsdone += (stall_cpu_holdoff + stall_gp_kthread + stall_cpu + 60) * HZ; VERBOSE_TOROUT_STRING("rcu_torture_writer task started"); if (!can_expedite) pr_alert("%s" TORTURE_FLAG @@ -1580,11 +1584,11 @@ rcu_torture_writer(void *arg) !atomic_read(&rcu_fwd_cb_nodelay) && !cur_ops->slow_gps && !torture_must_stop() && - boot_ended) + boot_ended && + time_after(jiffies, stallsdone)) for (i = 0; i < ARRAY_SIZE(rcu_tortures); i++) if (list_empty(&rcu_tortures[i].rtort_free) && - rcu_access_pointer(rcu_torture_current) != - &rcu_tortures[i]) { + 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); @@ -2445,7 +2449,8 @@ static struct notifier_block rcu_torture_stall_block = { /* * CPU-stall kthread. It waits as specified by stall_cpu_holdoff, then - * induces a CPU stall for the time specified by stall_cpu. + * induces a CPU stall for the time specified by stall_cpu. If a new + * stall test is added, stallsdone in rcu_torture_writer() must be adjusted. */ static int rcu_torture_stall(void *args) {