lkml.org 
[lkml]   [2017]   [Nov]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[tip:locking/core] perf/core: Use lockdep to assert IRQs are disabled/enabled
Commit-ID:  164446455a5d3f1402b5a0ea42acce33fd576ed7
Gitweb: https://git.kernel.org/tip/164446455a5d3f1402b5a0ea42acce33fd576ed7
Author: Frederic Weisbecker <frederic@kernel.org>
AuthorDate: Mon, 6 Nov 2017 16:01:24 +0100
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Wed, 8 Nov 2017 11:13:51 +0100

perf/core: Use lockdep to assert IRQs are disabled/enabled

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>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Cc: David S . Miller <davem@davemloft.net>
Cc: Lai Jiangshan <jiangshanlai@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Tejun Heo <tj@kernel.org>
Link: http://lkml.kernel.org/r/1509980490-4285-9-git-send-email-frederic@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
kernel/events/core.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index b315aeb..c298847 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -209,7 +209,7 @@ static int event_function(void *info)
struct perf_event_context *task_ctx = cpuctx->task_ctx;
int ret = 0;

- WARN_ON_ONCE(!irqs_disabled());
+ lockdep_assert_irqs_disabled();

perf_ctx_lock(cpuctx, task_ctx);
/*
@@ -306,7 +306,7 @@ static void event_function_local(struct perf_event *event, event_f func, void *d
struct task_struct *task = READ_ONCE(ctx->task);
struct perf_event_context *task_ctx = NULL;

- WARN_ON_ONCE(!irqs_disabled());
+ lockdep_assert_irqs_disabled();

if (task) {
if (task == TASK_TOMBSTONE)
@@ -1006,7 +1006,7 @@ static enum hrtimer_restart perf_mux_hrtimer_handler(struct hrtimer *hr)
struct perf_cpu_context *cpuctx;
int rotations = 0;

- WARN_ON(!irqs_disabled());
+ lockdep_assert_irqs_disabled();

cpuctx = container_of(hr, struct perf_cpu_context, hrtimer);
rotations = perf_rotate_context(cpuctx);
@@ -1093,7 +1093,7 @@ static void perf_event_ctx_activate(struct perf_event_context *ctx)
{
struct list_head *head = this_cpu_ptr(&active_ctx_list);

- WARN_ON(!irqs_disabled());
+ lockdep_assert_irqs_disabled();

WARN_ON(!list_empty(&ctx->active_ctx_list));

@@ -1102,7 +1102,7 @@ static void perf_event_ctx_activate(struct perf_event_context *ctx)

static void perf_event_ctx_deactivate(struct perf_event_context *ctx)
{
- WARN_ON(!irqs_disabled());
+ lockdep_assert_irqs_disabled();

WARN_ON(list_empty(&ctx->active_ctx_list));

@@ -3523,7 +3523,7 @@ void perf_event_task_tick(void)
struct perf_event_context *ctx, *tmp;
int throttled;

- WARN_ON(!irqs_disabled());
+ lockdep_assert_irqs_disabled();

__this_cpu_inc(perf_throttled_seq);
throttled = __this_cpu_xchg(perf_throttled_count, 0);
\
 
 \ /
  Last update: 2017-11-08 21:11    [W:0.343 / U:2.248 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site