Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp2120289iog; Sun, 26 Jun 2022 07:12:24 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tHctzZNaqg8Bo2J4T5lub+OE3/FnN2fGzQk8EOjBBF378d9q3nNtKjCLNz6vAbvCv5usU7 X-Received: by 2002:a05:6402:5256:b0:435:9017:e5d3 with SMTP id t22-20020a056402525600b004359017e5d3mr11233149edd.258.1656252744466; Sun, 26 Jun 2022 07:12:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656252744; cv=none; d=google.com; s=arc-20160816; b=xKD2/U2DRMvVL4m7ZfWmYwhMawKufnMcgE0UU5RxJpuUmEFDi4fyom+yK9t1YNkPNG CFGexqQIWie8Lsk/P1KS7BtSX3j31e7DPbMuZp6xpcMSN38HzGjoMaqIM92dbdluv36C /HhJZE9Ll+/a2gk30bdliPJoq/fVKUpC4MTYBA5uM9u3SMF52a4UnfC7HGbIfj4F4/qO GKkHOQ8z/qQzUfMMWcli6j6VevzfTxAd/Yjx5mDwh+Opz5sspWaN8n3jNjntws9cjQSh /xHNmclJKg2/lN05pHTjVtAXsFJXKTCLHFwB+4Nojt3E90FcDWy5oniELrId3oUXNMN/ Yrqw== 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=p0OAhNYqbBB6GT7sSXWFfIT7pB6yhSHx6yXvarXY3ss=; b=Uyzj3FUrMtJBlEmv6EBbyowmE8HqB61EsPTx6FGU4iMiZ+JLQuyOuQf2wVuYGNM3Su k9Lx7q+1adWfMF4Ynq9cfivG5F1Vr20TzyZy+1FIvRwlUx39hVgoyN9wA1pmfNtDVp1m uDNUio2yxrceRafy+HKUJ4RV+PwTE3bjPM0PrURq0RUngaZxFAI+NHfn98cnDx9eki49 ozWApAi3yFcxvDPqQz63MDioeByXiG30xrs1/5uE4WZUasf4lJ9tE1i7lUlxJOesRa2H N4YPT+KHuhyjeuMBxh592dzTHHpG7L2lgEmS7oi8z7z5q+m7B9fhaZyZJpbPVlBtCgxg 9Pfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JyKCKixI; 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 i17-20020aa7c711000000b004358cd8c618si6801924edq.429.2022.06.26.07.11.57; Sun, 26 Jun 2022 07:12:24 -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=JyKCKixI; 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 S234357AbiFZNws (ORCPT + 99 others); Sun, 26 Jun 2022 09:52:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230497AbiFZNwr (ORCPT ); Sun, 26 Jun 2022 09:52:47 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70F3D101F5; Sun, 26 Jun 2022 06:52:44 -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 sin.source.kernel.org (Postfix) with ESMTPS id 8B062CE1012; Sun, 26 Jun 2022 13:52:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C00EAC34114; Sun, 26 Jun 2022 13:52:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1656251560; bh=4ULNrqMWCIKDAsuyKVrcTubv6ihbqmGy0Zneh62+Nzk=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=JyKCKixIS/rZt8Wjmd5UkfC0hIdtRN/6ofNYSnOk1NrKxe6As4irwYsvEXykuAPhU GyAp9jybiCa0CkFPop5ZtCUn7v9m+EInYePcHKqsrjpff8iiHBAwY6V0QZkpdJewWS OA2e+9hFo1FSkvdE81KoGNNSfDmc1eFZQgocfjV9XfBgoAAdWs45jdaxgkEieOEtHo hhTH7nZiPHIWalLB1G3o+UVLha0sEsHYHcxvHMCYOUsBW1cUHllwWw8qgCppEsK07P V1nAsGgsOafrlBOFlmMMwoWpq9HEExq2Xb3ijNcRCsL2VAhMGtwNwr3s1XT7ULwjlT zWvuwJ7Dwmyaw== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 681025C098A; Sun, 26 Jun 2022 06:52:40 -0700 (PDT) Date: Sun, 26 Jun 2022 06:52:40 -0700 From: "Paul E. McKenney" To: Joel Fernandes Cc: rcu@vger.kernel.org, linux-kernel@vger.kernel.org, rushikesh.s.kadam@intel.com, urezki@gmail.com, neeraj.iitr10@gmail.com, frederic@kernel.org, rostedt@goodmis.org, vineeth@bitbyteword.org Subject: Re: [PATCH v2 5/8] rcu/nocb: Wake up gp thread when flushing Message-ID: <20220626135240.GP1790663@paulmck-ThinkPad-P17-Gen-1> Reply-To: paulmck@kernel.org References: <20220622225102.2112026-1-joel@joelfernandes.org> <20220622225102.2112026-7-joel@joelfernandes.org> <20220626040622.GM1790663@paulmck-ThinkPad-P17-Gen-1> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-7.5 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 Sun, Jun 26, 2022 at 01:45:32PM +0000, Joel Fernandes wrote: > On Sat, Jun 25, 2022 at 09:06:22PM -0700, Paul E. McKenney wrote: > > On Wed, Jun 22, 2022 at 10:50:59PM +0000, Joel Fernandes (Google) wrote: > > > We notice that rcu_barrier() can take a really long time. It appears > > > that this can happen when all CBs are lazy and the timer does not fire > > > yet. So after flushing, nothing wakes up GP thread. This patch forces > > > GP thread to wake when bypass flushing happens, this fixes the > > > rcu_barrier() delays with lazy CBs. > > > > I am wondering if there is a bug in non-rcu_barrier() lazy callback > > processing hiding here as well? > > I don't think so because in both nocb_try_bypass and nocb_gp_wait, we are not > going to an indefinite sleep after the flush. However, with rcu_barrier() , > there is nothing to keep the RCU GP thread awake. That's my theory at least. > In practice, I have not been able to reproduce this issue with > non-rcu_barrier(). > > With rcu_barrier() I happen to hit it thanks to the rcuscale changes I did. > That's an interesting story! As I apply call_rcu_lazy() to the file table > code, turns out that on boot, the initram unpacking code continously triggers > call_rcu_lazy(). This happens apparently in a different thread than the one > that rcuscale is running in. In rcuscale, I did rcu_barrier() at init time > and this stalled for a long time to my surprise, and this patch fixed it. Cool! Then should this wake_nocb_gp() instead go into the rcu_barrier() code path? As shown below, wouldn't we be doing some spurious wakeups? Thanx, Paul > thanks, > > - Joel > > > > > > Thanx, Paul > > > > > Signed-off-by: Joel Fernandes (Google) > > > --- > > > kernel/rcu/tree_nocb.h | 2 ++ > > > 1 file changed, 2 insertions(+) > > > > > > diff --git a/kernel/rcu/tree_nocb.h b/kernel/rcu/tree_nocb.h > > > index 2f5da12811a5..b481f1ea57c0 100644 > > > --- a/kernel/rcu/tree_nocb.h > > > +++ b/kernel/rcu/tree_nocb.h > > > @@ -325,6 +325,8 @@ static bool rcu_nocb_do_flush_bypass(struct rcu_data *rdp, struct rcu_head *rhp, > > > rcu_segcblist_insert_pend_cbs(&rdp->cblist, &rcl); > > > WRITE_ONCE(rdp->nocb_bypass_first, j); > > > rcu_nocb_bypass_unlock(rdp); > > > + > > > + wake_nocb_gp(rdp, true); > > > return true; > > > } > > > > > > -- > > > 2.37.0.rc0.104.g0611611a94-goog > > >