Received: by 2002:a05:6358:701b:b0:131:369:b2a3 with SMTP id 27csp3330422rwo; Mon, 24 Jul 2023 09:24:39 -0700 (PDT) X-Google-Smtp-Source: APBJJlEgnZ+wVT8rF+ou2qy0/iTI/UwJyZPS3RK+Xb1pGWheyZOSvvgpcd8SJJh0au2RuIa5iCWI X-Received: by 2002:a05:6a20:1613:b0:133:3326:388a with SMTP id l19-20020a056a20161300b001333326388amr14182665pzj.0.1690215879245; Mon, 24 Jul 2023 09:24:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690215879; cv=none; d=google.com; s=arc-20160816; b=SMbKCUsBUHTzdYmw4584eom0kaWA/wcjx2Mk3XssYmzL/1G5nZyf+FDIdTZneI9EQa xbELL5NjTv7YxrAjV+iB17MinX2X+4YnOqPq0sxvh0KZMBnsrtpFsvhXAb4/HUycGjjY 1oaYmqXFMpWYzI+TH6UXgJEOGwPHhdtqJG6kLsSlxCcOWkuLNlAYgJ2FlUJTZ3rHi5oB St/lPoVWB5Isr3087jOo8k4Cf7dgvEDRGS/5TZVLu69QxfRb+nWVkFF4ZSFR1L/vFoxk dMcDZeJ+FXDVxC2sAqPAskb+bD+3BwuFaVJbFCLIk5B8VTq3tQA8aoHR1eXQLkOL8UlK gCpg== 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-transfer-encoding :content-disposition:mime-version:references:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=5vehLD/vRKNqaYZx8M7ymJm0KblS8WYQQ5ER4QEEhT8=; fh=ii6i95db0fAi6W1kGUnJMUmPnmZNIm1BuSC9Ee5DQB8=; b=fg1aNoEvtcXFlKIRkq/9MapTumhGkCrKOIKLh2ef/RlPtxMjoy/WyK24LXvgbgYPUc xxHHCSY+ZU3Oue3BOSEE3riy7dJ/dNt2l/0qU/IUOBkRAjJthBjqC9v1xULfq7uTHzyc YDTE+Y/90G+hc/AJpRlOfUPugMTdxHaWinWrrk/UcYglM8/qUdFGk5db1kwSpznpPZk+ AFylbswNGdpJYz+zXiUv40HL0BV+n+NBDTQ3GLFaSSeFDCZusXVRHjnXkDqhEWvpp2Qt lGFBknt+X6VkSUfpkKcPiI18DT218meT2Ne2OIXKp+kk3DR8Mr2TwTIWVeVTWxk4Kx+m bl9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JsgYAt5G; 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 cn7-20020a056a00340700b00668724d0816si9340410pfb.38.2023.07.24.09.24.26; Mon, 24 Jul 2023 09:24:39 -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=JsgYAt5G; 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 S230291AbjGXQAp (ORCPT + 99 others); Mon, 24 Jul 2023 12:00:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231254AbjGXQAn (ORCPT ); Mon, 24 Jul 2023 12:00:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 364F5E76; Mon, 24 Jul 2023 09:00:42 -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 7D19061234; Mon, 24 Jul 2023 16:00:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DC40AC433C8; Mon, 24 Jul 2023 16:00:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690214440; bh=HiWKiSQHyMaDEa0UiXE1Jt4gJBcBxoHYQfLcTXtdLDQ=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=JsgYAt5GJCqyn3QYlUMN4EXGVsqVeZ/6C2hqUKN5bwIJ89GPa3ZpLKd/CJxVCxk3G RW63NxZSjsP1SotXymG3DgXJPnK3OoGlO3+451CjPs0BWhbm/TjbsmCtZZV28zN2HR DvqSZLQDDC6Ab5kxW69aS6BidQ4NRRoTB5/Vb2JipHYwYA/tZ4R0S9JOG2VRDxOtZD yH/OX7MtDrBX+Q9l8ykUQq/s3geiWJafOaho7zT8/cumXa8IiNVarDork0te5btsX/ VE8AMUkSdmE0SRCAPlOVR//hO38orIK9rNu/ZwSvicxH7sCDT7y614CY+O91Dt8e/q kcCMpTlo/V3Cw== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 6D342CE0C4B; Mon, 24 Jul 2023 09:00:40 -0700 (PDT) Date: Mon, 24 Jul 2023 09:00:40 -0700 From: "Paul E. McKenney" To: Joel Fernandes Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, rcu@vger.kernel.org, Greg KH Subject: Re: [BUG] Re: Linux 6.4.4 Message-ID: <4b231ce5-7bb8-4abf-9c40-04aa676d1e45@paulmck-laptop> Reply-To: paulmck@kernel.org References: <32aec6d1-bf25-7b47-8f31-7b6318d5238d@joelfernandes.org> <9b42cb38-8375-fc41-475a-2bd26c60a7b9@joelfernandes.org> <5dcf7117-cec7-4772-8aad-e100484a84dc@paulmck-laptop> <7bfde9f4-2bd6-7337-b9ca-94a9253d847f@joelfernandes.org> <20230724003257.GA60074@google.com> <381862e5-153c-4641-a60e-8175acae971d@paulmck-laptop> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: 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 Mon, Jul 24, 2023 at 09:36:02AM -0400, Joel Fernandes wrote: > On Sun, Jul 23, 2023 at 11:35 PM Paul E. McKenney wrote: > > > > On Mon, Jul 24, 2023 at 12:32:57AM +0000, Joel Fernandes wrote: > > > On Sun, Jul 23, 2023 at 10:19:27AM -0700, Paul E. McKenney wrote: > > > > On Sun, Jul 23, 2023 at 10:50:26AM -0400, Joel Fernandes wrote: > > > > > > > > > > > > > > > On 7/22/23 13:27, Paul E. McKenney wrote: > > > > > [..] > > > > > > > > > > > > OK, if this kernel is non-preemptible, you are not running TREE03, > > > > > > correct? > > > > > > > > > > > >> Next plan of action is to get sched_waking stack traces since I have a > > > > > >> very reliable repro of this now. > > > > > > > > > > > > Too much fun! ;-) > > > > > > > > > > For TREE07 issue, it is actually the schedule_timeout_interruptible(1) > > > > > in stutter_wait() that is beating up the CPU0 for 4 seconds. > > > > > > > > > > This is very similar to the issue I fixed in New year in d52d3a2bf408 > > > > > ("torture: Fix hang during kthread shutdown phase") > > > > > > > > Agreed, if there are enough kthreads, and all the kthreads are on a > > > > single CPU, this could consume that CPU. > > > > > > > > > Adding a cond_resched() there also did not help. > > > > > > > > > > I think the issue is the stutter thread fails to move spt forward > > > > > because it does not get CPU time. But spt == 1 should be very brief > > > > > AFAIU. I was wondering if we could set that to RT. > > > > > > > > Or just use a single hrtimer-based wait for each kthread? > > > > > > [Joel] > > > Yes this might be better, but there's still the issue that spt may not be set > > > back to 0 in some future release where the thread gets starved. > > > > But if each thread knows the absolute time at which the current stutter > > period is supposed to end, there should not be any need for the spt > > variable, correct? > > Yes. > > > > > > But also maybe the following will cure it like it did for the shutdown > > > > > issue, giving the stutter thread just enough CPU time to move spt forward. > > > > > > > > > > Now I am trying the following and will let it run while I go do other > > > > > family related things. ;) > > > > > > > > Good point, if this avoids the problem, that gives a strong indication > > > > that your hypothesis on the root cause is correct. > > > > > > [Joel] > > > And the TREE07 issue is gone with that change! > [...] > > > Let me know what you think, thanks! > > > > If we can make the stutter kthread set an absolute time for the current > > stutter period to end, then we should be able to simplify the code quite > > a bit and get rid of the CPU consumption entirely. (Give or take the > > possible need for a given thread to check whether it was erroneously > > awakened early.) > > > > But what specifically did you have in mind? > > I was thinking of a 2 counter approach storing the absolute time. Use > an alternative counter for different stuttering sessions. But yes, > generally I agree with the absolute time idea. What do you think Paul? > > Do we want to just do the simpler schedule_timeout at HZ / 20 to keep stable > green, and do the absolute-time approach for mainline? That might be better > from a process PoV. But I think stable requires patches to be upstream. Greg? > > I will try to send out patches this week to discuss this, thanks, Heh!!! Me, I was just thinking of mainline. ;-) Thanx, Paul