From: Denis Kirjanov <kda@linux-powerpc.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-kernel@vger.kernel.org, paulmck@linux.vnet.ibm.com,
Denis Kirjanov <kda@linux-powerpc.org>
Subject: [PATCH 1/2] tracing/mm: don't trace kfree on offline CPUs
Date: Sat, 13 Feb 2016 21:22:52 +0300 [thread overview]
Message-ID: <1455387773-4245-1-git-send-email-kda@linux-powerpc.org> (raw)
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
next reply other threads:[~2016-02-13 18:25 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-13 18:22 Denis Kirjanov [this message]
2016-02-13 18:22 ` [PATCH 2/2] tracing/rcu: don't trace rcu_callback on offline CPUs 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
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=1455387773-4245-1-git-send-email-kda@linux-powerpc.org \
--to=kda@linux-powerpc.org \
--cc=linux-kernel@vger.kernel.org \
--cc=paulmck@linux.vnet.ibm.com \
--cc=rostedt@goodmis.org \
/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