Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp529121lqg; Fri, 1 Mar 2024 12:25:18 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWQcvUnIE7Q03e8SMjTWQcMsNh/E91DwL1Yeeo6sYu8owBYNqM2BXxolzt2WidWJVkeU9pydV7QB/cQBVydtYxcsVTVTtdrBNIKuMpCAg== X-Google-Smtp-Source: AGHT+IFJbyRYBNLkeCiLKOGIYUTPMH832dg77xQLcpj02kHCgkQLwA4mWvsBq7SnFvml07qsIwJY X-Received: by 2002:a17:906:355a:b0:a43:f1d9:400a with SMTP id s26-20020a170906355a00b00a43f1d9400amr2318841eja.26.1709324718460; Fri, 01 Mar 2024 12:25:18 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709324718; cv=pass; d=google.com; s=arc-20160816; b=wlQeGkJAeG48BjQaR3DeB+GKKp6EGnvlHhsazAbn5eZCZr4+gl8suQK4qZqqbaihvm nn63sy2CIlPDoxEtKsBER1XVlzvwrqrs9vOYyv/RRUfducK/YE2vcjH+zhCocaAmM5yn w+b8Z3E/uvcjoJk8i+o589VeIFOe/pmrkdDwQ0+KnhWC4e22G+8VAndsLywoS+B8ST7R ATUX+PyLDqaECW6NWPf7JLlIsfjsLM/Meu273AKNmK2bB6jXJ4qfSWFOJqJIE3cc/rXJ EY4XDE1d2sH3bk1idHDLWeAEiwWQml2i9/81nNQRA8HZ323tfGX+u3Z4OKAxQuBJokm+ 0cfQ== 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=JVS6wEtoxefyJSx22GQegNPLNoesQs0KxqDfnwsGnhg=; fh=tp57ZCsx7UGLsJiFkEUQTPpTv5hE+bKQZLxL0RMdvcc=; b=wF/t++v2rBWS34TzS1nLV8O1dCp3tr26mVs+aDy8/igaF7KJiUVP2IsYqygaGhwuyo 7bNOEgZS6k0SpoaCd4cJqHW1vzNORwQUF+3HLsczh0E98IjesG470sspZ4EYgyOP6wc/ uJmjmt9TT22HnJXzAKJpr2uYuWlpbinwzHlQU3k3ggSVCQ4Pe96v7me5xqVlxVhVX8mv Rjj4vgVxLEf03OtJmukvjlWoBSLSfMWFuwABbr2MPnmnFk56X9czK8d5H06yR/Foc+Lp 4r5+G3rBqSppHheBUFWQt11PrFKT1F+/f+8i9IVREUQFyPie4wyALt3cLaqgdr00ihif ikxg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Cry3iSVZ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-89077-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-89077-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 h9-20020a170906590900b00a441102e817si1593877ejq.305.2024.03.01.12.25.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 12:25:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-89077-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=Cry3iSVZ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-89077-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-89077-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 32C171F25EA8 for ; Fri, 1 Mar 2024 20:25:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 620253C48C; Fri, 1 Mar 2024 20:25:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Cry3iSVZ" 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 88C13182B9; Fri, 1 Mar 2024 20:25:10 +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=1709324711; cv=none; b=p6HVQkPKuOODCpnVYawsH2G/VPPSNSUL5JdD1/pg0ZrbzIupcvZvMKNDLagiRbxKoCFSWrWH63KUq4oswgPqsM3ARznpUHlmSxTis/17CXEyArwi6mA6yWZYL7K5youWDycHSGfh+l9ZAm+ig2kF5g1WP8Bq5l1oK/6WHEZGpto= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709324711; c=relaxed/simple; bh=NbJWYIXhuWsSLKTuuf57NsT0HeUXNYUm+t2wP6ldURc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=pXQ/qfetiuXkjeDpnnA2bfSe+gUg5kP76AtDKj+DaFQFar28s/DbyYzneSglhMdZx81gCaBNuC+K48vNoTs82OmEP/T3KI9E02S38siZnJ+fVkS49WgfY7b77URpnAKmb/aSZ2OLID9FPVyN8D+wNgjcfZQeSn6XhmCnE1ciE6o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Cry3iSVZ; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 996BDC433F1; Fri, 1 Mar 2024 20:25:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709324710; bh=NbJWYIXhuWsSLKTuuf57NsT0HeUXNYUm+t2wP6ldURc=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=Cry3iSVZDK2HW9ERSNepVknZ0sfy0csOD8tA92/cMob9VuXSTQym6E6adCN8us2MG BpozCW6Tz9Wg89v2c8H0mQXbfMB/eYwE/Nzl8+Aa2jPhWJJSw9n/imZA3B+t02a4ML SdTyQ4eFMwyr9nHcLXAb99LeI0IDAA9eYjSP9AJOeXf2tVAby/Fkh7IVRZYEEYksgd CYzUSEcj8wD5donYnvRkX9dlwDklnG0U8Cqg4/eQ6oqf2iXYFwIqP7XD2asfiBbKrZ EvmkTP0FZ0//KQT68oFlDETuBfKNM+acU2HVKtgygyKC6QHMFCm5je/KNb6y+teiLv ES4L3cPkZ4NFw== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 3F74ACE140C; Fri, 1 Mar 2024 12:25:10 -0800 (PST) Date: Fri, 1 Mar 2024 12:25:10 -0800 From: "Paul E. McKenney" To: Steven Rostedt Cc: linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org, Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Ankur Arora , Thomas Gleixner , kernel-team@meta.com Subject: Re: [PATCH RFC ftrace] Chose RCU Tasks based on TASKS_RCU rather than PREEMPTION Message-ID: <2835d5ea-0396-49f6-88fb-be49cb998cc5@paulmck-laptop> Reply-To: paulmck@kernel.org References: <20240228152236.7a4c9eec@gandalf.local.home> 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: On Wed, Feb 28, 2024 at 01:16:04PM -0800, Paul E. McKenney wrote: > On Wed, Feb 28, 2024 at 03:22:36PM -0500, Steven Rostedt wrote: > > On Wed, 28 Feb 2024 11:38:29 -0800 > > "Paul E. McKenney" wrote: > > > > > The advent of CONFIG_PREEMPT_AUTO, AKA lazy preemption, will mean that > > > even kernels built with CONFIG_PREEMPT_NONE or CONFIG_PREEMPT_VOLUNTARY > > > might see the occasional preemption, and that this preemption just might > > > happen within a trampoline. > > > > > > Therefore, update ftrace_shutdown() to invoke synchronize_rcu_tasks() > > > based on CONFIG_TASKS_RCU instead of CONFIG_PREEMPTION. > > > > > > Only build tested. > > > > > > Signed-off-by: Paul E. McKenney > > > Cc: Steven Rostedt > > > Cc: Masami Hiramatsu > > > Cc: Mark Rutland > > > Cc: Mathieu Desnoyers > > > Cc: Ankur Arora > > > Cc: Thomas Gleixner > > > Cc: > > > > > > diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c > > > index 2da4eaa2777d6..c9e6c69cf3446 100644 > > > --- a/kernel/trace/ftrace.c > > > +++ b/kernel/trace/ftrace.c > > > @@ -3156,7 +3156,7 @@ int ftrace_shutdown(struct ftrace_ops *ops, int command) > > > * synchronize_rcu_tasks() will wait for those tasks to > > > * execute and either schedule voluntarily or enter user space. > > > */ > > > - if (IS_ENABLED(CONFIG_PREEMPTION)) > > > + if (IS_ENABLED(CONFIG_TASKS_RCU)) > > > synchronize_rcu_tasks(); > > > > What happens if CONFIG_TASKS_RCU is not enabled? Does > > synchronize_rcu_tasks() do anything? Or is it just a synchronize_rcu()? > > It is just a synchronize_rcu(). > > > If that's the case, perhaps just remove the if statement and make it: > > > > synchronize_rcu_tasks(); > > > > Not sure an extra synchronize_rcu() will hurt (especially after doing a > > synchronize_rcu_tasks_rude() just before hand! > > That would work for me. If there are no objections, I will make this > change. But I did check the latency of synchronize_rcu_tasks_rude() (about 100ms) and synchronize_rcu() (about 20ms). This is on a 80-hardware-thread x86 system that is being flooded with calls to one or the other of these two functions, but is otherwise idle. So adding that unnecessary synchronize_rcu() adds about 20% to that synchronization delay. Which might still be OK, but... In the immortal words of MS-DOS, "Are you sure?". ;-) Thanx, Paul