Re: [PATCH 1/3] locking/ww_mutex: cleanup lock->ctx usage in amdgpu

2018-02-20 Thread Peter Zijlstra
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

Re: [PATCH 1/3] locking/ww_mutex: cleanup lock->ctx usage in amdgpu

2018-02-20 Thread Peter Zijlstra
This really should've been Cc'ed to me. On Thu, Feb 15, 2018 at 03:19:42PM +0100, Christian König wrote: > diff --git a/include/linux/ww_mutex.h b/include/linux/ww_mutex.h > index 39fda195bf78..dd580db289e8 100644 > --- a/include/linux/ww_mutex.h > +++ b/include/linux/ww_mutex.h > @@ -358,4 +358,

Re: [PATCH 1/3] locking/ww_mutex: cleanup lock->ctx usage in amdgpu

2018-02-20 Thread Christian König
Am 20.02.2018 um 13:35 schrieb Peter Zijlstra: This really should've been Cc'ed to me. On Thu, Feb 15, 2018 at 03:19:42PM +0100, Christian König wrote: diff --git a/include/linux/ww_mutex.h b/include/linux/ww_mutex.h index 39fda195bf78..dd580db289e8 100644 --- a/include/linux/ww_mutex.h +++ b/i

Re: [PATCH 1/3] locking/ww_mutex: cleanup lock->ctx usage in amdgpu

2018-02-20 Thread Christian König
Am 20.02.2018 um 12:33 schrieb Daniel Vetter: [SNIP] Ah, so the ttm_ctx I've spotted was something entirely different and doesn't contain the ww_acquire_ctx (I didn't check)? I'd assume you have the same ctx passed around to everything in ttm, but if that doesn't exist then we can indeed not anno

Re: [PATCH 1/3] locking/ww_mutex: cleanup lock->ctx usage in amdgpu

2018-02-20 Thread Daniel Vetter
On Tue, Feb 20, 2018 at 10:43:48AM +0100, Christian König wrote: > Am 19.02.2018 um 17:43 schrieb Daniel Vetter: > > On Mon, Feb 19, 2018 at 05:29:46PM +0100, Christian König wrote: > > > [SNIP] > > > Well that is not a problem at all. See we don't nest trylock with normal > > > lock acquiring, cau

Re: [PATCH 1/3] locking/ww_mutex: cleanup lock->ctx usage in amdgpu

2018-02-20 Thread Christian König
Am 19.02.2018 um 17:43 schrieb Daniel Vetter: On Mon, Feb 19, 2018 at 05:29:46PM +0100, Christian König wrote: [SNIP] Well that is not a problem at all. See we don't nest trylock with normal lock acquiring, cause that would indeed bypass the whole deadlock detection. Instead we first use ww_mut

Re: [PATCH 1/3] locking/ww_mutex: cleanup lock->ctx usage in amdgpu

2018-02-19 Thread Daniel Vetter
On Mon, Feb 19, 2018 at 05:29:46PM +0100, Christian König wrote: > Am 19.02.2018 um 17:15 schrieb Daniel Vetter: > > On Mon, Feb 19, 2018 at 04:41:55PM +0100, Christian König wrote: > > > Am 19.02.2018 um 16:24 schrieb Daniel Vetter: > > > > On Thu, Feb 15, 2018 at 03:19:42PM +0100, Christian König

Re: [PATCH 1/3] locking/ww_mutex: cleanup lock->ctx usage in amdgpu

2018-02-19 Thread Christian König
Am 19.02.2018 um 17:15 schrieb Daniel Vetter: On Mon, Feb 19, 2018 at 04:41:55PM +0100, Christian König wrote: Am 19.02.2018 um 16:24 schrieb Daniel Vetter: On Thu, Feb 15, 2018 at 03:19:42PM +0100, Christian König wrote: amdgpu needs to verify if userspace sends us valid addresses and the sim

Re: [PATCH 1/3] locking/ww_mutex: cleanup lock->ctx usage in amdgpu

2018-02-19 Thread Daniel Vetter
On Mon, Feb 19, 2018 at 04:41:55PM +0100, Christian König wrote: > Am 19.02.2018 um 16:24 schrieb Daniel Vetter: > > On Thu, Feb 15, 2018 at 03:19:42PM +0100, Christian König wrote: > > > amdgpu needs to verify if userspace sends us valid addresses and the > > > simplest > > > way of doing this is

Re: [PATCH 1/3] locking/ww_mutex: cleanup lock->ctx usage in amdgpu

2018-02-19 Thread Christian König
Am 19.02.2018 um 16:24 schrieb Daniel Vetter: On Thu, Feb 15, 2018 at 03:19:42PM +0100, Christian König wrote: amdgpu needs to verify if userspace sends us valid addresses and the simplest way of doing this is to check if the buffer object is locked with the ticket of the current submission. Cl

Re: [PATCH 1/3] locking/ww_mutex: cleanup lock->ctx usage in amdgpu

2018-02-19 Thread Daniel Vetter
On Thu, Feb 15, 2018 at 03:19:42PM +0100, Christian König wrote: > amdgpu needs to verify if userspace sends us valid addresses and the simplest > way of doing this is to check if the buffer object is locked with the ticket > of the current submission. > > Clean up the access to the ww_mutex inter

Re: [PATCH 1/3] locking/ww_mutex: cleanup lock->ctx usage in amdgpu

2018-02-15 Thread Alex Deucher
On Thu, Feb 15, 2018 at 9:19 AM, Christian König wrote: > amdgpu needs to verify if userspace sends us valid addresses and the simplest > way of doing this is to check if the buffer object is locked with the ticket > of the current submission. > > Clean up the access to the ww_mutex internals by p