linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Joel Fernandes (Google)" <joel@joelfernandes.org>
To: linux-kernel@vger.kernel.org
Cc: "Joel Fernandes (Google)" <joel@joelfernandes.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Gustavo A. R. Silva" <gustavo@embeddedor.com>,
	Ingo Molnar <mingo@redhat.com>,
	Richard Fontana <rfontana@redhat.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	"Paul E. McKenney" <paulmck@kernel.org>,
	Josh Triplett <josh@joshtriplett.org>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Lai Jiangshan <jiangshanlai@gmail.com>
Subject: [RFC 3/3] Revert "tracepoint: Make rcuidle tracepoint callers use SRCU"
Date: Fri,  7 Feb 2020 15:56:56 -0500	[thread overview]
Message-ID: <20200207205656.61938-4-joel@joelfernandes.org> (raw)
In-Reply-To: <20200207205656.61938-1-joel@joelfernandes.org>

This reverts commit e6753f23d961d601dbae50a2fc2a3975c9715b14.

Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
---
 include/linux/tracepoint.h | 40 ++++++++------------------------------
 kernel/tracepoint.c        | 10 +---------
 2 files changed, 9 insertions(+), 41 deletions(-)

diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index ab1f13b7f7d2c..b2b13cf03e092 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -13,7 +13,6 @@
  */
 
 #include <linux/smp.h>
-#include <linux/srcu.h>
 #include <linux/errno.h>
 #include <linux/types.h>
 #include <linux/cpumask.h>
@@ -32,8 +31,6 @@ struct trace_eval_map {
 
 #define TRACEPOINT_DEFAULT_PRIO	10
 
-extern struct srcu_struct tracepoint_srcu;
-
 extern int
 tracepoint_probe_register(struct tracepoint *tp, void *probe, void *data);
 extern int
@@ -76,16 +73,10 @@ int unregister_tracepoint_module_notifier(struct notifier_block *nb)
  * probe unregistration and the end of module exit to make sure there is no
  * caller executing a probe when it is freed.
  */
-#ifdef CONFIG_TRACEPOINTS
 static inline void tracepoint_synchronize_unregister(void)
 {
-	synchronize_srcu(&tracepoint_srcu);
 	synchronize_rcu();
 }
-#else
-static inline void tracepoint_synchronize_unregister(void)
-{ }
-#endif
 
 #ifdef CONFIG_HAVE_SYSCALL_TRACEPOINTS
 extern int syscall_regfunc(void);
@@ -159,31 +150,18 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p)
  * as "(void *, void)". The DECLARE_TRACE_NOARGS() will pass in just
  * "void *data", where as the DECLARE_TRACE() will pass in "void *data, proto".
  */
-#define __DO_TRACE(tp, proto, args, cond, rcuidle)			\
+#define __DO_TRACE(tp, proto, args, cond, rcucheck)			\
 	do {								\
 		struct tracepoint_func *it_func_ptr;			\
 		void *it_func;						\
 		void *__data;						\
-		int __maybe_unused idx = 0;				\
 									\
 		if (!(cond))						\
 			return;						\
-									\
-		/* srcu can't be used from NMI */			\
-		WARN_ON_ONCE(rcuidle && in_nmi());			\
-									\
-		/* keep srcu and sched-rcu usage consistent */		\
-		preempt_disable_notrace();				\
-									\
-		/*							\
-		 * For rcuidle callers, use srcu since sched-rcu	\
-		 * doesn't work from the idle path.			\
-		 */							\
-		if (rcuidle)						\
-			idx = srcu_read_lock_notrace(&tracepoint_srcu);	\
-									\
-		it_func_ptr = rcu_dereference_raw((tp)->funcs);		\
-									\
+		if (rcucheck)						\
+			rcu_irq_enter_irqson();				\
+		rcu_read_lock_sched_notrace();				\
+		it_func_ptr = rcu_dereference_sched((tp)->funcs);	\
 		if (it_func_ptr) {					\
 			do {						\
 				it_func = (it_func_ptr)->func;		\
@@ -191,11 +169,9 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p)
 				((void(*)(proto))(it_func))(args);	\
 			} while ((++it_func_ptr)->func);		\
 		}							\
-									\
-		if (rcuidle)						\
-			srcu_read_unlock_notrace(&tracepoint_srcu, idx);\
-									\
-		preempt_enable_notrace();				\
+		rcu_read_unlock_sched_notrace();			\
+		if (rcucheck)						\
+			rcu_irq_exit_irqson();				\
 	} while (0)
 
 #ifndef MODULE
diff --git a/kernel/tracepoint.c b/kernel/tracepoint.c
index 73956eaff8a9c..df956fc23ca57 100644
--- a/kernel/tracepoint.c
+++ b/kernel/tracepoint.c
@@ -18,9 +18,6 @@
 extern tracepoint_ptr_t __start___tracepoints_ptrs[];
 extern tracepoint_ptr_t __stop___tracepoints_ptrs[];
 
-DEFINE_SRCU(tracepoint_srcu);
-EXPORT_SYMBOL_GPL(tracepoint_srcu);
-
 /* Set to 1 to enable tracepoint debug output */
 static const int tracepoint_debug;
 
@@ -60,14 +57,9 @@ static inline void *allocate_probes(int count)
 	return p == NULL ? NULL : p->probes;
 }
 
-static void srcu_free_old_probes(struct rcu_head *head)
-{
-	kfree(container_of(head, struct tp_probes, rcu));
-}
-
 static void rcu_free_old_probes(struct rcu_head *head)
 {
-	call_srcu(&tracepoint_srcu, head, srcu_free_old_probes);
+	kfree(container_of(head, struct tp_probes, rcu));
 }
 
 static __init int release_early_probes(void)
-- 
2.25.0.341.g760bfbb309-goog


  parent reply	other threads:[~2020-02-07 20:57 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-07 20:56 [RFC 0/3] Revert SRCU from tracepoint infrastructure Joel Fernandes (Google)
2020-02-07 20:56 ` [RFC 1/3] Revert "tracepoint: Use __idx instead of idx in DO_TRACE macro to make it unique" Joel Fernandes (Google)
2020-02-07 21:07   ` Steven Rostedt
2020-02-07 20:56 ` [RFC 2/3] Revert "tracing: Add back in rcu_irq_enter/exit_irqson() for rcuidle tracepoints" Joel Fernandes (Google)
2020-02-07 20:56 ` Joel Fernandes (Google) [this message]
2020-02-07 21:24 ` [RFC 0/3] Revert SRCU from tracepoint infrastructure Paul E. McKenney
2020-02-07 21:43   ` Joel Fernandes
2020-02-08 16:39     ` Mathieu Desnoyers
2020-02-08 16:31 ` Mathieu Desnoyers
2020-02-10  9:46   ` Peter Zijlstra
2020-02-10 10:19     ` Peter Zijlstra
2020-02-10 13:36     ` Paul E. McKenney
2020-02-10 13:44       ` Peter Zijlstra
2020-02-10 13:57         ` Paul E. McKenney
2020-02-10 17:17       ` Joel Fernandes
2020-02-10 17:05     ` Steven Rostedt
2020-02-10 17:33       ` Mathieu Desnoyers
2020-02-10 18:30         ` Steven Rostedt
2020-02-10 19:05           ` Mathieu Desnoyers
2020-02-10 19:53           ` Joel Fernandes
2020-02-10 20:03             ` Steven Rostedt
2020-02-10 20:30               ` Joel Fernandes
2020-02-10 18:07       ` Paul E. McKenney
2020-02-10 16:59   ` Joel Fernandes

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=20200207205656.61938-4-joel@joelfernandes.org \
    --to=joel@joelfernandes.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=gustavo@embeddedor.com \
    --cc=jiangshanlai@gmail.com \
    --cc=josh@joshtriplett.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mingo@redhat.com \
    --cc=paulmck@kernel.org \
    --cc=rfontana@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /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).