Commit 531f64fd authored by Frederic Weisbecker's avatar Frederic Weisbecker

posix-timers: Convert abuses of BUG_ON to WARN_ON

The posix cpu timers code makes a heavy use of BUG_ON()
but none of these concern fatal issues that require
to stop the machine. So let's just warn the user when
some internal state slips out of our hands.
Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Kosaki Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
parent e73d84e3
...@@ -395,7 +395,7 @@ static int posix_cpu_timer_del(struct k_itimer *timer) ...@@ -395,7 +395,7 @@ static int posix_cpu_timer_del(struct k_itimer *timer)
* We raced with the reaping of the task. * We raced with the reaping of the task.
* The deletion should have cleared us off the list. * The deletion should have cleared us off the list.
*/ */
BUG_ON(!list_empty(&timer->it.cpu.entry)); WARN_ON_ONCE(!list_empty(&timer->it.cpu.entry));
} else { } else {
if (timer->it.cpu.firing) if (timer->it.cpu.firing)
ret = TIMER_RETRY; ret = TIMER_RETRY;
...@@ -640,7 +640,7 @@ static int posix_cpu_timer_set(struct k_itimer *timer, int timer_flags, ...@@ -640,7 +640,7 @@ static int posix_cpu_timer_set(struct k_itimer *timer, int timer_flags,
/* /*
* Disarm any old timer after extracting its expiry time. * Disarm any old timer after extracting its expiry time.
*/ */
BUG_ON(!irqs_disabled()); WARN_ON_ONCE(!irqs_disabled());
ret = 0; ret = 0;
old_incr = timer->it.cpu.incr; old_incr = timer->it.cpu.incr;
...@@ -1061,7 +1061,7 @@ void posix_cpu_timer_schedule(struct k_itimer *timer) ...@@ -1061,7 +1061,7 @@ void posix_cpu_timer_schedule(struct k_itimer *timer)
/* /*
* Now re-arm for the new expiry time. * Now re-arm for the new expiry time.
*/ */
BUG_ON(!irqs_disabled()); WARN_ON_ONCE(!irqs_disabled());
arm_timer(timer); arm_timer(timer);
unlock_task_sighand(p, &flags); unlock_task_sighand(p, &flags);
...@@ -1150,7 +1150,7 @@ void run_posix_cpu_timers(struct task_struct *tsk) ...@@ -1150,7 +1150,7 @@ void run_posix_cpu_timers(struct task_struct *tsk)
struct k_itimer *timer, *next; struct k_itimer *timer, *next;
unsigned long flags; unsigned long flags;
BUG_ON(!irqs_disabled()); WARN_ON_ONCE(!irqs_disabled());
/* /*
* The fast path checks that there are no expired thread or thread * The fast path checks that there are no expired thread or thread
...@@ -1217,7 +1217,7 @@ void set_process_cpu_timer(struct task_struct *tsk, unsigned int clock_idx, ...@@ -1217,7 +1217,7 @@ void set_process_cpu_timer(struct task_struct *tsk, unsigned int clock_idx,
{ {
unsigned long long now; unsigned long long now;
BUG_ON(clock_idx == CPUCLOCK_SCHED); WARN_ON_ONCE(clock_idx == CPUCLOCK_SCHED);
cpu_timer_sample_group(clock_idx, tsk, &now); cpu_timer_sample_group(clock_idx, tsk, &now);
if (oldval) { if (oldval) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment