lkml.org 
[lkml]   [2018]   [Feb]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/3] locking/ww_mutex: cleanup lock->ctx usage in amdgpu
On Tue, Feb 20, 2018 at 02:08:26PM +0100, Christian König wrote:
> Am 20.02.2018 um 13:35 schrieb Peter Zijlstra:
> > > +static inline bool ww_mutex_is_owned_by(struct ww_mutex *lock,
> > > + struct task_struct *task,
> > > + struct ww_acquire_ctx *ctx)
> > > +{
> > > + return likely(__mutex_owner(&lock->base) == task) &&
> > > + READ_ONCE(lock->ctx) == ctx;
> > > +}
> > Nak on that interface, that's racy and broken by design.
>
> Why?

If task != current you can race with a concurrent mutex_unlock().

\
 
 \ /
  Last update: 2018-02-20 14:25    [W:0.064 / U:0.156 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site