From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753556AbbBTEwm (ORCPT ); Thu, 19 Feb 2015 23:52:42 -0500 Received: from cdptpa-outbound-snat.email.rr.com ([107.14.166.229]:25422 "EHLO cdptpa-oedge-vip.email.rr.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751996AbbBTEwl (ORCPT ); Thu, 19 Feb 2015 23:52:41 -0500 Date: Thu, 19 Feb 2015 23:53:21 -0500 From: Steven Rostedt To: Thavatchai Makphaibulchoke Cc: linux-kernel@vger.kernel.org, mingo@redhat.com, tglx@linutronix.de, linux-rt-users@vger.kernel.org Subject: Re: [PATCH 3.14.25-rt22 1/2] rtmutex Real-Time Linux: Fixing kernel BUG at kernel/locking/rtmutex.c:997! Message-ID: <20150219235321.0acf3c75@grimm.local.home> In-Reply-To: <1424395866-81589-2-git-send-email-tmac@hp.com> References: <1424395866-81589-1-git-send-email-tmac@hp.com> <1424395866-81589-2-git-send-email-tmac@hp.com> X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.25; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-RR-Connecting-IP: 107.14.168.130:25 X-Cloudmark-Score: 0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 19 Feb 2015 18:31:05 -0700 Thavatchai Makphaibulchoke wrote: > This patch fixes the problem that the ownership of a mutex acquired by an > interrupt handler(IH) gets incorrectly attributed to the interrupted thread. *blink* > > This could result in an incorrect deadlock detection in function > rt_mutex_adjust_prio_chain(), causing thread to be killed and possibly leading > up to a system hang. I highly doubt this is an incorrect deadlock that was detected. My money is on a real deadlock that happened. > > Here is the approach taken: when calling from an interrupt handler, instead of > attributing ownership to the interrupted task, use a reserved task_struct value > to indicate that the owner is a interrupt handler. This approach avoids the > incorrect deadlock detection. How is this an incorrect deadlock? Please explain. > > This also includes changes in several function in rtmutex.c now that the lock's > requester may be a interrupt handler, not a real task struct. This impacts > the way how the lock is acquired and prioritized and decision whether to do > the house keeping functions required for a real task struct. > > The reserved task_struct values for interrupt handler are > > current | 0x2 > > where current is the task_struct value of the interrupted task. > > Since IH will both acquire and release the lock only during an interrupt > handling, during which current is not changed, the reserved task_struct value > for an IH should be distinct from another instances of IH on a different cpu. > The interrupt handler is a thread just like any other task. It's not special. If there was a deadlock detected, it most likely means that a deadlock exists. -- Steve > Kernel version 3.14.25 + patch-3.14.25-rt22 > > Signed-off-by: T. Makphaibulchoke > --- > include/linux/spinlock_rt.h | 4 + > kernel/locking/rtmutex-debug.c | 15 ++- > kernel/locking/rtmutex.c | 212 ++++++++++++++++++++++++++++------------ > kernel/locking/rtmutex_common.h | 21 ++++ > kernel/timer.c | 4 +- > 5 files changed, 188 insertions(+), 68 deletions(-) >