Skip to contentSkip to conversation

sched: Fix preempt_schedule_common() triggering tracing recursion

PATCH New Frederic Weisbecker 2 participants 2 messages Feb 16, 2015 – Feb 18, 2015 Scheduler

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sched: Fix preempt_schedule_common() triggering tracing recursion

Since the function graph tracer needs to disable preemption, it might call preempt_schedule() after reenabling it if something triggered the need for rescheduling in between.

Therefore we can't trace preempt_schedule() itself because we would face a function tracing recursion otherwise as the tracer is always called before PREEMPT_ACTIVE gets set to prevent that recursion. This is why preempt_schedule() is tagged as "notrace".

But the same issue applies to every function called by preempt_schedule() before PREEMPT_ACTIVE is actually set. And preempt_schedule_common() is one such example. Unfortunately we forgot to tag it as notrace as well and as a result we are encountering tracing recursion since it got introduced by a18b5d01819235629289212ad428a5ee2b40f0d9
("sched: Fix missing preemption opportunity").

Let's fix that by applying the appropriate function tag to preempt_schedule_common().

---
 kernel/sched/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/core.c +1 -1
index 13049aa..683e850 100644
@@ -2899,7 +2899,7 @@ void __sched schedule_preempt_disabled(void)
 	preempt_disable();
 }
 
-static void preempt_schedule_common(void)
+static void __sched notrace preempt_schedule_common(void)
 {
 	do {
 		__preempt_count_add(PREEMPT_ACTIVE);
Signature · 1 line
2.1.4
#1 lore raw
sched: Fix preempt_schedule_common() triggering tracing recursion
Commit-ID:  06b1f8083d6ed379ec1207a96339f23e8f7abfcf
Gitweb:     http://git.kernel.org/tip/06b1f8083d6ed379ec1207a96339f23e8f7abfcf
Author:     Frederic Weisbecker <[email protected]>
AuthorDate: Mon, 16 Feb 2015 19:20:07 +0100
Committer:  Ingo Molnar <[email protected]>
CommitDate: Wed, 18 Feb 2015 14:27:38 +0100

sched: Fix preempt_schedule_common() triggering tracing recursion

Since the function graph tracer needs to disable preemption, it might call preempt_schedule() after reenabling it if something triggered the need for rescheduling in between.

Therefore we can't trace preempt_schedule() itself because we would face a function tracing recursion otherwise as the tracer is always called before PREEMPT_ACTIVE gets set to prevent that recursion. This is why preempt_schedule() is tagged as "notrace".

But the same issue applies to every function called by preempt_schedule() before PREEMPT_ACTIVE is actually set. And preempt_schedule_common() is one such example. Unfortunately we forgot to tag it as notrace as well and as a result we are encountering tracing recursion since it got introduced by:

a18b5d0181923 ("sched: Fix missing preemption opportunity")

Let's fix that by applying the appropriate function tag to preempt_schedule_common().

---
 kernel/sched/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/core.c +1 -1
index f77acd9..c314000 100644
@@ -2839,7 +2839,7 @@ void __sched schedule_preempt_disabled(void)
 	preempt_disable();
 }
 
-static void preempt_schedule_common(void)
+static void __sched notrace preempt_schedule_common(void)
 {
 	do {
 		__preempt_count_add(PREEMPT_ACTIVE);