From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754891AbbCLTO1 (ORCPT ); Thu, 12 Mar 2015 15:14:27 -0400 Received: from cdptpa-outbound-snat.email.rr.com ([107.14.166.227]:15889 "EHLO cdptpa-oedge-vip.email.rr.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754204AbbCLTOO (ORCPT ); Thu, 12 Mar 2015 15:14:14 -0400 Message-Id: <20150312191410.040507487@goodmis.org> User-Agent: quilt/0.61-1 Date: Thu, 12 Mar 2015 15:13:25 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org, linux-rt-users Cc: Thomas Gleixner , Carsten Emde , Sebastian Andrzej Siewior , John Kacur , Paul Gortmaker , , Mike Galbraith Subject: [PATCH RT 18/39] rt,locking: fix __ww_mutex_lock_interruptible() lockdep annotation References: <20150312191307.081068717@goodmis.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Disposition: inline; filename=0018-rt-locking-fix-__ww_mutex_lock_interruptible-lockdep.patch X-RR-Connecting-IP: 107.14.168.142:25 X-Cloudmark-Score: 0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.14.34-rt32-rc1 stable review patch. If anyone has any objections, please let me know. ------------------ From: Mike Galbraith Using mutex_acquire_nest() as used in __ww_mutex_lock() fixes the splat below. Remove superfluous line break in __ww_mutex_lock() as well. |============================================= |[ INFO: possible recursive locking detected ] |3.14.4-rt5 #26 Not tainted |--------------------------------------------- |Xorg/4298 is trying to acquire lock: | (reservation_ww_class_mutex){+.+.+.}, at: [] nouveau_gem_ioctl_pushbuf+0x870/0x19f0 [nouveau] |but task is already holding lock: | (reservation_ww_class_mutex){+.+.+.}, at: [] nouveau_gem_ioctl_pushbuf+0x870/0x19f0 [nouveau] |other info that might help us debug this: | Possible unsafe locking scenario: | CPU0 | ---- | lock(reservation_ww_class_mutex); | lock(reservation_ww_class_mutex); | | *** DEADLOCK *** | | May be due to missing lock nesting notation | |3 locks held by Xorg/4298: | #0: (&cli->mutex){+.+.+.}, at: [] nouveau_abi16_get+0x2b/0x100 [nouveau] | #1: (reservation_ww_class_acquire){+.+...}, at: [] drm_ioctl+0x4d2/0x610 [drm] | #2: (reservation_ww_class_mutex){+.+.+.}, at: [] nouveau_gem_ioctl_pushbuf+0x870/0x19f0 [nouveau] Cc: stable-rt@vger.kernel.org Signed-off-by: Mike Galbraith Signed-off-by: Steven Rostedt --- kernel/locking/rtmutex.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c index 74a824523d3a..1794fae96a2a 100644 --- a/kernel/locking/rtmutex.c +++ b/kernel/locking/rtmutex.c @@ -2238,7 +2238,7 @@ __ww_mutex_lock_interruptible(struct ww_mutex *lock, struct ww_acquire_ctx *ww_c might_sleep(); - mutex_acquire(&lock->base.dep_map, 0, 0, _RET_IP_); + mutex_acquire_nest(&lock->base.dep_map, 0, 0, &ww_ctx->dep_map, _RET_IP_); ret = rt_mutex_slowlock(&lock->base.lock, TASK_INTERRUPTIBLE, NULL, 0, ww_ctx); if (ret) mutex_release(&lock->base.dep_map, 1, _RET_IP_); @@ -2256,8 +2256,7 @@ __ww_mutex_lock(struct ww_mutex *lock, struct ww_acquire_ctx *ww_ctx) might_sleep(); - mutex_acquire_nest(&lock->base.dep_map, 0, 0, &ww_ctx->dep_map, - _RET_IP_); + mutex_acquire_nest(&lock->base.dep_map, 0, 0, &ww_ctx->dep_map, _RET_IP_); ret = rt_mutex_slowlock(&lock->base.lock, TASK_UNINTERRUPTIBLE, NULL, 0, ww_ctx); if (ret) mutex_release(&lock->base.dep_map, 1, _RET_IP_); -- 2.1.4