linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: peterz@infradead.org
Cc: richard.henderson@linaro.org, ink@jurassic.park.msu.ru,
	mattst88@gmail.com, vgupta@kernel.org, linux@armlinux.org.uk,
	ulli.kroll@googlemail.com, linus.walleij@linaro.org,
	shawnguo@kernel.org, Sascha Hauer <s.hauer@pengutronix.de>,
	kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com,
	tony@atomide.com, khilman@kernel.org, catalin.marinas@arm.com,
	will@kernel.org, guoren@kernel.org, bcain@quicinc.com,
	chenhuacai@kernel.org, kernel@xen0n.name, geert@linux-m68k.org,
	sammy@sammy.net, monstr@monstr.eu, tsbogend@alpha.franken.de,
	dinguyen@kernel.org, jonas@southpole.se,
	stefan.kristiansson@saunalahti.fi, shorne@gmail.com,
	James.Bottomley@HansenPartnership.com, deller@gmx.de,
	mpe@ellerman.id.au, npiggin@gmail.com,
	christophe.leroy@csgroup.eu, paul.walmsley@sifive.com,
	palmer@dabbelt.com, aou@eecs.berkeley.edu, hca@linux.ibm.com,
	gor@linux.ibm.com, agordeev@linux.ibm.com,
	borntraeger@linux.ibm.com, svens@linux.ibm.com,
	ysato@users.sourceforge.jp, dalias@libc.org, davem@davemloft.net,
	richard@nod.at, anton.ivanov@cambridgegreys.com,
	johannes@sipsolutions.net, tglx@linutronix.de, mingo@redhat.com,
	bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org,
	hpa@zytor.com, acme@kernel.org, mark.rutland@arm.com,
	alexander.shishkin@linux.intel.com, jolsa@kernel.org,
	namhyung@kernel.org, jgross@suse.com, srivatsa@csail.mit.edu,
	amakhalov@vmware.com, pv-drivers@vmware.com,
	boris.ostrovsky@oracle.com, chris@zankel.net, jcmvbkbc@gmail.com,
	rafael@kernel.org, lenb@kernel.org, pavel@ucw.cz,
	gregkh@linuxfoundation.org, mturquette@baylibre.com,
	sboyd@kernel.org, daniel.lezcano@linaro.org,
	lpieralisi@kernel.org, sudeep.holla@arm.com, agross@kernel.org,
	bjorn.andersson@linaro.org, konrad.dybcio@somainline.org,
	anup@brainfault.org, thierry.reding@gmail.com,
	jonathanh@nvidia.com, jacob.jun.pan@linux.intel.com,
	atishp@atishpatra.org, Arnd Bergmann <arnd@arndb.de>,
	yury.norov@gmail.com, andriy.shevchenko@linux.intel.com,
	linux@rasmusvillemoes.dk, dennis@kernel.org, tj@kernel.org,
	cl@linux.com, rostedt@goodmis.org, pmladek@suse.com,
	senozhatsky@chromium.org, john.ogness@linutronix.de,
	juri.lelli@redhat.com, vincent.guittot@linaro.org,
	dietmar.eggemann@arm.com, bsegall@google.com, mgorman@suse.de,
	bristot@redhat.com, vschneid@redhat.com, fweisbec@gmail.com,
	ryabinin.a.a@gmail.com, glider@google.com, andreyknvl@gmail.com,
	dvyukov@google.com, vincenzo.frascino@arm.com,
	Andrew Morton <akpm@linux-foundation.org>,
	jpoimboe@kernel.org, linux-alpha@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-snps-arc@lists.infradead.org,
	linux-omap@vger.kernel.org, linux-csky@vger.kernel.org,
	linux-hexagon@vger.kernel.org, linux-ia64@vger.kernel.org,
	loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org,
	linux-mips@vger.kernel.org, openrisc@lists.librecores.org,
	linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
	linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org,
	linux-sh@vger.kernel.org, sparclinux@vger.kernel.org,
	linux-um@lists.infradead.org, linux-perf-users@vger.kernel.org,
	virtualization@lists.linux-foundation.org,
	linux-xtensa@linux-xtensa.org, linux-acpi@vger.kernel.org,
	linux-pm@vger.kernel.org, linux-clk@vger.kernel.org,
	linux-arm-msm@vger.kernel.org, linux-tegra@vger.kernel.org,
	linux-arch@vger.kernel.org, kasan-dev@googlegroups.com
Subject: [PATCH v2 33/44] ftrace: WARN on rcuidle
Date: Mon, 19 Sep 2022 12:00:12 +0200	[thread overview]
Message-ID: <20220919101522.573936213@infradead.org> (raw)
In-Reply-To: 20220919095939.761690562@infradead.org

CONFIG_GENERIC_ENTRY disallows any and all tracing when RCU isn't
enabled.

XXX if s390 (the only other GENERIC_ENTRY user as of this writing)
isn't comfortable with this, we could switch to
HAVE_NOINSTR_VALIDATION which is x86_64 only atm.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
 include/linux/tracepoint.h |   13 ++++++++++++-
 kernel/trace/trace.c       |    3 +++
 2 files changed, 15 insertions(+), 1 deletion(-)

--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -178,6 +178,16 @@ static inline struct tracepoint *tracepo
 #endif /* CONFIG_HAVE_STATIC_CALL */
 
 /*
+ * CONFIG_GENERIC_ENTRY archs are expected to have sanitized entry and idle
+ * code that disallow any/all tracing/instrumentation when RCU isn't watching.
+ */
+#ifdef CONFIG_GENERIC_ENTRY
+#define RCUIDLE_COND(rcuidle)	(rcuidle)
+#else
+#define RCUIDLE_COND(rcuidle)	(rcuidle && in_nmi())
+#endif
+
+/*
  * it_func[0] is never NULL because there is at least one element in the array
  * when the array itself is non NULL.
  */
@@ -189,7 +199,8 @@ static inline struct tracepoint *tracepo
 			return;						\
 									\
 		/* srcu can't be used from NMI */			\
-		WARN_ON_ONCE(rcuidle && in_nmi());			\
+		if (WARN_ON_ONCE(RCUIDLE_COND(rcuidle)))		\
+			return;						\
 									\
 		/* keep srcu and sched-rcu usage consistent */		\
 		preempt_disable_notrace();				\
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -3104,6 +3104,9 @@ void __trace_stack(struct trace_array *t
 		return;
 	}
 
+	if (WARN_ON_ONCE(IS_ENABLED(CONFIG_GENERIC_ENTRY)))
+		return;
+
 	/*
 	 * When an NMI triggers, RCU is enabled via ct_nmi_enter(),
 	 * but if the above rcu_is_watching() failed, then the NMI



  parent reply	other threads:[~2022-09-19 10:23 UTC|newest]

Thread overview: 87+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-19  9:59 [PATCH v2 00/44] cpuidle,rcu: Clean up the mess Peter Zijlstra
2022-09-19  9:59 ` [PATCH v2 01/44] x86/perf/amd: Remove tracing from perf_lopwr_cb() Peter Zijlstra
2022-09-19  9:59 ` [PATCH v2 02/44] x86/idle: Replace x86_idle with a static_call Peter Zijlstra
2022-09-19  9:59 ` [PATCH v2 03/44] cpuidle/poll: Ensure IRQ state is invariant Peter Zijlstra
2022-09-19 13:19   ` Frederic Weisbecker
2022-09-20  8:57     ` Peter Zijlstra
2022-09-20 10:43       ` Frederic Weisbecker
2022-09-19  9:59 ` [PATCH v2 04/44] cpuidle: Move IRQ state validation Peter Zijlstra
2022-09-19  9:59 ` [PATCH v2 05/44] cpuidle,riscv: Push RCU-idle into driver Peter Zijlstra
2022-09-19 11:54   ` Anup Patel
2022-09-19 13:46   ` Frederic Weisbecker
2022-09-19  9:59 ` [PATCH v2 06/44] cpuidle,tegra: " Peter Zijlstra
2022-09-19 14:05   ` Frederic Weisbecker
2022-09-19  9:59 ` [PATCH v2 07/44] cpuidle,psci: " Peter Zijlstra
2022-09-19 14:11   ` Frederic Weisbecker
2022-09-21 21:51   ` Kajetan Puchalski
2022-09-22  0:45   ` Guo Ren
2022-09-19  9:59 ` [PATCH v2 08/44] cpuidle,imx6: " Peter Zijlstra
2022-09-19 14:21   ` Frederic Weisbecker
2022-09-19 15:00     ` Peter Zijlstra
2022-09-20  8:58     ` Peter Zijlstra
2022-09-20  9:01       ` Frederic Weisbecker
2022-09-19 14:49   ` Frederic Weisbecker
2022-09-19 15:01     ` Peter Zijlstra
2022-09-19 15:03     ` Peter Zijlstra
2022-09-19 15:17       ` Frederic Weisbecker
2022-09-19  9:59 ` [PATCH v2 09/44] cpuidle,omap3: " Peter Zijlstra
2022-09-19 14:31   ` Frederic Weisbecker
2022-09-19 15:19     ` Peter Zijlstra
2022-09-20  8:39       ` Frederic Weisbecker
2022-09-19 14:43   ` Frederic Weisbecker
2022-09-19  9:59 ` [PATCH v2 10/44] cpuidle,armada: " Peter Zijlstra
2022-09-19 14:39   ` Frederic Weisbecker
2022-09-19  9:59 ` [PATCH v2 11/44] cpuidle,omap4: " Peter Zijlstra
2022-09-20 10:53   ` Frederic Weisbecker
2022-09-19  9:59 ` [PATCH v2 12/44] cpuidle,dt: " Peter Zijlstra
2022-10-04 11:03   ` Ulf Hansson
2022-10-04 11:43     ` Ulf Hansson
2022-11-16 15:29     ` Peter Zijlstra
2022-11-22 16:04       ` Ulf Hansson
2022-09-19  9:59 ` [PATCH v2 13/44] cpuidle: Fix ct_idle_*() usage Peter Zijlstra
2022-09-19  9:59 ` [PATCH v2 14/44] cpuidle,cpu_pm: Remove RCU fiddling from cpu_pm_{enter,exit}() Peter Zijlstra
2022-10-04 11:04   ` Ulf Hansson
2022-09-19  9:59 ` [PATCH v2 15/44] acpi_idle: Remove tracing Peter Zijlstra
2022-09-19  9:59 ` [PATCH v2 16/44] cpuidle: Annotate poll_idle() Peter Zijlstra
2022-09-19  9:59 ` [PATCH v2 17/44] objtool/idle: Validate __cpuidle code as noinstr Peter Zijlstra
2022-09-19  9:59 ` [PATCH v2 18/44] cpuidle,intel_idle: Fix CPUIDLE_FLAG_IRQ_ENABLE *again* Peter Zijlstra
2022-09-19  9:59 ` [PATCH v2 19/44] cpuidle,intel_idle: Fix CPUIDLE_FLAG_INIT_XSTATE Peter Zijlstra
2022-09-19  9:59 ` [PATCH v2 20/44] cpuidle,intel_idle: Fix CPUIDLE_FLAG_IBRS Peter Zijlstra
2022-09-19 10:00 ` [PATCH v2 21/44] arch/idle: Change arch_cpu_idle() IRQ behaviour Peter Zijlstra
2022-09-20  5:08   ` Guo Ren
2022-09-19 10:00 ` [PATCH v2 22/44] x86/tdx: Remove TDX_HCALL_ISSUE_STI Peter Zijlstra
2022-09-19 10:00 ` [PATCH v2 23/44] arm,smp: Remove trace_.*_rcuidle() usage Peter Zijlstra
2022-10-04 11:08   ` Ulf Hansson
2022-09-19 10:00 ` [PATCH v2 24/44] arm64,smp: " Peter Zijlstra
2022-09-19 10:00 ` [PATCH v2 25/44] printk: " Peter Zijlstra
2022-09-20  2:49   ` Sergey Senozhatsky
2022-09-19 10:00 ` [PATCH v2 26/44] time/tick-broadcast: Remove RCU_NONIDLE usage Peter Zijlstra
2022-09-19 10:00 ` [PATCH v2 27/44] cpuidle,sched: Remove annotations from TIF_{POLLING_NRFLAG,NEED_RESCHED} Peter Zijlstra
2022-09-19 10:00 ` [PATCH v2 28/44] cpuidle,mwait: Make noinstr clean Peter Zijlstra
2022-09-19 10:00 ` [PATCH v2 29/44] cpuidle,tdx: Make tdx " Peter Zijlstra
2022-09-19 10:00 ` [PATCH v2 30/44] cpuidle,xenpv: Make more PARAVIRT_XXL " Peter Zijlstra
2022-09-19 10:45   ` Juergen Gross
2022-09-19 10:00 ` [PATCH v2 31/44] cpuidle,nospec: Make " Peter Zijlstra
2022-09-19 10:00 ` [PATCH v2 32/44] cpuidle,acpi: " Peter Zijlstra
2022-09-19 10:00 ` Peter Zijlstra [this message]
2022-09-26 18:41   ` [PATCH v2 33/44] ftrace: WARN on rcuidle Steven Rostedt
2022-10-04 17:19   ` Mark Rutland
2022-09-19 10:00 ` [PATCH v2 34/44] cpuidle,omap3: Use WFI for omap3_pm_idle() Peter Zijlstra
2022-09-19 10:00 ` [PATCH v2 35/44] cpuidle,omap3: Push RCU-idle into omap_sram_idle() Peter Zijlstra
2022-09-19 10:00 ` [PATCH v2 36/44] cpuidle,omap4: Push RCU-idle into omap4_enter_lowpower() Peter Zijlstra
2022-09-19 10:00 ` [PATCH v2 37/44] arm,omap2: Use WFI for omap2_pm_idle() Peter Zijlstra
2022-09-27  6:21   ` Tony Lindgren
2022-09-19 10:00 ` [PATCH v2 38/44] cpuidle,powerdomain: Remove trace_.*_rcuidle() Peter Zijlstra
2022-10-04 11:12   ` Ulf Hansson
2022-09-19 10:00 ` [PATCH v2 39/44] cpuidle,clk: " Peter Zijlstra
2022-10-04 11:09   ` Ulf Hansson
2022-09-19 10:00 ` [PATCH v2 40/44] ubsan: Fix objtool UACCESS warns Peter Zijlstra
2022-09-19 10:00 ` [PATCH v2 41/44] intel_idle: Add force_irq_on module param Peter Zijlstra
2022-09-19 10:00 ` [PATCH v2 42/44] entry,kasan,x86: Disallow overriding mem*() functions Peter Zijlstra
2022-09-19 10:00 ` [PATCH v2 43/44] sched: Always inline __this_cpu_preempt_check() Peter Zijlstra
2022-09-19 10:00 ` [PATCH v2 44/44] arm64,riscv,perf: Remove RCU_NONIDLE() usage Peter Zijlstra
2022-09-19 15:21 ` [PATCH v2 00/44] cpuidle,rcu: Clean up the mess Rafael J. Wysocki
2022-09-20 12:31 ` Frederic Weisbecker
2022-09-20 14:04 ` Peter Zijlstra
2022-09-27  6:31 ` Tony Lindgren
2022-10-04 15:15 ` Ulf Hansson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220919101522.573936213@infradead.org \
    --to=peterz@infradead.org \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=acme@kernel.org \
    --cc=agordeev@linux.ibm.com \
    --cc=agross@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=amakhalov@vmware.com \
    --cc=andreyknvl@gmail.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=anton.ivanov@cambridgegreys.com \
    --cc=anup@brainfault.org \
    --cc=aou@eecs.berkeley.edu \
    --cc=arnd@arndb.de \
    --cc=atishp@atishpatra.org \
    --cc=bcain@quicinc.com \
    --cc=bjorn.andersson@linaro.org \
    --cc=boris.ostrovsky@oracle.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=bp@alien8.de \
    --cc=bristot@redhat.com \
    --cc=bsegall@google.com \
    --cc=catalin.marinas@arm.com \
    --cc=chenhuacai@kernel.org \
    --cc=chris@zankel.net \
    --cc=christophe.leroy@csgroup.eu \
    --cc=cl@linux.com \
    --cc=dalias@libc.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=dave.hansen@linux.intel.com \
    --cc=davem@davemloft.net \
    --cc=deller@gmx.de \
    --cc=dennis@kernel.org \
    --cc=dietmar.eggemann@arm.com \
    --cc=dinguyen@kernel.org \
    --cc=dvyukov@google.com \
    --cc=festevam@gmail.com \
    --cc=fweisbec@gmail.com \
    --cc=geert@linux-m68k.org \
    --cc=glider@google.com \
    --cc=gor@linux.ibm.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=guoren@kernel.org \
    --cc=hca@linux.ibm.com \
    --cc=hpa@zytor.com \
    --cc=ink@jurassic.park.msu.ru \
    --cc=jacob.jun.pan@linux.intel.com \
    --cc=jcmvbkbc@gmail.com \
    --cc=jgross@suse.com \
    --cc=johannes@sipsolutions.net \
    --cc=john.ogness@linutronix.de \
    --cc=jolsa@kernel.org \
    --cc=jonas@southpole.se \
    --cc=jonathanh@nvidia.com \
    --cc=jpoimboe@kernel.org \
    --cc=juri.lelli@redhat.com \
    --cc=kasan-dev@googlegroups.com \
    --cc=kernel@pengutronix.de \
    --cc=kernel@xen0n.name \
    --cc=khilman@kernel.org \
    --cc=konrad.dybcio@somainline.org \
    --cc=lenb@kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-alpha@vger.kernel.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-csky@vger.kernel.org \
    --cc=linux-hexagon@vger.kernel.org \
    --cc=linux-ia64@vger.kernel.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-m68k@lists.linux-m68k.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-parisc@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=linux-snps-arc@lists.infradead.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=linux-um@lists.infradead.org \
    --cc=linux-xtensa@linux-xtensa.org \
    --cc=linux@armlinux.org.uk \
    --cc=linux@rasmusvillemoes.dk \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=loongarch@lists.linux.dev \
    --cc=lpieralisi@kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mattst88@gmail.com \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=monstr@monstr.eu \
    --cc=mpe@ellerman.id.au \
    --cc=mturquette@baylibre.com \
    --cc=namhyung@kernel.org \
    --cc=npiggin@gmail.com \
    --cc=openrisc@lists.librecores.org \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=pavel@ucw.cz \
    --cc=pmladek@suse.com \
    --cc=pv-drivers@vmware.com \
    --cc=rafael@kernel.org \
    --cc=richard.henderson@linaro.org \
    --cc=richard@nod.at \
    --cc=rostedt@goodmis.org \
    --cc=ryabinin.a.a@gmail.com \
    --cc=s.hauer@pengutronix.de \
    --cc=sammy@sammy.net \
    --cc=sboyd@kernel.org \
    --cc=senozhatsky@chromium.org \
    --cc=shawnguo@kernel.org \
    --cc=shorne@gmail.com \
    --cc=sparclinux@vger.kernel.org \
    --cc=srivatsa@csail.mit.edu \
    --cc=stefan.kristiansson@saunalahti.fi \
    --cc=sudeep.holla@arm.com \
    --cc=svens@linux.ibm.com \
    --cc=tglx@linutronix.de \
    --cc=thierry.reding@gmail.com \
    --cc=tj@kernel.org \
    --cc=tony@atomide.com \
    --cc=tsbogend@alpha.franken.de \
    --cc=ulli.kroll@googlemail.com \
    --cc=vgupta@kernel.org \
    --cc=vincent.guittot@linaro.org \
    --cc=vincenzo.frascino@arm.com \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=vschneid@redhat.com \
    --cc=will@kernel.org \
    --cc=x86@kernel.org \
    --cc=ysato@users.sourceforge.jp \
    --cc=yury.norov@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).