Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp3154906rwe; Mon, 29 Aug 2022 06:48:50 -0700 (PDT) X-Google-Smtp-Source: AA6agR6HCBAwmJj7g43kp+X0CdC9uJkMYMJPd/OJ8Jvq4BzMdBOo1vauVsnr55vxwTU0PQH8pMmf X-Received: by 2002:a05:6a00:14c6:b0:536:e81f:66e5 with SMTP id w6-20020a056a0014c600b00536e81f66e5mr16948291pfu.44.1661780929765; Mon, 29 Aug 2022 06:48:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661780929; cv=none; d=google.com; s=arc-20160816; b=HU2q3kjhxHrN3vbiqUzkwua6eZopdMCgE4+inNRJQBaOpqpzKvqWkhySe3n3b/0diP DBeugaB3YlRKUDJhfAO7dBTmM2y9Gs9fpYc+V/cz4Nj7X/f+HK+fag2soMiicDnpXjZt AZKlEUAzOGiXQZ9299wJfdYKCG/V5HLFGds221EMwiR8k8Fy99akYIKm9h/rwjDSg4CT DSQ2PDg442AqxzFupGz28auIuyUFzk9C/vJKqug9G/CJSgR0zjLC0ZKGXsWZv3RxQOsu PiDZJL5Lx2myYsPuLpS7Qe6EZaDDa3BY0iKzw0pDm1qRxcVPv55Lk7OAPkia3YjRwhLG Ke0A== 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=vjnaCEKzR2n2H5MVqvRLMRLmm+FV+YULTjz6PF7JDyU=; b=Bf4HKTwS8iqLZF5Q9WXxsnDwjrvCiEWe668/HaZPQyuk17n4Zr8x8bEOsEIL4zf6+A V8qrxNKgvJ/MolhL22v6upv+b6e752/zBFVznpfx0nw+zZj8dU6S3mNT2lKlXpW3MlOE E7TF2sNTlrMQ6gBwYk0CuaUIHh9xDuxNpyjmX4CU3X+Ie7XMqDBQoiZBfg/qZpR1Gn9/ DmEFaYf7sO09RfKHM/cRpVWOvjIEntZEU32935AGukLPPavwmJ7epVL5HUt7vXEdO2aQ 2QHmdlq1av1KaNho3K1Ca93TXndmWf7aG8Tqy6xHxFeQH+PEFn4BjpAVuXFh0/jR1RH1 W7Pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="fBo/LjLe"; 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 p3-20020a170902ebc300b00172bf02a987si8907435plg.189.2022.08.29.06.48.38; Mon, 29 Aug 2022 06:48:49 -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="fBo/LjLe"; 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 S229796AbiH2NlA (ORCPT + 99 others); Mon, 29 Aug 2022 09:41:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230088AbiH2Nkv (ORCPT ); Mon, 29 Aug 2022 09:40:51 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2394A7696A; Mon, 29 Aug 2022 06:40: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 dfw.source.kernel.org (Postfix) with ESMTPS id A697260E2D; Mon, 29 Aug 2022 13:40:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8320DC433D6; Mon, 29 Aug 2022 13:40:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1661780449; bh=xv38Z6v2n0K90c6gGumVR9aB5fi61GGLKWtszP09R1E=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=fBo/LjLe6wSHY95tDt85mxAz+iCyQu+l5tvBzWIod+9JxgupGYr92IefdZN2Z89bN 7WQLALVjtSLLDzn1OOFO8GC2QgReJ8oiZw9Myra2Qfy2iXRnZP5+R2DmFyw12aG54v j2GHoQ1OPqVk6Few7Qbmq7Hc3KWToC7KHF28kAXqw1Z14QN4J2uOnXa/BmpD7tGNCY aEh7cz4ofwYY5KGZ40zm7aYSHkET50qTT/VsKeBqvPiC8loBoAuAZYaGkrFCiuCcgy wDIIZDa8qAuCVUxTVXNwIQbENWJsr3usj8TDG9yNfVOehwJSaYplWGb8UG/ngecu1r w5//ykycgqhJQ== Date: Mon, 29 Aug 2022 15:40:45 +0200 From: Frederic Weisbecker To: "Joel Fernandes (Google)" Cc: linux-kernel@vger.kernel.org, paulmck@kernel.org, Rushikesh S Kadam , "Uladzislau Rezki (Sony)" , Neeraj upadhyay , Steven Rostedt , rcu , vineeth@bitbyteword.org Subject: Re: [PATCH v4 00/14] Implement call_rcu_lazy() and miscellaneous fixes Message-ID: <20220829134045.GA54589@lothringen> References: <20220819204857.3066329-1-joel@joelfernandes.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220819204857.3066329-1-joel@joelfernandes.org> 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,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 Fri, Aug 19, 2022 at 08:48:43PM +0000, Joel Fernandes (Google) wrote: > Refresh tested on real ChromeOS userspace and hardware, passes boot time tests > and rcuscale tests. > > Fixes on top of v3: > - Fix boot issues due to a race in the lazy RCU logic which caused a missed > wakeup of the RCU GP thread, causing synchronize_rcu() to stall. > - Fixed trace_rcu_callback tracepoint > > I tested power previously [1], I am in the process of testing power again but I > wanted share my latest code as others who are testing power as well could use > the above fixes. Your patch is very likely to be _generally_ useful and therefore, the more I look into this, the more I wonder if it is a good idea to rely on bypass at all, let alone NOCB. Of course in the long term the goal is to have bypass working without NOCB but why even bothering implementing it for nocb in the first place? Several highlights: 1) NOCB is most often needed for nohz_full and the latter has terrible power management. The CPU 0 is active all the time there. 2) NOCB without nohz_full has extremely rare usecase (RT niche: https://lore.kernel.org/lkml/CAFzL-7vqTX-y06Kc3HaLqRWAYE0d=ms3TzVtZLn0c6ATrKD+Qw@mail.gmail.com/ ) 2) NOCB implies performance issues. 3) We are mixing up two very different things in a single list of callbacks: lazy callbacks and flooding callbacks, as a result we are adding lots of off-topic corner cases all around: * a seperate lazy len field to struct rcu_cblist whose purpose is much more general than just bypass/lazy * "lazy" specialized parameters to general purpose cblist management functions 4) This is further complexifying bypass core code, nocb timer management, core nocb group management, all of which being already very complicated. 5) The !NOCB implementation is going to be very different Ok I can admit one counter argument in favour of using NO_CB: -1) The scheduler can benefit from a wake CPU to run the callbacks on behalf of a bunch of idle CPUs, instead of waking up that bunch of CPUs. But still we are dealing with callbacks that can actually wait... So here is a proposal: how about forgetting NOCB for now and instead add a new RCU_LAZY_TAIL segment in the struct rcu_segcblist right after RCU_NEXT_TAIL? Then ignore that segment until some timer expiry has been met or the CPU is known to be busy? Probably some tiny bits need to be tweaked in segcblist management functions but probably not that much. And also make sure that entrain() queues to RCU_LAZY_TAIL. Then the only difference in the case of NOCB is that we add a new timer to the nocb group leader instead of a local timer in !NOCB. Now of course I'm certainly overlooking obvious things as always :) Thanks.