From patchwork Wed Feb 28 19:38:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. McKenney" X-Patchwork-Id: 208019 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp3571526dyb; Wed, 28 Feb 2024 11:45:48 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV8AphM+RaBhSFrWCwm7uOtIyzFMNkSrrcZYLcnMvf6zk4WbrYxBR5wVLXNt3V85zSzcVpJGw+3VwU1gVtFyy5GsrtRiA== X-Google-Smtp-Source: AGHT+IHrzO2j3iSjIrNUOL0HbZH/3Jga1v8grqK4eR35vHIdpX5bx1SyxwGIRfZGRXnusxOcYFXM X-Received: by 2002:a05:6a20:c91b:b0:1a0:e232:b4d5 with SMTP id gx27-20020a056a20c91b00b001a0e232b4d5mr237278pzb.53.1709149547796; Wed, 28 Feb 2024 11:45:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709149547; cv=pass; d=google.com; s=arc-20160816; b=pbGOWRf1hwTzv4tBVBwejkJ0S2vbbRC3qTLoVK1vyzdzEzgnUPE+V/v0rjtwRfPm3j 6SpthjMqt+ecBAjE3RfVHmUJew8AZm2yAM0EsnjdJ/IO9OBBpK9sqmPOjxobDysDIcEZ PuruCN5Y/nfoIQy9NT4qr2m3nWPvvpFXThPaJaSapa5Z6elU7A1yJRfTstZ06qayt0DE RXCJ+Wf8fTWBZaYiqd7fTSS2YhUaWbYHdwblLExyXnj3sUBgQsfcG126GuuSHqKcu6A7 sNET3y4EvjESD0xfQxjR0sWq1Bc3IIhKupKGiFfJ9XbxRnllrrxkcTmh/EQEbnUDtcS9 aEew== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-disposition:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=Mswom4W81eAfGBrrrJAx1kgU1xcOa1jdZNt+DroAE94=; fh=UHrhq233cCwHNLD4ywZGPj3Dd4S2gixqDJ66CgEmCUQ=; b=yM4L5gV93YYFFl1Jm3r+cNv8mEFYMUl1OW1vVP9SozWoaRcdmBhizzmiqgbsqYU0p0 uij8RtRXxE/V69E+HctpHoYknsEvS/ynWlKuQfRVlNExhr7XQAY+1ujZMNJSpXRqWxgP 1qeNPgfuZwr343DHBBhPqm364KoYa3UwPycH/V0IYO5258Nk1mwypS+8uCauQEh9/NXy ndGfCzOax8Pmf8VSlwtMmU8eCUudvd+BD6PjZ4LVjb6c8DrK54s1xGUtwuXj5WUF0F9D shgFns3+KYTaCfWD7qF1hL1cqmBkKzYE5REzODsJJul4UXgik+IDk70pDCb3UcdWQaqE Ruuw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=b1iFGEj+; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-85628-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-85628-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id c6-20020a6566c6000000b005d8b7053276si179554pgw.160.2024.02.28.11.45.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 11:45:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-85628-ouuuleilei=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=b1iFGEj+; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-85628-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-85628-ouuuleilei=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 4DA1CB234A1 for ; Wed, 28 Feb 2024 19:41:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0F2FD5E090; Wed, 28 Feb 2024 19:38:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="b1iFGEj+" 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 411F55E074; Wed, 28 Feb 2024 19:38:29 +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=1709149110; cv=none; b=ixqUwtTl2ml/mM8JNU5ovjJX+35XW81gmD8QYFWfc0B9xZAb8YIbLL0S17Us4gHT0BpqyX2t4Gi7HMZb+9v0E4N5wW0g2laCetpq/frD4AnT5y3STD8YbpDVGtc9IxgT5Fxrfccsp4WK8PSV6S+sbjs8WbgfKOsKPsbgv2q05OQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709149110; c=relaxed/simple; bh=HKsFoZKnJ34YSBFn9vTGSnBy8Xop5g9WIhcVbvX1B6E=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=PlLGcavv2I/hTYDkl/aDk6B7vHhQVQzPFCP3omfDXkgF5o2V9H3S8v72FbpplNEjAXvVAqAKR5qLkfOi2BcFUeNCVx4sTqZRj/IeHS059FTACkYCY/9DauiT0bM+zuIMi/+I6aseNuqEswKyCUdZ58HXssSgaCYPfiRKupOfao0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=b1iFGEj+; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id B1245C433C7; Wed, 28 Feb 2024 19:38:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709149109; bh=HKsFoZKnJ34YSBFn9vTGSnBy8Xop5g9WIhcVbvX1B6E=; h=Date:From:To:Cc:Subject:Reply-To:From; b=b1iFGEj+idZwyXYGELoyOx0I31GFrOItcdTvZYjxdyO8tk9y57qABVza2+j3QCN0H A29rheh2pPAOD49LuBeKJpJIqBBsYQa97eta4qmyyyfNyNhFvTXmL1NiL27dQpYkeG FpR0WCG3KxMCRt9W3nG2R9CiBg5Rb7P7Sc7cgRW6Iy+mfGbB8MqdrCj2FFyqzbT6lj rDOscHOOnD6zgn+kJIvDlbEu+cxpOlQlplajPzfJvhTud8avA79bTKBaafKxVcxPVt i7k/NQc6vs8sA+USwz3sxgYWDkBsxqpEl7RKPqFcc8uqzEk1GRqzCp/XkOGbYlQz34 BbIKnWc2aq51Q== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 4F340CE03F3; Wed, 28 Feb 2024 11:38:29 -0800 (PST) Date: Wed, 28 Feb 2024 11:38:29 -0800 From: "Paul E. McKenney" To: linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Steven Rostedt , Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Ankur Arora , Thomas Gleixner , kernel-team@meta.com Subject: [PATCH RFC ftrace] Chose RCU Tasks based on TASKS_RCU rather than PREEMPTION Message-ID: Reply-To: paulmck@kernel.org Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792172975286295499 X-GMAIL-MSGID: 1792173196325171479 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(); ftrace_trampoline_free(ops);