Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp4793126rwb; Tue, 6 Sep 2022 12:50:05 -0700 (PDT) X-Google-Smtp-Source: AA6agR7vTzTuvfl+++WsEQCS+cM9irwSwJHBwyhua6HcjvHAwIMObqfUzrT+YHAawx4X55KfMIZL X-Received: by 2002:a17:902:f711:b0:170:9e3c:1540 with SMTP id h17-20020a170902f71100b001709e3c1540mr54214882plo.22.1662493804986; Tue, 06 Sep 2022 12:50:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662493804; cv=none; d=google.com; s=arc-20160816; b=04KyOvQ5/E8F+NIlZ2lw7rrayA/JXt41P7I4McP8AA2k8aLKYuOsaibBQmJiuHIIdr B/x6EGHgRLfEo6tMayhZmZNiAxQtpECnXzymL15I+3TlfqneToc0HN4j502ext7JNZVd l3P/2Cij24CYYTBzv24lcE5MH9j+VFEHSA6MI1KqDyX4wnc+OWRDwH/Lc8BKFjI0Hq4c vGvi6TWbQ7sv/SompqtG5noCiPpIuSkhPivUcwyW2pNnmKES8ZZKu2/JvCxbskAdMrDJ I4deQvmY9JPeiXk5EzT98dSMEOHoqYjJ5JDZOpg493+H7wK4N+QvM8QBPfmem0xzjzj0 J3Hg== 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=euxCRGMeSiERh47u8SlkJ89NJ2EGLwQatyuPyE9TJxo=; b=WaNnw1OtHjNtMIkdc/o76xMxbYvOhKsW0DytrLGm4WZMJzay5E0E4W4cEk3RZwjyRY FeDfImaqujNPd6NC9CJ11Ge3qMUG7t0uSXdcHiyHjLG38x5MbKbuo+jxzvaB5ybDFvfB /DNfvLkNjgSyyLWsd+JuDif4iCi49oiuZd4+NypUu8PfXYEvxS++KWhe3TnL+YTmTFBX hEGsFdo1PxXu9SP0p7KVkBWTX06ELf63+bJZSjlhsudVDADwKykl8Ei4pdIy86nsEBhK 1jJEJXtH83J8LXiFnsm3Uv0A0NjAMogUzydiaPXRQvra40EqdUKnRO50yjOBDsOf9Ncu Swfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hCJaUttR; 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 25-20020a631759000000b0042acd4e78efsi124210pgx.669.2022.09.06.12.49.53; Tue, 06 Sep 2022 12:50:04 -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=hCJaUttR; 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 S229746AbiIFTLY (ORCPT + 99 others); Tue, 6 Sep 2022 15:11:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229721AbiIFTLU (ORCPT ); Tue, 6 Sep 2022 15:11:20 -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 C7C9DA2D97; Tue, 6 Sep 2022 12:11:15 -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 45657B819F7; Tue, 6 Sep 2022 19:11:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 900FEC433C1; Tue, 6 Sep 2022 19:11:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1662491472; bh=I2thZSdsMA3fAvQeM9frwdjRPaDPr7Ghu/hTt+TPzy4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=hCJaUttRCTAa7ZyovROYIPZpH2DCmCqtP430NHFmrESACmlK0JcaP0r69c1ZtfYYl S2oH/cGOWmqUyrsz9IwSmehKBiiG9pd0F9fEOkfDRIUEXiTpmFrbDpwcJM1vSh8DDZ Esatx2eS7D2pdwLmRw4aZTcAcC5zLn4ozmz4n4yGVP2JTqmF4bHQ8MuzK6X9rXnONY LcyYoMstLFMVGz2RJ4p1lazjpapwQcXpCzxblRMW+7I85//IVSie++B0fVDAWbzubg E0YAUtQV/2/CUI9XS4EKysseVpwdf/bW5e0vV4e/1Z9ukNFkk0PXPsm4VlS4x4wBuO mbfkvFFtUzieA== Date: Tue, 6 Sep 2022 21:11:10 +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, vineeth@bitbyteword.org, boqun.feng@gmail.com Subject: Re: [PATCH v5 06/18] rcu: Introduce call_rcu_lazy() API implementation Message-ID: <20220906191110.GA187950@lothringen> References: <20220901221720.1105021-1-joel@joelfernandes.org> <20220901221720.1105021-7-joel@joelfernandes.org> <20220902152132.GA115525@lothringen> <20220906151757.GA183806@lothringen> <64f5770c-df37-8975-200d-7908de23fa73@joelfernandes.org> <4f6061f0-0de7-2916-dc6e-9f5af9b944c0@joelfernandes.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4f6061f0-0de7-2916-dc6e-9f5af9b944c0@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 Tue, Sep 06, 2022 at 12:43:52PM -0400, Joel Fernandes wrote: > On 9/6/2022 12:38 PM, Joel Fernandes wrote: > Ah, now I know why I got confused. I *used* to flush the bypass list before when > !lazy CBs showed up. Paul suggested this is overkill. In this old overkill > method, I was missing a wake up which was likely causing the boot regression. > Forcing a wake up fixed that. Now in v5 I make it such that I don't do the flush > on a !lazy rate-limit. > > I am sorry for the confusion. Either way, in my defense this is just an extra > bit of code that I have to delete. This code is hard. I have mostly relied on a > test-driven development. But now thanks to this review and I am learning the > code more and more... Yeah this code is hard. Especially as it's possible to flush from both sides and queue the timer from both sides. And both sides read the bypass/lazy counter locklessly. But only call_rcu_*() can queue/increase the bypass size whereas only nocb_gp_wait() can cancel the timer. Phew! Among the many possible dances between rcu_nocb_try_bypass() and nocb_gp_wait(), I haven't found a way yet for the timer to be set to LAZY when it should be BYPASS (or other kind of accident such as an ignored callback). In the worst case we may arm an earlier timer than necessary (RCU_NOCB_WAKE_BYPASS instead of RCU_NOCB_WAKE_LAZY for example). Famous last words... > Thanks, > > - Joel > > >