[Freedreno] [PATCH 00/14] drm/msm: de-struct_mutex-ification

2020-10-04 Thread Rob Clark
From: Rob Clark This doesn't remove *all* the struct_mutex, but it covers the worst of it, ie. shrinker/madvise/free/retire. The submit path still uses struct_mutex, but it still needs *something* serialize a portion of the submit path, and lock_stat mostly just shows the lock contention there b

[Freedreno] [PATCH 01/14] drm/msm: Use correct drm_gem_object_put() in fail case

2020-10-04 Thread Rob Clark
From: Rob Clark We only want to use the _unlocked() variant in the unlocked case. Signed-off-by: Rob Clark --- drivers/gpu/drm/msm/msm_gem.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c index 14e14caf90f9

[Freedreno] [PATCH 04/14] drm/msm: Add priv->mm_lock to protect active/inactive lists

2020-10-04 Thread Rob Clark
From: Rob Clark Rather than relying on the big dev->struct_mutex hammer, introduce a more specific lock for protecting the bo lists. Signed-off-by: Rob Clark --- drivers/gpu/drm/msm/msm_debugfs.c | 7 +++ drivers/gpu/drm/msm/msm_drv.c | 1 + drivers/gpu/drm/msm/msm_drv.h

[Freedreno] [PATCH 03/14] drm/msm: Move update_fences()

2020-10-04 Thread Rob Clark
From: Rob Clark Small cleanup, update_fences() is used in the hangcheck path, but also in the normal retire path. Signed-off-by: Rob Clark --- drivers/gpu/drm/msm/msm_gpu.c | 28 ++-- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/drm/msm/ms

[Freedreno] [PATCH 02/14] drm/msm: Drop chatty trace

2020-10-04 Thread Rob Clark
From: Rob Clark It is somewhat redundant with the gpu tracepoints, and anyways not too useful to justify spamming the log when debug traces are enabled. Signed-off-by: Rob Clark --- drivers/gpu/drm/msm/msm_gpu.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/gpu/drm/msm/msm_gpu.c b

[Freedreno] [PATCH 06/14] drm/msm: Protect ring->submits with it's own lock

2020-10-04 Thread Rob Clark
From: Rob Clark One less place to rely on dev->struct_mutex. Signed-off-by: Rob Clark --- drivers/gpu/drm/msm/msm_gem_submit.c | 2 ++ drivers/gpu/drm/msm/msm_gpu.c| 37 ++-- drivers/gpu/drm/msm/msm_ringbuffer.c | 1 + drivers/gpu/drm/msm/msm_ringbuffer.h | 6

[Freedreno] [PATCH 05/14] drm/msm: Document and rename preempt_lock

2020-10-04 Thread Rob Clark
From: Rob Clark Before adding another lock, give ring->lock a more descriptive name. Signed-off-by: Rob Clark --- drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 4 ++-- drivers/gpu/drm/msm/adreno/a5xx_preempt.c | 12 ++-- drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 4 ++-- drivers/gpu/d

[Freedreno] [PATCH 10/14] drm/msm: Drop struct_mutex in free_object() path

2020-10-04 Thread Rob Clark
From: Rob Clark Now that active_list/inactive_list is protected by mm_lock, we no longer need dev->struct_mutex in the free_object() path. Signed-off-by: Rob Clark --- drivers/gpu/drm/msm/msm_gem.c | 8 1 file changed, 8 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drive

[Freedreno] [PATCH 12/14] drm/msm: drop struct_mutex in madvise path

2020-10-04 Thread Rob Clark
From: Rob Clark The obj->lock is sufficient for what we need. This *does* have the implication that userspace can try to shoot themselves in the foot by racing madvise(DONTNEED) with submit. But the result will be about the same if they did madvise(DONTNEED) before the submit ioctl, ie. they mi

[Freedreno] [PATCH 07/14] drm/msm: Refcount submits

2020-10-04 Thread Rob Clark
From: Rob Clark Before we remove dev->struct_mutex from the retire path, we have to deal with the situation of a submit retiring before the submit ioctl returns. To deal with this, ring->submits will hold a reference to the submit, which is dropped when the submit is retired. And the submit ioc

[Freedreno] [PATCH 11/14] drm/msm: remove msm_gem_free_work

2020-10-04 Thread Rob Clark
From: Rob Clark Now that we don't need struct_mutex in the free path, we can get rid of the asynchronous free altogether. Signed-off-by: Rob Clark --- drivers/gpu/drm/msm/msm_drv.c | 3 --- drivers/gpu/drm/msm/msm_drv.h | 5 - drivers/gpu/drm/msm/msm_gem.c | 27 --

[Freedreno] [PATCH 13/14] drm/msm: Drop struct_mutex in shrinker path

2020-10-04 Thread Rob Clark
From: Rob Clark Now that the inactive_list is protected by mm_lock, and everything else on per-obj basis is protected by obj->lock, we no longer depend on struct_mutex. Signed-off-by: Rob Clark --- drivers/gpu/drm/msm/msm_gem.c | 1 - drivers/gpu/drm/msm/msm_gem_shrinker.c | 54 -

[Freedreno] [PATCH 14/14] drm/msm: Don't implicit-sync if only a single ring

2020-10-04 Thread Rob Clark
From: Rob Clark Any cross-device sync use-cases *must* use explicit sync. And if there is only a single ring (no-preemption), everything is FIFO order and there is no need to implicit-sync. Mesa should probably just always use MSM_SUBMIT_NO_IMPLICIT, as behavior is undefined when fences are not

[Freedreno] [PATCH 08/14] drm/msm: Remove obj->gpu

2020-10-04 Thread Rob Clark
From: Rob Clark It cannot be atomically updated with obj->active_count, and the only purpose is a useless WARN_ON() (which becomes a buggy WARN_ON() once retire_submits() is not serialized with incoming submits via struct_mutex) Signed-off-by: Rob Clark --- drivers/gpu/drm/msm/msm_gem.c | 2 --

[Freedreno] [PATCH 09/14] drm/msm: Drop struct_mutex from the retire path

2020-10-04 Thread Rob Clark
From: Rob Clark Now that we are not relying on dev->struct_mutex to protect the ring->submits lists, drop the struct_mutex lock. Signed-off-by: Rob Clark --- drivers/gpu/drm/msm/msm_gpu.c | 8 +--- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_gpu.c b

Re: [Freedreno] [PATCH 04/14] drm/msm: Add priv->mm_lock to protect active/inactive lists

2020-10-04 Thread Daniel Vetter
On Sun, Oct 4, 2020 at 9:21 PM Rob Clark wrote: > > From: Rob Clark > > Rather than relying on the big dev->struct_mutex hammer, introduce a > more specific lock for protecting the bo lists. > > Signed-off-by: Rob Clark > --- > drivers/gpu/drm/msm/msm_debugfs.c | 7 +++ > drivers/gpu/

Re: [Freedreno] [PATCH 04/14] drm/msm: Add priv->mm_lock to protect active/inactive lists

2020-10-04 Thread Rob Clark
On Sun, Oct 4, 2020 at 3:15 PM Daniel Vetter wrote: > > On Sun, Oct 4, 2020 at 9:21 PM Rob Clark wrote: > > > > From: Rob Clark > > > > Rather than relying on the big dev->struct_mutex hammer, introduce a > > more specific lock for protecting the bo lists. > > > > Signed-off-by: Rob Clark > > -

Re: [Freedreno] [PATCH V2 3/8] drm/msm: Unconditionally call dev_pm_opp_of_remove_table()

2020-10-04 Thread Viresh Kumar
On 28-08-20, 11:37, Viresh Kumar wrote: > dev_pm_opp_of_remove_table() doesn't report any errors when it fails to > find the OPP table with error -ENODEV (i.e. OPP table not present for > the device). And we can call dev_pm_opp_of_remove_table() > unconditionally here. > > While at it, also create