Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1334656

Re: [PATCH 1/2] tracing/mm: don't trace kfree on offline CPUs

From Steven Rostedt <rostedt@goodmis.org>
Newsgroups linux.kernel
Subject Re: [PATCH 1/2] tracing/mm: don't trace kfree on offline CPUs
Date 2016-02-15 18:40 +0100
Message-ID <r2vhU-49p-13@gated-at.bofh.it> (permalink)
References <r1N7b-8vh-7@gated-at.bofh.it> <r281Y-5fl-13@gated-at.bofh.it> <r2bjc-7Fs-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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;							\

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/2] tracing/mm: don't trace kfree on offline CPUs Denis Kirjanov <kda@linux-powerpc.org> - 2016-02-13 19:30 +0100
  Re: [PATCH 1/2] tracing/mm: don't trace kfree on offline CPUs Steven Rostedt <rostedt@goodmis.org> - 2016-02-14 17:50 +0100
    Re: [PATCH 1/2] tracing/mm: don't trace kfree on offline CPUs Denis Kirjanov <kda@linux-powerpc.org> - 2016-02-14 18:40 +0100
    Re: [PATCH 1/2] tracing/mm: don't trace kfree on offline CPUs Denis Kirjanov <kda@linux-powerpc.org> - 2016-02-14 21:20 +0100
      Re: [PATCH 1/2] tracing/mm: don't trace kfree on offline CPUs Steven Rostedt <rostedt@goodmis.org> - 2016-02-15 18:40 +0100
        Re: [PATCH 1/2] tracing/mm: don't trace kfree on offline CPUs Denis Kirjanov <kda@linux-powerpc.org> - 2016-02-16 07:00 +0100
          Re: [PATCH 1/2] tracing/mm: don't trace kfree on offline CPUs "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-02-16 12:10 +0100
          Re: [PATCH 1/2] tracing/mm: don't trace kfree on offline CPUs Steven Rostedt <rostedt@goodmis.org> - 2016-02-16 16:10 +0100
            Re: [PATCH 1/2] tracing/mm: don't trace kfree on offline CPUs Steven Rostedt <rostedt@goodmis.org> - 2016-02-16 16:10 +0100

csiph-web