Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1742674rwb; Wed, 5 Oct 2022 04:15:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5gtiUylFkQb6Au+xgwiXUipjC+yczPYWkTAEAHzCoqqHTCK7kV2UIE/G3QFA4GdiUtc0JW X-Received: by 2002:a17:907:1df2:b0:78d:31d3:427a with SMTP id og50-20020a1709071df200b0078d31d3427amr1397791ejc.757.1664968544403; Wed, 05 Oct 2022 04:15:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664968544; cv=none; d=google.com; s=arc-20160816; b=IK57Qlf9rqLdT5hFypBe+LCimfXDtDVuinLstSyvoq/HAXhgqISYLNPZkeFqMv46a5 3gVuORGCGxlPHIC5bKW+lCL/U3do0zE0ObCCFvlIt0OtIkXrlQkeCGx8foViirq5KRyY pNaRrm9GbMtw552V9pbkko6EZ1O5KeoLBcVXsqDpB5AdgzhZHYWIRG8pBIGqkIZThuKh Q9a24F4ghUYctp3MiGZ37bTnCWPJFIlVVAPIsId/djSWFImzl6pk3JFzNSUOcHaV1akX MEHKo23z3gJHC4pg21eVhL6S0D0qB16lHB/PBX+LS5DOi5FC3X/8pBeeuZfLVfy1rCax IOlg== 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:message-id:subject:cc:to:from:date:dkim-signature; bh=++ZOTqQhTQ6s0IMJyRxRYpajg7k3vO+ihjbFnvJETds=; b=nbgEViNgZMZZc5Hjd6RbHrtSNna4cxQBsl5wSYcI6KKm6gFm2/UJksKB+G8gisDp1z HY6WVYAYqhrQCEL2HeDNFgkIeO3onUipF0CXeDwhcGuV6FpZal9ziuNCdqp6Ul/IWEf0 9CUgADRbSzGidpVDA15rJcZaWtUcMfyeBs7Hxx19xxud65Ny3oj+rGONJUF4XOUUP3+z aVSIK78Xtr/kZ1v6Dz7BzwikFcfhJMq8zjaAysK4tHe6IqG8onk4k9/aIskaedA4rjCb uY5NK42ja0kBe1b811pfaUvjEol8loECtiHnPWTX4bYbVbJVnsIaMGdCOkjIiTIpMOKe xnFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="KmZE/Zzb"; 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 m8-20020a170906720800b0077951929341si12861750ejk.312.2022.10.05.04.15.14; Wed, 05 Oct 2022 04:15: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="KmZE/Zzb"; 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 S229653AbiJEKj3 (ORCPT + 99 others); Wed, 5 Oct 2022 06:39:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229586AbiJEKj0 (ORCPT ); Wed, 5 Oct 2022 06:39:26 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BCAC458DD7; Wed, 5 Oct 2022 03:39:24 -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 D52CC61631; Wed, 5 Oct 2022 10:39:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DDA2DC4347C; Wed, 5 Oct 2022 10:39:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1664966363; bh=34r0VvrhY3RK5Xag76GfQPTcTj8nQrZw7LsztzDMZ5s=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=KmZE/Zzbw6CH4z4rbZtBj92r0jhmLY/7Dh5LJ8ZCj6cCPRbZcSrL8TbpImLuC/JFy kcrEOwsN0bOvK12Rw9rpAHCW5THGP5ZGBI7qQk5NWWfo0wXX/LFS4SX6q5ek9dIRwO PCGctggnIufOK5j6tKLbCx/3yeEgB8XoP6isLVgC8wlfRPJVcYK4R3XpoFC8AqAOP6 tnmZpkl49z35OLeRhOh9iB2xuH9n8lcCcRU/SXh3ZoXttc1eQxboGA6335vmtqzfoX bK/0C0bujBbYZTAvA0Evbm0smczkS930T2Ph+kR8VXLIJpspfNrunu/9chTLhkVyrx qEDvsqkXRei7Q== Date: Wed, 5 Oct 2022 12:39:20 +0200 From: Frederic Weisbecker 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, paulmck@kernel.org, rostedt@goodmis.org, youssefesmat@google.com, surenb@google.com Subject: Re: [PATCH v7 01/11] rcu: Wake up nocb gp thread on rcu_barrier_entrain() Message-ID: <20221005103920.GA326169@lothringen> References: <20221004024157.2470238-1-joel@joelfernandes.org> <20221004024157.2470238-2-joel@joelfernandes.org> <20221004222853.GA323878@lothringen> 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 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 Tue, Oct 04, 2022 at 06:57:59PM -0400, Joel Fernandes wrote: > >> needed after an entrain. Otherwise, the RCU barrier callback can wait in > >> the queue for several seconds before the lazy callbacks in front of it > >> are serviced. > > > > It's not about lazy callbacks here (but you can mention the fact that > > waking nocb_gp if necessary after flushing bypass is a beneficial side > > effect for further lazy implementation). > > > > So here is the possible bad scenario: > > > > 1) CPU 0 is nocb, it queues a callback > > 2) CPU 0 goes idle (or userspace with nohz_full) forever > > 3) The grace period related to that callback elapses > > 4) The callback is moved to the done list (but is not invoked yet), there are no more pending for CPU 0 > > 5) CPU 1 calls rcu_barrier() and entrains to CPU 0 cblist > > CPU 1 can only entrain into CPU 0 if the CPU is offline: > > if (!rcu_rdp_cpu_online(rdp)) { > rcu_barrier_entrain(rdp); > WARN_ON_ONCE(READ_ONCE(rdp->barrier_seq_snap) != gseq); > raw_spin_unlock_irqrestore(&rcu_state.barrier_lock, > ... > continue; > } Ah good point. So CPU 1 sends an IPI to CPU 0 which entrains itself. And then looks like the result is the same. > > Otherwise an IPI does the entraining. So I do not see how CPU 0 being idle > causes the cross-CPU entraining. It doesn't but it shows that the CPU isn't going to enqueue any further callback before a while. Though even if it did, it may not even solve the situation, not until an RCU_NOCB_WAKE_FORCE is issued... > > > 6) CPU 1 waits forever > > But, I agree it can still wait forever, once the IPI handler does the > entraining, since nothing will do the GP thread wakeup. > > >> > >> Reported-by: Joel Fernandes (Google) > > > > Fixes: 5d6742b37727 ("rcu/nocb: Use rcu_segcblist for no-CBs CPUs") > > So, do you mind writing a proper patch with a proper commit message and Fixes > tag then? It can independent of this series and add my Reported-by tag, > thanks! Ok will do. Thanks! > > Thanks! > > - Joel >