Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp48741rwo; Tue, 1 Aug 2023 12:41:08 -0700 (PDT) X-Google-Smtp-Source: APBJJlG2kigY2c8OVjK+o5htGN/x3Pbj3c0JALhozCLcATYx3DWHF3DJDKZdS/RGnMUMVU0MGCAL X-Received: by 2002:a17:902:7486:b0:1bc:5d0:e8db with SMTP id h6-20020a170902748600b001bc05d0e8dbmr8979717pll.62.1690918867966; Tue, 01 Aug 2023 12:41:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690918867; cv=none; d=google.com; s=arc-20160816; b=VVszGTgXxkuxOmq6Hgc0g9XVpMKGAWyUDFjOKxgJxxmHetbvVzTAuA2JVXWKX4Q4Fg 96k8lgTivw46MDRF/zHbAzEh37GJ9qjsHhq+KyV0rViC32xHKwGYFDbQanHxkgOUygQn BPs2kdjB4aKd5qqV6hHqjnoNHFAYZ3wHNSqi0Dg0TxTWgqGFQKGY5MCRv3uYD4ZPXwhl 8pD//k/GHbEnRQbq3ygDbiLGJMyZ1YSXRjCZR/QXF6LeRWroDnokGVqZLJ1+e6ULh492 xqf9r/mYW2QGAe3/G2CNU3YYzzQTz1HvYx1NEMBVJmdNN0GQWiyICL9yXDOY2DbiLuLs +Frw== 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=TFoyKqbAndQwc1WJQVX3YR8AZTvtOvI0K2lZCMuwVYI=; fh=kfWuX8p+jxCumuWT+t7FupAqQgh4HFhQUer7ctyVVVs=; b=TRa4NUYIKDaa1odVVuTguILjzb9YrsUWZffFLqH/avQh8Ei1SitnT1/79RkTzbGF7E qDzQtR9csLQ5J4cnqtQRv7o9Gt0gyEYzb6PofAf7ZsN8HIL08cwricA58YxMOAkGx0DE GM4SnFo4KEvSDGcjKJNxDXOxXMnvg/fLk9rXv49m4zi55rsOP6KQLtN8t2SUheJpUlKL c4wHWOxI4gkAfGE65joakjg7K8Gq5Gs2Z+12ddnYPyqaUrAFlLPePzZsv0UU/FLFDHhv WX6Z50qbocogHrF0ZQ5sBRiQMGIy3LvI3d5JBgEymfcBPq7c4g812vfNWNOwstOPAEqT +xGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=K3zM9rcg; 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 z16-20020a170903019000b001b8b3f21a18si8198610plg.637.2023.08.01.12.40.53; Tue, 01 Aug 2023 12:41:07 -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=K3zM9rcg; 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 S232112AbjHATOe (ORCPT + 99 others); Tue, 1 Aug 2023 15:14:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231143AbjHATOd (ORCPT ); Tue, 1 Aug 2023 15:14:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E48CE57; Tue, 1 Aug 2023 12:14:32 -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 EF38E616AB; Tue, 1 Aug 2023 19:14:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3F4E6C433C7; Tue, 1 Aug 2023 19:14:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690917271; bh=JIJPdUANHrD6Yb6wBmrW7GHkKKSJRvPopi+aSXxrjwU=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=K3zM9rcgo3wdtzWy15KNTAuv1/KkedB/OkEMO8niKImrZX2KnF8/+q1k9MF4shlrF /8JAwuV0xhzD8drIZSDYedqbz3E4QhMeOGA1jjT+RP4e+RzuEXoEvsQEh3W97CCtKZ 2PhC0Wy4cepJaTvG2cSfrtHbYTJveoeMatC7wWG8vQ8S3tmUo2y8U5MQidSwBB0Nxu kaSseiqQ88kh1EjduVUFyB17HARd8hBk1+d5tgW/QWQGTvrSaVcjfqP+c/nOzgFjpO YC63toNsjnwQ10vRnSH7Kyo35ryDaUelBVz1RtbfOfFcbhlJ0wqxHMgsCYZ0OIM+fl jgXq/t7kXF8wg== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id D1E36CE0908; Tue, 1 Aug 2023 12:14:30 -0700 (PDT) Date: Tue, 1 Aug 2023 12:14:30 -0700 From: "Paul E. McKenney" To: Guenter Roeck Cc: Peter Zijlstra , Roy Hopkins , Joel Fernandes , Pavel Machek , Greg Kroah-Hartman , stable@vger.kernel.org, patches@lists.linux.dev, linux-kernel@vger.kernel.org, torvalds@linux-foundation.org, akpm@linux-foundation.org, shuah@kernel.org, patches@kernelci.org, lkft-triage@lists.linaro.org, jonathanh@nvidia.com, f.fainelli@gmail.com, sudipm.mukherjee@gmail.com, srw@sladewatkins.net, rwarsow@gmx.de, conor@kernel.org, rcu@vger.kernel.org, Ingo Molnar Subject: Re: scheduler problems in -next (was: Re: [PATCH 6.4 000/227] 6.4.7-rc1 review) Message-ID: Reply-To: paulmck@kernel.org References: <20230731141934.GK29590@hirez.programming.kicks-ass.net> <20230731143954.GB37820@hirez.programming.kicks-ass.net> <20230731145232.GM29590@hirez.programming.kicks-ass.net> <7ff2a2393d78275b14ff867f3af902b5d4b93ea2.camel@suse.de> <20230731161452.GA40850@hirez.programming.kicks-ass.net> <20230731211517.GA51835@hirez.programming.kicks-ass.net> <8215f037-63e9-4e92-8403-c5431ada9cc9@paulmck-laptop> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8215f037-63e9-4e92-8403-c5431ada9cc9@paulmck-laptop> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 Tue, Aug 01, 2023 at 12:11:04PM -0700, Paul E. McKenney wrote: > On Tue, Aug 01, 2023 at 10:32:45AM -0700, Guenter Roeck wrote: > > On 7/31/23 14:15, Peter Zijlstra wrote: > > > On Mon, Jul 31, 2023 at 09:34:29AM -0700, Guenter Roeck wrote: > > > > > Ha!, I was poking around the same thing. My hack below seems to (so far, > > > > > <20 boots) help things. > > > > > > > > > > > > > So, dumb question: > > > > How comes this bisects to "sched/fair: Remove sched_feat(START_DEBIT)" ? > > > > > > That commit changes the timings of things; dumb luck otherwise. > > > > Kind of scary. So I only experienced the problem because the START_DEBIT patch > > happened to be queued roughly at the same time, and it might otherwise have > > found its way unnoticed into the upstream kernel. And just to set the record straight, this bug has been in mainline for about a year, since v5.19. Thanx, Paul > > That makes me wonder if this > > or other similar patches may uncover similar problems elsewhere in the kernel > > (i.e., either hide new or existing race conditions or expose existing ones). > > > > This in turn makes me wonder if it would be possible to define a test which > > would uncover such problems without the START_DEBIT patch. Any idea ? > > Thank you all for tracking this down! > > One way is to put a schedule_timeout_idle(100) right before the call to > rcu_tasks_one_gp() from synchronize_rcu_tasks_generic(). That is quite > specific to this particular issue, but it does have the virtue of making > it actually happen in my testing. > > There have been a few academic projects that inject delays at points > chosen by various heuristics plus some randomness. But this would be > a bit of a challenge to those because each kernel only passes through > this window once at boot time. > > Please see below for my preferred fix. Does this work for you guys? > > Back to figuring out why recent kernels occasionally to blow up all > rcutorture guest OSes... > > Thanx, Paul > > ------------------------------------------------------------------------ > > diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h > index 7294be62727b..2d5b8385c357 100644 > --- a/kernel/rcu/tasks.h > +++ b/kernel/rcu/tasks.h > @@ -570,10 +570,12 @@ static void rcu_tasks_one_gp(struct rcu_tasks *rtp, bool midboot) > if (unlikely(midboot)) { > needgpcb = 0x2; > } else { > + mutex_unlock(&rtp->tasks_gp_mutex); > set_tasks_gp_state(rtp, RTGS_WAIT_CBS); > rcuwait_wait_event(&rtp->cbs_wait, > (needgpcb = rcu_tasks_need_gpcb(rtp)), > TASK_IDLE); > + mutex_lock(&rtp->tasks_gp_mutex); > } > > if (needgpcb & 0x2) {