From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752021AbcDWMyt (ORCPT ); Sat, 23 Apr 2016 08:54:49 -0400 Received: from terminus.zytor.com ([198.137.202.10]:39122 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751609AbcDWMyr (ORCPT ); Sat, 23 Apr 2016 08:54:47 -0400 Date: Sat, 23 Apr 2016 05:53:59 -0700 From: tip-bot for Boqun Feng Message-ID: Cc: torvalds@linux-foundation.org, hpa@zytor.com, linux-kernel@vger.kernel.org, mingo@kernel.org, mathieu.desnoyers@efficios.com, josh@joshtriplett.org, rostedt@goodmis.org, akpm@linux-foundation.org, boqun.feng@gmail.com, jiangshanlai@gmail.com, paulmck@linux.vnet.ibm.com, tglx@linutronix.de, peterz@infradead.org Reply-To: jiangshanlai@gmail.com, boqun.feng@gmail.com, akpm@linux-foundation.org, rostedt@goodmis.org, peterz@infradead.org, tglx@linutronix.de, paulmck@linux.vnet.ibm.com, linux-kernel@vger.kernel.org, hpa@zytor.com, torvalds@linux-foundation.org, josh@joshtriplett.org, mingo@kernel.org, mathieu.desnoyers@efficios.com In-Reply-To: <1455602265-16490-2-git-send-email-boqun.feng@gmail.com> References: <1455602265-16490-2-git-send-email-boqun.feng@gmail.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:locking/urgent] locking/lockdep: Fix ->irq_context calculation Git-Commit-ID: c24697566298df04cac9913e0601501b5ee2b3f5 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: c24697566298df04cac9913e0601501b5ee2b3f5 Gitweb: http://git.kernel.org/tip/c24697566298df04cac9913e0601501b5ee2b3f5 Author: Boqun Feng AuthorDate: Tue, 16 Feb 2016 13:57:40 +0800 Committer: Ingo Molnar CommitDate: Sat, 23 Apr 2016 13:53:03 +0200 locking/lockdep: Fix ->irq_context calculation task_irq_context() returns the encoded irq_context of the task, the return value is encoded in the same as ->irq_context of held_lock. Always return 0 if !(CONFIG_TRACE_IRQFLAGS && CONFIG_PROVE_LOCKING) Signed-off-by: Boqun Feng Signed-off-by: Peter Zijlstra (Intel) Cc: Andrew Morton Cc: Josh Triplett Cc: Lai Jiangshan Cc: Linus Torvalds Cc: Mathieu Desnoyers Cc: Paul E. McKenney Cc: Peter Zijlstra Cc: Steven Rostedt Cc: Thomas Gleixner Cc: sasha.levin@oracle.com Link: http://lkml.kernel.org/r/1455602265-16490-2-git-send-email-boqun.feng@gmail.com Signed-off-by: Ingo Molnar --- kernel/locking/lockdep.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c index ed94109..beb06f6 100644 --- a/kernel/locking/lockdep.c +++ b/kernel/locking/lockdep.c @@ -2932,6 +2932,11 @@ static int mark_irqflags(struct task_struct *curr, struct held_lock *hlock) return 1; } +static inline unsigned int task_irq_context(struct task_struct *task) +{ + return 2 * !!task->hardirq_context + !!task->softirq_context; +} + static int separate_irq_context(struct task_struct *curr, struct held_lock *hlock) { @@ -2940,8 +2945,6 @@ static int separate_irq_context(struct task_struct *curr, /* * Keep track of points where we cross into an interrupt context: */ - hlock->irq_context = 2*(curr->hardirq_context ? 1 : 0) + - curr->softirq_context; if (depth) { struct held_lock *prev_hlock; @@ -2973,6 +2976,11 @@ static inline int mark_irqflags(struct task_struct *curr, return 1; } +static inline unsigned int task_irq_context(struct task_struct *task) +{ + return 0; +} + static inline int separate_irq_context(struct task_struct *curr, struct held_lock *hlock) { @@ -3241,6 +3249,7 @@ static int __lock_acquire(struct lockdep_map *lock, unsigned int subclass, hlock->acquire_ip = ip; hlock->instance = lock; hlock->nest_lock = nest_lock; + hlock->irq_context = task_irq_context(curr); hlock->trylock = trylock; hlock->read = read; hlock->check = check;