diff --git a/kernel/sched/core.c b/kernel/sched/core.c index d09e4107b895..74fd1edad65e 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -3864,6 +3864,9 @@ static noinline void __schedule_bug(struct task_struct *prev) if (panic_on_warn) panic("scheduling while atomic\n"); +#ifdef CONFIG_PANIC_ON_SCHED_BUG + BUG(); +#endif dump_stack(); add_taint(TAINT_WARN, LOCKDEP_STILL_OK); } @@ -6787,6 +6790,9 @@ void ___might_sleep(const char *file, int line, int preempt_offset) print_ip_sym(preempt_disable_ip); pr_cont("\n"); } +#ifdef CONFIG_PANIC_ON_SCHED_BUG + BUG(); +#endif dump_stack(); add_taint(TAINT_WARN, LOCKDEP_STILL_OK); } diff --git a/kernel/sched/features.h b/kernel/sched/features.h index 2410db5e9a35..602ce1ed59b8 100644 --- a/kernel/sched/features.h +++ b/kernel/sched/features.h @@ -49,7 +49,7 @@ SCHED_FEAT(NONTASK_CAPACITY, true) * Queue remote wakeups on the target CPU and process them * using the scheduler IPI. Reduces rq->lock contention/bounces. */ -SCHED_FEAT(TTWU_QUEUE, true) +SCHED_FEAT(TTWU_QUEUE, false) /* * When doing wakeups, attempt to limit superfluous scans of the LLC domain. diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c index 66885f6f8d4b..2feb5db24220 100644 --- a/kernel/time/hrtimer.c +++ b/kernel/time/hrtimer.c @@ -1452,8 +1452,8 @@ bool hrtimer_active(const struct hrtimer *timer) base = READ_ONCE(timer->base); seq = raw_read_seqcount_begin(&base->seq); - if (timer->state != HRTIMER_STATE_INACTIVE || - base->running == timer) + if (((timer->state & ~HRTIMER_STATE_PINNED) != + HRTIMER_STATE_INACTIVE) || base->running == timer) return true; } while (read_seqcount_retry(&base->seq, seq) || diff --git a/kernel/time/timer.c b/kernel/time/timer.c index d168d6ff3799..7f772cdeca5d 100644 --- a/kernel/time/timer.c +++ b/kernel/time/timer.c @@ -2057,6 +2057,13 @@ int timers_dead_cpu(unsigned int cpu) return 0; } +#ifdef CONFIG_CPUSETS +void timer_quiesce_cpu(void *cpup) +{ + __migrate_timers(*(unsigned int *)cpup, false); +} +#endif /* CONFIG_CPUSETS */ + #endif /* CONFIG_HOTPLUG_CPU */ static void __init init_timer_cpu(int cpu) diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 4df053457644..fd224c58e338 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -1022,6 +1022,15 @@ config SCHED_INFO bool default n +config PANIC_ON_SCHED_BUG + bool "Panic on all bugs encountered by the scheduler" + help + Say Y here to panic on all 'BUG:' conditions encountered by the + scheduler, even potentially-recoverable ones such as scheduling + while atomic and sleeping from invalid context etc. + + Say N if unsure. + config SCHEDSTATS bool "Collect scheduler statistics" depends on DEBUG_KERNEL && PROC_FS