summaryrefslogtreecommitdiff
path: root/kernel/sched
diff options
context:
space:
mode:
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>2016-02-11 22:06:28 +0100
committerDaniel Wagner <wagi@monom.org>2018-07-26 06:48:01 +0200
commit3cfed63854891f3678dc0009d84a8c8104b47bf2 (patch)
treec5400550cc44da68434b045051967d3d45d77d27 /kernel/sched
parent7b4752359d0b1a26dc61dbf0ce1754a889ff4dd6 (diff)
downloadlinux-rt-3cfed63854891f3678dc0009d84a8c8104b47bf2.tar.gz
kernel: sched: Fix preempt_disable_ip recodring for preempt_disable()
preempt_disable() invokes preempt_count_add() which saves the caller in current->preempt_disable_ip. It uses CALLER_ADDR1 which does not look for its caller but for the parent of the caller. Which means we get the correct caller for something like spin_lock() unless the architectures inlines those invocations. It is always wrong for preempt_disable() or local_bh_disable(). This patch makes the function get_parent_ip() which tries CALLER_ADDR0,1,2 if the former is a locking function. This seems to record the preempt_disable() caller properly for preempt_disable() itself as well as for get_cpu_var() or local_bh_disable(). Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Diffstat (limited to 'kernel/sched')
-rw-r--r--kernel/sched/core.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index d0c6e7fecb20..d0041549e178 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -3065,16 +3065,6 @@ u64 scheduler_tick_max_deferment(void)
}
#endif
-notrace unsigned long get_parent_ip(unsigned long addr)
-{
- if (in_lock_functions(addr)) {
- addr = CALLER_ADDR2;
- if (in_lock_functions(addr))
- addr = CALLER_ADDR3;
- }
- return addr;
-}
-
#if defined(CONFIG_PREEMPT) && (defined(CONFIG_DEBUG_PREEMPT) || \
defined(CONFIG_PREEMPT_TRACER))
@@ -3096,7 +3086,7 @@ void preempt_count_add(int val)
PREEMPT_MASK - 10);
#endif
if (preempt_count() == val) {
- unsigned long ip = get_parent_ip(CALLER_ADDR1);
+ unsigned long ip = get_lock_parent_ip();
#ifdef CONFIG_DEBUG_PREEMPT
current->preempt_disable_ip = ip;
#endif
@@ -3123,7 +3113,7 @@ void preempt_count_sub(int val)
#endif
if (preempt_count() == val)
- trace_preempt_on(CALLER_ADDR0, get_parent_ip(CALLER_ADDR1));
+ trace_preempt_on(CALLER_ADDR0, get_lock_parent_ip());
__preempt_count_sub(val);
}
EXPORT_SYMBOL(preempt_count_sub);