Re: [PATCH 2/3] locking: ww_mutex: Allow to use rt_mutex instead of mutex for the baselock

2015-03-10 Thread Maarten Lankhorst
Hey, Op 10-03-15 om 16:28 schreef Peter Zijlstra: > On Tue, Mar 10, 2015 at 03:10:46PM +0100, Maarten Lankhorst wrote: >> Op 10-03-15 om 13:37 schreef Peter Zijlstra: > >>> So IIRC this is the function that checks who gets wounded (and gets to >>> do the whole retry thing), right? >>> >>> So for

Re: [PATCH 2/3] locking: ww_mutex: Allow to use rt_mutex instead of mutex for the baselock

2015-03-10 Thread Peter Zijlstra
On Tue, Mar 10, 2015 at 03:10:46PM +0100, Maarten Lankhorst wrote: > Op 10-03-15 om 13:37 schreef Peter Zijlstra: > > So IIRC this is the function that checks who gets wounded (and gets to > > do the whole retry thing), right? > > > > So for the RT case, I think we should extend it to not (primari

Re: [PATCH 2/3] locking: ww_mutex: Allow to use rt_mutex instead of mutex for the baselock

2015-03-10 Thread Maarten Lankhorst
Op 10-03-15 om 13:37 schreef Peter Zijlstra: > On Fri, Feb 27, 2015 at 05:57:08PM +0100, Sebastian Andrzej Siewior wrote: >> +static int __sched __mutex_lock_check_stamp(struct rt_mutex *lock, >> +struct ww_acquire_ctx *ctx) >> +{ >> +#ifdef CONFIG_WW_MUTEX_R

Re: [PATCH 2/3] locking: ww_mutex: Allow to use rt_mutex instead of mutex for the baselock

2015-03-10 Thread Peter Zijlstra
On Fri, Feb 27, 2015 at 05:57:08PM +0100, Sebastian Andrzej Siewior wrote: > +static int __sched __mutex_lock_check_stamp(struct rt_mutex *lock, > + struct ww_acquire_ctx *ctx) On that; should we rename this to __ww_mutex_check_wound() ? or something to more

Re: [PATCH 2/3] locking: ww_mutex: Allow to use rt_mutex instead of mutex for the baselock

2015-03-10 Thread Peter Zijlstra
On Fri, Feb 27, 2015 at 05:57:08PM +0100, Sebastian Andrzej Siewior wrote: > +#ifdef CONFIG_WW_MUTEX_RTMUTEX > +static void ww_mutex_lock_acquired(struct ww_mutex *ww, > +struct ww_acquire_ctx *ww_ctx) > +{ > +#ifdef CONFIG_DEBUG_MUTEXES > + /* > + * If this

Re: [PATCH 2/3] locking: ww_mutex: Allow to use rt_mutex instead of mutex for the baselock

2015-03-10 Thread Peter Zijlstra
On Tue, Mar 10, 2015 at 01:37:40PM +0100, Peter Zijlstra wrote: > On Fri, Feb 27, 2015 at 05:57:08PM +0100, Sebastian Andrzej Siewior wrote: > > +static int __sched __mutex_lock_check_stamp(struct rt_mutex *lock, > > + struct ww_acquire_ctx *ctx) > > +{ > > +#i

Re: [PATCH 2/3] locking: ww_mutex: Allow to use rt_mutex instead of mutex for the baselock

2015-03-10 Thread Peter Zijlstra
On Fri, Feb 27, 2015 at 05:57:08PM +0100, Sebastian Andrzej Siewior wrote: > +static int __sched __mutex_lock_check_stamp(struct rt_mutex *lock, > + struct ww_acquire_ctx *ctx) > +{ > +#ifdef CONFIG_WW_MUTEX_RTMUTEX > + struct ww_mutex *ww = container_of(

Re: [PATCH 2/3] locking: ww_mutex: Allow to use rt_mutex instead of mutex for the baselock

2015-03-10 Thread Peter Zijlstra
On Fri, Feb 27, 2015 at 05:57:08PM +0100, Sebastian Andrzej Siewior wrote: > diff --git a/kernel/locking/mutex.c b/kernel/locking/mutex.c > index 16b2d3cc88b0..0a652ba46081 100644 > --- a/kernel/locking/mutex.c > +++ b/kernel/locking/mutex.c > @@ -106,6 +106,7 @@ void __sched mutex_lock(struct mute

Re: [PATCH 2/3] locking: ww_mutex: Allow to use rt_mutex instead of mutex for the baselock

2015-03-09 Thread Paul E. McKenney
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 mi

Re: [PATCH 2/3] locking: ww_mutex: Allow to use rt_mutex instead of mutex for the baselock

2015-03-09 Thread Sebastian Andrzej Siewior
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

Re: [PATCH 2/3] locking: ww_mutex: Allow to use rt_mutex instead of mutex for the baselock

2015-03-09 Thread Mike Galbraith
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 afai

Re: [PATCH 2/3] locking: ww_mutex: Allow to use rt_mutex instead of mutex for the baselock

2015-03-09 Thread Sebastian Andrzej Siewior
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?) and one of the things it does is PI. On -R

Re: [PATCH 2/3] locking: ww_mutex: Allow to use rt_mutex instead of mutex for the baselock

2015-03-09 Thread Mike Galbraith
On Mon, 2015-03-09 at 11:00 +0100, Sebastian Andrzej Siewior wrote: > On 03/06/2015 06:50 PM, Mike Galbraith wrote: > > On Fri, 2015-03-06 at 13:36 +0100, Sebastian Andrzej Siewior wrote: > >> On 03/06/2015 01:16 PM, Maarten Lankhorst wrote: > >> > Okay so what I the point made here? It is onl

Re: [PATCH 2/3] locking: ww_mutex: Allow to use rt_mutex instead of mutex for the baselock

2015-03-09 Thread Sebastian Andrzej Siewior
On 03/06/2015 06:50 PM, Mike Galbraith wrote: > On Fri, 2015-03-06 at 13:36 +0100, Sebastian Andrzej Siewior wrote: >> On 03/06/2015 01:16 PM, Maarten Lankhorst wrote: >> Okay so what I the point made here? It is only about the config option, right? What are the preferences here: [ ]

Re: [PATCH 2/3] locking: ww_mutex: Allow to use rt_mutex instead of mutex for the baselock

2015-03-06 Thread Mike Galbraith
On Fri, 2015-03-06 at 13:36 +0100, Sebastian Andrzej Siewior wrote: > On 03/06/2015 01:16 PM, Maarten Lankhorst wrote: > > >> Okay so what I the point made here? It is only about the config option, > >> right? What are the preferences here: > >> [ ] yes, the way it is now > > Is my personal prefer

Re: [PATCH 2/3] locking: ww_mutex: Allow to use rt_mutex instead of mutex for the baselock

2015-03-06 Thread Sebastian Andrzej Siewior
On 03/06/2015 01:16 PM, Maarten Lankhorst wrote: >> Okay so what I the point made here? It is only about the config option, >> right? What are the preferences here: >> [ ] yes, the way it is now > Is my personal preference, but I'm not a locking expert(TM). Lets see what Mike says. I currently do

Re: [PATCH 2/3] locking: ww_mutex: Allow to use rt_mutex instead of mutex for the baselock

2015-03-06 Thread Maarten Lankhorst
On 06-03-15 13:14, Sebastian Andrzej Siewior wrote: > On 03/02/2015 09:46 AM, Maarten Lankhorst wrote: >> Hey, >> >> Op 02-03-15 om 04:20 schreef Mike Galbraith: >>> On Fri, 2015-02-27 at 17:57 +0100, Sebastian Andrzej Siewior wrote: This patch makes it possible to replace the base mutex by

Re: [PATCH 2/3] locking: ww_mutex: Allow to use rt_mutex instead of mutex for the baselock

2015-03-06 Thread Sebastian Andrzej Siewior
On 03/02/2015 09:46 AM, Maarten Lankhorst wrote: > Hey, > > Op 02-03-15 om 04:20 schreef Mike Galbraith: >> On Fri, 2015-02-27 at 17:57 +0100, Sebastian Andrzej Siewior wrote: >>> This patch makes it possible to replace the base mutex by a rt_mutex. In >>> general one would not do this. >> I would

Re: [PATCH 2/3] locking: ww_mutex: Allow to use rt_mutex instead of mutex for the baselock

2015-03-02 Thread Mike Galbraith
On Mon, 2015-03-02 at 09:46 +0100, Maarten Lankhorst wrote: > Hey, > > Op 02-03-15 om 04:20 schreef Mike Galbraith: > > On Fri, 2015-02-27 at 17:57 +0100, Sebastian Andrzej Siewior wrote: > >> This patch makes it possible to replace the base mutex by a rt_mutex. In > >> general one would not do th

Re: [PATCH 2/3] locking: ww_mutex: Allow to use rt_mutex instead of mutex for the baselock

2015-03-02 Thread Maarten Lankhorst
Hey, Op 02-03-15 om 04:20 schreef Mike Galbraith: > On Fri, 2015-02-27 at 17:57 +0100, Sebastian Andrzej Siewior wrote: >> This patch makes it possible to replace the base mutex by a rt_mutex. In >> general one would not do this. > I would argue that the thing should be born as a full fledged prim

Re: [PATCH 2/3] locking: ww_mutex: Allow to use rt_mutex instead of mutex for the baselock

2015-03-01 Thread Mike Galbraith
On Fri, 2015-02-27 at 17:57 +0100, Sebastian Andrzej Siewior wrote: > This patch makes it possible to replace the base mutex by a rt_mutex. In > general one would not do this. I would argue that the thing should be born as a full fledged primitive, not a config option, as an rt_ww_mutex is the ww

[PATCH 2/3] locking: ww_mutex: Allow to use rt_mutex instead of mutex for the baselock

2015-02-27 Thread Sebastian Andrzej Siewior
This patch makes it possible to replace the base mutex by a rt_mutex. In general one would not do this. In -RT we use rt_mutex instead of the mutex by default and this means we need the ww_mutex functionality based on rt_mutex. This patch includes a slightly modified version of what we have in the