From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 849E6C433DB for ; Thu, 25 Feb 2021 00:49:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 29EFF6146B for ; Thu, 25 Feb 2021 00:49:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236452AbhBYAtD (ORCPT ); Wed, 24 Feb 2021 19:49:03 -0500 Received: from mail.kernel.org ([198.145.29.99]:44222 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236421AbhBYAs4 (ORCPT ); Wed, 24 Feb 2021 19:48:56 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 684EA6146B; Thu, 25 Feb 2021 00:48:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1614214096; bh=P6YhKinu23PkPP/k4EIifcZhpqaz7+hAFMZPWD9ydqw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=YnciVnY0U5Lq9txw9Utq5s5oIj/cjMLXbwnMAK2V9DohXcNKzS8uCHJUQhznFjpca SOt4TnUjtzN0nUxG/3R5/RvH1c4lFEBzxDOSQlGddaihTng6zuMFANX0l2VswfN/2n lMKDxUZqdfTDvPBMvQYlxBMIdFEVV9Ozi9AyuErQVfs/8V/ex8knfPBDHSWuF6CxiC hEOsWkVWLMeb7vPosjtLQDcONJ+D5oQCVBrVzZzWZj2JRwHDLJCvYne4YLP7a5jCkh pQi0YTcX7K8JFWbABg3BfX2guAOLVmqb26SvHsQRYUa5c8fUrWleJiCuyLauiNbved onePSotlk5WBg== Date: Thu, 25 Feb 2021 01:48:13 +0100 From: Frederic Weisbecker To: "Paul E. McKenney" Cc: LKML , Thomas Gleixner , Boqun Feng , Lai Jiangshan , Neeraj Upadhyay , Josh Triplett , Stable , Joel Fernandes Subject: Re: [PATCH 01/13] rcu/nocb: Fix potential missed nocb_timer rearm Message-ID: <20210225004813.GB12431@lothringen> References: <20210223001011.127063-1-frederic@kernel.org> <20210223001011.127063-2-frederic@kernel.org> <20210224183709.GI2743@paulmck-ThinkPad-P72> <20210224220606.GA3179@lothringen> <20210225001425.GL2743@paulmck-ThinkPad-P72> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210225001425.GL2743@paulmck-ThinkPad-P72> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 24, 2021 at 04:14:25PM -0800, Paul E. McKenney wrote: > On Wed, Feb 24, 2021 at 11:06:06PM +0100, Frederic Weisbecker wrote: > > I managed to recollect some pieces of my brain. So keep the above but > > let's change the point 10: > > > > 10. CPU 0 enqueues its second callback, this time with interrupts > > enabled so it can wake directly ->nocb_gp_kthread. > > It does so with calling __wake_nocb_gp() which also cancels the > > pending timer that got queued in step 2. But that doesn't reset > > CPU 0's ->nocb_defer_wakeup which is still set to RCU_NOCB_WAKE. > > So CPU 0's ->nocb_defer_wakeup and CPU 0's ->nocb_timer are now > > desynchronized. > > > > 11. ->nocb_gp_kthread associates the callback queued in 10 with a new > > grace period, arrange for it to start and sleeps on it. > > > > 12. The grace period ends, ->nocb_gp_kthread awakens and wakes up > > CPU 0's ->nocb_cb_kthread which invokes the callback queued in 10. > > > > 13. CPU 0 enqueues its third callback, this time with interrupts > > disabled so it tries to queue a deferred wakeup. However > > ->nocb_defer_wakeup has a stalled RCU_NOCB_WAKE value which prevents > > the CPU 0's ->nocb_timer, that got cancelled in 10, from being armed. > > > > 14. CPU 0 has its pending callback and it may go unnoticed until > > some other CPU ever wakes up ->nocb_gp_kthread or CPU 0 ever calls > > an explicit deferred wake up caller like idle entry. > > > > I hope I'm not missing something this time... > > Thank you, that does sound plausible. I guess I can see how rcutorture > might have missed this one! I must admit it requires a lot of stars to be aligned :-) Thanks.