From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Vetter Subject: Re: [PATCH v2 2/3] mutex: add support for reservation style locks, v2 Date: Wed, 10 Apr 2013 10:27:44 +0200 Message-ID: References: <20130228102452.15191.22673.stgit@patser> <20130228102502.15191.14146.stgit@patser> <1364900432.18374.24.camel@laptop> <515AF1C1.7080508@canonical.com> <1364921954.20640.22.camel@laptop> <1365076908.2609.94.camel@laptop> <20130404133123.GW2228@phenom.ffwll.local> <1365093516.2609.109.camel@laptop> <20130409222707.GB20739@home.goodmis.org> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Return-path: In-Reply-To: <20130409222707.GB20739@home.goodmis.org> Sender: linux-kernel-owner@vger.kernel.org To: Steven Rostedt Cc: Peter Zijlstra , Maarten Lankhorst , linux-arch@vger.kernel.org, x86@kernel.org, Linux Kernel Mailing List , dri-devel , "linaro-mm-sig@lists.linaro.org" , rob clark , Thomas Gleixner , Ingo Molnar , "linux-media@vger.kernel.org" List-Id: linux-arch.vger.kernel.org On Wed, Apr 10, 2013 at 12:27 AM, Steven Rostedt wrote: > On Thu, Apr 04, 2013 at 06:38:36PM +0200, Peter Zijlstra wrote: >> On Thu, 2013-04-04 at 15:31 +0200, Daniel Vetter wrote: >> > Hm, I guess your aim with the TASK_DEADLOCK wakeup is to bound the >> > wait >> > times of older task. >> >> No, imagine the following: >> >> struct ww_mutex A, B; >> struct mutex C; >> >> task-O task-Y task-X >> A >> B >> C >> C >> B >> >> At this point O finds that Y owns B and thus we want to make Y 'yield' >> B to make allow B progress. Since Y is blocked, we'll send a wakeup. >> However Y is blocked on a different locking primitive; one that doesn't >> collaborate in the -EDEADLK scheme therefore we don't want the wakeup to >> succeed. > > I'm confused to why the above is a problem. Task-X will eventually > release C, and then Y will release B and O will get to continue. Do we > have to drop them once the owner is blocked? Can't we follow the chain > like the PI code does? Just waiting until every task already holding a lock completes and unlucks it is indeed a viable solution - it's the currently implemented algorithm in ttm and Maarten's current patches. The nice thing with Peter's wakeup idea on top is: - It bounds blocked times. - And (at least I think so) it's the key thing making PI boosting possible without any ugly PI inversion deadlocks happening. See Message-ID: for my current reasoning about this (I have not yet managed to poke a hole into it). -Daniel -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ia0-f176.google.com ([209.85.210.176]:64608 "EHLO mail-ia0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935579Ab3DJI1p (ORCPT ); Wed, 10 Apr 2013 04:27:45 -0400 Received: by mail-ia0-f176.google.com with SMTP id i1so186050iaa.21 for ; Wed, 10 Apr 2013 01:27:45 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <20130409222707.GB20739@home.goodmis.org> References: <20130228102452.15191.22673.stgit@patser> <20130228102502.15191.14146.stgit@patser> <1364900432.18374.24.camel@laptop> <515AF1C1.7080508@canonical.com> <1364921954.20640.22.camel@laptop> <1365076908.2609.94.camel@laptop> <20130404133123.GW2228@phenom.ffwll.local> <1365093516.2609.109.camel@laptop> <20130409222707.GB20739@home.goodmis.org> Date: Wed, 10 Apr 2013 10:27:44 +0200 Message-ID: Subject: Re: [PATCH v2 2/3] mutex: add support for reservation style locks, v2 From: Daniel Vetter Content-Type: text/plain; charset=ISO-8859-1 Sender: linux-arch-owner@vger.kernel.org List-ID: To: Steven Rostedt Cc: Peter Zijlstra , Maarten Lankhorst , linux-arch@vger.kernel.org, x86@kernel.org, Linux Kernel Mailing List , dri-devel , "linaro-mm-sig@lists.linaro.org" , rob clark , Thomas Gleixner , Ingo Molnar , "linux-media@vger.kernel.org" Message-ID: <20130410082744.TAE4NrUwTT7XsjddTVq71zpqqCJvFjcoyCLBfA-Jt7M@z> On Wed, Apr 10, 2013 at 12:27 AM, Steven Rostedt wrote: > On Thu, Apr 04, 2013 at 06:38:36PM +0200, Peter Zijlstra wrote: >> On Thu, 2013-04-04 at 15:31 +0200, Daniel Vetter wrote: >> > Hm, I guess your aim with the TASK_DEADLOCK wakeup is to bound the >> > wait >> > times of older task. >> >> No, imagine the following: >> >> struct ww_mutex A, B; >> struct mutex C; >> >> task-O task-Y task-X >> A >> B >> C >> C >> B >> >> At this point O finds that Y owns B and thus we want to make Y 'yield' >> B to make allow B progress. Since Y is blocked, we'll send a wakeup. >> However Y is blocked on a different locking primitive; one that doesn't >> collaborate in the -EDEADLK scheme therefore we don't want the wakeup to >> succeed. > > I'm confused to why the above is a problem. Task-X will eventually > release C, and then Y will release B and O will get to continue. Do we > have to drop them once the owner is blocked? Can't we follow the chain > like the PI code does? Just waiting until every task already holding a lock completes and unlucks it is indeed a viable solution - it's the currently implemented algorithm in ttm and Maarten's current patches. The nice thing with Peter's wakeup idea on top is: - It bounds blocked times. - And (at least I think so) it's the key thing making PI boosting possible without any ugly PI inversion deadlocks happening. See Message-ID: for my current reasoning about this (I have not yet managed to poke a hole into it). -Daniel -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch