Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp7001611rdb; Fri, 15 Dec 2023 14:48:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IGNMR8KIaYrtY9sovtHfpa/taxF4Fvy95on2qOaMTWCnUmunPdmR6minFYF9mj8cZrQNsCJ X-Received: by 2002:a17:902:ebcd:b0:1d0:c906:f5e0 with SMTP id p13-20020a170902ebcd00b001d0c906f5e0mr15305721plg.72.1702680505530; Fri, 15 Dec 2023 14:48:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702680505; cv=none; d=google.com; s=arc-20160816; b=cxZyzvsOZkypA4WEzW15+S3gcNOrLMxE5/agBjbUf2B2WUkG9Fjc1rKOY5Jql47kPk Czs1knI1CWoM6Peunpr24F3a+u/Fsqk8gmASxwitQV6kkAPho7Nq0TldIGzWzq5/0qk0 x5scVwMUpgnoTJ7TGXFuSGYXHG6hvqPOTXySHqtwnsbotB95wv4e0IB6mVrddB3M5g8z s4XlkeBviiPkE1sSN/ZGJsqp8PJAY8pTBH5N2mtfb5RCoh2aJ3PrABl3sZVhIxIKoOWm EaY2mc2/QJi3+PFAUrsNq1LmKULkCr89Gs06MRklIFeIPxvHwoL+p9QHuZ5XOVbyhUDl VfAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=XIWED5BaLhRY/GkvDBwpljGf7EHBV+YYams2Uza/KBE=; fh=Vx3pwgmnemWm+9YMKxX5N1WnwdPf5ZjKwbPpmwcm+qI=; b=gWVymNIZBUExfpwWbgrEm/NvqvsA9zQ/6eZ0D4QXXArW89amMxGVZNDZfwpfLnSbQn XI629Xp5DdCiBQRKTsGyJxNsSPOyLq/snJshDBappbTUNy/48RDGg25oVgavWe/BUclC P3irL+boDHNxOCAali8RAqUIgFa351kyf+F+Vi2hh5HGy742ZRGshoYMtPF2E0wscyJ7 Wb+N0d/xi+dxlB8kuTBMR1wo3pUcDDsECt2JVuytrFGfLrBY1Z5BvcQmPzsmddHN/24z pdwIZzleGtYTP7KDs/MmevaVIvbpyaVlMNXTyH+FWxDy3NerjyYYtjEW0snmO+YpyJ2r pn7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=OAbuHoNq; spf=pass (google.com: domain of linux-kernel+bounces-1791-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1791-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id u9-20020a170902e80900b001cf579f758asi14072430plg.437.2023.12.15.14.48.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 14:48:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-1791-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=OAbuHoNq; spf=pass (google.com: domain of linux-kernel+bounces-1791-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1791-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 0B0E5B20F0A for ; Fri, 15 Dec 2023 22:48:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 991F45F845; Fri, 15 Dec 2023 22:48:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=joelfernandes.org header.i=@joelfernandes.org header.b="OAbuHoNq" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-lj1-f170.google.com (mail-lj1-f170.google.com [209.85.208.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EC9725F843 for ; Fri, 15 Dec 2023 22:48:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=joelfernandes.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=joelfernandes.org Received: by mail-lj1-f170.google.com with SMTP id 38308e7fff4ca-2c9f559b82cso11704411fa.0 for ; Fri, 15 Dec 2023 14:48:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; t=1702680489; x=1703285289; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=XIWED5BaLhRY/GkvDBwpljGf7EHBV+YYams2Uza/KBE=; b=OAbuHoNqA5zSlwKqAHuhhVkJ7izLcQgTNc0Cnt8hGgjACBp0FZfNoRQxU3F9KWRTZB CyD4tChU3sKJuRMJyQCruY6cl3s8zIoTjAII9EvftYvzLg8Gvwj7rzJKeWI+X6+VEZt5 46jBvvVRbP2rKXHabI8olFl2sSrnV1h0RnFeA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702680489; x=1703285289; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XIWED5BaLhRY/GkvDBwpljGf7EHBV+YYams2Uza/KBE=; b=rTtiVbBcMx832tiTobTB7God5NvjLtzgZvOiRMTsntlaAcqS+e46Yt54Pto2QDD+SL 7+I/Si059JEk3A1LLpN31jdOFfBUbzpIq2v3Kb999rtGDmiwLIZf57xcM9q4crqk+Swg SrAQFF+d5Ei93BC20uFrD5qZuESfaJkb/OtFu0Hu4yFid+euzfDSHvnHr5sNkd5JHGS7 QH81apwhWTwEg9RaKpnw6kafN6bskLXXygVtDpot2y2okFJYTEp0ByvwmXMvPF1ovSwf /XQPDOi5HfRkd0JPegwVfW5di6EmeiHetL/dLfBDdlOGX1LdMC6CiqzN6GaX8+TxF0Or iECg== X-Gm-Message-State: AOJu0YwQ6Y3PV3LUEm9L/s1QlxTDnukHSBU+gT50ZoPU7lSInbzZMRlY O8urWTsuJfnHygkXvxRf9hcKCew0TDqjqSrIHeDX7Q== X-Received: by 2002:a05:651c:151:b0:2cc:430a:a3c6 with SMTP id c17-20020a05651c015100b002cc430aa3c6mr1541241ljd.77.1702680488844; Fri, 15 Dec 2023 14:48:08 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20231203011252.233748-1-qyousef@layalina.io> In-Reply-To: From: Joel Fernandes Date: Fri, 15 Dec 2023 17:47:57 -0500 Message-ID: Subject: Re: [PATCH v2] rcu: Provide a boot time parameter to control lazy RCU To: paulmck@kernel.org Cc: Uladzislau Rezki , Qais Yousef , Frederic Weisbecker , Neeraj Upadhyay , Josh Triplett , Boqun Feng , Steven Rostedt , Mathieu Desnoyers , Lai Jiangshan , Zqiang , Andrea Righi , John Stultz , linux-kernel@vger.kernel.org, rcu@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Dec 15, 2023 at 1:46=E2=80=AFPM Paul E. McKenney wrote: > > On Fri, Dec 15, 2023 at 05:58:55PM +0100, Uladzislau Rezki wrote: > > Hello, Joel! > > > > > [....] > > > > > > > + Use rcutree.enable_rcu_lazy=3D0 to turn it off at boo= t time. > > > > > > > + > > > > > > > +config RCU_LAZY_DEFAULT_OFF > > > > > > > + bool "Turn RCU lazy invocation off by default" > > > > > > > + depends on RCU_LAZY > > > > > > > + default n > > > > > > > + help > > > > > > > + Allows building the kernel with CONFIG_RCU_LAZY=3Dy y= et keep it default > > > > > > > + off. Boot time param rcutree.enable_rcu_lazy=3D1 can = be used to switch > > > > > > > + it back on. > > > > > > > + > > > > > > > config RCU_DOUBLE_CHECK_CB_TIME > > > > > > > bool "RCU callback-batch backup time check" > > > > > > > depends on RCU_EXPERT > > > > > > > diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c > > > > > > > index 3ac3c846105f..8b7675624815 100644 > > > > > > > --- a/kernel/rcu/tree.c > > > > > > > +++ b/kernel/rcu/tree.c > > > > > > > @@ -2719,6 +2719,9 @@ __call_rcu_common(struct rcu_head *head= , rcu_callback_t func, bool lazy_in) > > > > > > > } > > > > > > > > > > > > > > #ifdef CONFIG_RCU_LAZY > > > > > > > +static bool enable_rcu_lazy __read_mostly =3D !IS_ENABLED(CO= NFIG_RCU_LAZY_DEFAULT_OFF); > > > > > > > +module_param(enable_rcu_lazy, bool, 0444); > > > > > > > + > > > > > > > /** > > > > > > > * call_rcu_hurry() - Queue RCU callback for invocation afte= r grace period, and > > > > > > > * flush all lazy callbacks (including the new one) to the m= ain ->cblist while > > > > > > > @@ -2744,6 +2747,8 @@ void call_rcu_hurry(struct rcu_head *he= ad, rcu_callback_t func) > > > > > > > __call_rcu_common(head, func, false); > > > > > > > } > > > > > > > EXPORT_SYMBOL_GPL(call_rcu_hurry); > > > > > > > +#else > > > > > > > +#define enable_rcu_lazy false > > > > > > > #endif > > > > > > > > > > > > > > /** > > > > > > > @@ -2792,7 +2797,7 @@ EXPORT_SYMBOL_GPL(call_rcu_hurry); > > > > > > > */ > > > > > > > void call_rcu(struct rcu_head *head, rcu_callback_t func) > > > > > > > { > > > > > > > - __call_rcu_common(head, func, IS_ENABLED(CONFIG_RCU_LAZ= Y)); > > > > > > > + __call_rcu_common(head, func, enable_rcu_lazy); > > > > > > > } > > > > > > > EXPORT_SYMBOL_GPL(call_rcu); > > > > > > > > > > > > > I think, it makes sense. Especially for devices/systems where i= t is hard > > > > > > to recompile the kernel and deploy it. For example, Google and = GKI approach. > > > > > > > > > > My concerns had nothing to do with recompiling the kernel. Passin= g a > > > > > boot parameter (without a kernel compile) can just as well > > > > > default-disable the feature. > > > > > > > > > > I think what Qais is saying is that passing a boot parameter is i= tself > > > > > a hassle in Android (something I did not know about) because of G= KI > > > > > etc. > > > > > > > > > That is true. Doing: > > > > > > > > echo 1 > /sys/.../enable_lazy > > > > > > > > is a way how to make it easy and flexible. > > > > > > Hey Vlad, are you suggesting that the boot parameter be made to > > > support runtime? We can keep that for later as it may get complicated= . > > > Qais's boot parameter is designed only for boot time. > > > > > No problem. Yes, i meant a runtime one. But as you stated there might > > be hidden issues witch we are not aware of yet. > > My current thought is that Qais's version currently in -rcu for > the merge window after next (v6.9) suits our current situation. > But if we are eventually able to support runtime changes to this new > rcutree.enable_rcu_lazy module parameter via simplification to the > rcu_nocb_try_bypass() function (or maybe a better analysis of it), > then at that point it would be good to allow this module parameter to > be changed via sysfs at runtime. Yes, that's right. > Does that make sense, or am I missing some aspect or use case? No you are not missing anything. Thanks.