Loading include/linux/sched.h +9 −0 Original line number Diff line number Diff line Loading @@ -3247,6 +3247,15 @@ static inline void cond_resched_rcu(void) #endif } static inline unsigned long get_preempt_disable_ip(struct task_struct *p) { #ifdef CONFIG_DEBUG_PREEMPT return p->preempt_disable_ip; #else return 0; #endif } /* * Does a critical section need to be broken due to another * task waiting?: (technically does not depend on CONFIG_PREEMPT, Loading kernel/sched/core.c +13 −8 Original line number Diff line number Diff line Loading @@ -3364,6 +3364,9 @@ NOKPROBE_SYMBOL(preempt_count_sub); */ static noinline void __schedule_bug(struct task_struct *prev) { /* Save this before calling printk(), since that will clobber it */ unsigned long preempt_disable_ip = get_preempt_disable_ip(current); if (oops_in_progress) return; Loading @@ -3374,13 +3377,12 @@ static noinline void __schedule_bug(struct task_struct *prev) print_modules(); if (irqs_disabled()) print_irqtrace_events(prev); #ifdef CONFIG_DEBUG_PREEMPT if (in_atomic_preempt_off()) { if (IS_ENABLED(CONFIG_DEBUG_PREEMPT) && in_atomic_preempt_off()) { pr_err("Preemption disabled at:"); print_ip_sym(current->preempt_disable_ip); print_ip_sym(preempt_disable_ip); pr_cont("\n"); } #endif #ifdef CONFIG_PANIC_ON_SCHED_BUG BUG(); #endif Loading Loading @@ -8513,6 +8515,7 @@ EXPORT_SYMBOL(__might_sleep); void ___might_sleep(const char *file, int line, int preempt_offset) { static unsigned long prev_jiffy; /* ratelimiting */ unsigned long preempt_disable_ip; rcu_sleep_check(); /* WARN_ON_ONCE() by default, no rate limit reqd. */ if ((preempt_count_equals(preempt_offset) && !irqs_disabled() && Loading @@ -8525,6 +8528,9 @@ void ___might_sleep(const char *file, int line, int preempt_offset) return; prev_jiffy = jiffies; /* Save this before calling printk(), since that will clobber it */ preempt_disable_ip = get_preempt_disable_ip(current); printk(KERN_ERR "BUG: sleeping function called from invalid context at %s:%d\n", file, line); Loading @@ -8539,13 +8545,12 @@ void ___might_sleep(const char *file, int line, int preempt_offset) debug_show_held_locks(current); if (irqs_disabled()) print_irqtrace_events(current); #ifdef CONFIG_DEBUG_PREEMPT if (!preempt_count_equals(preempt_offset)) { if (IS_ENABLED(CONFIG_DEBUG_PREEMPT) && !preempt_count_equals(preempt_offset)) { pr_err("Preemption disabled at:"); print_ip_sym(current->preempt_disable_ip); print_ip_sym(preempt_disable_ip); pr_cont("\n"); } #endif #ifdef CONFIG_PANIC_ON_SCHED_BUG BUG(); #endif Loading Loading
include/linux/sched.h +9 −0 Original line number Diff line number Diff line Loading @@ -3247,6 +3247,15 @@ static inline void cond_resched_rcu(void) #endif } static inline unsigned long get_preempt_disable_ip(struct task_struct *p) { #ifdef CONFIG_DEBUG_PREEMPT return p->preempt_disable_ip; #else return 0; #endif } /* * Does a critical section need to be broken due to another * task waiting?: (technically does not depend on CONFIG_PREEMPT, Loading
kernel/sched/core.c +13 −8 Original line number Diff line number Diff line Loading @@ -3364,6 +3364,9 @@ NOKPROBE_SYMBOL(preempt_count_sub); */ static noinline void __schedule_bug(struct task_struct *prev) { /* Save this before calling printk(), since that will clobber it */ unsigned long preempt_disable_ip = get_preempt_disable_ip(current); if (oops_in_progress) return; Loading @@ -3374,13 +3377,12 @@ static noinline void __schedule_bug(struct task_struct *prev) print_modules(); if (irqs_disabled()) print_irqtrace_events(prev); #ifdef CONFIG_DEBUG_PREEMPT if (in_atomic_preempt_off()) { if (IS_ENABLED(CONFIG_DEBUG_PREEMPT) && in_atomic_preempt_off()) { pr_err("Preemption disabled at:"); print_ip_sym(current->preempt_disable_ip); print_ip_sym(preempt_disable_ip); pr_cont("\n"); } #endif #ifdef CONFIG_PANIC_ON_SCHED_BUG BUG(); #endif Loading Loading @@ -8513,6 +8515,7 @@ EXPORT_SYMBOL(__might_sleep); void ___might_sleep(const char *file, int line, int preempt_offset) { static unsigned long prev_jiffy; /* ratelimiting */ unsigned long preempt_disable_ip; rcu_sleep_check(); /* WARN_ON_ONCE() by default, no rate limit reqd. */ if ((preempt_count_equals(preempt_offset) && !irqs_disabled() && Loading @@ -8525,6 +8528,9 @@ void ___might_sleep(const char *file, int line, int preempt_offset) return; prev_jiffy = jiffies; /* Save this before calling printk(), since that will clobber it */ preempt_disable_ip = get_preempt_disable_ip(current); printk(KERN_ERR "BUG: sleeping function called from invalid context at %s:%d\n", file, line); Loading @@ -8539,13 +8545,12 @@ void ___might_sleep(const char *file, int line, int preempt_offset) debug_show_held_locks(current); if (irqs_disabled()) print_irqtrace_events(current); #ifdef CONFIG_DEBUG_PREEMPT if (!preempt_count_equals(preempt_offset)) { if (IS_ENABLED(CONFIG_DEBUG_PREEMPT) && !preempt_count_equals(preempt_offset)) { pr_err("Preemption disabled at:"); print_ip_sym(current->preempt_disable_ip); print_ip_sym(preempt_disable_ip); pr_cont("\n"); } #endif #ifdef CONFIG_PANIC_ON_SCHED_BUG BUG(); #endif Loading