diff options
author | Shreyas B. Prabhu <shreyas@linux.vnet.ibm.com> | 2015-05-28 18:44:19 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-05-28 21:25:18 -0400 |
commit | 1f0c27b50f4f2567e649f49d77daee2bbf3f40e5 (patch) | |
tree | cdf33c9a7a9e676d5be8dc4ac41f5aa8a56760ed | |
parent | e5feb1ebaadfb1f5f70a3591e762d780232a4f5d (diff) |
tracing/mm: don't trace mm_page_free on offline cpus
Since tracepoints use RCU for protection, they must not be called on
offline cpus. trace_mm_page_free can be called on an offline cpu in this
scenario caught by LOCKDEP:
===============================
[ INFO: suspicious RCU usage. ]
4.1.0-rc1+ #9 Not tainted
-------------------------------
include/trace/events/kmem.h:170 suspicious rcu_dereference_check() usage!
other info that might help us debug this:
RCU used illegally from offline CPU!
rcu_scheduler_active = 1, debug_locks = 1
no locks held by swapper/1/0.
stack backtrace:
CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.1.0-rc1+ #9
Call Trace:
.dump_stack+0x98/0xd4 (unreliable)
.lockdep_rcu_suspicious+0x108/0x170
.free_pages_prepare+0x494/0x680
.free_hot_cold_page+0x50/0x280
.destroy_context+0x90/0xd0
.__mmdrop+0x58/0x160
.idle_task_exit+0xf0/0x100
.pnv_smp_cpu_kill_self+0x58/0x2c0
.cpu_die+0x34/0x50
.arch_cpu_idle_dead+0x20/0x40
.cpu_startup_entry+0x708/0x7a0
.start_secondary+0x36c/0x3a0
start_secondary_prolog+0x10/0x14
Fix this by converting mm_page_free trace point into TRACE_EVENT_CONDITION
where condition is cpu_online(smp_processor_id())
Signed-off-by: Shreyas B. Prabhu <shreyas@linux.vnet.ibm.com>
Reviewed-by: Preeti U Murthy <preeti@linux.vnet.ibm.com>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | include/trace/events/kmem.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/include/trace/events/kmem.h b/include/trace/events/kmem.h index 78efa0a197a9..aa863549e77a 100644 --- a/include/trace/events/kmem.h +++ b/include/trace/events/kmem.h | |||
@@ -158,12 +158,24 @@ DEFINE_EVENT_CONDITION(kmem_free, kmem_cache_free, | |||
158 | TP_CONDITION(cpu_online(raw_smp_processor_id())) | 158 | TP_CONDITION(cpu_online(raw_smp_processor_id())) |
159 | ); | 159 | ); |
160 | 160 | ||
161 | TRACE_EVENT(mm_page_free, | 161 | TRACE_EVENT_CONDITION(mm_page_free, |
162 | 162 | ||
163 | TP_PROTO(struct page *page, unsigned int order), | 163 | TP_PROTO(struct page *page, unsigned int order), |
164 | 164 | ||
165 | TP_ARGS(page, order), | 165 | TP_ARGS(page, order), |
166 | 166 | ||
167 | |||
168 | /* | ||
169 | * This trace can be potentially called from an offlined cpu. | ||
170 | * Since trace points use RCU and RCU should not be used from | ||
171 | * offline cpus, filter such calls out. | ||
172 | * While this trace can be called from a preemptable section, | ||
173 | * it has no impact on the condition since tasks can migrate | ||
174 | * only from online cpus to other online cpus. Thus its safe | ||
175 | * to use raw_smp_processor_id. | ||
176 | */ | ||
177 | TP_CONDITION(cpu_online(raw_smp_processor_id())), | ||
178 | |||
167 | TP_STRUCT__entry( | 179 | TP_STRUCT__entry( |
168 | __field( unsigned long, pfn ) | 180 | __field( unsigned long, pfn ) |
169 | __field( unsigned int, order ) | 181 | __field( unsigned int, order ) |