public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Frederic Weisbecker <fweisbec@gmail.com>
To: Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Oleg Nesterov <oleg@redhat.com>,
	Kosaki Motohiro <kosaki.motohiro@jp.fujitsu.com>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: [PATCH 10/10] posix-timers: Convert abuses of BUG_ON to WARN_ON
Date: Sat, 23 Nov 2013 16:37:20 +0100	[thread overview]
Message-ID: <1385221040-24731-11-git-send-email-fweisbec@gmail.com> (raw)
In-Reply-To: <1385221040-24731-1-git-send-email-fweisbec@gmail.com>

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: Frederic 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>
---
 kernel/posix-cpu-timers.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/kernel/posix-cpu-timers.c b/kernel/posix-cpu-timers.c
index 8c75408..3c9594b 100644
--- a/kernel/posix-cpu-timers.c
+++ b/kernel/posix-cpu-timers.c
@@ -395,7 +395,7 @@ static int posix_cpu_timer_del(struct k_itimer *timer)
 		 * We raced with the reaping of the task.
 		 * 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 {
 		if (timer->it.cpu.firing)
 			ret = TIMER_RETRY;
@@ -639,7 +639,7 @@ static int posix_cpu_timer_set(struct k_itimer *timer, int timer_flags,
 	/*
 	 * Disarm any old timer after extracting its expiry time.
 	 */
-	BUG_ON(!irqs_disabled());
+	WARN_ON_ONCE(!irqs_disabled());
 
 	ret = 0;
 	old_incr = timer->it.cpu.incr;
@@ -1060,7 +1060,7 @@ void posix_cpu_timer_schedule(struct k_itimer *timer)
 	/*
 	 * Now re-arm for the new expiry time.
 	 */
-	BUG_ON(!irqs_disabled());
+	WARN_ON_ONCE(!irqs_disabled());
 	arm_timer(timer);
 
 out_unlock:
@@ -1149,7 +1149,7 @@ void run_posix_cpu_timers(struct task_struct *tsk)
 	struct k_itimer *timer, *next;
 	unsigned long flags;
 
-	BUG_ON(!irqs_disabled());
+	WARN_ON_ONCE(!irqs_disabled());
 
 	/*
 	 * The fast path checks that there are no expired thread or thread
@@ -1223,7 +1223,7 @@ void set_process_cpu_timer(struct task_struct *tsk, unsigned int clock_idx,
 {
 	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);
 
 	if (oldval) {
-- 
1.8.3.1


  parent reply	other threads:[~2013-11-23 15:37 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-23 15:37 [GIT PULL] posix cpu timers cleanups for 3.14 Frederic Weisbecker
2013-11-23 15:37 ` [PATCH 01/10] posix-timers: Remove dead thread posix cpu timers caching Frederic Weisbecker
2013-11-23 15:37 ` [PATCH 02/10] posix-timers: Remove dead process " Frederic Weisbecker
2013-12-04 18:50   ` KOSAKI Motohiro
2013-12-05  0:32     ` Frederic Weisbecker
2013-11-23 15:37 ` [PATCH 03/10] posix-timers: Cleanup reaped target handling Frederic Weisbecker
2013-11-23 15:37 ` [PATCH 04/10] posix-timers: Remove dead task special case Frederic Weisbecker
2013-11-23 15:37 ` [PATCH 05/10] posix-timers: Remove useless clock sample on timers cleanup Frederic Weisbecker
2013-11-23 15:37 ` [PATCH 06/10] posix-timers: Consolidate posix_cpu_clock_get() Frederic Weisbecker
2013-11-23 15:37 ` [PATCH 07/10] posix-timers: Use sighand lock instead of tasklist_lock for task clock sample Frederic Weisbecker
2013-11-23 15:37 ` [PATCH 08/10] posix-timers: Use sighand lock instead of tasklist_lock on timer deletion Frederic Weisbecker
2013-11-23 15:37 ` [PATCH 09/10] posix-timers: Remove remaining uses of tasklist_lock Frederic Weisbecker
2013-11-23 15:37 ` Frederic Weisbecker [this message]
2013-12-02 15:20 ` [GIT PULL] posix cpu timers cleanups for 3.14 Frederic Weisbecker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1385221040-24731-11-git-send-email-fweisbec@gmail.com \
    --to=fweisbec@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=oleg@redhat.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox