Received: by 2002:a05:7208:2202:b0:86:316c:7444 with SMTP id s2csp100377rbb; Thu, 30 May 2024 16:29:00 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUiWB7owjNh85MkPDpVRKHXiYodYG/cInWEJjIqs3FZwOBm4W86F0wybHLeT95OTNORHMoed3HtM//x3ZDpHTEfr9WxnRAoMxOoXwtU8A== X-Google-Smtp-Source: AGHT+IFEAWDZcs78H/PUuLsCO38R7+tEQ4KWwieu5+jXau0j3SXqlgaOODJeNQD6knec1T4TwGYx X-Received: by 2002:a05:6870:350c:b0:24f:c055:fc3b with SMTP id 586e51a60fabf-2508b783b40mr507824fac.11.1717111740160; Thu, 30 May 2024 16:29:00 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717111740; cv=pass; d=google.com; s=arc-20160816; b=0NBSaBqlMI2OEYKd4Tem8zAAWXkFpsrqXY9ZkDT8bdRtRydjxOM+BQjfdaXm47C1VQ Jd+Tt3aILtuf168B6S3Ml/u5Obr59OStWoK9nAiWqNDCvjW8+qTYjcEXRZHbInvNRMBU +zHzrWj8k9sKNibrg/o+E0dQzDrcPa/udXZohimDFO2ao0naN8Cv/0ceQ4WhLdrgeBwL VZ9/cJA8l8ZnK1MQXvPddNo+23Eavk1gCcKZY2nbl9eCEmiUDBSDNpHyhDppjtfzcmqm yj0/hGLl+c5dBcMlEHcpmdrsYCe4Xs8LOxBLbZjRjvMaVKQ930cGC/8/Pd0lpz12pmlW xhbQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=YCYS7C7bg/bVStLtRdb66Dj/tgYzmkQP0XdKEDmXJUg=; fh=3rSVSgt54mqvPl1A7FxupWP3QSmVkrcsOXNVhsGZu+o=; b=P4JGbRerqwm9iG0QQ6AwB2VJ+gzVeu4AMlkPDMKqjq+4X7ctHdEJ6HyGA7Af1T8Ckd GqqgmmZLl3afGz7TyuMI+UTWA8mwarMagFMO5j8iYoys9X3VbQVkJ8h+vITB5nuPtZRj fzWGKLngDBjbZhxcW1iJxCxIGn8/Ql3GZ14TFQkf0PEAaKJ71XfEyWK0zYwYGVBBro3n sK7ULyMXGeGxir0xoJr/bTRmSFBhEnEBfYamt84EQNgOVwsi0jRN0+zo1ahO3bh/SPSH 0VX5gMhDO1MpVUQsBYpLSNxmZT0gsqEXv6aGP2o3Cz0JNiRmR6TwB7rOlFFh0hMl10hJ qdcw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="ou7/XSLz"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-196023-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-196023-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 d2e1a72fcca58-702425ecbf9si419055b3a.81.2024.05.30.16.28.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 16:29:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-196023-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=@kernel.org header.s=k20201202 header.b="ou7/XSLz"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-196023-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-196023-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 45634B25D73 for ; Thu, 30 May 2024 23:20:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 222C917E450; Thu, 30 May 2024 23:20:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ou7/XSLz" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4224F4D8C3 for ; Thu, 30 May 2024 23:20:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717111233; cv=none; b=is5ceSs1sXBcck5t30nc1vHgUTzpdKbeppdFLPxiwH2Tlixv+YIHN4HDnDdg9x+xe6oqOEDgujwXLYvGa95BYKAcFK1VNdkA9m4wgwx7EgboTkoKQn8rrtASW0V09DR/hvTE2j4c/u6I+wCDkJ/82Q8IMoRsRZIBofFJdeNXB7c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717111233; c=relaxed/simple; bh=XhvThE/+JuRA8Pp1EUt7hg24P1MzvKOA3s/VoNCpliI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=bH+6DPYSis3+t0c9lfALHOaV3ewb76FfGOHrFHMSY+d/5kgxmkFwfkqiOYnwmzWQQxoziRE3LZt8Gu2JqcQNr5H5LxzE5jr7KxaaRALTonaa/aWrEaZdoll9MnXuLd7pOi9cNjjehdet06lS8ctOkUglN8+yqJjBYsetrxSnjcY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ou7/XSLz; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8E270C2BBFC; Thu, 30 May 2024 23:20:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717111232; bh=XhvThE/+JuRA8Pp1EUt7hg24P1MzvKOA3s/VoNCpliI=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=ou7/XSLzeOe50jbGtA1OMlu+yEZAuk6jmIQrFbGuivXe+aY+7rbXn1QqS3SQ8ljnB UNWIPewZ0+3cCfqml/oLg34UXKnOp2qkUg9E+ezH7ZhpJ0ERRkRmCVqUB75uNRg2+B 5DIzFeKnJgaeJgQDnV43QLVlwnrkNQwT9q6ZTuFZXjNmH2VMYCTcDtcax6EXu9eMVO swDk32c/rOIy7R6sxVQ81zCzT2Au/FMzw0HezWh/cf9CYkASVc+eBvZz4F++BfTe47 kwYN4iq9H+7aFvX/QpRFiY8iGS+qctmsb02I7H6uFaFZAidjbKYkJwxcLdgpg/o4pk Iy4TMMTuX2GYQ== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 96EFFCE095C; Thu, 30 May 2024 16:20:26 -0700 (PDT) Date: Thu, 30 May 2024 16:20:26 -0700 From: "Paul E. McKenney" To: Ankur Arora Cc: Peter Zijlstra , linux-kernel@vger.kernel.org, tglx@linutronix.de, torvalds@linux-foundation.org, rostedt@goodmis.org, mark.rutland@arm.com, juri.lelli@redhat.com, joel@joelfernandes.org, raghavendra.kt@amd.com, sshegde@linux.ibm.com, boris.ostrovsky@oracle.com, konrad.wilk@oracle.com, Ingo Molnar , Vincent Guittot Subject: Re: [PATCH v2 16/35] preempt,rcu: warn on PREEMPT_RCU=n, preempt=full Message-ID: Reply-To: paulmck@kernel.org References: <20240528003521.979836-1-ankur.a.arora@oracle.com> <20240528003521.979836-17-ankur.a.arora@oracle.com> <20240529081404.GI26599@noisy.programming.kicks-ass.net> <8734py6gvq.fsf@oracle.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8734py6gvq.fsf@oracle.com> On Thu, May 30, 2024 at 04:04:41PM -0700, Ankur Arora wrote: > > Peter Zijlstra writes: > > > On Mon, May 27, 2024 at 05:35:02PM -0700, Ankur Arora wrote: > >> The combination of PREEMPT_RCU=n and (PREEMPT_AUTO=y, preempt=full) > >> works at cross purposes: the RCU read side critical sections disable > >> preemption, while preempt=full schedules eagerly to minimize > >> latency. > >> > >> Warn if the user is switching to full preemption with PREEMPT_RCU=n. > >> > >> Cc: Ingo Molnar > >> Cc: Peter Zijlstra > >> Cc: Juri Lelli > >> Cc: Vincent Guittot > >> Suggested-by: Paul E. McKenney > >> Link: https://lore.kernel.org/lkml/842f589e-5ea3-4c2b-9376-d718c14fabf5@paulmck-laptop/ > >> Signed-off-by: Ankur Arora > >> --- > >> kernel/sched/core.c | 4 ++++ > >> 1 file changed, 4 insertions(+) > >> > >> diff --git a/kernel/sched/core.c b/kernel/sched/core.c > >> index d7804e29182d..df8e333f2d8b 100644 > >> --- a/kernel/sched/core.c > >> +++ b/kernel/sched/core.c > >> @@ -8943,6 +8943,10 @@ static void __sched_dynamic_update(int mode) > >> break; > >> > >> case preempt_dynamic_full: > >> + if (!IS_ENABLED(CONFIG_PREEMPT_RCU)) > >> + pr_warn("%s: preempt=full is not recommended with CONFIG_PREEMPT_RCU=n", > >> + PREEMPT_MODE); > >> + > > > > Yeah, so I don't believe this is a viable strategy. > > > > Firstly, none of these RCU patches are actually about the whole LAZY > > preempt scheme, they apply equally well (arguably better) to the > > existing PREEMPT_DYNAMIC thing. > > Agreed. > > > Secondly, esp. with the LAZY thing, you are effectively running FULL at > > all times. It's just that some of the preemptions, typically those of > > the normal scheduling class are somewhat delayed. However RT/DL classes > > are still insta preempt. > > Also, agreed. > > > Meaning that if you run anything in the realtime classes you're running > > a fully preemptible kernel. As such, RCU had better be able to deal with > > it. > > So, RCU can deal with (PREEMPT_RCU=y, PREEMPT_AUTO=y, preempt=none/voluntary/full). > Since that's basically what PREEMPT_DYNAMIC already works with. > > The other combination, (PREEMPT_RCU=n, PREEMPT_AUTO, > preempt=none/voluntary) would generally be business as usual, except, as > you say, it is really PREEMPT_RCU=n, preempt=full in disguise. > > However, as Paul says __rcu_read_lock(), for PREEMPT_RCU=n is defined as: > > static inline void __rcu_read_lock(void) > { > preempt_disable(); > } > > So, this combination -- though non standard -- should also work. > > The reason for adding the warning was because Paul had warned in > discussions earlier (see here for instance: > https://lore.kernel.org/lkml/842f589e-5ea3-4c2b-9376-d718c14fabf5@paulmck-laptop/) > > that the PREEMPT_FULL=y and PREEMPT_RCU=n is basically useless. But at > least in my understanding that's primarily a performance concern not a > correctness concern. But, Paul can probably speak to that more. > > "PREEMPT_FULL=y plus PREEMPT_RCU=n appears to be a useless > combination. All of the gains from PREEMPT_FULL=y are more than lost > due to PREEMPT_RCU=n, especially when the kernel decides to do something > like walk a long task list under RCU protection. We should not waste > people's time getting burned by this combination, nor should we waste > cycles testing it." My selfish motivation here is to avoid testing this combination unless and until someone actually has a good use for it. I do not think that anyone will ever need it, but perhaps I am suffering from a failure of imagination. If so, they hit that WARN, complain and explain their use case, and at that point I start testing it (and fixing whatever bugs have accumulated in the meantime). But until that time, I save time by avoiding testing it. Thanx, Paul