From patchwork Tue Dec 6 03:28:45 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yong Zhang X-Patchwork-Id: 5501 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 7657823E0C for ; Tue, 6 Dec 2011 03:29:06 +0000 (UTC) Received: from mail-lpp01m010-f52.google.com (mail-lpp01m010-f52.google.com [209.85.215.52]) by fiordland.canonical.com (Postfix) with ESMTP id 5B305A1833C for ; Tue, 6 Dec 2011 03:29:06 +0000 (UTC) Received: by lagm6 with SMTP id m6so710024lag.11 for ; Mon, 05 Dec 2011 19:29:06 -0800 (PST) Received: by 10.152.106.115 with SMTP id gt19mr7820679lab.27.1323142146044; Mon, 05 Dec 2011 19:29:06 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.152.41.198 with SMTP id h6cs294843lal; Mon, 5 Dec 2011 19:29:05 -0800 (PST) Received: by 10.50.208.72 with SMTP id mc8mr12935316igc.19.1323142143950; Mon, 05 Dec 2011 19:29:03 -0800 (PST) Received: from mail-iy0-f178.google.com (mail-iy0-f178.google.com [209.85.210.178]) by mx.google.com with ESMTPS id f3si4738317ibo.52.2011.12.05.19.29.03 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 05 Dec 2011 19:29:03 -0800 (PST) Received-SPF: pass (google.com: domain of yong.zhang0@gmail.com designates 209.85.210.178 as permitted sender) client-ip=209.85.210.178; Authentication-Results: mx.google.com; spf=pass (google.com: domain of yong.zhang0@gmail.com designates 209.85.210.178 as permitted sender) smtp.mail=yong.zhang0@gmail.com; dkim=pass (test mode) header.i=@gmail.com Received: by iabn5 with SMTP id n5so700106iab.37 for ; Mon, 05 Dec 2011 19:29:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:reply-to:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=bSlD6caO4Q/G9z5FrlqFWet0KIbsfwT8M8eBfVVq68w=; b=lJQjNL5TlxbnLRe7xxCWoaxX8dTPKf1ANV8ToAbSTpx+FrVFiT8yIweetEAfioMLAG 7+T5N6iLxRz47584Jjbu34GUG5KGChzB92G+A3MyGqDlZk+cAFld3yV+iwLw+zLQ0dLF 7yehckthrD5TjQZdUU+rQtNm1Zcp8Zkbt9GIM= Received: by 10.42.147.65 with SMTP id m1mr12421095icv.27.1323142143348; Mon, 05 Dec 2011 19:29:03 -0800 (PST) Received: from localhost ([61.148.56.138]) by mx.google.com with ESMTPS id mb4sm46576930igc.1.2011.12.05.19.28.51 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 05 Dec 2011 19:29:02 -0800 (PST) Date: Tue, 6 Dec 2011 11:28:45 +0800 From: Yong Zhang To: "Paul E. McKenney" Cc: linux-kernel@vger.kernel.org, mingo@elte.hu, laijs@cn.fujitsu.com, dipankar@in.ibm.com, akpm@linux-foundation.org, mathieu.desnoyers@polymtl.ca, josh@joshtriplett.org, niv@us.ibm.com, tglx@linutronix.de, peterz@infradead.org, rostedt@goodmis.org, Valdis.Kletnieks@vt.edu, dhowells@redhat.com, eric.dumazet@gmail.com, darren@dvhart.com, patches@linaro.org Subject: [PATCH 2/3] rtmutex: introduce rt_mutex_lock_irqdisabled() Message-ID: <20111206032845.GB17091@zhy> Reply-To: Yong Zhang References: <20111203183417.GA18914@linux.vnet.ibm.com> <1322937282-19846-7-git-send-email-paulmck@linux.vnet.ibm.com> <20111205091924.GA28117@zhy> <20111205164505.GB2326@linux.vnet.ibm.com> <20111206012635.GA32498@zhy> <20111206021227.GO2326@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20111206021227.GO2326@linux.vnet.ibm.com> User-Agent: Mutt/1.5.21 (2010-09-15) Since we permit rt_mutex_lock() to be called with irq disabled in commit 5342e269, and we will call might_sleep() in rt_mutex_lock() unconditionally, false positive will be made. So introduce rt_mutex_lock_irqdisabled() for that kind of usage. Signed-off-by: Yong Zhang --- include/linux/rtmutex.h | 1 + kernel/rtmutex.c | 13 +++++++++++++ 2 files changed, 14 insertions(+), 0 deletions(-) diff --git a/include/linux/rtmutex.h b/include/linux/rtmutex.h index de17134..0732a25 100644 --- a/include/linux/rtmutex.h +++ b/include/linux/rtmutex.h @@ -88,6 +88,7 @@ extern void __rt_mutex_init(struct rt_mutex *lock, const char *name); extern void rt_mutex_destroy(struct rt_mutex *lock); extern void rt_mutex_lock(struct rt_mutex *lock); +extern void rt_mutex_lock_irqdisabled(struct rt_mutex *lock); extern int rt_mutex_lock_interruptible(struct rt_mutex *lock, int detect_deadlock); extern int rt_mutex_timed_lock(struct rt_mutex *lock, diff --git a/kernel/rtmutex.c b/kernel/rtmutex.c index f9d8482..961a100 100644 --- a/kernel/rtmutex.c +++ b/kernel/rtmutex.c @@ -797,6 +797,19 @@ void __sched rt_mutex_lock(struct rt_mutex *lock) EXPORT_SYMBOL_GPL(rt_mutex_lock); /** + * rt_mutex_lock_irqdisabled - lock a rt_mutex with irq disabled + * + * @lock: the rt_mutex to be locked + */ +void __sched rt_mutex_lock_irqdisabled(struct rt_mutex *lock) +{ + might_sleep_irqdisabled(); + + rt_mutex_fastlock(lock, TASK_UNINTERRUPTIBLE, 0, rt_mutex_slowlock); +} +EXPORT_SYMBOL_GPL(rt_mutex_lock_irqdisabled); + +/** * rt_mutex_lock_interruptible - lock a rt_mutex interruptible * * @lock: the rt_mutex to be locked