linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Sedat Dilek <sedat.dilek@gmail.com>
Cc: Paul McKenney <paulmck@linux.vnet.ibm.com>,
	Dave Hansen <dave@sr71.net>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	linux-next <linux-next@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	Kristen Carlson Accardi <kristen@linux.intel.com>,
	"H. Peter Anvin" <hpa@linux.intel.com>,
	Rik van Riel <riel@redhat.com>, Mel Gorman <mgorman@suse.de>
Subject: Re: linux-next: Tree for Feb 4
Date: Thu, 5 Feb 2015 18:11:41 -0500	[thread overview]
Message-ID: <20150205181141.6f1d532a@gandalf.local.home> (raw)
In-Reply-To: <CA+icZUX_f_M7EmV3OM_CeosjfqoMSkJrCgUBm0LKFFurFGRvGQ@mail.gmail.com>

On Thu, 5 Feb 2015 23:16:21 +0100
Sedat Dilek <sedat.dilek@gmail.com> wrote:

> On Thu, Feb 5, 2015 at 11:09 PM, Steven Rostedt <rostedt@goodmis.org> wrote:
> > On Thu, 5 Feb 2015 22:45:59 +0100
> > Sedat Dilek <sedat.dilek@gmail.com> wrote:
> >
> >> Steve, this was a typo it's called tlb_flush not tlb_flush*ed*:
> >
> > Heh, yeah, I typed that entire line in by hand. Just be lucky that was
> > the only typo ;-)
> >
> >>
> >> # cat /sys/kernel/debug/tracing/events/tlb/tlb_flush/enable
> >> 1
> >>
> >> [  391.090381] intel_pstate CPU 1 exiting
> >> [  391.104491] smpboot: CPU 1 is now offline
> >>
> >
> > Now, if you disable that (echo 0 to that file), do you still get the
> > rcu lockdep splat if you suspend and resume?
> >
> 
> YES, I get the call-trace again!
> 

Bah! I see where the warning comes from. In include/linux/tracepoint.h
we have:

#define __DECLARE_TRACE(name, proto, args, cond, data_proto, data_args) \
	extern struct tracepoint __tracepoint_##name;			\
	static inline void trace_##name(proto)				\
	{								\
		if (static_key_false(&__tracepoint_##name.key))		\
			__DO_TRACE(&__tracepoint_##name,		\
				TP_PROTO(data_proto),			\
				TP_ARGS(data_args),			\
				TP_CONDITION(cond),,);			\
		if (IS_ENABLED(CONFIG_LOCKDEP)) {			\
			rcu_read_lock_sched_notrace();			\
			rcu_dereference_sched(__tracepoint_##name.funcs);\
			rcu_read_unlock_sched_notrace();		\
		}							\
	}								\

See that if (IS_ENABLED(CONFIG_LOCKDEP))?

I'm recalling this. Because tracepoints require RCU, and RCU lockdep
doesn't trigger if a tracepoint isn't enabled (because the rcu calls
are hidden in the __DO_TRACE() behind that static_key_false), we would
be missing lots of rcu problem tracepoints because tests were run
without them enabled.

The answer was to add this rcu check when LOCKDEP was enabled. So no,
adding that conditional isn't going to help, because lockdep will
trigger here, even if it were safe because of the conditional :-/.

That said, let's add this (on top of the old patch):

(again, not tested)

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-------
diff --git a/arch/x86/include/asm/mmu_context.h b/arch/x86/include/asm/mmu_context.h
index 4b75d591eb5e..401b5bfbcdbd 100644
--- a/arch/x86/include/asm/mmu_context.h
+++ b/arch/x86/include/asm/mmu_context.h
@@ -47,7 +47,12 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
 
 		/* Re-load page tables */
 		load_cr3(next->pgd);
-		trace_tlb_flush(TLB_FLUSH_ON_TASK_SWITCH, TLB_FLUSH_ALL);
+		/*
+		 * Do not check rcu when tracing is not enabled. The
+		 * tracepoint has a condition to not trace if the CPU is
+		 * offline, and rcu check will complain if it is.
+		 */
+		trace_tlb_flush_rcu_nocheck(TLB_FLUSH_ON_TASK_SWITCH, TLB_FLUSH_ALL);
 
 		/* Stop flush ipis for the previous mm */
 		cpumask_clear_cpu(cpu, mm_cpumask(prev));
@@ -84,7 +89,13 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
 			 * to make sure to use no freed page tables.
 			 */
 			load_cr3(next->pgd);
-			trace_tlb_flush(TLB_FLUSH_ON_TASK_SWITCH, TLB_FLUSH_ALL);
+			/*
+			 * Do not check rcu when tracing is not enabled. The
+			 * tracepoint has a condition to not trace if the CPU is
+			 * offline, and rcu check will complain if it is.
+			 */
+			trace_tlb_flush_rcu_nocheck(TLB_FLUSH_ON_TASK_SWITCH,
+						    TLB_FLUSH_ALL);
 			load_LDT_nolock(&next->context);
 		}
 	}
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index e08e21e5f601..747a05aceb60 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -179,6 +179,14 @@ extern void syscall_unregfunc(void);
 			rcu_read_unlock_sched_notrace();		\
 		}							\
 	}								\
+	static inline void trace_##name##_rcu_nocheck(proto)		\
+	{								\
+		if (static_key_false(&__tracepoint_##name.key))		\
+			__DO_TRACE(&__tracepoint_##name,		\
+				TP_PROTO(data_proto),			\
+				TP_ARGS(data_args),			\
+				TP_CONDITION(cond),,);			\
+	}								\
 	__DECLARE_TRACE_RCU(name, PARAMS(proto), PARAMS(args),		\
 		PARAMS(cond), PARAMS(data_proto), PARAMS(data_args))	\
 	static inline int						\
@@ -230,6 +238,8 @@ extern void syscall_unregfunc(void);
 #define __DECLARE_TRACE(name, proto, args, cond, data_proto, data_args) \
 	static inline void trace_##name(proto)				\
 	{ }								\
+	static inline void trace_##name##_rcu_nocheck(proto)		\
+	{ }								\
 	static inline void trace_##name##_rcuidle(proto)		\
 	{ }								\
 	static inline int						\

  reply	other threads:[~2015-02-05 23:11 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-04  8:35 linux-next: Tree for Feb 4 Stephen Rothwell
2015-02-04 12:26 ` Sedat Dilek
2015-02-04 15:16   ` Jens Axboe
2015-02-04 15:21     ` Sedat Dilek
2015-02-04 15:31       ` Jens Axboe
2015-02-04 15:36         ` Sedat Dilek
2015-02-04 15:58           ` Martin K. Petersen
2015-02-04 16:06             ` Sedat Dilek
2015-02-05  3:17               ` Martin K. Petersen
2015-02-05  3:41                 ` Sedat Dilek
2015-02-05 19:46                 ` Sedat Dilek
2015-02-06 15:24                   ` Sedat Dilek
2015-02-04 20:18 ` Sedat Dilek
2015-02-04 21:54   ` Rafael J. Wysocki
2015-02-04 21:53     ` Paul E. McKenney
2015-02-04 22:59       ` Rafael J. Wysocki
2015-02-04 23:51         ` Paul E. McKenney
2015-02-04 23:58           ` Sedat Dilek
2015-02-05  0:10           ` Paul E. McKenney
2015-02-05  0:30             ` Sedat Dilek
2015-02-05  0:57               ` Paul E. McKenney
2015-02-05  1:18                 ` Sedat Dilek
2015-02-05  1:51                   ` Paul E. McKenney
2015-02-05  1:53                     ` Sedat Dilek
2015-02-05  2:12                       ` Sedat Dilek
2015-02-05  4:13                         ` Paul E. McKenney
2015-02-05  7:14                       ` Dave Hansen
2015-02-05 14:37                         ` Paul E. McKenney
2015-02-05 14:57                         ` Sedat Dilek
2015-02-05 16:58                           ` Paul E. McKenney
2015-02-05 18:03                         ` Steven Rostedt
2015-02-05 18:08                           ` Steven Rostedt
2015-02-05 18:11                             ` Dave Hansen
2015-02-05 18:34                               ` Paul E. McKenney
2015-02-05 18:35                                 ` Dave Hansen
2015-02-05 18:45                                   ` Paul E. McKenney
2015-02-05 19:25                                     ` Sedat Dilek
2015-02-05 19:33                                       ` Paul E. McKenney
2015-02-05 19:42                                         ` Sedat Dilek
2015-02-05 19:58                                       ` Steven Rostedt
2015-02-05 20:07                                         ` Sedat Dilek
2015-02-05 20:22                                           ` Steven Rostedt
2015-02-05 20:50                                             ` Sedat Dilek
2015-02-05 21:45                                               ` Sedat Dilek
2015-02-05 22:09                                                 ` Steven Rostedt
2015-02-05 22:16                                                   ` Sedat Dilek
2015-02-05 23:11                                                     ` Steven Rostedt [this message]
2015-02-05 23:53                                                       ` Sedat Dilek
2015-02-06  0:03                                                         ` Sedat Dilek
2015-02-06  0:12                                                         ` Steven Rostedt
2015-02-06  0:14                                                           ` Sedat Dilek
2015-02-04 22:38     ` Sedat Dilek
2015-02-04 23:25       ` Rafael J. Wysocki
2015-02-04 23:54         ` Sedat Dilek
2015-02-04 22:46     ` Sedat Dilek
2015-02-04 23:30       ` Rafael J. Wysocki
2015-02-04 23:48         ` Sedat Dilek
  -- strict thread matches above, loose matches on Subject: below --
2022-02-04  4:14 Stephen Rothwell
2021-02-04  9:13 Stephen Rothwell
2020-02-04  4:19 Stephen Rothwell
2019-02-04  5:35 Stephen Rothwell
2016-02-04  3:48 Stephen Rothwell
2014-02-04  5:07 Stephen Rothwell
     [not found] ` <CAP=VYLpgLC_4yuPtQH_yAd8S9cqQAVu2uB2=Wf3q_zgY4uzkLw@mail.gmail.com>
2014-02-04 22:23   ` Stephen Rothwell
2014-02-05  0:41 ` Stephen Rothwell
2013-02-04  7:39 Stephen Rothwell
2013-02-04 13:56 ` James Hogan
2013-02-04 20:33   ` Stephen Rothwell

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=20150205181141.6f1d532a@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=dave@sr71.net \
    --cc=hpa@linux.intel.com \
    --cc=kristen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=rafael.j.wysocki@intel.com \
    --cc=riel@redhat.com \
    --cc=rjw@rjwysocki.net \
    --cc=sedat.dilek@gmail.com \
    --cc=sfr@canb.auug.org.au \
    /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;
as well as URLs for NNTP newsgroup(s).