Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp940323rdg; Wed, 11 Oct 2023 09:31:52 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHPAzvlPi+54basd3sEo3Xo5wGVOKNvV1DoUnw7JvL2ruEj4ordeaT//Z1CoBRHd9w1902+ X-Received: by 2002:a17:902:ecc5:b0:1c9:d940:78ea with SMTP id a5-20020a170902ecc500b001c9d94078eamr765430plh.22.1697041911685; Wed, 11 Oct 2023 09:31:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697041911; cv=none; d=google.com; s=arc-20160816; b=V6aIKekJDNjyujFTzHP0bRm7fhaymP8zpNSMFXHOwgmVcA7L1iSC0/fsL0+QTE67Ma 0pWlUbmO9+s8ehO6WM3Qv169soITUnyHs7g0ML0g/kfvzphjfDqlfrosLJQQr2mnDT8+ VFBRTGhR7ibfNoEuGnxLf3O/C8y2Bdblldc5PpOjIzXQjA8WpCmSK8iXx5JwPwh7bkfY DtySfbRNTb4KXuWTG6uJVBGg9hfz450Tj1ReXa9cJByFOcInR2msG5KQpKkCg1fWeQ7r WTsWW9J4xKZQd4OZo2wtAQ3W+ab8wzq6W7s5mpSWIPkGdGBMRqsWDahDwHXhuyGOwyhd 9D1w== 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-transfer-encoding :content-disposition:mime-version:references:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=mjCloyfU+ys6jcvQud4PFpapB+sMzk4s2mE1U95fUGU=; fh=ual126uqQzN//99aTdM3LdEytB2LHA0E4JAggGTXMQA=; b=AYoHppdrzblqcsFkUuGL4WsTjgtnMReH1aXru05rEl49zWruJ+37QHq+Z2tXkrVMOr WO211tCdQb+dR0ggOrpewljKs5nD7UicmRfUazQhqppht9/QEbiIuUgAof4PBnrMd4WK lqHeH0qdTWfekswZQnj7pqvWS748QdFAIP9jAJ2wVwTQkmd4xfeLuVifxwvi62j7A0yY bIIxqtagP08IC6Ou4/I4PcXXz+vtvSZGbM5lMpe+r7ISFrhxl6AuELB1gsBHHA2vGDY5 iCyms6iPFwfbc2KFi5rlm42gUcJgTkcg8M2M9s53+YrSP5Jx7tWl0Q+5cCRkUMpVKXtt 2A6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VGLoGxYi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id t10-20020a170902bc4a00b001bde0b58abesi83221plz.161.2023.10.11.09.31.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 09:31:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VGLoGxYi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 97DB98096A41; Wed, 11 Oct 2023 09:31:47 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232640AbjJKQbj (ORCPT + 99 others); Wed, 11 Oct 2023 12:31:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230185AbjJKQbi (ORCPT ); Wed, 11 Oct 2023 12:31:38 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A583691; Wed, 11 Oct 2023 09:31:36 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 43952C433CA; Wed, 11 Oct 2023 16:31:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697041896; bh=FGA8gM4FeYE4IWyx429Dya7HEFgaNp50J+X1XqE49q8=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=VGLoGxYihF/YYfew9Ft1kVSjBHObtFNw5bKvSrYo98+Qn+61pehsVyPIUnOEwN0hS EwAD2BQWoOzwjuwQGShhSeizFMKMyLNXFwxtwN6I9nPnMIR2wRxk83BoTTXHVUSv6e AOhNH8xNcRKEoULOJe5HnJt+KvSLrBC0csomVujidH1b+6pfMVhsSGtY28Ll8PDjk1 ik33X3N0RSINRmps91GGkcxrcsJLizPNhDf7eTKMezNOnm0IrumVHabo7dd0BSph3O RjeqEBIKaxn85DieIibabR+HwOndWQrXIgbu/aoi31pbuOPe/kwxSa+q6P0KCoedQW r53uBsdnIY7SA== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id E681ECE0AD4; Wed, 11 Oct 2023 09:31:35 -0700 (PDT) Date: Wed, 11 Oct 2023 09:31:35 -0700 From: "Paul E. McKenney" To: Frederic Weisbecker Cc: Joel Fernandes , "Liam R. Howlett" , Naresh Kamboju , Greg Kroah-Hartman , stable@vger.kernel.org, patches@lists.linux.dev, linux-kernel@vger.kernel.org, torvalds@linux-foundation.org, akpm@linux-foundation.org, linux@roeck-us.net, shuah@kernel.org, patches@kernelci.org, lkft-triage@lists.linaro.org, pavel@denx.de, jonathanh@nvidia.com, f.fainelli@gmail.com, sudipm.mukherjee@gmail.com, srw@sladewatkins.net, rwarsow@gmx.de, conor@kernel.org, Chengming Zhou , Peter Zijlstra , Ovidiu Panait , Ingo Molnar , rcu Subject: Re: [PATCH 5.15 000/183] 5.15.134-rc1 review Message-ID: <273869c3-ba4b-4173-a14e-bd201d900079@paulmck-laptop> Reply-To: paulmck@kernel.org References: <20231004175203.943277832@linuxfoundation.org> <20231006162038.d3q7sl34b4ouvjxf@revolver> <57c1ff4d-f138-4f89-8add-c96fb3ba6701@paulmck-laptop> <20231006175714.begtgj6wrs46ukmo@revolver> <7652477c-a37c-4509-9dc9-7f9d1dc08291@paulmck-laptop> <9470dab6-dee5-4505-95a2-f6782b648726@paulmck-laptop> <433f5823-059c-4b51-8d18-8b356a5a507f@paulmck-laptop> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=2.4 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Wed, 11 Oct 2023 09:31:47 -0700 (PDT) X-Spam-Level: ** On Wed, Oct 11, 2023 at 03:47:23PM +0200, Frederic Weisbecker wrote: > Le Tue, Oct 10, 2023 at 06:34:35PM -0700, Paul E. McKenney a ?crit : > > If this problem is real, fixes include: > > > > o Revert Liam's patch and make Tiny RCU's call_rcu() deal with > > the problem. This is overhead and non-tinyness, but to Joel's > > point, it might be best. > > But what is calling call_rcu() or start_poll_synchronize_rcu() so > early that the CPU is not even online? (that's before boot_cpu_init() !) > > Deferring PF_IDLE setting might pave the way for more issues like this one, > present or future. Though is_idle_task() returning true when the task is not > in the idle loop but is playing the init/0 role is debatable. > > An alternative for tiny RCU is to force waking up ksoftirqd when call_rcu() > is in the idle task. Since rcu_qs() during the context switch raises a softirq > anyway. It's more overhead for start_poll_synchronize_rcu() though but do we > expect much RCU polling in idle? Nice!!! This does solve the original problem with little or no additional overhead (perhaps even with decreased overhead), and avoids the other RCU Tasks issues. Thanx, Paul > diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h > index a92bce40b04b..6ab15233e2be 100644 > --- a/include/linux/interrupt.h > +++ b/include/linux/interrupt.h > @@ -604,6 +604,7 @@ extern void __raise_softirq_irqoff(unsigned int nr); > > extern void raise_softirq_irqoff(unsigned int nr); > extern void raise_softirq(unsigned int nr); > +extern void raise_ksoftirqd_irqsoff(unsigned int nr); > > DECLARE_PER_CPU(struct task_struct *, ksoftirqd); > > diff --git a/kernel/rcu/tiny.c b/kernel/rcu/tiny.c > index 42f7589e51e0..872dab8b8b53 100644 > --- a/kernel/rcu/tiny.c > +++ b/kernel/rcu/tiny.c > @@ -189,12 +189,12 @@ void call_rcu(struct rcu_head *head, rcu_callback_t func) > local_irq_save(flags); > *rcu_ctrlblk.curtail = head; > rcu_ctrlblk.curtail = &head->next; > - local_irq_restore(flags); > > if (unlikely(is_idle_task(current))) { > /* force scheduling for rcu_qs() */ > - resched_cpu(0); > + raise_ksoftirqd_irqsoff(RCU_SOFTIRQ); > } > + local_irq_restore(flags); > } > EXPORT_SYMBOL_GPL(call_rcu); > > @@ -225,10 +225,13 @@ EXPORT_SYMBOL_GPL(get_state_synchronize_rcu); > unsigned long start_poll_synchronize_rcu(void) > { > unsigned long gp_seq = get_state_synchronize_rcu(); > + unsigned long flags; > > if (unlikely(is_idle_task(current))) { > + local_irq_save(flags); > /* force scheduling for rcu_qs() */ > - resched_cpu(0); > + raise_ksoftirqd_irqsoff(RCU_SOFTIRQ); > + local_irq_restore(flags); > } > return gp_seq; > } > diff --git a/kernel/softirq.c b/kernel/softirq.c > index 210cf5f8d92c..ef105cbdc705 100644 > --- a/kernel/softirq.c > +++ b/kernel/softirq.c > @@ -695,6 +695,14 @@ void __raise_softirq_irqoff(unsigned int nr) > or_softirq_pending(1UL << nr); > } > > +#ifdef CONFIG_RCU_TINY > +void raise_ksoftirqd(unsigned int nr) > +{ > + __raise_softirq_irqoff(nr); > + wakeup_softirqd(); > +} > +#endif > + > void open_softirq(int nr, void (*action)(struct softirq_action *)) > { > softirq_vec[nr].action = action; > > > >