Received: by 2002:ab2:7853:0:b0:1fa:5c73:8e2d with SMTP id m19csp47908lqp; Thu, 30 May 2024 11:33:03 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWX6VqsnO/O76YjK5zNY9RST913bkmFDnYSkrqh3Dzv4TgVtdt27vFu304+LvYrm36nOunXnKQom/nL1+Pl68pnCUs7+EcBNENadUuQMg== X-Google-Smtp-Source: AGHT+IEcXeUl/Dp4tSPE3eM+H+sl/JJKPgK1WqXwc2lGmD6pBITjiIsQEudKG/m25HW16GIZ+aUO X-Received: by 2002:a50:d718:0:b0:570:38a:57ea with SMTP id 4fb4d7f45d1cf-57a1791a11emr1480042a12.33.1717093982967; Thu, 30 May 2024 11:33:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717093982; cv=pass; d=google.com; s=arc-20160816; b=HF3NOvKdLOf2Pi4jYtnS2B42otv8ZQ0d3qMDRyFHq2lbwl5hWw1uQmEZLv0hsXxj0U dG3+Tmqk5nd8qdl70TRbYfvK58w2IBaWCO0O5F4ujrtWOzsz+/U7Mw6BNw2z/DHgrQua h/KYCVOPdoNDKSyikWih5quwnL9TvOhlyojDTWbc18m5wDTzTyELG6wk5pgVvp8Wn03D 7auC8GW9f8DJUzpQU8xl1zmrGHviqLAfbHHZAasKc80ZvMoGMzxpFwZnZpnpekbT36Pq CViCINmcQxkO4/4Uz+89s/qiTd6M5LOAtodXNYI9NigzmhPuD5CyBxdmv9rVSwQMOMg0 UlGg== 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=/DGQWKi7vPfJ0aF1cfljzlcuGQ821f32XpkOjSAD3EM=; fh=/34lilXR2SFyytNDKypxy03QYQMAa03KZ2daoBz+WXQ=; b=zfLi+ADiW7LCm+UfBc2raPepECsRG4ZleNf6QH2wOqeeGKI/Ah6yEWhyevWM9hGHLQ lVI+uCXAEx0wRT6fuVTT+sPpzcQmCmZ2q8P1C2zuEM2czSdWEEi90YWjljd/vDYXKTfw qq0ZJgihRNmNu7/HYuu8Dw73nzP3LK146xVfVX8wFXrDjESuFvF1sjLcoelUHDPi1Nfc H7k4B/KTVIFYTPPK4UFtK3LOrWTJQzIZDOIv9ry7ydOB3vMjuMqyuC4rdy27m+Ksz31Q 15EcsiHAwpQHgkStDuicFkSMtx1CM/2s5kVwNPmwxYuHdaxfu5Lo4oS/q1lvlPozzwoS 3Vbw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mAAEJizx; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-195787-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-195787-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57a31b81313si89340a12.53.2024.05.30.11.33.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 11:33:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-195787-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mAAEJizx; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-195787-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-195787-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 am.mirrors.kernel.org (Postfix) with ESMTPS id AC5091F22D85 for ; Thu, 30 May 2024 18:33:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 431754D5B0; Thu, 30 May 2024 18:32:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="mAAEJizx" 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 6C49C1BDDC for ; Thu, 30 May 2024 18:32:56 +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=1717093976; cv=none; b=UlqJzemGUdOB0zviLCFgGc1Y+xIS0fsVZDq+u+GC8MHFHZbL8rdI8arVZZvgT3jvzUONFJes93XWAE2lw0A74RXoRko77I34MNbqtSbwrb1lzxue/5knHcAeY0shbnKGtnQ3FOIMOQPH1mzp6/MQ4veEVrrdp9U/RjjHgZ2WALw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717093976; c=relaxed/simple; bh=gNqTWo2XHLxvBsJqH+AAZXFzbYlY/JjkMwxPP5WTT94=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=c/dwoAU63eN5WoUQ34m+l+zFVdL4cB4AvsTn2MS24dfKVjCcl4JaopbcaRiD2DqNCO+fBe0n1DvYG5LyTJpofYKt7/vvSQwtJ6YnB1LJvr59B5OcG/l+ivP50L8NmEF87EMnURNMrCDhFv7cWMGI4kYUrEBl04CtYknGXCF1Ioo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=mAAEJizx; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 04EBDC2BBFC; Thu, 30 May 2024 18:32:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717093976; bh=gNqTWo2XHLxvBsJqH+AAZXFzbYlY/JjkMwxPP5WTT94=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=mAAEJizxIWZn+AdcqNLKayKsKHntMJb8L/lOEfC8IzjYLoALtSdORxDZf1mGCuOrc zkmyfbHDWXMtIMIOoKmknVjoq7E+0YnusqyBAeuePnowPj0baYZQQZh5nqo6/qMW4D jSiECPbmN5wHUAaUyYNqCUt2N5D699AxaX7m/g2MZ4ZOR2YN4Rn0Y5cFu2Oi8as6Ms Wwy7/yJN0DcLhf45tQvQmByQzixH96XPK0VvaAgJ/pg4x2OrqhFFyEOQy83rbRxeAd MJ9ChikIN0+VKuCHAdX9qL8UQq60q+15qegKou/bJap1beC8eneufUGPFBaQPLht2n VV1T9GmWX3yfw== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 3C588CE075F; Thu, 30 May 2024 11:32:55 -0700 (PDT) Date: Thu, 30 May 2024 11:32:55 -0700 From: "Paul E. McKenney" To: Peter Zijlstra Cc: Ankur Arora , 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> 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: <20240529081404.GI26599@noisy.programming.kicks-ass.net> On Wed, May 29, 2024 at 10:14:04AM +0200, Peter Zijlstra wrote: > 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. > > 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. > > 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 no, I don't believe this is right. At one point, lazy preemption selected PREEMPT_COUNT (which I am not seeing in this version, perhaps due to blindness on my part). Of course, selecting PREEMPT_COUNT would result in !PREEMPT_RCU kernel's rcu_read_lock() explicitly disabling preemption, thus avoiding preemption (including lazy preemption) in RCU read-side critical sections. Ankur, what am I missing here? Thanx, Paul