Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp782273rwi; Fri, 14 Oct 2022 08:31:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6uglR0RYKlw1Qcbq0K7zBrDs81KNjn8MwWArclx/cESIcEVfQOllzJ/7RFomol/c1K15by X-Received: by 2002:a17:906:9b93:b0:78d:eb36:1ce7 with SMTP id dd19-20020a1709069b9300b0078deb361ce7mr3997398ejc.621.1665761461402; Fri, 14 Oct 2022 08:31:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665761461; cv=none; d=google.com; s=arc-20160816; b=C92adIvXrxgRsx5Zpnme5Ig1fzF9yuy63HeuZNRZG3ZPzmIRcX3kwNUDuxMym4dS/Z sCwQ6hqMN6RxC4z3GWJylmcK28xVMzdwnq6JN2RQw9J9yEKg6XzAPk4pnBBvxHARiq/g DrLKpWkHTWMHwH0bGVRH6ZUtIilFQosrlp4w8g2Je799+HARQl4NPhQQ0yKBsxdnKc22 kkURtHkNWQlUPi7u6dohAsjPff95PgwWDuNvKY5NlccuP7GUT6Q6Ibjh/aJiMKwBuRZW Hir6vcRPOSfcOA5QFSwL20LureuNLfuNIcs9kbJRYZ8qsf32gxrhD3vMVZNC7B5ykQE2 Ne4g== 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=BfNQ3MYRI1mWFVsFFFCBGzVo/JmemCyvThwNhZWr4mM=; b=QVJNSbe8Q2ujFXLNptTjmMCJDlHZVhnbirnat8uq3qYYWv8V6gJFN8IC7WJhkoemcc uT7lq7S8vJBb5qr9n+YyvrA4+juco57utExSJ2eYV4QVm5x3j8N+7Oza4z1hHwrjKny/ gtrW2sB8SoU/7j6WXDHDkNHQUI19JKNB/y8VIHreqSz6yKwCYv/YMOLs5gQw1bNDAFIf j0k21hrPu/YJi27ZxNfRJhh2lrLhc7dxIKT4fGAvp9Ow5LrZwatMevhQ11QoAOYkgG49 iAQzIrPT3voIGbChMQqW8WtvdipWp1gG19lEURYO9fkFOL5tYgcAdOX3u1foNRCb1cKb gBVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=fdHhq1wG; 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 hs41-20020a1709073ea900b0077b6ecac099si2775455ejc.287.2022.10.14.08.30.31; Fri, 14 Oct 2022 08:31:01 -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=fdHhq1wG; 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 S229698AbiJNPDx (ORCPT + 99 others); Fri, 14 Oct 2022 11:03:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229496AbiJNPDv (ORCPT ); Fri, 14 Oct 2022 11:03:51 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E587A1CFC7E; Fri, 14 Oct 2022 08:03:50 -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 ams.source.kernel.org (Postfix) with ESMTPS id ABC52B82352; Fri, 14 Oct 2022 15:03:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 295C5C433C1; Fri, 14 Oct 2022 15:03:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1665759828; bh=8JHrqp2BtSY6zR/ZUbmdFTfoDk9yKJl0APpTHHSZIFc=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=fdHhq1wGeNLjcgDC6hMGXoXuyYyRBm7gnx7/Ky1DLSXnJuVoNXYUES5Ys0RymAr/g LWPfsze9hHcB9snAQHxvewCvS8UjgfIoXsJlV9re8vwh5yq+I0DpeX8qGdoXT09aNK 6IeCJfCliAkvvLF+tdRWBV/RBbRO1+2u5ngfnUWHa9VH+2P7TTZ54b4fpsdCACv4hL uC4DxZPJQB3M5Rj1LIayd5lRYvY3f2X3rlpm6smJSjj430mSejh4LoMiXrWmrfFKd8 sPScLnL/ET2kTweYTQd41bYmyslUB2fQvSOVg4QY5f2wFKNJ3A09VKbL/c+WSLFdES cgh1YHCd+Lbag== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id E709D5C32BF; Fri, 14 Oct 2022 08:03:44 -0700 (PDT) Date: Fri, 14 Oct 2022 08:03:44 -0700 From: "Paul E. McKenney" To: Frederic Weisbecker Cc: "Joel Fernandes (Google)" , rcu@vger.kernel.org, linux-kernel@vger.kernel.org, rushikesh.s.kadam@intel.com, urezki@gmail.com, neeraj.iitr10@gmail.com, rostedt@goodmis.org, youssefesmat@google.com, surenb@google.com Subject: Re: [PATCH v8 01/13] rcu: Fix missing nocb gp wake on rcu_barrier() Message-ID: <20221014150344.GG4221@paulmck-ThinkPad-P17-Gen-1> Reply-To: paulmck@kernel.org References: <20221011180142.2742289-1-joel@joelfernandes.org> <20221011180142.2742289-2-joel@joelfernandes.org> <20221014142127.GE4221@paulmck-ThinkPad-P17-Gen-1> <20221014144019.GB1108603@lothringen> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221014144019.GB1108603@lothringen> 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 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 Fri, Oct 14, 2022 at 04:40:19PM +0200, Frederic Weisbecker wrote: > On Fri, Oct 14, 2022 at 07:21:27AM -0700, Paul E. McKenney wrote: > > On Tue, Oct 11, 2022 at 06:01:30PM +0000, Joel Fernandes (Google) wrote: > > > From: Frederic Weisbecker > > > > > > Upon entraining a callback to a NOCB CPU, no further wake up is > > > issued on the corresponding nocb_gp kthread. As a result, the callback > > > and all the subsequent ones on that CPU may be ignored, at least until > > > an RCU_NOCB_WAKE_FORCE timer is ever armed or another NOCB CPU belonging > > > to the same group enqueues a callback on an empty queue. > > > > > > Here is a possible bad scenario: > > > > > > 1) CPU 0 is NOCB unlike all other CPUs. > > > 2) CPU 0 queues a callback > > > > Call it CB1. > > > > > 2) The grace period related to that callback elapses > > > 3) The callback is moved to the done list (but is not invoked yet), > > > there are no more pending callbacks for CPU 0 > > > > So CB1 is on ->cblist waiting to be invoked, correct? > > > > > 4) CPU 1 calls rcu_barrier() and sends an IPI to CPU 0 > > > 5) CPU 0 entrains the callback but doesn't wake up nocb_gp > > > > And CB1 must still be there because otherwise the IPI handler would not > > have entrained the callback, correct? If so, we have both CB1 and the > > rcu_barrier() callback (call it CB2) in ->cblist, but on the done list. > > > > > 6) CPU 1 blocks forever, unless CPU 0 ever queues enough further > > > callbacks to arm an RCU_NOCB_WAKE_FORCE timer. > > > > Except that -something- must have already been prepared to wake up in > > order to invoke CB1. And that something would invoke CB2 along with CB1, > > given that they are both on the done list. If there is no such wakeup > > already, then the hang could occur with just CB1, without the help of CB2. > > Heh good point. I was confused with CB1 on RCU_DONE_TAIL and the possibility > for CB2 to be entrained on RCU_WAIT_TAIL. But that's indeed not supposed to > happen. Ok so this patch indeed doesn't make sense outside lazy. Whew!!! ;-) > > > This is also required to make sure lazy callbacks in future patches > > > don't end up making rcu_barrier() wait for multiple seconds. > > > > But I do see that the wakeup is needed in the lazy case, and if I remember > > correctly, the ten-second rcu_barrier() delay really did happen. If I > > understand correctly, for this to happen, all of the callbacks must be > > in the bypass list, that is, ->cblist must be empty. > > > > So has the scenario steps 1-6 called out above actually happened in the > > absence of lazy callbacks? > > Nope, so I guess we can have the pending check around rcu_nocb_flush_bypass() > only... OK, sounds good. I have put this series on branch lazy.2022.10.14a and am testing it. Thanx, Paul