LKML Archive on lore.kernel.org
 help / color / Atom feed
From: Frederic Weisbecker <frederic@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Frederic Weisbecker <frederic@kernel.org>,
	Tejun Heo <tj@kernel.org>, Peter Zijlstra <peterz@infradead.org>,
	"David S . Miller" <davem@davemloft.net>,
	Lai Jiangshan <jiangshanlai@gmail.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	"Paul E . McKenney" <paulmck@linux.vnet.ibm.com>
Subject: [PATCH 12/14] posix-cpu-timers: Use lockdep to assert IRQs are disabled/enabled
Date: Mon,  6 Nov 2017 16:01:28 +0100
Message-ID: <1509980490-4285-13-git-send-email-frederic@kernel.org> (raw)
In-Reply-To: <1509980490-4285-1-git-send-email-frederic@kernel.org>

Use lockdep to check that IRQs are enabled or disabled as expected. This
way the sanity check only shows overhead when concurrency correctness
debug code is enabled.

Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
 kernel/time/posix-cpu-timers.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/time/posix-cpu-timers.c b/kernel/time/posix-cpu-timers.c
index 8585ad6..8fafb87 100644
--- a/kernel/time/posix-cpu-timers.c
+++ b/kernel/time/posix-cpu-timers.c
@@ -602,7 +602,7 @@ static int posix_cpu_timer_set(struct k_itimer *timer, int timer_flags,
 	/*
 	 * Disarm any old timer after extracting its expiry time.
 	 */
-	WARN_ON_ONCE(!irqs_disabled());
+	lockdep_assert_irqs_disabled();
 
 	ret = 0;
 	old_incr = timer->it.cpu.incr;
@@ -1033,7 +1033,7 @@ static void posix_cpu_timer_rearm(struct k_itimer *timer)
 	/*
 	 * Now re-arm for the new expiry time.
 	 */
-	WARN_ON_ONCE(!irqs_disabled());
+	lockdep_assert_irqs_disabled();
 	arm_timer(timer);
 unlock:
 	unlock_task_sighand(p, &flags);
@@ -1124,7 +1124,7 @@ void run_posix_cpu_timers(struct task_struct *tsk)
 	struct k_itimer *timer, *next;
 	unsigned long flags;
 
-	WARN_ON_ONCE(!irqs_disabled());
+	lockdep_assert_irqs_disabled();
 
 	/*
 	 * The fast path checks that there are no expired thread or thread
-- 
2.7.4

  parent reply index

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-06 15:01 [GIT PULL] lockdep: Add lightweight IRQs disabled/enabled check v2 Frederic Weisbecker
2017-11-06 15:01 ` [PATCH 01/14] lockdep: Add IRQs disabled/enabled assertion Frederic Weisbecker
2017-11-08 10:51   ` [tip:locking/core] locking/lockdep: Add IRQs disabled/enabled assertion APIs: lockdep_assert_irqs_enabled()/disabled() tip-bot for Frederic Weisbecker
2017-11-06 15:01 ` [PATCH 02/14] irq: Use lockdep to assert IRQs are disabled/enabled Frederic Weisbecker
2017-11-08 10:52   ` [tip:locking/core] irq/softirqs: " tip-bot for Frederic Weisbecker
2017-11-06 15:01 ` [PATCH 03/14] workqueue: " Frederic Weisbecker
2017-11-08 10:52   ` [tip:locking/core] " tip-bot for Frederic Weisbecker
2017-11-06 15:01 ` [PATCH 04/14] nohz: " Frederic Weisbecker
2017-11-08 10:53   ` [tip:locking/core] timers/nohz: " tip-bot for Frederic Weisbecker
2017-11-06 15:01 ` [PATCH 05/14] hrtimer: " Frederic Weisbecker
2017-11-08 10:53   ` [tip:locking/core] timers/hrtimer: " tip-bot for Frederic Weisbecker
2017-11-06 15:01 ` [PATCH 06/14] smp: " Frederic Weisbecker
2017-11-08 10:54   ` [tip:locking/core] smp/core: " tip-bot for Frederic Weisbecker
2017-11-06 15:01 ` [PATCH 07/14] x86: " Frederic Weisbecker
2017-11-08 10:54   ` [tip:locking/core] " tip-bot for Frederic Weisbecker
2017-11-06 15:01 ` [PATCH 08/14] perf: " Frederic Weisbecker
2017-11-08 10:54   ` [tip:locking/core] perf/core: " tip-bot for Frederic Weisbecker
2017-11-06 15:01 ` [PATCH 09/14] irq/timings: " Frederic Weisbecker
2017-11-08 10:55   ` [tip:locking/core] " tip-bot for Frederic Weisbecker
2017-11-06 15:01 ` [PATCH 10/14] irq_work: " Frederic Weisbecker
2017-11-08 10:55   ` [tip:locking/core] " tip-bot for Frederic Weisbecker
2017-11-06 15:01 ` [PATCH 11/14] sched: " Frederic Weisbecker
2017-11-08 10:56   ` [tip:locking/core] sched/clock, sched/cputime: " tip-bot for Frederic Weisbecker
2017-11-06 15:01 ` Frederic Weisbecker [this message]
2017-11-08 10:56   ` [tip:locking/core] timers/posix-cpu-timers: " tip-bot for Frederic Weisbecker
2017-11-06 15:01 ` [PATCH 13/14] netpoll: " Frederic Weisbecker
2017-11-08 10:57   ` [tip:locking/core] " tip-bot for Frederic Weisbecker
2017-11-06 15:01 ` [PATCH 14/14] rcu: " Frederic Weisbecker
2017-11-08 10:57   ` [tip:locking/core] " tip-bot for Frederic Weisbecker
2017-11-08  9:58 ` [GIT PULL] lockdep: Add lightweight IRQs disabled/enabled check v2 Thomas Gleixner
  -- strict thread matches above, loose matches on Subject: below --
2017-10-20  0:55 [PATCH 00/14] lockdep: Add lightweight IRQs disabled/enabled check Frederic Weisbecker
2017-10-20  0:56 ` [PATCH 12/14] posix-cpu-timers: Use lockdep to assert IRQs are disabled/enabled 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=1509980490-4285-13-git-send-email-frederic@kernel.org \
    --to=frederic@kernel.org \
    --cc=davem@davemloft.net \
    --cc=jiangshanlai@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=tj@kernel.org \
    /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

LKML Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/lkml/0 lkml/git/0.git
	git clone --mirror https://lore.kernel.org/lkml/1 lkml/git/1.git
	git clone --mirror https://lore.kernel.org/lkml/2 lkml/git/2.git
	git clone --mirror https://lore.kernel.org/lkml/3 lkml/git/3.git
	git clone --mirror https://lore.kernel.org/lkml/4 lkml/git/4.git
	git clone --mirror https://lore.kernel.org/lkml/5 lkml/git/5.git
	git clone --mirror https://lore.kernel.org/lkml/6 lkml/git/6.git
	git clone --mirror https://lore.kernel.org/lkml/7 lkml/git/7.git
	git clone --mirror https://lore.kernel.org/lkml/8 lkml/git/8.git
	git clone --mirror https://lore.kernel.org/lkml/9 lkml/git/9.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ https://lore.kernel.org/lkml \
		linux-kernel@vger.kernel.org
	public-inbox-index lkml

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git