On Mon, Aug 10, 2020 at 3:27 PM Jordan Crouse <jcro...@codeaurora.org> wrote: > > Each submitqueue is attached to a context. Add a pointer to the > context to the submitqueue at create time and refcount it so > that it stays around through the life of the queue. > > GPU submissions can access the active context via the submitqueue > instead of requiring it to be passed around from function to > function. > > Signed-off-by: Jordan Crouse <jcro...@codeaurora.org> > --- > > drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 12 +++++------- > drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 5 ++--- > drivers/gpu/drm/msm/adreno/adreno_gpu.c | 5 ++--- > drivers/gpu/drm/msm/adreno/adreno_gpu.h | 3 +-- > drivers/gpu/drm/msm/msm_drv.c | 3 ++- > drivers/gpu/drm/msm/msm_drv.h | 8 ++++++++ > drivers/gpu/drm/msm/msm_gem.h | 1 + > drivers/gpu/drm/msm/msm_gem_submit.c | 8 ++++---- > drivers/gpu/drm/msm/msm_gpu.c | 9 ++++----- > drivers/gpu/drm/msm/msm_gpu.h | 7 +++---- > drivers/gpu/drm/msm/msm_submitqueue.c | 8 +++++++- > 11 files changed, 39 insertions(+), 30 deletions(-) >
[snip] > diff --git a/drivers/gpu/drm/msm/msm_submitqueue.c > b/drivers/gpu/drm/msm/msm_submitqueue.c > index a1d94be7883a..10f557225a3e 100644 > --- a/drivers/gpu/drm/msm/msm_submitqueue.c > +++ b/drivers/gpu/drm/msm/msm_submitqueue.c > @@ -49,8 +49,10 @@ void msm_submitqueue_close(struct msm_file_private *ctx) > * No lock needed in close and there won't > * be any more user ioctls coming our way > */ > - list_for_each_entry_safe(entry, tmp, &ctx->submitqueues, node) > + list_for_each_entry_safe(entry, tmp, &ctx->submitqueues, node) { > + kref_put(&ctx->ref, msm_file_private_destroy); > msm_submitqueue_put(entry); > + } oh, this is the problem I mentioned in the last email.. we are dropping the queue's reference to the ctx, when the device file is closed, not on the last unref of the queue. So the queue stays live until all associated submits are retired, but the ctx ref (and therefore the aspace) get destroyed earlier BR, -R > } > > int msm_submitqueue_create(struct drm_device *drm, struct msm_file_private > *ctx, _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu