All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] tracing/mm: don't trace kfree on offline CPUs
@ 2016-02-13 18:22 Denis Kirjanov
  2016-02-13 18:22 ` [PATCH 2/2] tracing/rcu: don't trace rcu_callback " Denis Kirjanov
  2016-02-14 16:45 ` [PATCH 1/2] tracing/mm: don't trace kfree " Steven Rostedt
  0 siblings, 2 replies; 13+ messages in thread
From: Denis Kirjanov @ 2016-02-13 18:22 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: linux-kernel, paulmck, Denis Kirjanov

Tracepoints use RCU for protection and they must not be called on
offline CPUS. So make this tracepoint conditional.

INFO: suspicious RCU usage. ]
[   99.749382] 4.4.0-00006-g0fe53e8-dirty #34 Tainted: G S
[   99.749383] -------------------------------
[   99.749385] include/trace/events/kmem.h:141 suspicious rcu_dereference_check() usage!
[   99.749385]
other info that might help us debug this:

[   99.749387]
RCU used illegally from offline CPU!
rcu_scheduler_active = 1, debug_locks = 1
[   99.749388] no locks held by swapper/8/0.
[   99.749388]
stack backtrace:
[   99.749390] CPU: 8 PID: 0 Comm: swapper/8 Tainted: G S              4.4.0-00006-g0fe53e8-dirty #34
[   99.749391] Call Trace:
[   99.749399] [c0000005b76c78d0] [c0000000008b9540] .dump_stack+0x98/0xd4 (unreliable)
[   99.749402] [c0000005b76c7950] [c00000000010c898] .lockdep_rcu_suspicious+0x108/0x170
[   99.749405] [c0000005b76c79e0] [c00000000029adc0] .kfree+0x390/0x440
[   99.749409] [c0000005b76c7a80] [c000000000055f74] .destroy_context+0x44/0x100
[   99.749412] [c0000005b76c7b00] [c0000000000934a0] .__mmdrop+0x60/0x150
[   99.749415] [c0000005b76c7b90] [c0000000000e3ff0] .idle_task_exit+0x130/0x140
[   99.749417] [c0000005b76c7c20] [c000000000075804] .pseries_mach_cpu_die+0x64/0x310
[   99.749420] [c0000005b76c7cd0] [c000000000043e7c] .cpu_die+0x3c/0x60
[   99.749423] [c0000005b76c7d40] [c0000000000188d8] .arch_cpu_idle_dead+0x28/0x40
[   99.749426] [c0000005b76c7db0] [c000000000101e6c] .cpu_startup_entry+0x50c/0x560
[   99.749428] [c0000005b76c7ed0] [c000000000043bd8] .start_secondary+0x328/0x360
[   99.749431] [c0000005b76c7f90] [c000000000008a6c] start_secondary_prolog+0x10/0x14

Signed-off-by: Denis Kirjanov <kda@linux-powerpc.org>
---
 include/trace/events/kmem.h | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/include/trace/events/kmem.h b/include/trace/events/kmem.h
index f7554fd..9473c2d 100644
--- a/include/trace/events/kmem.h
+++ b/include/trace/events/kmem.h
@@ -133,11 +133,22 @@ DECLARE_EVENT_CLASS(kmem_free,
 	TP_printk("call_site=%lx ptr=%p", __entry->call_site, __entry->ptr)
 );
 
-DEFINE_EVENT(kmem_free, kfree,
+DEFINE_EVENT_CONDITION(kmem_free, kfree,
 
 	TP_PROTO(unsigned long call_site, const void *ptr),
 
-	TP_ARGS(call_site, ptr)
+	TP_ARGS(call_site, ptr),
+
+	/*
+	 * This trace can be potentially called from an offlined cpu.
+	 * Since trace points use RCU and RCU should not be used from
+	 * offline cpus, filter such calls out.
+	 * While this trace can be called from a preemptable section,
+	 * it has no impact on the condition since tasks can migrate
+	 * only from online cpus to other online cpus. Thus its safe
+	 * to use raw_smp_processor_id.
+	 */
+	TP_CONDITION(cpu_online(raw_smp_processor_id()))
 );
 
 DEFINE_EVENT_CONDITION(kmem_free, kmem_cache_free,
-- 
2.4.0

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 2/2] tracing/rcu: don't trace rcu_callback on offline CPUs
  2016-02-13 18:22 [PATCH 1/2] tracing/mm: don't trace kfree on offline CPUs Denis Kirjanov
@ 2016-02-13 18:22 ` Denis Kirjanov
  2016-02-13 19:25   ` kbuild test robot
  2016-02-14 16:43   ` Steven Rostedt
  2016-02-14 16:45 ` [PATCH 1/2] tracing/mm: don't trace kfree " Steven Rostedt
  1 sibling, 2 replies; 13+ messages in thread
From: Denis Kirjanov @ 2016-02-13 18:22 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: linux-kernel, paulmck, Denis Kirjanov

Tracepoints use RCU for protection and they must not be called on
offline CPUS. So make this tracepoint conditional.

INFO: suspicious RCU usage. ]
[  413.344670] 4.4.0-00006-g0fe53e8-dirty #33 Tainted: G S
[  413.344672] -------------------------------
[  413.344673] include/trace/events/rcu.h:457 suspicious rcu_dereference_check() usage!
[  413.344674]
other info that might help us debug this:

[  413.344676]
RCU used illegally from offline CPU!
rcu_scheduler_active = 1, debug_locks = 1
[  413.344678] no locks held by swapper/4/0.
[  413.344679]
stack backtrace:
[  413.344682] CPU: 4 PID: 0 Comm: swapper/4 Tainted: G S              4.4.0-00006-g0fe53e8-dirty #33
[  413.344683] Call Trace:
[  413.344692] [c0000005b76b7800] [c0000000008bb080] .dump_stack+0x98/0xd4 (unreliable)
[  413.344698] [c0000005b76b7880] [c00000000010c8b8] .lockdep_rcu_suspicious+0x108/0x170
[  413.344703] [c0000005b76b7910] [c00000000013b9e4] .__call_rcu.constprop.60+0x264/0x600
[  413.344708] [c0000005b76b79e0] [c0000000002bceec] .put_object+0x5c/0x80
[  413.344712] [c0000005b76b7a60] [c00000000029a368] .kmem_cache_free+0x298/0x450
[  413.344716] [c0000005b76b7b00] [c000000000093494] .__mmdrop+0x54/0x150
[  413.344720] [c0000005b76b7b90] [c0000000000e4010] .idle_task_exit+0x130/0x140
[  413.344725] [c0000005b76b7c20] [c000000000075804] .pseries_mach_cpu_die+0x64/0x310
[  413.344730] [c0000005b76b7cd0] [c000000000043e7c] .cpu_die+0x3c/0x60
[  413.344734] [c0000005b76b7d40] [c0000000000188d8] .arch_cpu_idle_dead+0x28/0x40
[  413.344738] [c0000005b76b7db0] [c000000000101e8c] .cpu_startup_entry+0x50c/0x560
[  413.344741] [c0000005b76b7ed0] [c000000000043bd8] .start_secondary+0x328/0x360
[  413.344746] [c0000005b76b7f90] [c000000000008a6c] start_secondary_prolog+0x10/0x14
Signed-off-by: Denis Kirjanov <kda@linux-powerpc.org>
---
 include/trace/events/rcu.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/trace/events/rcu.h b/include/trace/events/rcu.h
index ef72c4a..5470f2f 100644
--- a/include/trace/events/rcu.h
+++ b/include/trace/events/rcu.h
@@ -435,6 +435,8 @@ TRACE_EVENT(rcu_callback,
 
 	TP_ARGS(rcuname, rhp, qlen_lazy, qlen),
 
+	TP_CONDITION(cpu_online(raw_smp_processor_id())),
+
 	TP_STRUCT__entry(
 		__field(const char *, rcuname)
 		__field(void *, rhp)
-- 
2.4.0

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/2] tracing/rcu: don't trace rcu_callback on offline CPUs
  2016-02-13 18:22 ` [PATCH 2/2] tracing/rcu: don't trace rcu_callback " Denis Kirjanov
@ 2016-02-13 19:25   ` kbuild test robot
  2016-02-14 16:43   ` Steven Rostedt
  1 sibling, 0 replies; 13+ messages in thread
From: kbuild test robot @ 2016-02-13 19:25 UTC (permalink / raw)
  To: Denis Kirjanov
  Cc: kbuild-all, Steven Rostedt, linux-kernel, paulmck, Denis Kirjanov

[-- Attachment #1: Type: text/plain, Size: 19231 bytes --]

Hi Denis,

[auto build test ERROR on tip/perf/core]
[also build test ERROR on v4.5-rc3 next-20160212]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url:    https://github.com/0day-ci/linux/commits/Denis-Kirjanov/tracing-mm-don-t-trace-kfree-on-offline-CPUs/20160214-022834
config: x86_64-allmodconfig (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All error/warnings (new ones prefixed by >>):

   include/trace/events/rcu.h:431:1: sparse: macro "TRACE_EVENT" passed 7 arguments, but takes just 6
   include/trace/events/rcu.h:431:1: sparse: macro "TRACE_EVENT" passed 7 arguments, but takes just 6
   include/trace/events/rcu.h:431:1: sparse: macro "TRACE_EVENT" passed 7 arguments, but takes just 6
   include/trace/events/rcu.h:431:1: sparse: macro "TRACE_EVENT" passed 7 arguments, but takes just 6
   include/trace/events/rcu.h:431:1: sparse: macro "TRACE_EVENT" passed 7 arguments, but takes just 6
   include/trace/events/rcu.h:431:1: sparse: macro "TRACE_EVENT" passed 7 arguments, but takes just 6
   include/trace/events/rcu.h:431:1: sparse: macro "TRACE_EVENT" passed 7 arguments, but takes just 6
   include/trace/events/rcu.h:431:1: sparse: macro "TRACE_EVENT" passed 7 arguments, but takes just 6
   include/trace/events/rcu.h:431:1: sparse: macro "TRACE_EVENT" passed 7 arguments, but takes just 6
   include/trace/events/rcu.h:431:1: sparse: macro "TRACE_EVENT" passed 7 arguments, but takes just 6
   include/linux/compiler.h:228:8: sparse: attribute 'no_sanitize_address': unknown attribute
   In file included from kernel/rcu/rcu.h:26:0,
                    from kernel/rcu/update.c:55:
>> include/trace/events/rcu.h:459:1: error: macro "TRACE_EVENT" passed 7 arguments, but takes just 6
    );
    ^
>> include/trace/events/rcu.h:431:1: warning: data definition has no type or storage class
    TRACE_EVENT(rcu_callback,
    ^
>> include/trace/events/rcu.h:431:1: error: type defaults to 'int' in declaration of 'TRACE_EVENT' [-Werror=implicit-int]
   In file included from include/trace/define_trace.h:88:0,
                    from include/trace/events/rcu.h:741,
                    from kernel/rcu/rcu.h:26,
                    from kernel/rcu/update.c:55:
>> include/trace/events/rcu.h:459:1: error: macro "TRACE_EVENT" passed 7 arguments, but takes just 6
    );
    ^
>> include/trace/events/rcu.h:431:1: warning: data definition has no type or storage class
    TRACE_EVENT(rcu_callback,
    ^
>> include/trace/events/rcu.h:431:1: error: type defaults to 'int' in declaration of 'TRACE_EVENT' [-Werror=implicit-int]
   In file included from include/trace/trace_events.h:140:0,
                    from include/trace/define_trace.h:95,
                    from include/trace/events/rcu.h:741,
                    from kernel/rcu/rcu.h:26,
                    from kernel/rcu/update.c:55:
>> include/trace/events/rcu.h:459:1: error: macro "TRACE_EVENT" passed 7 arguments, but takes just 6
    );
    ^
>> include/trace/events/rcu.h:431:1: warning: data definition has no type or storage class
    TRACE_EVENT(rcu_callback,
    ^
>> include/trace/events/rcu.h:431:1: error: type defaults to 'int' in declaration of 'TRACE_EVENT' [-Werror=implicit-int]
   In file included from include/trace/trace_events.h:204:0,
                    from include/trace/define_trace.h:95,
                    from include/trace/events/rcu.h:741,
                    from kernel/rcu/rcu.h:26,
                    from kernel/rcu/update.c:55:
>> include/trace/events/rcu.h:459:1: error: macro "TRACE_EVENT" passed 7 arguments, but takes just 6
    );
    ^
>> include/trace/events/rcu.h:431:1: warning: data definition has no type or storage class
    TRACE_EVENT(rcu_callback,
    ^
>> include/trace/events/rcu.h:431:1: error: type defaults to 'int' in declaration of 'TRACE_EVENT' [-Werror=implicit-int]
   In file included from include/trace/trace_events.h:361:0,
                    from include/trace/define_trace.h:95,
                    from include/trace/events/rcu.h:741,
                    from kernel/rcu/rcu.h:26,
                    from kernel/rcu/update.c:55:
>> include/trace/events/rcu.h:459:1: error: macro "TRACE_EVENT" passed 7 arguments, but takes just 6
    );
    ^
>> include/trace/events/rcu.h:431:1: warning: data definition has no type or storage class
    TRACE_EVENT(rcu_callback,
    ^
>> include/trace/events/rcu.h:431:1: error: type defaults to 'int' in declaration of 'TRACE_EVENT' [-Werror=implicit-int]
   In file included from include/trace/trace_events.h:433:0,
                    from include/trace/define_trace.h:95,
                    from include/trace/events/rcu.h:741,
                    from kernel/rcu/rcu.h:26,
                    from kernel/rcu/update.c:55:
>> include/trace/events/rcu.h:459:1: error: macro "TRACE_EVENT" passed 7 arguments, but takes just 6
    );
    ^
>> include/trace/events/rcu.h:431:1: warning: data definition has no type or storage class
    TRACE_EVENT(rcu_callback,
    ^
>> include/trace/events/rcu.h:431:1: error: type defaults to 'int' in declaration of 'TRACE_EVENT' [-Werror=implicit-int]
   In file included from include/trace/trace_events.h:513:0,
                    from include/trace/define_trace.h:95,
                    from include/trace/events/rcu.h:741,
                    from kernel/rcu/rcu.h:26,
                    from kernel/rcu/update.c:55:
>> include/trace/events/rcu.h:459:1: error: macro "TRACE_EVENT" passed 7 arguments, but takes just 6
    );
    ^
>> include/trace/events/rcu.h:431:1: warning: data definition has no type or storage class
    TRACE_EVENT(rcu_callback,
    ^
--
   include/trace/events/rcu.h:431:1: sparse: macro "TRACE_EVENT" passed 7 arguments, but takes just 6
   include/linux/compiler.h:228:8: sparse: attribute 'no_sanitize_address': unknown attribute
   In file included from kernel/rcu/rcu.h:26:0,
                    from kernel/rcu/srcu.c:39:
>> include/trace/events/rcu.h:459:1: error: macro "TRACE_EVENT" passed 7 arguments, but takes just 6
    );
    ^
>> include/trace/events/rcu.h:431:1: warning: data definition has no type or storage class
    TRACE_EVENT(rcu_callback,
    ^
>> include/trace/events/rcu.h:431:1: error: type defaults to 'int' in declaration of 'TRACE_EVENT' [-Werror=implicit-int]
   cc1: some warnings being treated as errors
--
   include/trace/events/rcu.h:431:1: sparse: macro "TRACE_EVENT" passed 7 arguments, but takes just 6
   include/linux/compiler.h:228:8: sparse: attribute 'no_sanitize_address': unknown attribute
   kernel/rcu/tree_plugin.h:1996:17: sparse: undefined identifier 'trace_rcu_callback'
   kernel/rcu/tree.c:3109:17: sparse: undefined identifier 'trace_rcu_callback'
   In file included from kernel/rcu/rcu.h:26:0,
                    from kernel/rcu/tree.c:61:
>> include/trace/events/rcu.h:459:1: error: macro "TRACE_EVENT" passed 7 arguments, but takes just 6
    );
    ^
>> include/trace/events/rcu.h:431:1: warning: data definition has no type or storage class
    TRACE_EVENT(rcu_callback,
    ^
>> include/trace/events/rcu.h:431:1: error: type defaults to 'int' in declaration of 'TRACE_EVENT' [-Werror=implicit-int]
   kernel/rcu/tree.c: In function '__call_rcu':
>> kernel/rcu/tree.c:3109:3: error: implicit declaration of function 'trace_rcu_callback' [-Werror=implicit-function-declaration]
      trace_rcu_callback(rsp->name, head, rdp->qlen_lazy, rdp->qlen);
      ^
   cc1: some warnings being treated as errors

sparse warnings: (new ones prefixed by >>)

>> include/trace/events/rcu.h:431:1: sparse: macro "TRACE_EVENT" passed 7 arguments, but takes just 6
>> include/trace/events/rcu.h:431:1: sparse: macro "TRACE_EVENT" passed 7 arguments, but takes just 6
>> include/trace/events/rcu.h:431:1: sparse: macro "TRACE_EVENT" passed 7 arguments, but takes just 6
>> include/trace/events/rcu.h:431:1: sparse: macro "TRACE_EVENT" passed 7 arguments, but takes just 6
>> include/trace/events/rcu.h:431:1: sparse: macro "TRACE_EVENT" passed 7 arguments, but takes just 6
>> include/trace/events/rcu.h:431:1: sparse: macro "TRACE_EVENT" passed 7 arguments, but takes just 6
>> include/trace/events/rcu.h:431:1: sparse: macro "TRACE_EVENT" passed 7 arguments, but takes just 6
>> include/trace/events/rcu.h:431:1: sparse: macro "TRACE_EVENT" passed 7 arguments, but takes just 6
>> include/trace/events/rcu.h:431:1: sparse: macro "TRACE_EVENT" passed 7 arguments, but takes just 6
>> include/trace/events/rcu.h:431:1: sparse: macro "TRACE_EVENT" passed 7 arguments, but takes just 6
   include/linux/compiler.h:228:8: sparse: attribute 'no_sanitize_address': unknown attribute
   In file included from kernel/rcu/rcu.h:26:0,
                    from kernel/rcu/update.c:55:
   include/trace/events/rcu.h:459:1: error: macro "TRACE_EVENT" passed 7 arguments, but takes just 6
    );
    ^
   include/trace/events/rcu.h:431:1: warning: data definition has no type or storage class
    TRACE_EVENT(rcu_callback,
    ^
   include/trace/events/rcu.h:431:1: error: type defaults to 'int' in declaration of 'TRACE_EVENT' [-Werror=implicit-int]
   In file included from include/trace/define_trace.h:88:0,
                    from include/trace/events/rcu.h:741,
                    from kernel/rcu/rcu.h:26,
                    from kernel/rcu/update.c:55:
   include/trace/events/rcu.h:459:1: error: macro "TRACE_EVENT" passed 7 arguments, but takes just 6
    );
    ^
   include/trace/events/rcu.h:431:1: warning: data definition has no type or storage class
    TRACE_EVENT(rcu_callback,
    ^
   include/trace/events/rcu.h:431:1: error: type defaults to 'int' in declaration of 'TRACE_EVENT' [-Werror=implicit-int]
   In file included from include/trace/trace_events.h:140:0,
                    from include/trace/define_trace.h:95,
                    from include/trace/events/rcu.h:741,
                    from kernel/rcu/rcu.h:26,
                    from kernel/rcu/update.c:55:
   include/trace/events/rcu.h:459:1: error: macro "TRACE_EVENT" passed 7 arguments, but takes just 6
    );
    ^
   include/trace/events/rcu.h:431:1: warning: data definition has no type or storage class
    TRACE_EVENT(rcu_callback,
    ^
   include/trace/events/rcu.h:431:1: error: type defaults to 'int' in declaration of 'TRACE_EVENT' [-Werror=implicit-int]
   In file included from include/trace/trace_events.h:204:0,
                    from include/trace/define_trace.h:95,
                    from include/trace/events/rcu.h:741,
                    from kernel/rcu/rcu.h:26,
                    from kernel/rcu/update.c:55:
   include/trace/events/rcu.h:459:1: error: macro "TRACE_EVENT" passed 7 arguments, but takes just 6
    );
    ^
   include/trace/events/rcu.h:431:1: warning: data definition has no type or storage class
    TRACE_EVENT(rcu_callback,
    ^
   include/trace/events/rcu.h:431:1: error: type defaults to 'int' in declaration of 'TRACE_EVENT' [-Werror=implicit-int]
   In file included from include/trace/trace_events.h:361:0,
                    from include/trace/define_trace.h:95,
                    from include/trace/events/rcu.h:741,
                    from kernel/rcu/rcu.h:26,
                    from kernel/rcu/update.c:55:
   include/trace/events/rcu.h:459:1: error: macro "TRACE_EVENT" passed 7 arguments, but takes just 6
    );
    ^
   include/trace/events/rcu.h:431:1: warning: data definition has no type or storage class
    TRACE_EVENT(rcu_callback,
    ^
   include/trace/events/rcu.h:431:1: error: type defaults to 'int' in declaration of 'TRACE_EVENT' [-Werror=implicit-int]
   In file included from include/trace/trace_events.h:433:0,
                    from include/trace/define_trace.h:95,
                    from include/trace/events/rcu.h:741,
                    from kernel/rcu/rcu.h:26,
                    from kernel/rcu/update.c:55:
   include/trace/events/rcu.h:459:1: error: macro "TRACE_EVENT" passed 7 arguments, but takes just 6
    );
    ^
   include/trace/events/rcu.h:431:1: warning: data definition has no type or storage class
    TRACE_EVENT(rcu_callback,
    ^
   include/trace/events/rcu.h:431:1: error: type defaults to 'int' in declaration of 'TRACE_EVENT' [-Werror=implicit-int]
   In file included from include/trace/trace_events.h:513:0,
                    from include/trace/define_trace.h:95,
                    from include/trace/events/rcu.h:741,
                    from kernel/rcu/rcu.h:26,
                    from kernel/rcu/update.c:55:
   include/trace/events/rcu.h:459:1: error: macro "TRACE_EVENT" passed 7 arguments, but takes just 6
    );
    ^
   include/trace/events/rcu.h:431:1: warning: data definition has no type or storage class
    TRACE_EVENT(rcu_callback,
    ^
   include/trace/events/rcu.h:431:1: error: type defaults to 'int' in declaration of 'TRACE_EVENT' [-Werror=implicit-int]
   In file included from include/trace/trace_events.h:709:0,
                    from include/trace/define_trace.h:95,
                    from include/trace/events/rcu.h:741,
                    from kernel/rcu/rcu.h:26,
                    from kernel/rcu/update.c:55:
   include/trace/events/rcu.h:459:1: error: macro "TRACE_EVENT" passed 7 arguments, but takes just 6
    );
    ^
   include/trace/events/rcu.h:431:1: warning: data definition has no type or storage class
    TRACE_EVENT(rcu_callback,
    ^
   include/trace/events/rcu.h:431:1: error: type defaults to 'int' in declaration of 'TRACE_EVENT' [-Werror=implicit-int]
   In file included from include/trace/trace_events.h:772:0,
                    from include/trace/define_trace.h:95,
                    from include/trace/events/rcu.h:741,
                    from kernel/rcu/rcu.h:26,
                    from kernel/rcu/update.c:55:
   include/trace/events/rcu.h:459:1: error: macro "TRACE_EVENT" passed 7 arguments, but takes just 6
    );
--
>> include/trace/events/rcu.h:431:1: sparse: macro "TRACE_EVENT" passed 7 arguments, but takes just 6
   include/linux/compiler.h:228:8: sparse: attribute 'no_sanitize_address': unknown attribute
   In file included from kernel/rcu/rcu.h:26:0,
                    from kernel/rcu/srcu.c:39:
   include/trace/events/rcu.h:459:1: error: macro "TRACE_EVENT" passed 7 arguments, but takes just 6
    );
    ^
   include/trace/events/rcu.h:431:1: warning: data definition has no type or storage class
    TRACE_EVENT(rcu_callback,
    ^
   include/trace/events/rcu.h:431:1: error: type defaults to 'int' in declaration of 'TRACE_EVENT' [-Werror=implicit-int]
   cc1: some warnings being treated as errors
--
>> include/trace/events/rcu.h:431:1: sparse: macro "TRACE_EVENT" passed 7 arguments, but takes just 6
   include/linux/compiler.h:228:8: sparse: attribute 'no_sanitize_address': unknown attribute
   kernel/rcu/tree_plugin.h:1996:17: sparse: undefined identifier 'trace_rcu_callback'
   kernel/rcu/tree.c:3109:17: sparse: undefined identifier 'trace_rcu_callback'
   In file included from kernel/rcu/rcu.h:26:0,
                    from kernel/rcu/tree.c:61:
   include/trace/events/rcu.h:459:1: error: macro "TRACE_EVENT" passed 7 arguments, but takes just 6
    );
    ^
   include/trace/events/rcu.h:431:1: warning: data definition has no type or storage class
    TRACE_EVENT(rcu_callback,
    ^
   include/trace/events/rcu.h:431:1: error: type defaults to 'int' in declaration of 'TRACE_EVENT' [-Werror=implicit-int]
   kernel/rcu/tree.c: In function '__call_rcu':
   kernel/rcu/tree.c:3109:3: error: implicit declaration of function 'trace_rcu_callback' [-Werror=implicit-function-declaration]
      trace_rcu_callback(rsp->name, head, rdp->qlen_lazy, rdp->qlen);
      ^
   cc1: some warnings being treated as errors

vim +/TRACE_EVENT +459 include/trace/events/rcu.h

d4c08f2a Paul E. McKenney         2011-06-25  425   * Tracepoint for the registration of a single RCU callback function.
d4c08f2a Paul E. McKenney         2011-06-25  426   * The first argument is the type of RCU, the second argument is
486e2593 Paul E. McKenney         2012-01-06  427   * a pointer to the RCU callback itself, the third element is the
486e2593 Paul E. McKenney         2012-01-06  428   * number of lazy callbacks queued, and the fourth element is the
486e2593 Paul E. McKenney         2012-01-06  429   * total number of callbacks queued.
d4c08f2a Paul E. McKenney         2011-06-25  430   */
d4c08f2a Paul E. McKenney         2011-06-25 @431  TRACE_EVENT(rcu_callback,
d4c08f2a Paul E. McKenney         2011-06-25  432  
e66c33d5 Steven Rostedt (Red Hat  2013-07-12  433) 	TP_PROTO(const char *rcuname, struct rcu_head *rhp, long qlen_lazy,
486e2593 Paul E. McKenney         2012-01-06  434  		 long qlen),
d4c08f2a Paul E. McKenney         2011-06-25  435  
486e2593 Paul E. McKenney         2012-01-06  436  	TP_ARGS(rcuname, rhp, qlen_lazy, qlen),
d4c08f2a Paul E. McKenney         2011-06-25  437  
0b6c19e4 Denis Kirjanov           2016-02-13  438  	TP_CONDITION(cpu_online(raw_smp_processor_id())),
0b6c19e4 Denis Kirjanov           2016-02-13  439  
d4c08f2a Paul E. McKenney         2011-06-25  440  	TP_STRUCT__entry(
e66c33d5 Steven Rostedt (Red Hat  2013-07-12  441) 		__field(const char *, rcuname)
d4c08f2a Paul E. McKenney         2011-06-25  442  		__field(void *, rhp)
d4c08f2a Paul E. McKenney         2011-06-25  443  		__field(void *, func)
486e2593 Paul E. McKenney         2012-01-06  444  		__field(long, qlen_lazy)
d4c08f2a Paul E. McKenney         2011-06-25  445  		__field(long, qlen)
d4c08f2a Paul E. McKenney         2011-06-25  446  	),
d4c08f2a Paul E. McKenney         2011-06-25  447  
d4c08f2a Paul E. McKenney         2011-06-25  448  	TP_fast_assign(
d4c08f2a Paul E. McKenney         2011-06-25  449  		__entry->rcuname = rcuname;
d4c08f2a Paul E. McKenney         2011-06-25  450  		__entry->rhp = rhp;
d4c08f2a Paul E. McKenney         2011-06-25  451  		__entry->func = rhp->func;
486e2593 Paul E. McKenney         2012-01-06  452  		__entry->qlen_lazy = qlen_lazy;
d4c08f2a Paul E. McKenney         2011-06-25  453  		__entry->qlen = qlen;
d4c08f2a Paul E. McKenney         2011-06-25  454  	),
d4c08f2a Paul E. McKenney         2011-06-25  455  
486e2593 Paul E. McKenney         2012-01-06  456  	TP_printk("%s rhp=%p func=%pf %ld/%ld",
486e2593 Paul E. McKenney         2012-01-06  457  		  __entry->rcuname, __entry->rhp, __entry->func,
486e2593 Paul E. McKenney         2012-01-06  458  		  __entry->qlen_lazy, __entry->qlen)
d4c08f2a Paul E. McKenney         2011-06-25 @459  );
d4c08f2a Paul E. McKenney         2011-06-25  460  
d4c08f2a Paul E. McKenney         2011-06-25  461  /*
d4c08f2a Paul E. McKenney         2011-06-25  462   * Tracepoint for the registration of a single RCU callback of the special

:::::: The code at line 459 was first introduced by commit
:::::: d4c08f2ac311a360230eef7e5395b0ec8d8f0670 rcu: Add grace-period, quiescent-state, and call_rcu trace events

:::::: TO: Paul E. McKenney <paul.mckenney@linaro.org>
:::::: CC: Paul E. McKenney <paulmck@linux.vnet.ibm.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 53132 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/2] tracing/rcu: don't trace rcu_callback on offline CPUs
  2016-02-13 18:22 ` [PATCH 2/2] tracing/rcu: don't trace rcu_callback " Denis Kirjanov
  2016-02-13 19:25   ` kbuild test robot
@ 2016-02-14 16:43   ` Steven Rostedt
  2016-02-14 17:35     ` Denis Kirjanov
  1 sibling, 1 reply; 13+ messages in thread
From: Steven Rostedt @ 2016-02-14 16:43 UTC (permalink / raw)
  To: Denis Kirjanov; +Cc: linux-kernel, paulmck

On Sat, 13 Feb 2016 21:22:53 +0300
Denis Kirjanov <kda@linux-powerpc.org> wrote:

> 
> diff --git a/include/trace/events/rcu.h b/include/trace/events/rcu.h
> index ef72c4a..5470f2f 100644
> --- a/include/trace/events/rcu.h
> +++ b/include/trace/events/rcu.h
> @@ -435,6 +435,8 @@ TRACE_EVENT(rcu_callback,
>  
>  	TP_ARGS(rcuname, rhp, qlen_lazy, qlen),
>  
> +	TP_CONDITION(cpu_online(raw_smp_processor_id())),
> +

Besides the fact that this isn't a TRACE_EVENT_CONDITION, Isn't calling
rcu_callback() dangerous from an offline CPU?

Or is calling a callback from an offline CPU OK?

Perhaps it is OK, as it doesn't need to worry about its current CPU,
just the other CPUs.

Paul?

-- Steve


>  	TP_STRUCT__entry(
>  		__field(const char *, rcuname)
>  		__field(void *, rhp)

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/2] tracing/mm: don't trace kfree on offline CPUs
  2016-02-13 18:22 [PATCH 1/2] tracing/mm: don't trace kfree on offline CPUs Denis Kirjanov
  2016-02-13 18:22 ` [PATCH 2/2] tracing/rcu: don't trace rcu_callback " Denis Kirjanov
@ 2016-02-14 16:45 ` Steven Rostedt
  2016-02-14 17:35   ` Denis Kirjanov
  2016-02-14 20:19   ` Denis Kirjanov
  1 sibling, 2 replies; 13+ messages in thread
From: Steven Rostedt @ 2016-02-14 16:45 UTC (permalink / raw)
  To: Denis Kirjanov; +Cc: linux-kernel, paulmck

On Sat, 13 Feb 2016 21:22:52 +0300
Denis Kirjanov <kda@linux-powerpc.org> wrote:

> -DEFINE_EVENT(kmem_free, kfree,
> +DEFINE_EVENT_CONDITION(kmem_free, kfree,
>  
>  	TP_PROTO(unsigned long call_site, const void *ptr),
>  
> -	TP_ARGS(call_site, ptr)
> +	TP_ARGS(call_site, ptr),
> +
> +	/*
> +	 * This trace can be potentially called from an offlined cpu.
> +	 * Since trace points use RCU and RCU should not be used from
> +	 * offline cpus, filter such calls out.
> +	 * While this trace can be called from a preemptable section,
> +	 * it has no impact on the condition since tasks can migrate
> +	 * only from online cpus to other online cpus. Thus its safe
> +	 * to use raw_smp_processor_id.
> +	 */
> +	TP_CONDITION(cpu_online(raw_smp_processor_id()))

This is starting to become a common occurrence. Perhaps it is best to
just hardcode this into the tracepoint code itself?

-- Steve

>  );
>  
>  DEFINE_EVENT_CONDITION(kmem_free, kmem_cache_free,

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/2] tracing/mm: don't trace kfree on offline CPUs
  2016-02-14 16:45 ` [PATCH 1/2] tracing/mm: don't trace kfree " Steven Rostedt
@ 2016-02-14 17:35   ` Denis Kirjanov
  2016-02-14 20:19   ` Denis Kirjanov
  1 sibling, 0 replies; 13+ messages in thread
From: Denis Kirjanov @ 2016-02-14 17:35 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: linux-kernel, paulmck

On 2/14/16, Steven Rostedt <rostedt@goodmis.org> wrote:
> On Sat, 13 Feb 2016 21:22:52 +0300
> Denis Kirjanov <kda@linux-powerpc.org> wrote:
>
>> -DEFINE_EVENT(kmem_free, kfree,
>> +DEFINE_EVENT_CONDITION(kmem_free, kfree,
>>
>>  	TP_PROTO(unsigned long call_site, const void *ptr),
>>
>> -	TP_ARGS(call_site, ptr)
>> +	TP_ARGS(call_site, ptr),
>> +
>> +	/*
>> +	 * This trace can be potentially called from an offlined cpu.
>> +	 * Since trace points use RCU and RCU should not be used from
>> +	 * offline cpus, filter such calls out.
>> +	 * While this trace can be called from a preemptable section,
>> +	 * it has no impact on the condition since tasks can migrate
>> +	 * only from online cpus to other online cpus. Thus its safe
>> +	 * to use raw_smp_processor_id.
>> +	 */
>> +	TP_CONDITION(cpu_online(raw_smp_processor_id()))
>
> This is starting to become a common occurrence. Perhaps it is best to
> just hardcode this into the tracepoint code itself?

Yeah, I was thinking about it the same way and so we can make it generic

>
> -- Steve
>
>>  );
>>
>>  DEFINE_EVENT_CONDITION(kmem_free, kmem_cache_free,
>
>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/2] tracing/rcu: don't trace rcu_callback on offline CPUs
  2016-02-14 16:43   ` Steven Rostedt
@ 2016-02-14 17:35     ` Denis Kirjanov
  0 siblings, 0 replies; 13+ messages in thread
From: Denis Kirjanov @ 2016-02-14 17:35 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: linux-kernel, paulmck

On 2/14/16, Steven Rostedt <rostedt@goodmis.org> wrote:
> On Sat, 13 Feb 2016 21:22:53 +0300
> Denis Kirjanov <kda@linux-powerpc.org> wrote:
>
>>
>> diff --git a/include/trace/events/rcu.h b/include/trace/events/rcu.h
>> index ef72c4a..5470f2f 100644
>> --- a/include/trace/events/rcu.h
>> +++ b/include/trace/events/rcu.h
>> @@ -435,6 +435,8 @@ TRACE_EVENT(rcu_callback,
>>
>>  	TP_ARGS(rcuname, rhp, qlen_lazy, qlen),
>>
>> +	TP_CONDITION(cpu_online(raw_smp_processor_id())),
>> +
>
> Besides the fact that this isn't a TRACE_EVENT_CONDITION, Isn't calling
> rcu_callback() dangerous from an offline CPU?

That was the wrong patch, I've sent the v2.

>
> Or is calling a callback from an offline CPU OK?
>
> Perhaps it is OK, as it doesn't need to worry about its current CPU,
> just the other CPUs.
>
> Paul?
>
> -- Steve
>
>
>>  	TP_STRUCT__entry(
>>  		__field(const char *, rcuname)
>>  		__field(void *, rhp)
>
>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/2] tracing/mm: don't trace kfree on offline CPUs
  2016-02-14 16:45 ` [PATCH 1/2] tracing/mm: don't trace kfree " Steven Rostedt
  2016-02-14 17:35   ` Denis Kirjanov
@ 2016-02-14 20:19   ` Denis Kirjanov
  2016-02-15 17:32     ` Steven Rostedt
  1 sibling, 1 reply; 13+ messages in thread
From: Denis Kirjanov @ 2016-02-14 20:19 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: linux-kernel, paulmck

On 2/14/16, Steven Rostedt <rostedt@goodmis.org> wrote:
> On Sat, 13 Feb 2016 21:22:52 +0300
> Denis Kirjanov <kda@linux-powerpc.org> wrote:
>
>> -DEFINE_EVENT(kmem_free, kfree,
>> +DEFINE_EVENT_CONDITION(kmem_free, kfree,
>>
>>  	TP_PROTO(unsigned long call_site, const void *ptr),
>>
>> -	TP_ARGS(call_site, ptr)
>> +	TP_ARGS(call_site, ptr),
>> +
>> +	/*
>> +	 * This trace can be potentially called from an offlined cpu.
>> +	 * Since trace points use RCU and RCU should not be used from
>> +	 * offline cpus, filter such calls out.
>> +	 * While this trace can be called from a preemptable section,
>> +	 * it has no impact on the condition since tasks can migrate
>> +	 * only from online cpus to other online cpus. Thus its safe
>> +	 * to use raw_smp_processor_id.
>> +	 */
>> +	TP_CONDITION(cpu_online(raw_smp_processor_id()))
>
> This is starting to become a common occurrence. Perhaps it is best to
> just hardcode this into the tracepoint code itself?

Can you take it as a fix for now. I'll post the follow-up patch then
for rcu and offline cpus
issue.

Thanks!

>
> -- Steve
>
>>  );
>>
>>  DEFINE_EVENT_CONDITION(kmem_free, kmem_cache_free,
>
>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/2] tracing/mm: don't trace kfree on offline CPUs
  2016-02-14 20:19   ` Denis Kirjanov
@ 2016-02-15 17:32     ` Steven Rostedt
  2016-02-16  5:52       ` Denis Kirjanov
  0 siblings, 1 reply; 13+ messages in thread
From: Steven Rostedt @ 2016-02-15 17:32 UTC (permalink / raw)
  To: Denis Kirjanov; +Cc: linux-kernel, paulmck

On Sun, 14 Feb 2016 23:19:42 +0300
Denis Kirjanov <kda@linux-powerpc.org> wrote:


> >>  	TP_PROTO(unsigned long call_site, const void *ptr),
> >>
> >> -	TP_ARGS(call_site, ptr)
> >> +	TP_ARGS(call_site, ptr),
> >> +
> >> +	/*
> >> +	 * This trace can be potentially called from an offlined cpu.
> >> +	 * Since trace points use RCU and RCU should not be used from
> >> +	 * offline cpus, filter such calls out.
> >> +	 * While this trace can be called from a preemptable section,
> >> +	 * it has no impact on the condition since tasks can migrate
> >> +	 * only from online cpus to other online cpus. Thus its safe
> >> +	 * to use raw_smp_processor_id.
> >> +	 */
> >> +	TP_CONDITION(cpu_online(raw_smp_processor_id()))  
> >
> > This is starting to become a common occurrence. Perhaps it is best to
> > just hardcode this into the tracepoint code itself?  
> 
> Can you take it as a fix for now. I'll post the follow-up patch then
> for rcu and offline cpus
> issue.

Actually, I prefer not to add more checks for cpu_online(), if its
going to become the default.

Does this work for you instead?

-- Steve

diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index acd522a91539..acfdbf353a0b 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -14,8 +14,10 @@
  * See the file COPYING for more details.
  */
 
+#include <linux/smp.h>
 #include <linux/errno.h>
 #include <linux/types.h>
+#include <linux/cpumask.h>
 #include <linux/rcupdate.h>
 #include <linux/tracepoint-defs.h>
 
@@ -132,6 +134,9 @@ extern void syscall_unregfunc(void);
 		void *it_func;						\
 		void *__data;						\
 									\
+		if (!cpu_online(raw_smp_processor_id()))		\
+			return;						\
+									\
 		if (!(cond))						\
 			return;						\
 		prercu;							\

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/2] tracing/mm: don't trace kfree on offline CPUs
  2016-02-15 17:32     ` Steven Rostedt
@ 2016-02-16  5:52       ` Denis Kirjanov
  2016-02-16 11:03         ` Paul E. McKenney
  2016-02-16 15:01         ` Steven Rostedt
  0 siblings, 2 replies; 13+ messages in thread
From: Denis Kirjanov @ 2016-02-16  5:52 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: linux-kernel, paulmck

On 2/15/16, Steven Rostedt <rostedt@goodmis.org> wrote:
> On Sun, 14 Feb 2016 23:19:42 +0300
> Denis Kirjanov <kda@linux-powerpc.org> wrote:
>
>
>> >>  	TP_PROTO(unsigned long call_site, const void *ptr),
>> >>
>> >> -	TP_ARGS(call_site, ptr)
>> >> +	TP_ARGS(call_site, ptr),
>> >> +
>> >> +	/*
>> >> +	 * This trace can be potentially called from an offlined cpu.
>> >> +	 * Since trace points use RCU and RCU should not be used from
>> >> +	 * offline cpus, filter such calls out.
>> >> +	 * While this trace can be called from a preemptable section,
>> >> +	 * it has no impact on the condition since tasks can migrate
>> >> +	 * only from online cpus to other online cpus. Thus its safe
>> >> +	 * to use raw_smp_processor_id.
>> >> +	 */
>> >> +	TP_CONDITION(cpu_online(raw_smp_processor_id()))
>> >
>> > This is starting to become a common occurrence. Perhaps it is best to
>> > just hardcode this into the tracepoint code itself?
>>
>> Can you take it as a fix for now. I'll post the follow-up patch then
>> for rcu and offline cpus
>> issue.
>
> Actually, I prefer not to add more checks for cpu_online(), if its
> going to become the default.
>
> Does this work for you instead?

Hm, somehow it doesn't work:

[   84.692846] ===============================
[   84.692847] [ INFO: suspicious RCU usage. ]
[   84.692849] 4.5.0-rc3-00765-g78b70d4-dirty #36 Tainted: G S
[   84.692850] -------------------------------
[   84.692851] include/trace/events/rcu.h:457 suspicious
rcu_dereference_check() usage!
[   84.692852]
other info that might help us debug this:

[   84.692854]
RCU used illegally from offline CPU!
rcu_scheduler_active = 1, debug_locks = 1
[   84.692855] no locks held by swapper/11/0.
[   84.692856]
stack backtrace:
[   84.692858] CPU: 11 PID: 0 Comm: swapper/11 Tainted: G S
  4.5.0-rc3-00765-g78b70d4-dirty #36
[   84.692860] Call Trace:
[   84.692868] [c0000005b76d37f0] [c0000000008c57ac]
.dump_stack+0xe0/0x14c (unreliable)
[   84.692872] [c0000005b76d3880] [c00000000010d0c8]
.lockdep_rcu_suspicious+0x108/0x170
[   84.692876] [c0000005b76d3910] [c00000000013cab4]
.__call_rcu.constprop.60+0x244/0x680
[   84.692880] [c0000005b76d39e0] [c0000000002c38ec] .put_object+0x5c/0x80
[   84.692884] [c0000005b76d3a60] [c00000000029e748]
.kmem_cache_free+0x318/0x4c0
[   84.692888] [c0000005b76d3b00] [c0000000000936b4] .__mmdrop+0x54/0x150
[   84.692891] [c0000005b76d3b90] [c0000000000e46e0] .idle_task_exit+0x120/0x130
[   84.692895] [c0000005b76d3c20] [c000000000075a14]
.pseries_mach_cpu_die+0x64/0x310
[   84.692899] [c0000005b76d3cd0] [c00000000004401c] .cpu_die+0x3c/0x60
[   84.692902] [c0000005b76d3d40] [c000000000018998]
.arch_cpu_idle_dead+0x28/0x40
[   84.692906] [c0000005b76d3db0] [c000000000102714]
.cpu_startup_entry+0x554/0x580
[   84.692909] [c0000005b76d3ed0] [c000000000043d68]
.start_secondary+0x348/0x390
[   84.692913] [c0000005b76d3f90] [c000000000008a6c]
start_secondary_prolog+0x10/0x14

[   84.692918] ===============================
[   84.692919] [ INFO: suspicious RCU usage. ]
[   84.692920] 4.5.0-rc3-00765-g78b70d4-dirty #36 Tainted: G S
[   84.692921] -------------------------------
[   84.692922] include/trace/events/kmem.h:141 suspicious
rcu_dereference_check() usage!
[   84.692923]
other info that might help us debug this:

[   84.692924]
RCU used illegally from offline CPU!
rcu_scheduler_active = 1, debug_locks = 1
[   84.692925] no locks held by swapper/11/0.
[   84.692926]
stack backtrace:
[   84.692928] CPU: 11 PID: 0 Comm: swapper/11 Tainted: G S
  4.5.0-rc3-00765-g78b70d4-dirty #36
[   84.692929] Call Trace:
[   84.692933] [c0000005b76d38c0] [c0000000008c57ac]
.dump_stack+0xe0/0x14c (unreliable)
[   84.692936] [c0000005b76d3950] [c00000000010d0c8]
.lockdep_rcu_suspicious+0x108/0x170
[   84.692939] [c0000005b76d39e0] [c00000000029f1c0] .kfree+0x380/0x470
[   84.692942] [c0000005b76d3a80] [c000000000056194] .destroy_context+0x44/0x100
[   84.692946] [c0000005b76d3b00] [c0000000000936c0] .__mmdrop+0x60/0x150
[   84.692948] [c0000005b76d3b90] [c0000000000e46e0] .idle_task_exit+0x120/0x130
[   84.692951] [c0000005b76d3c20] [c000000000075a14]
.pseries_mach_cpu_die+0x64/0x310
[   84.692954] [c0000005b76d3cd0] [c00000000004401c] .cpu_die+0x3c/0x60
[   84.692957] [c0000005b76d3d40] [c000000000018998]
.arch_cpu_idle_dead+0x28/0x40
[   84.692960] [c0000005b76d3db0] [c000000000102714]
.cpu_startup_entry+0x554/0x580
[   84.692963] [c0000005b76d3ed0] [c000000000043d68]
.start_secondary+0x348/0x390
[   84.692966] [c0000005b76d3f90] [c000000000008a6c]
start_secondary_prolog+0x10/0x14



>
> -- Steve
>
> diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
> index acd522a91539..acfdbf353a0b 100644
> --- a/include/linux/tracepoint.h
> +++ b/include/linux/tracepoint.h
> @@ -14,8 +14,10 @@
>   * See the file COPYING for more details.
>   */
>
> +#include <linux/smp.h>
>  #include <linux/errno.h>
>  #include <linux/types.h>
> +#include <linux/cpumask.h>
>  #include <linux/rcupdate.h>
>  #include <linux/tracepoint-defs.h>
>
> @@ -132,6 +134,9 @@ extern void syscall_unregfunc(void);
>  		void *it_func;						\
>  		void *__data;						\
>  									\
> +		if (!cpu_online(raw_smp_processor_id()))		\
> +			return;						\
> +									\
>  		if (!(cond))						\
>  			return;						\
>  		prercu;							\
>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/2] tracing/mm: don't trace kfree on offline CPUs
  2016-02-16  5:52       ` Denis Kirjanov
@ 2016-02-16 11:03         ` Paul E. McKenney
  2016-02-16 15:01         ` Steven Rostedt
  1 sibling, 0 replies; 13+ messages in thread
From: Paul E. McKenney @ 2016-02-16 11:03 UTC (permalink / raw)
  To: Denis Kirjanov; +Cc: Steven Rostedt, linux-kernel

On Tue, Feb 16, 2016 at 08:52:24AM +0300, Denis Kirjanov wrote:
> On 2/15/16, Steven Rostedt <rostedt@goodmis.org> wrote:
> > On Sun, 14 Feb 2016 23:19:42 +0300
> > Denis Kirjanov <kda@linux-powerpc.org> wrote:
> >
> >
> >> >>  	TP_PROTO(unsigned long call_site, const void *ptr),
> >> >>
> >> >> -	TP_ARGS(call_site, ptr)
> >> >> +	TP_ARGS(call_site, ptr),
> >> >> +
> >> >> +	/*
> >> >> +	 * This trace can be potentially called from an offlined cpu.
> >> >> +	 * Since trace points use RCU and RCU should not be used from
> >> >> +	 * offline cpus, filter such calls out.
> >> >> +	 * While this trace can be called from a preemptable section,
> >> >> +	 * it has no impact on the condition since tasks can migrate
> >> >> +	 * only from online cpus to other online cpus. Thus its safe
> >> >> +	 * to use raw_smp_processor_id.
> >> >> +	 */
> >> >> +	TP_CONDITION(cpu_online(raw_smp_processor_id()))
> >> >
> >> > This is starting to become a common occurrence. Perhaps it is best to
> >> > just hardcode this into the tracepoint code itself?
> >>
> >> Can you take it as a fix for now. I'll post the follow-up patch then
> >> for rcu and offline cpus
> >> issue.
> >
> > Actually, I prefer not to add more checks for cpu_online(), if its
> > going to become the default.
> >
> > Does this work for you instead?
> 
> Hm, somehow it doesn't work:
> 
> [   84.692846] ===============================
> [   84.692847] [ INFO: suspicious RCU usage. ]
> [   84.692849] 4.5.0-rc3-00765-g78b70d4-dirty #36 Tainted: G S
> [   84.692850] -------------------------------
> [   84.692851] include/trace/events/rcu.h:457 suspicious
> rcu_dereference_check() usage!
> [   84.692852]
> other info that might help us debug this:
> 
> [   84.692854]
> RCU used illegally from offline CPU!

The problem is that the CPU really is offline as far as RCU is concerned.
The usual idle-loop workarounds do not apply here.

> rcu_scheduler_active = 1, debug_locks = 1
> [   84.692855] no locks held by swapper/11/0.
> [   84.692856]
> stack backtrace:
> [   84.692858] CPU: 11 PID: 0 Comm: swapper/11 Tainted: G S
>   4.5.0-rc3-00765-g78b70d4-dirty #36
> [   84.692860] Call Trace:
> [   84.692868] [c0000005b76d37f0] [c0000000008c57ac]
> .dump_stack+0xe0/0x14c (unreliable)
> [   84.692872] [c0000005b76d3880] [c00000000010d0c8]
> .lockdep_rcu_suspicious+0x108/0x170
> [   84.692876] [c0000005b76d3910] [c00000000013cab4]
> .__call_rcu.constprop.60+0x244/0x680
> [   84.692880] [c0000005b76d39e0] [c0000000002c38ec] .put_object+0x5c/0x80
> [   84.692884] [c0000005b76d3a60] [c00000000029e748]
> .kmem_cache_free+0x318/0x4c0
> [   84.692888] [c0000005b76d3b00] [c0000000000936b4] .__mmdrop+0x54/0x150

Ah, this is the problem.  We are calling __mmdrop() on a CPU that RCU
believes to be offline.

Can we pull the call to __mmdrop() forward?  (Trying to recall what
x86 did about a very similar problem...)

							Thanx, Paul

> [   84.692891] [c0000005b76d3b90] [c0000000000e46e0] .idle_task_exit+0x120/0x130
> [   84.692895] [c0000005b76d3c20] [c000000000075a14]
> .pseries_mach_cpu_die+0x64/0x310
> [   84.692899] [c0000005b76d3cd0] [c00000000004401c] .cpu_die+0x3c/0x60
> [   84.692902] [c0000005b76d3d40] [c000000000018998]
> .arch_cpu_idle_dead+0x28/0x40
> [   84.692906] [c0000005b76d3db0] [c000000000102714]
> .cpu_startup_entry+0x554/0x580
> [   84.692909] [c0000005b76d3ed0] [c000000000043d68]
> .start_secondary+0x348/0x390
> [   84.692913] [c0000005b76d3f90] [c000000000008a6c]
> start_secondary_prolog+0x10/0x14
> 
> [   84.692918] ===============================
> [   84.692919] [ INFO: suspicious RCU usage. ]
> [   84.692920] 4.5.0-rc3-00765-g78b70d4-dirty #36 Tainted: G S
> [   84.692921] -------------------------------
> [   84.692922] include/trace/events/kmem.h:141 suspicious
> rcu_dereference_check() usage!
> [   84.692923]
> other info that might help us debug this:
> 
> [   84.692924]
> RCU used illegally from offline CPU!
> rcu_scheduler_active = 1, debug_locks = 1
> [   84.692925] no locks held by swapper/11/0.
> [   84.692926]
> stack backtrace:
> [   84.692928] CPU: 11 PID: 0 Comm: swapper/11 Tainted: G S
>   4.5.0-rc3-00765-g78b70d4-dirty #36
> [   84.692929] Call Trace:
> [   84.692933] [c0000005b76d38c0] [c0000000008c57ac]
> .dump_stack+0xe0/0x14c (unreliable)
> [   84.692936] [c0000005b76d3950] [c00000000010d0c8]
> .lockdep_rcu_suspicious+0x108/0x170
> [   84.692939] [c0000005b76d39e0] [c00000000029f1c0] .kfree+0x380/0x470
> [   84.692942] [c0000005b76d3a80] [c000000000056194] .destroy_context+0x44/0x100
> [   84.692946] [c0000005b76d3b00] [c0000000000936c0] .__mmdrop+0x60/0x150
> [   84.692948] [c0000005b76d3b90] [c0000000000e46e0] .idle_task_exit+0x120/0x130
> [   84.692951] [c0000005b76d3c20] [c000000000075a14]
> .pseries_mach_cpu_die+0x64/0x310
> [   84.692954] [c0000005b76d3cd0] [c00000000004401c] .cpu_die+0x3c/0x60
> [   84.692957] [c0000005b76d3d40] [c000000000018998]
> .arch_cpu_idle_dead+0x28/0x40
> [   84.692960] [c0000005b76d3db0] [c000000000102714]
> .cpu_startup_entry+0x554/0x580
> [   84.692963] [c0000005b76d3ed0] [c000000000043d68]
> .start_secondary+0x348/0x390
> [   84.692966] [c0000005b76d3f90] [c000000000008a6c]
> start_secondary_prolog+0x10/0x14
> 
> 
> 
> >
> > -- Steve
> >
> > diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
> > index acd522a91539..acfdbf353a0b 100644
> > --- a/include/linux/tracepoint.h
> > +++ b/include/linux/tracepoint.h
> > @@ -14,8 +14,10 @@
> >   * See the file COPYING for more details.
> >   */
> >
> > +#include <linux/smp.h>
> >  #include <linux/errno.h>
> >  #include <linux/types.h>
> > +#include <linux/cpumask.h>
> >  #include <linux/rcupdate.h>
> >  #include <linux/tracepoint-defs.h>
> >
> > @@ -132,6 +134,9 @@ extern void syscall_unregfunc(void);
> >  		void *it_func;						\
> >  		void *__data;						\
> >  									\
> > +		if (!cpu_online(raw_smp_processor_id()))		\
> > +			return;						\
> > +									\
> >  		if (!(cond))						\
> >  			return;						\
> >  		prercu;							\
> >
> 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/2] tracing/mm: don't trace kfree on offline CPUs
  2016-02-16  5:52       ` Denis Kirjanov
  2016-02-16 11:03         ` Paul E. McKenney
@ 2016-02-16 15:01         ` Steven Rostedt
  2016-02-16 15:03           ` Steven Rostedt
  1 sibling, 1 reply; 13+ messages in thread
From: Steven Rostedt @ 2016-02-16 15:01 UTC (permalink / raw)
  To: Denis Kirjanov; +Cc: linux-kernel, paulmck

On Tue, 16 Feb 2016 08:52:24 +0300
Denis Kirjanov <kda@linux-powerpc.org> wrote:

> On 2/15/16, Steven Rostedt <rostedt@goodmis.org> wrote:
> > On Sun, 14 Feb 2016 23:19:42 +0300
> > Denis Kirjanov <kda@linux-powerpc.org> wrote:
> >
> >  
> >> >>  	TP_PROTO(unsigned long call_site, const void *ptr),
> >> >>
> >> >> -	TP_ARGS(call_site, ptr)
> >> >> +	TP_ARGS(call_site, ptr),
> >> >> +
> >> >> +	/*
> >> >> +	 * This trace can be potentially called from an offlined cpu.
> >> >> +	 * Since trace points use RCU and RCU should not be used from
> >> >> +	 * offline cpus, filter such calls out.
> >> >> +	 * While this trace can be called from a preemptable section,
> >> >> +	 * it has no impact on the condition since tasks can migrate
> >> >> +	 * only from online cpus to other online cpus. Thus its safe
> >> >> +	 * to use raw_smp_processor_id.
> >> >> +	 */
> >> >> +	TP_CONDITION(cpu_online(raw_smp_processor_id()))  
> >> >
> >> > This is starting to become a common occurrence. Perhaps it is best to
> >> > just hardcode this into the tracepoint code itself?  
> >>
> >> Can you take it as a fix for now. I'll post the follow-up patch then
> >> for rcu and offline cpus
> >> issue.  
> >
> > Actually, I prefer not to add more checks for cpu_online(), if its
> > going to become the default.
> >
> > Does this work for you instead?  
> 
> Hm, somehow it doesn't work:

But your patch works? Strange, because my exit condition is done before
the conditional part of the trace event. Thus, if this didn't work,
than your original patch should not work either.

-- Steve

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/2] tracing/mm: don't trace kfree on offline CPUs
  2016-02-16 15:01         ` Steven Rostedt
@ 2016-02-16 15:03           ` Steven Rostedt
  0 siblings, 0 replies; 13+ messages in thread
From: Steven Rostedt @ 2016-02-16 15:03 UTC (permalink / raw)
  To: Denis Kirjanov; +Cc: linux-kernel, paulmck

On Tue, 16 Feb 2016 10:01:21 -0500
Steven Rostedt <rostedt@goodmis.org> wrote:


> > > Does this work for you instead?    
> > 
> > Hm, somehow it doesn't work:  
> 
> But your patch works? Strange, because my exit condition is done before
> the conditional part of the trace event. Thus, if this didn't work,
> than your original patch should not work either.

Anyway, I'm going to do the push to Linus with the patch, because
there's been other locations that this has caused issues before.

-- Steve

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2016-02-16 15:03 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-13 18:22 [PATCH 1/2] tracing/mm: don't trace kfree on offline CPUs Denis Kirjanov
2016-02-13 18:22 ` [PATCH 2/2] tracing/rcu: don't trace rcu_callback " Denis Kirjanov
2016-02-13 19:25   ` kbuild test robot
2016-02-14 16:43   ` Steven Rostedt
2016-02-14 17:35     ` Denis Kirjanov
2016-02-14 16:45 ` [PATCH 1/2] tracing/mm: don't trace kfree " Steven Rostedt
2016-02-14 17:35   ` Denis Kirjanov
2016-02-14 20:19   ` Denis Kirjanov
2016-02-15 17:32     ` Steven Rostedt
2016-02-16  5:52       ` Denis Kirjanov
2016-02-16 11:03         ` Paul E. McKenney
2016-02-16 15:01         ` Steven Rostedt
2016-02-16 15:03           ` Steven Rostedt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.