From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753608AbbCIW1s (ORCPT ); Mon, 9 Mar 2015 18:27:48 -0400 Received: from e37.co.us.ibm.com ([32.97.110.158]:58443 "EHLO e37.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750933AbbCIW1r (ORCPT ); Mon, 9 Mar 2015 18:27:47 -0400 Date: Mon, 9 Mar 2015 15:27:42 -0700 From: "Paul E. McKenney" To: Sebastian Andrzej Siewior Cc: Mike Galbraith , Maarten Lankhorst , linux-kernel@vger.kernel.org, Peter Zijlstra , Ingo Molnar Subject: Re: [PATCH 2/3] locking: ww_mutex: Allow to use rt_mutex instead of mutex for the baselock Message-ID: <20150309222741.GB5708@linux.vnet.ibm.com> Reply-To: paulmck@linux.vnet.ibm.com References: <54F4237B.40903@canonical.com> <54F99A38.1070806@linutronix.de> <54F99A9B.1050503@canonical.com> <54F99F36.4030405@linutronix.de> <1425664233.7562.21.camel@gmail.com> <54FD6F5A.1030809@linutronix.de> <1425898264.9329.10.camel@gmail.com> <54FD7EFF.90105@linutronix.de> <1425900552.6715.7.camel@gmail.com> <54FD9E71.1050602@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <54FD9E71.1050602@linutronix.de> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15030922-0025-0000-0000-00000922DE4A Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 09, 2015 at 02:21:53PM +0100, Sebastian Andrzej Siewior wrote: > On 03/09/2015 12:29 PM, Mike Galbraith wrote: > > On Mon, 2015-03-09 at 12:07 +0100, Sebastian Andrzej Siewior wrote: > >> On 03/09/2015 11:51 AM, Mike Galbraith wrote: > >>> Why do both mutex and rtmutex then exist one might ask? ;-) No big deal > >>> either way though, it's not like it becomes immutable once applied. > >> > >> You don't choose rtmutex afaik. rtmutex is used by futex (only?) > > > > Almost only, but not quite. > > > > drivers/media/usb/em28xx/em28xx.h: struct rt_mutex i2c_bus_lock; > > include/linux/i2c.h: struct rt_mutex bus_lock; > > kernel/rcu/tree.h: struct rt_mutex boost_mtx; > > So you have two users here: RCU and i2c-bus. The RCU thingy came from > -RT (I think). RCU uses rt_mutex rather than mutex because it needs rt_mutex's priority-inheritance features for RCU priority boosting. This did indeed originally come from -rt, but is now in mainline. If mutex gains rt_mutex's priority-boosting capability, then RCU could switch to mutex. But you both probably knew all that already... Thanx, Paul > and I2C is actually one user. I am not sure Mauro used the rt-mutex in > em28xx for a reason or just blindly copied the i2c code. The i2c-core > holds a bus_lock so I don't think he needs to do the same thing. > And i2c is the other user. It does a try_lock() in "irq_disabled()" > context which records the wrong owner for PI-boosting if it is used > from IRQ context. > > I'm not against it but from ww-mutex point it makes most likely sense > to switch them all and not decide which one to switch. > > Sebastian > > -- > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/ >