Message ID | 20211005113742.1101-15-christian.koenig@amd.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [01/28] dma-buf: add dma_resv_for_each_fence_unlocked v8 | expand |
On Tue, Oct 05, 2021 at 01:37:28PM +0200, Christian König wrote: > Simplifying the code a bit. Also drop the RCU read side lock since the > object is locked anyway. > > Untested since I can't get the driver to compile on !ARM. Cross-compiler install is pretty easy and you should have that for pushing drm changes to drm-misc :-) > Signed-off-by: Christian König <christian.koenig@amd.com> Assuming this compiles, it looks correct. Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> > --- > drivers/gpu/drm/msm/msm_gem.c | 19 +++++-------------- > 1 file changed, 5 insertions(+), 14 deletions(-) > > diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c > index 40a9863f5951..5bd511f07c07 100644 > --- a/drivers/gpu/drm/msm/msm_gem.c > +++ b/drivers/gpu/drm/msm/msm_gem.c > @@ -880,7 +880,7 @@ void msm_gem_describe(struct drm_gem_object *obj, struct seq_file *m, > { > struct msm_gem_object *msm_obj = to_msm_bo(obj); > struct dma_resv *robj = obj->resv; > - struct dma_resv_list *fobj; > + struct dma_resv_iter cursor; > struct dma_fence *fence; > struct msm_gem_vma *vma; > uint64_t off = drm_vma_node_start(&obj->vma_node); > @@ -955,22 +955,13 @@ void msm_gem_describe(struct drm_gem_object *obj, struct seq_file *m, > seq_puts(m, "\n"); > } > > - rcu_read_lock(); > - fobj = dma_resv_shared_list(robj); > - if (fobj) { > - unsigned int i, shared_count = fobj->shared_count; > - > - for (i = 0; i < shared_count; i++) { > - fence = rcu_dereference(fobj->shared[i]); > + dma_resv_for_each_fence(&cursor, robj, true, fence) { > + if (dma_resv_iter_is_exclusive(&cursor)) > + describe_fence(fence, "Exclusive", m); > + else > describe_fence(fence, "Shared", m); > - } > } > > - fence = dma_resv_excl_fence(robj); > - if (fence) > - describe_fence(fence, "Exclusive", m); > - rcu_read_unlock(); > - > msm_gem_unlock(obj); > } > > -- > 2.25.1 >
Am 13.10.21 um 16:14 schrieb Daniel Vetter: > On Tue, Oct 05, 2021 at 01:37:28PM +0200, Christian König wrote: >> Simplifying the code a bit. Also drop the RCU read side lock since the >> object is locked anyway. >> >> Untested since I can't get the driver to compile on !ARM. > Cross-compiler install is pretty easy and you should have that for pushing > drm changes to drm-misc :-) I do have cross compile setups for some architectures, but I seriously can't do that for every single driver. With only a bit of work we allowed MSM to be compile tested on other architectures as well now. That even yielded a couple of missing includes and dependencies in MSM which just don't matter on ARM. > >> Signed-off-by: Christian König <christian.koenig@amd.com> > Assuming this compiles, it looks correct. Yes it does. > > Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Thanks, Christian. > >> --- >> drivers/gpu/drm/msm/msm_gem.c | 19 +++++-------------- >> 1 file changed, 5 insertions(+), 14 deletions(-) >> >> diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c >> index 40a9863f5951..5bd511f07c07 100644 >> --- a/drivers/gpu/drm/msm/msm_gem.c >> +++ b/drivers/gpu/drm/msm/msm_gem.c >> @@ -880,7 +880,7 @@ void msm_gem_describe(struct drm_gem_object *obj, struct seq_file *m, >> { >> struct msm_gem_object *msm_obj = to_msm_bo(obj); >> struct dma_resv *robj = obj->resv; >> - struct dma_resv_list *fobj; >> + struct dma_resv_iter cursor; >> struct dma_fence *fence; >> struct msm_gem_vma *vma; >> uint64_t off = drm_vma_node_start(&obj->vma_node); >> @@ -955,22 +955,13 @@ void msm_gem_describe(struct drm_gem_object *obj, struct seq_file *m, >> seq_puts(m, "\n"); >> } >> >> - rcu_read_lock(); >> - fobj = dma_resv_shared_list(robj); >> - if (fobj) { >> - unsigned int i, shared_count = fobj->shared_count; >> - >> - for (i = 0; i < shared_count; i++) { >> - fence = rcu_dereference(fobj->shared[i]); >> + dma_resv_for_each_fence(&cursor, robj, true, fence) { >> + if (dma_resv_iter_is_exclusive(&cursor)) >> + describe_fence(fence, "Exclusive", m); >> + else >> describe_fence(fence, "Shared", m); >> - } >> } >> >> - fence = dma_resv_excl_fence(robj); >> - if (fence) >> - describe_fence(fence, "Exclusive", m); >> - rcu_read_unlock(); >> - >> msm_gem_unlock(obj); >> } >> >> -- >> 2.25.1 >>
On Tue, Oct 19, 2021 at 01:49:08PM +0200, Christian König wrote: > Am 13.10.21 um 16:14 schrieb Daniel Vetter: > > On Tue, Oct 05, 2021 at 01:37:28PM +0200, Christian König wrote: > > > Simplifying the code a bit. Also drop the RCU read side lock since the > > > object is locked anyway. > > > > > > Untested since I can't get the driver to compile on !ARM. > > Cross-compiler install is pretty easy and you should have that for pushing > > drm changes to drm-misc :-) > > I do have cross compile setups for some architectures, but I seriously can't > do that for every single driver. > > With only a bit of work we allowed MSM to be compile tested on other > architectures as well now. That even yielded a couple of missing includes > and dependencies in MSM which just don't matter on ARM. The only ones you need is arm32 and arm64. -Daniel > > > > > > Signed-off-by: Christian König <christian.koenig@amd.com> > > Assuming this compiles, it looks correct. > > Yes it does. > > > > > Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> > > > Thanks, > Christian. > > > > > > --- > > > drivers/gpu/drm/msm/msm_gem.c | 19 +++++-------------- > > > 1 file changed, 5 insertions(+), 14 deletions(-) > > > > > > diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c > > > index 40a9863f5951..5bd511f07c07 100644 > > > --- a/drivers/gpu/drm/msm/msm_gem.c > > > +++ b/drivers/gpu/drm/msm/msm_gem.c > > > @@ -880,7 +880,7 @@ void msm_gem_describe(struct drm_gem_object *obj, struct seq_file *m, > > > { > > > struct msm_gem_object *msm_obj = to_msm_bo(obj); > > > struct dma_resv *robj = obj->resv; > > > - struct dma_resv_list *fobj; > > > + struct dma_resv_iter cursor; > > > struct dma_fence *fence; > > > struct msm_gem_vma *vma; > > > uint64_t off = drm_vma_node_start(&obj->vma_node); > > > @@ -955,22 +955,13 @@ void msm_gem_describe(struct drm_gem_object *obj, struct seq_file *m, > > > seq_puts(m, "\n"); > > > } > > > - rcu_read_lock(); > > > - fobj = dma_resv_shared_list(robj); > > > - if (fobj) { > > > - unsigned int i, shared_count = fobj->shared_count; > > > - > > > - for (i = 0; i < shared_count; i++) { > > > - fence = rcu_dereference(fobj->shared[i]); > > > + dma_resv_for_each_fence(&cursor, robj, true, fence) { > > > + if (dma_resv_iter_is_exclusive(&cursor)) > > > + describe_fence(fence, "Exclusive", m); > > > + else > > > describe_fence(fence, "Shared", m); > > > - } > > > } > > > - fence = dma_resv_excl_fence(robj); > > > - if (fence) > > > - describe_fence(fence, "Exclusive", m); > > > - rcu_read_unlock(); > > > - > > > msm_gem_unlock(obj); > > > } > > > -- > > > 2.25.1 > > > >
diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c index 40a9863f5951..5bd511f07c07 100644 --- a/drivers/gpu/drm/msm/msm_gem.c +++ b/drivers/gpu/drm/msm/msm_gem.c @@ -880,7 +880,7 @@ void msm_gem_describe(struct drm_gem_object *obj, struct seq_file *m, { struct msm_gem_object *msm_obj = to_msm_bo(obj); struct dma_resv *robj = obj->resv; - struct dma_resv_list *fobj; + struct dma_resv_iter cursor; struct dma_fence *fence; struct msm_gem_vma *vma; uint64_t off = drm_vma_node_start(&obj->vma_node); @@ -955,22 +955,13 @@ void msm_gem_describe(struct drm_gem_object *obj, struct seq_file *m, seq_puts(m, "\n"); } - rcu_read_lock(); - fobj = dma_resv_shared_list(robj); - if (fobj) { - unsigned int i, shared_count = fobj->shared_count; - - for (i = 0; i < shared_count; i++) { - fence = rcu_dereference(fobj->shared[i]); + dma_resv_for_each_fence(&cursor, robj, true, fence) { + if (dma_resv_iter_is_exclusive(&cursor)) + describe_fence(fence, "Exclusive", m); + else describe_fence(fence, "Shared", m); - } } - fence = dma_resv_excl_fence(robj); - if (fence) - describe_fence(fence, "Exclusive", m); - rcu_read_unlock(); - msm_gem_unlock(obj); }
Simplifying the code a bit. Also drop the RCU read side lock since the object is locked anyway. Untested since I can't get the driver to compile on !ARM. Signed-off-by: Christian König <christian.koenig@amd.com> --- drivers/gpu/drm/msm/msm_gem.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-)