[ltt-dev] [PATCH for -tip] Notifiers: atomic notifier "notrace" call chain

Mathieu Desnoyers mathieu.desnoyers at efficios.com
Wed Sep 1 15:28:44 EDT 2010


The impact of this patch is that the RCU read-side is now marked "notrace" in
the atomic call chain notifier. It also switch this atomic notifier call chain
from RCU to "sched RCU". Disabling preemption in the atomic notifier does not
have any significant side-effect, because atomic notifiers already expect to
execute in atomic context. The notifier unregistration is adapted to use "sched
RCU".

The "Generic Ring Buffer Library" needs to be able to use the atomic notifier
from cpu idle entry. The aim is to ensure the ring buffer makes the last events
ready for reading before the CPU goes idle. This is required by the Generic Ring
Buffer Library because it uses deferrable timers for trace streaming.

This is also useful to the die notifier, which makes breakpoint insertion valid
in more code paths.

I submit this patch for inclusion in -tip. Meanwhile, I will add this patch to
the tip-pull-queue in the ringbuffer git tree:

git://git.kernel.org/pub/scm/linux/kernel/git/compudj/linux-2.6-ringbuffer.git
branch: tip-pull-queue

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
Reviewed-by: Paul E. McKenney <paulmck at linux.vnet.ibm.com>
Reviewed-by: Masami Hiramatsu <mhiramat at redhat.com>
CC: Jason Baron <jbaron at redhat.com>
CC: Ingo Molnar <mingo at elte.hu>
CC: Thomas Gleixner <tglx at linutronix.de>
---
 kernel/notifier.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Index: linux-2.6-lttng/kernel/notifier.c
===================================================================
--- linux-2.6-lttng.orig/kernel/notifier.c	2009-11-12 17:58:56.000000000 -0500
+++ linux-2.6-lttng/kernel/notifier.c	2009-11-12 18:03:28.000000000 -0500
@@ -148,7 +148,7 @@ int atomic_notifier_chain_unregister(str
 	spin_lock_irqsave(&nh->lock, flags);
 	ret = notifier_chain_unregister(&nh->head, n);
 	spin_unlock_irqrestore(&nh->lock, flags);
-	synchronize_rcu();
+	synchronize_sched();
 	return ret;
 }
 EXPORT_SYMBOL_GPL(atomic_notifier_chain_unregister);
@@ -178,9 +178,9 @@ int __kprobes __atomic_notifier_call_cha
 {
 	int ret;
 
-	rcu_read_lock();
+	rcu_read_lock_sched_notrace();
 	ret = notifier_call_chain(&nh->head, val, v, nr_to_call, nr_calls);
-	rcu_read_unlock();
+	rcu_read_unlock_sched_notrace();
 	return ret;
 }
 EXPORT_SYMBOL_GPL(__atomic_notifier_call_chain);
-- 
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com




More information about the lttng-dev mailing list