Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1118360rwb; Thu, 18 Aug 2022 19:48:44 -0700 (PDT) X-Google-Smtp-Source: AA6agR707GhQyhGfKFqnEj4ySX/keNuaubW7PF/cbwYSkmqCkDsgr8Ew6KR9DPF7ntPo2f2/pSs5 X-Received: by 2002:a63:4711:0:b0:415:ff46:ba5 with SMTP id u17-20020a634711000000b00415ff460ba5mr4706498pga.133.1660877324060; Thu, 18 Aug 2022 19:48:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660877324; cv=none; d=google.com; s=arc-20160816; b=hIvj+okBGXTAOYJfcfhgpfuzw0fLTrmUTZ3WCiIFllDIUwmtjlEVRflSNP9assON9I 3loCwvyVYb73gLWHz1rO1LTk2LUkQxLYzftcjMBdHtbCEHsj/orj7OwrHkuc0eAclzFb qMlm5+YThj4wS5Kr+E9XjrTSxFr7thOkmwk2VQMB2hdlpI2zJ3TdVxD+eeYavkbdHVuc ywAFocmYo0Wqy2Iu2ASghJaDWdUNYzPR1qBLT8L4dRUokbqS9tghDuT7WAbVNidaEVAE 7+nkf2EMtM77K4ET/tJTziZmPl+ezBopvQmRweOnOCsrmsx2/XdnqUBBjf3I7iJ2hnlY cx/g== 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=k8mM5enHmWG59j813J8xyGEUFyG4N9Xzdq2+IAjjoW4=; b=b1QUwQbbLzakIiKdLHO8EYnqcJjUbUClpAIk8FSMUuEfoVFPZeg0DaR3cadiUDe8a8 bRY2Hl5m623uUcVCylmaexpCJ48VSAdIecgjYcX9yZmDnYNbxjMWP7fOBfp4cQWApG65 G8LVkCU3hqdUmA/sidvGUt0MlTjDFg6vqK6Kwenc9XL47o4iC/Cl9JxawiRzzpVwZ75v 0bIv8V+X4SXIsQ5+QBnrxXWH/tf/9zZBz3g4A01MvCJKkl4BMR5oSZxMOSWNoj6gH4qW 7nep4lSSxJJRAAq7giDSbkntNSieTZb4uvmlR2iJV+YAaFzNe8wnnHFi6ap86p/+LkWT Dpmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=iLpjJotF; 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 h21-20020a63e155000000b00415d0947647si2529841pgk.184.2022.08.18.19.48.33; Thu, 18 Aug 2022 19:48:44 -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=iLpjJotF; 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 S244352AbiHSCfy (ORCPT + 99 others); Thu, 18 Aug 2022 22:35:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243630AbiHSCfw (ORCPT ); Thu, 18 Aug 2022 22:35:52 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E76D0CB5E9; Thu, 18 Aug 2022 19:35:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7E80861483; Fri, 19 Aug 2022 02:35:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D5DB1C433C1; Fri, 19 Aug 2022 02:35:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1660876550; bh=gGDZJOTPnlUqiszONSLHfXy5nwAuAkiEqiVT95kJ5Js=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=iLpjJotFEWd4e9thkhHE20PIA+292ifv+Tr94rBHM1xv/cRRIS6kzwM/7rxUDfAPg pHyLhXKTvCghalrHLh1TQkA5Pf44i0z4MTEAjvhsWnHjjWEcJP9K7jPenc2lhupunE r7ja3maR2lydYSYiI39ohSoIdizZQsmurGUYQpGA0I32/Na+4saY2sNK/cVZicU/P0 KNvaHzaXnWTBpIqt75CuU7CjqmNWOvEQGWEz/my+kZzvS5nIUccIm8/utGIMgYK23n nvSEXmxpDpYcBaJW+K+4AJpduriJLqvYaeoELvxRJHC79ZyO/t9G59RHzTkMsOnfWO rCC5a0ReMhF+Q== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 7A5815C044D; Thu, 18 Aug 2022 19:35:50 -0700 (PDT) Date: Thu, 18 Aug 2022 19:35:50 -0700 From: "Paul E. McKenney" To: Joel Fernandes Cc: LKML , Rushikesh S Kadam , "Uladzislau Rezki (Sony)" , Neeraj upadhyay , Frederic Weisbecker , Steven Rostedt , rcu Subject: Re: [PATCH v3 resend 4/6] fs: Move call_rcu() to call_rcu_lazy() in some paths Message-ID: <20220819023550.GN2125313@paulmck-ThinkPad-P17-Gen-1> Reply-To: paulmck@kernel.org References: <20220809034517.3867176-1-joel@joelfernandes.org> <20220809034517.3867176-5-joel@joelfernandes.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 Thu, Aug 18, 2022 at 09:21:56PM -0400, Joel Fernandes wrote: > On Thu, Aug 18, 2022 at 7:05 PM Joel Fernandes wrote: > > > > On Thu, Aug 18, 2022 at 1:23 PM Joel Fernandes wrote: > > > > > > [Sorry, adding back the CC list] > > > > > > On Mon, Aug 8, 2022 at 11:45 PM Joel Fernandes (Google) > > > wrote: > > > > > > > > This is required to prevent callbacks triggering RCU machinery too > > > > quickly and too often, which adds more power to the system. > > > > > > > > When testing, we found that these paths were invoked often when the > > > > system is not doing anything (screen is ON but otherwise idle). > > > > > > Unfortunately, I am seeing a slow down in ChromeOS boot performance > > > after applying this particular patch. It is the first time I could > > > test ChromeOS boot times with the series since it was hard to find a > > > ChromeOS device that runs the upstream kernel. > > > > > > Anyway, Vlad, Neeraj, do you guys also see slower boot times with this > > > patch? I wonder if the issue is with wake up interaction with the nocb > > > GP threads. > > > > > > We ought to disable lazy RCU during boot since it would have little > > > benefit anyway. But I am also concerned about some deeper problem I > > > did not catch before. > > > > > > I'll look into tracing the fs paths to see if I can narrow down what's > > > causing it. Will also try a newer kernel, I am currently testing on > > > 5.19-rc4. > > > > I got somewhere with this. It looks like queuing CBs as lazy CBs > > instead of normal CBs, are triggering expedited stalls during the boot > > process: > > > > 39.949198] rcu: INFO: rcu_preempt detected expedited stalls on > > CPUs/tasks: { } 28 jiffies s: 69 root: 0x0/. > > > > No idea how/why lazy RCU CBs would be related to expedited GP issues, > > but maybe something hangs and causes that side-effect. > > > > initcall_debug did not help, as it seems initcalls all work fine, and > > then 8 seconds after the boot, it starts slowing down a lot, followed > > by the RCU stall messages. As a next step I'll enable ftrace during > > the boot to see if I can get more insight. But I believe, its not the > > FS layer, the FS layer just triggers lazy CBs, but there is something > > wrong with the core lazy-RCU work itself. > > > > This kernel is 5.19-rc4. I'll also try to rebase ChromeOS on more > > recent kernels and debug. > > More digging, thanks to trace_event= boot option , I find that the > boot process does have some synchronous waits, and though these are > "non-lazy", for some reason the lazy CBs that were previously queued > are making them wait for the *full* lazy duration. Which points to a > likely bug in the lazy RCU logic. These synchronous CBs should never > be waiting like the lazy ones: > > [ 17.715904] => trace_dump_stack > [ 17.715904] => __wait_rcu_gp > [ 17.715904] => synchronize_rcu > [ 17.715904] => selinux_netcache_avc_callback > [ 17.715904] => avc_ss_reset > [ 17.715904] => sel_write_enforce > [ 17.715904] => vfs_write > [ 17.715904] => ksys_write > [ 17.715904] => do_syscall_64 > [ 17.715904] => entry_SYSCALL_64_after_hwframe > > I'm tired so I'll resume the debug later. At times like this, I often pull the suspect code into userspace and run it through its paces. In this case, a bunch of call_rcu_lazy() invocations into an empty bypass list, followed by a call_rcu() invocation, then a check to make sure that the bypass list is no longer lazy. Thanx, Paul