Re: [PATCH 2/3] locking: ww_mutex: Allow to use rt_mutex instead of mutex for the baselock
From: Sebastian Andrzej Siewior
Date: Mon Mar 09 2015 - 09:22:09 EST
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.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/