Received: by 2002:a05:7412:1492:b0:e2:908c:2ebd with SMTP id s18csp284008rdh; Mon, 21 Aug 2023 15:34:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHjIs6+d3l4YNA+PY6NUP8OvyOcK2yJZlTUS6xQkWX4gz9flHRJjRrCEB+UNNZX4Skag1a4 X-Received: by 2002:a17:902:d705:b0:1bb:1523:b311 with SMTP id w5-20020a170902d70500b001bb1523b311mr4928377ply.41.1692657281002; Mon, 21 Aug 2023 15:34:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692657280; cv=none; d=google.com; s=arc-20160816; b=jxGi6ZXbe7GVv0tkXpw9AFyWvAEWJ3LEvV6cRtJNthCMizhuqd08Fk02TqypfcJJJD l0+XuwuK5GWY1j0VaUnDcE6f0MxDr552HJkMeBkr0bDtazCM8pyRKCN/Hq+WW6vwaNk+ IZLd+AB1ujH2rD8Han4gEP5lGNEZPhbNhdfL7vOYjjpC/wKXa1K5bb9ktB6iu+Kn0Hv9 o7mD87aTTji/lRWSBWu1RB+NT4KJ7vzNNlBVhuh1owZhCP+68e3KwUdSQ2QSaUg0oyEF RdtZueGvJZXz5bz/kJ5/OXsUv+Ygih+XReBYGxSG1cg8RqW9QGEIGi8iwXaxWeC0SgV0 nLkQ== 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=8hEou3fB+mXneBzwMGucFNzTJr5F837vGphyH92GHUs=; fh=8Tk9aDWtN2Z9AIPpVJc41XK9jDcrI0L+/7UGPEQb6k8=; b=m/WCm8/92kOvWNxUEh8LBxoWb8myT3Lz4yBKfqcG5FpVZBVcQOV6N6XPknKIVbwkxl Uw3aRoR31tA2hIspAk+4oWYbPOUBW/fyYJJN/45SzRUGD6iS+SE1G44az+TWhvUEY/e2 5Xl33KJHGbxzOpJ8hEwAea/BlnNKKT5sf9EVWoJ+lQFmrIbELF4rLywS78+z6RFRo+NE ZJS6sBYhOX5IRhoKFbNgzp0yv2Np3jmyhnSj8Zy7eut0vssEurYDr6mv4ChjJcSiKNkv goy0bIO1HKisAu2020Fbxln5QznGGFp9R2VsgbEvSNn3ThelEFupGn4iXA/wAJ3+G63g Tn/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=p9oa1727; 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 i14-20020a170902c94e00b001bb993ef74dsi518114pla.461.2023.08.21.15.34.28; Mon, 21 Aug 2023 15:34:40 -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=p9oa1727; 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 S230332AbjHUWDO (ORCPT + 99 others); Mon, 21 Aug 2023 18:03:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229462AbjHUWDN (ORCPT ); Mon, 21 Aug 2023 18:03:13 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA09510E; Mon, 21 Aug 2023 15:03:11 -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 8815861852; Mon, 21 Aug 2023 22:03:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E1FB5C433C7; Mon, 21 Aug 2023 22:03:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1692655390; bh=7mI/Dpv56bJFyiF6iBL/qZbmXzVgX6Ik3OS7+PdxP9I=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=p9oa17276g38os9BcSTPlIk+EzCorxqO/ucnXPZEMikGQpXKXa1DM8IZ/mdC9dAGK 57KvmX0TUcdU8DcPrB4rnuDs0f7MU42JrNkK5UPPNBVXVnQAXF01ODhP6JtPpo/FKk 7uvJ1KaO3PPFmDIROhQpIahnbu30WFofE+xSyIjhSryNAngSX7+b/yB2KW7zUCgmsK HCOeBc6QrtA5uV5AOpNy5s6mXP50+m4vZYhgtB++Nm3dG23qmFW5fTnfjAyOazgyml b3cgcS1nfPs54VkZad9EtBcOYPb6RUdOCfpVKTs0UT01zZ0jLKSZ67RqThghRGTQNL 77byE4LBJN0TA== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 83EB3CE02C9; Mon, 21 Aug 2023 15:03:10 -0700 (PDT) Date: Mon, 21 Aug 2023 15:03:10 -0700 From: "Paul E. McKenney" To: Wen Yang Cc: paul.gortmaker@windriver.com, LKML , linux-rt-users , Thomas Gleixner , Peter Zijlstra , Frederic Weisbecker Subject: Re: [PATCH] tick/rcu: fix false positive "softirq work is pending" messages on RT Message-ID: Reply-To: paulmck@kernel.org References: <20230818200757.1808398-1-paul.gortmaker@windriver.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,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 On Mon, Aug 21, 2023 at 01:23:15AM +0800, Wen Yang wrote: > > On 2023/8/19 04:07, paul.gortmaker@windriver.com wrote: > > From: Paul Gortmaker > > > > In commit 0345691b24c0 ("tick/rcu: Stop allowing RCU_SOFTIRQ in idle") > > the new function report_idle_softirq() was created by breaking code out > > of the existing can_stop_idle_tick() for kernels v5.18 and newer. > > > > In doing so, the code essentially went from a one conditional: > > > > if (a && b && c) > > warn(); > > > > to a three conditional: > > > > if (!a) > > return; > > if (!b) > > return; > > if (!c) > > return; > > warn(); > > > > However, it seems one of the conditionals didn't get a "!" removed. > > Compare the instance of local_bh_blocked() in the old code: > > > > - if (ratelimit < 10 && !local_bh_blocked() && > > - (local_softirq_pending() & SOFTIRQ_STOP_IDLE_MASK)) { > > - pr_warn("NOHZ tick-stop error: Non-RCU local softirq work is pending, handler #%02x!!!\n", > > - (unsigned int) local_softirq_pending()); > > - ratelimit++; > > - } > > > > ...to the usage in the new (5.18+) code: > > > > + /* On RT, softirqs handling may be waiting on some lock */ > > + if (!local_bh_blocked()) > > + return false; > > > > It seems apparent that the "!" should be removed from the new code. > > > > This issue lay dormant until another fixup for the same commit was added > > in commit a7e282c77785 ("tick/rcu: Fix bogus ratelimit condition"). > > This commit realized the ratelimit was essentially set to zero instead > > of ten, and hence *no* softirq pending messages would ever be issued. > > > > Once this commit was backported via linux-stable, both the v6.1 and v6.4 > > preempt-rt kernels started printing out 10 instances of this at boot: > > > > NOHZ tick-stop error: local softirq work is pending, handler #80!!! > > > > Just to double check my understanding of things, I confirmed that the > > v5.18-rt did print the pending-80 messages with a cherry pick of the > > ratelimit fix, and then confirmed no pending softirq messages were > > printed with a revert of mainline's 034569 on a v5.18-rt baseline. > > > > Finally I confirmed it fixed the issue on v6.1-rt and v6.4-rt, and > > also didn't break anything on a defconfig of mainline master of today. > > > > Fixes: 0345691b24c0 ("tick/rcu: Stop allowing RCU_SOFTIRQ in idle") > > Cc: Wen Yang > > Cc: Thomas Gleixner > > Cc: Peter Zijlstra > > Cc: Paul E. McKenney > > Cc: Frederic Weisbecker > > Signed-off-by: Paul Gortmaker > > > > diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c > > index 2b865cb77feb..b52e1861b913 100644 > > --- a/kernel/time/tick-sched.c > > +++ b/kernel/time/tick-sched.c > > @@ -1050,7 +1050,7 @@ static bool report_idle_softirq(void) > > return false; > > /* On RT, softirqs handling may be waiting on some lock */ > > - if (!local_bh_blocked()) > > + if (local_bh_blocked()) > > return false; > > pr_warn("NOHZ tick-stop error: local softirq work is pending, handler #%02x!!!\n", > > Good catch! > > Reviewed-by: Wen Yang Frederic would normally take this, but he appears to be out. So I am (probably only temporarily) queueing this in -rcu for more testing coverage. Thanx, Paul