From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753610AbbCINWE (ORCPT ); Mon, 9 Mar 2015 09:22:04 -0400 Received: from www.linutronix.de ([62.245.132.108]:35348 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753243AbbCINWB (ORCPT ); Mon, 9 Mar 2015 09:22:01 -0400 Message-ID: <54FD9E71.1050602@linutronix.de> Date: Mon, 09 Mar 2015 14:21:53 +0100 From: Sebastian Andrzej Siewior User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.4.0 MIME-Version: 1.0 To: Mike Galbraith CC: 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 References: <1425056229-22326-1-git-send-email-bigeasy@linutronix.de> <1425056229-22326-3-git-send-email-bigeasy@linutronix.de> <1425266436.7429.8.camel@gmail.com> <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> In-Reply-To: <1425900552.6715.7.camel@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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). 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