Re: [PATCH v3 35/51] trace,hardirq: No moar _rcuidle() tracing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
- Subject: Re: [PATCH v3 35/51] trace,hardirq: No moar _rcuidle() tracing
- From: Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx>
- Date: Tue, 17 Jan 2023 13:24:46 +0900
- Cc: richard.henderson@xxxxxxxxxx, ink@xxxxxxxxxxxxxxxxxxxx, mattst88@xxxxxxxxx, vgupta@xxxxxxxxxx, linux@xxxxxxxxxxxxxxx, nsekhar@xxxxxx, brgl@xxxxxxxx, ulli.kroll@xxxxxxxxxxxxxx, linus.walleij@xxxxxxxxxx, shawnguo@xxxxxxxxxx, Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>, kernel@xxxxxxxxxxxxxx, festevam@xxxxxxxxx, linux-imx@xxxxxxx, tony@xxxxxxxxxxx, khilman@xxxxxxxxxx, krzysztof.kozlowski@xxxxxxxxxx, alim.akhtar@xxxxxxxxxxx, catalin.marinas@xxxxxxx, will@xxxxxxxxxx, guoren@xxxxxxxxxx, bcain@xxxxxxxxxxx, chenhuacai@xxxxxxxxxx, kernel@xxxxxxxxxx, geert@xxxxxxxxxxxxxx, sammy@xxxxxxxxx, monstr@xxxxxxxxx, tsbogend@xxxxxxxxxxxxxxxx, dinguyen@xxxxxxxxxx, jonas@xxxxxxxxxxxx, stefan.kristiansson@xxxxxxxxxxxxx, shorne@xxxxxxxxx, James.Bottomley@xxxxxxxxxxxxxxxxxxxxx, deller@xxxxxx, mpe@xxxxxxxxxxxxxx, npiggin@xxxxxxxxx, christophe.leroy@xxxxxxxxxx, paul.walmsley@xxxxxxxxxx, palmer@xxxxxxxxxxx, aou@xxxxxxxxxxxxxxxxx, hca@xxxxxxxxxxxxx, gor@xxxxxxxxxxxxx, agordeev@xxxxxxxxxxxxx, borntraeger@xxxxxxxxxxxxx, svens@xxxxxxxxxxxxx, ysato@xxxxxxxxxxxxx, dalias@xxxxxxxx, davem@xxxxxxxxxxxxx, richard@xxxxxx, anton.ivanov@xxxxxxxxxxxxxxxxxx, johannes@xxxxxxxxxxxxxxxx, tglx@xxxxxxxxxxxxx, mingo@xxxxxxxxxx, bp@xxxxxxxxx, dave.hansen@xxxxxxxxxxxxxxx, x86@xxxxxxxxxx, hpa@xxxxxxxxx, acme@xxxxxxxxxx, mark.rutland@xxxxxxx, alexander.shishkin@xxxxxxxxxxxxxxx, jolsa@xxxxxxxxxx, namhyung@xxxxxxxxxx, jgross@xxxxxxxx, srivatsa@xxxxxxxxxxxxx, amakhalov@xxxxxxxxxx, pv-drivers@xxxxxxxxxx, boris.ostrovsky@xxxxxxxxxx, chris@xxxxxxxxxx, jcmvbkbc@xxxxxxxxx, rafael@xxxxxxxxxx, lenb@xxxxxxxxxx, pavel@xxxxxx, gregkh@xxxxxxxxxxxxxxxxxxx, mturquette@xxxxxxxxxxxx, sboyd@xxxxxxxxxx, daniel.lezcano@xxxxxxxxxx, lpieralisi@xxxxxxxxxx, sudeep.holla@xxxxxxx, agross@xxxxxxxxxx, andersson@xxxxxxxxxx, konrad.dybcio@xxxxxxxxxx, anup@xxxxxxxxxxxxxx, thierry.reding@xxxxxxxxx, jonathanh@xxxxxxxxxx, jacob.jun.pan@xxxxxxxxxxxxxxx, atishp@xxxxxxxxxxxxxx, Arnd Bergmann <arnd@xxxxxxxx>, yury.norov@xxxxxxxxx, andriy.shevchenko@xxxxxxxxxxxxxxx, linux@xxxxxxxxxxxxxxxxxx, dennis@xxxxxxxxxx, tj@xxxxxxxxxx, cl@xxxxxxxxx, rostedt@xxxxxxxxxxx, mhiramat@xxxxxxxxxx, frederic@xxxxxxxxxx, paulmck@xxxxxxxxxx, pmladek@xxxxxxxx, senozhatsky@xxxxxxxxxxxx, john.ogness@xxxxxxxxxxxxx, juri.lelli@xxxxxxxxxx, vincent.guittot@xxxxxxxxxx, dietmar.eggemann@xxxxxxx, bsegall@xxxxxxxxxx, mgorman@xxxxxxx, bristot@xxxxxxxxxx, vschneid@xxxxxxxxxx, ryabinin.a.a@xxxxxxxxx, glider@xxxxxxxxxx, andreyknvl@xxxxxxxxx, dvyukov@xxxxxxxxxx, vincenzo.frascino@xxxxxxx, Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>, jpoimboe@xxxxxxxxxx, linux-alpha@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, linux-snps-arc@xxxxxxxxxxxxxxxxxxx, linux-omap@xxxxxxxxxxxxxxx, linux-samsung-soc@xxxxxxxxxxxxxxx, linux-csky@xxxxxxxxxxxxxxx, linux-hexagon@xxxxxxxxxxxxxxx, linux-ia64@xxxxxxxxxxxxxxx, loongarch@xxxxxxxxxxxxxxx, linux-m68k@xxxxxxxxxxxxxxx, linux-mips@xxxxxxxxxxxxxxx, openrisc@xxxxxxxxxxxxxxxxxxxx, linux-parisc@xxxxxxxxxxxxxxx, linuxppc-dev@xxxxxxxxxxxxxxxx, linux-riscv@xxxxxxxxxxxxxxxxxxx, linux-s390@xxxxxxxxxxxxxxx, linux-sh@xxxxxxxxxxxxxxx, sparclinux@xxxxxxxxxxxxxxx, linux-um@xxxxxxxxxxxxxxxxxxx, linux-perf-users@xxxxxxxxxxxxxxx, virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx, linux-xtensa@xxxxxxxxxxxxxxxx, linux-acpi@xxxxxxxxxxxxxxx, linux-pm@xxxxxxxxxxxxxxx, linux-clk@xxxxxxxxxxxxxxx, linux-arm-msm@xxxxxxxxxxxxxxx, linux-tegra@xxxxxxxxxxxxxxx, linux-arch@xxxxxxxxxxxxxxx, linux-mm@xxxxxxxxx, linux-trace-kernel@xxxxxxxxxxxxxxx, kasan-dev@xxxxxxxxxxxxxxxx
- In-reply-to: <20230112195541.477416709@infradead.org>
- References: <20230112194314.845371875@infradead.org> <20230112195541.477416709@infradead.org>
Hi Peter,
On Thu, 12 Jan 2023 20:43:49 +0100
Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
> Robot reported that trace_hardirqs_{on,off}() tickle the forbidden
> _rcuidle() tracepoint through local_irq_{en,dis}able().
>
> For 'sane' configs, these calls will only happen with RCU enabled and
> as such can use the regular tracepoint. This also means it's possible
> to trace them from NMI context again.
>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
The code looks good to me. I just have a question about comment.
> ---
> kernel/trace/trace_preemptirq.c | 21 +++++++++++++--------
> 1 file changed, 13 insertions(+), 8 deletions(-)
>
> --- a/kernel/trace/trace_preemptirq.c
> +++ b/kernel/trace/trace_preemptirq.c
> @@ -20,6 +20,15 @@
> static DEFINE_PER_CPU(int, tracing_irq_cpu);
>
> /*
> + * ...
Is this intended? Wouldn't you leave any comment here?
Thank you,
> + */
> +#ifdef CONFIG_ARCH_WANTS_NO_INSTR
> +#define trace(point) trace_##point
> +#else
> +#define trace(point) if (!in_nmi()) trace_##point##_rcuidle
> +#endif
> +
> +/*
> * Like trace_hardirqs_on() but without the lockdep invocation. This is
> * used in the low level entry code where the ordering vs. RCU is important
> * and lockdep uses a staged approach which splits the lockdep hardirq
> @@ -28,8 +37,7 @@ static DEFINE_PER_CPU(int, tracing_irq_c
> void trace_hardirqs_on_prepare(void)
> {
> if (this_cpu_read(tracing_irq_cpu)) {
> - if (!in_nmi())
> - trace_irq_enable(CALLER_ADDR0, CALLER_ADDR1);
> + trace(irq_enable)(CALLER_ADDR0, CALLER_ADDR1);
> tracer_hardirqs_on(CALLER_ADDR0, CALLER_ADDR1);
> this_cpu_write(tracing_irq_cpu, 0);
> }
> @@ -40,8 +48,7 @@ NOKPROBE_SYMBOL(trace_hardirqs_on_prepar
> void trace_hardirqs_on(void)
> {
> if (this_cpu_read(tracing_irq_cpu)) {
> - if (!in_nmi())
> - trace_irq_enable_rcuidle(CALLER_ADDR0, CALLER_ADDR1);
> + trace(irq_enable)(CALLER_ADDR0, CALLER_ADDR1);
> tracer_hardirqs_on(CALLER_ADDR0, CALLER_ADDR1);
> this_cpu_write(tracing_irq_cpu, 0);
> }
> @@ -63,8 +70,7 @@ void trace_hardirqs_off_finish(void)
> if (!this_cpu_read(tracing_irq_cpu)) {
> this_cpu_write(tracing_irq_cpu, 1);
> tracer_hardirqs_off(CALLER_ADDR0, CALLER_ADDR1);
> - if (!in_nmi())
> - trace_irq_disable(CALLER_ADDR0, CALLER_ADDR1);
> + trace(irq_disable)(CALLER_ADDR0, CALLER_ADDR1);
> }
>
> }
> @@ -78,8 +84,7 @@ void trace_hardirqs_off(void)
> if (!this_cpu_read(tracing_irq_cpu)) {
> this_cpu_write(tracing_irq_cpu, 1);
> tracer_hardirqs_off(CALLER_ADDR0, CALLER_ADDR1);
> - if (!in_nmi())
> - trace_irq_disable_rcuidle(CALLER_ADDR0, CALLER_ADDR1);
> + trace(irq_disable)(CALLER_ADDR0, CALLER_ADDR1);
> }
> }
> EXPORT_SYMBOL(trace_hardirqs_off);
>
>
--
Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx>
[Index of Archives]
[Linux Kernel]
[Sparc Linux]
[DCCP]
[Linux ARM]
[Yosemite News]
[Linux SCSI]
[Linux x86_64]
[Linux for Ham Radio]