* [PATCH 0/6] make ctx mgr global @ 2016-08-18 7:50 Chunming Zhou [not found] ` <1471506618-29849-1-git-send-email-David1.Zhou-5C7GfCeVMHo@public.gmane.org> 0 siblings, 1 reply; 19+ messages in thread From: Chunming Zhou @ 2016-08-18 7:50 UTC (permalink / raw) To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW Cc: Chunming Zhou, David.Mao-5C7GfCeVMHo If we want to share semaphore/dependency across process across device, we must make ctx id be global, so that we can index it everywhere. Chunming Zhou (6): drm/amdgpu: use global ctx mgr instead of vm specified drm/amdgpu: clean up for amdgpu ctx drm/amdgpu: allocate progressively higher ids for ctx until idr counter wraps drm/amdgpu: ctx id should be removed when ctx is freed drm/amdgpu: use fence-array for ctx release drm/amdgpu: dependency is already signaled if ctx has been freed drivers/gpu/drm/amd/amdgpu/amdgpu.h | 17 ++-- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 9 +- drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 142 ++++++++++++++++++-------------- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 3 + drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 4 - 5 files changed, 92 insertions(+), 83 deletions(-) -- 1.9.1 _______________________________________________ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx ^ permalink raw reply [flat|nested] 19+ messages in thread
[parent not found: <1471506618-29849-1-git-send-email-David1.Zhou-5C7GfCeVMHo@public.gmane.org>]
* [PATCH 1/6] drm/amdgpu: use global ctx mgr instead of vm specified [not found] ` <1471506618-29849-1-git-send-email-David1.Zhou-5C7GfCeVMHo@public.gmane.org> @ 2016-08-18 7:50 ` Chunming Zhou 2016-08-18 7:50 ` [PATCH 2/6] drm/amdgpu: clean up for amdgpu ctx Chunming Zhou ` (6 subsequent siblings) 7 siblings, 0 replies; 19+ messages in thread From: Chunming Zhou @ 2016-08-18 7:50 UTC (permalink / raw) To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW Cc: Chunming Zhou, David.Mao-5C7GfCeVMHo ctx id will be used across process and across device. Change-Id: I3f4f99b75f457d60ae0e5c2a9ab126dff6f3418f Signed-off-by: Chunming Zhou <David1.Zhou@amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 59 +++++++++++---------------------- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 3 ++ 2 files changed, 23 insertions(+), 39 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c index 17e1362..bd74a57 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c @@ -25,6 +25,9 @@ #include <drm/drmP.h> #include "amdgpu.h" +static DEFINE_MUTEX(amdgpu_ctx_lock); +extern struct idr amdgpu_ctx_idr; + static int amdgpu_ctx_init(struct amdgpu_device *adev, struct amdgpu_ctx *ctx) { unsigned i, j; @@ -87,7 +90,6 @@ static int amdgpu_ctx_alloc(struct amdgpu_device *adev, struct amdgpu_fpriv *fpriv, uint32_t *id) { - struct amdgpu_ctx_mgr *mgr = &fpriv->ctx_mgr; struct amdgpu_ctx *ctx; int r; @@ -95,21 +97,21 @@ static int amdgpu_ctx_alloc(struct amdgpu_device *adev, if (!ctx) return -ENOMEM; - mutex_lock(&mgr->lock); - r = idr_alloc(&mgr->ctx_handles, ctx, 1, 0, GFP_KERNEL); + mutex_lock(&amdgpu_ctx_lock); + r = idr_alloc(&amdgpu_ctx_idr, ctx, 1, 0, GFP_KERNEL); if (r < 0) { - mutex_unlock(&mgr->lock); + mutex_unlock(&amdgpu_ctx_lock); kfree(ctx); return r; } *id = (uint32_t)r; r = amdgpu_ctx_init(adev, ctx); if (r) { - idr_remove(&mgr->ctx_handles, *id); + idr_remove(&amdgpu_ctx_idr, *id); *id = 0; kfree(ctx); } - mutex_unlock(&mgr->lock); + mutex_unlock(&amdgpu_ctx_lock); return r; } @@ -126,18 +128,17 @@ static void amdgpu_ctx_do_release(struct kref *ref) static int amdgpu_ctx_free(struct amdgpu_fpriv *fpriv, uint32_t id) { - struct amdgpu_ctx_mgr *mgr = &fpriv->ctx_mgr; struct amdgpu_ctx *ctx; - mutex_lock(&mgr->lock); - ctx = idr_find(&mgr->ctx_handles, id); + mutex_lock(&amdgpu_ctx_lock); + ctx = idr_find(&amdgpu_ctx_idr, id); if (ctx) { - idr_remove(&mgr->ctx_handles, id); + idr_remove(&amdgpu_ctx_idr, id); kref_put(&ctx->refcount, amdgpu_ctx_do_release); - mutex_unlock(&mgr->lock); + mutex_unlock(&amdgpu_ctx_lock); return 0; } - mutex_unlock(&mgr->lock); + mutex_unlock(&amdgpu_ctx_lock); return -EINVAL; } @@ -146,17 +147,15 @@ static int amdgpu_ctx_query(struct amdgpu_device *adev, union drm_amdgpu_ctx_out *out) { struct amdgpu_ctx *ctx; - struct amdgpu_ctx_mgr *mgr; unsigned reset_counter; if (!fpriv) return -EINVAL; - mgr = &fpriv->ctx_mgr; - mutex_lock(&mgr->lock); - ctx = idr_find(&mgr->ctx_handles, id); + mutex_lock(&amdgpu_ctx_lock); + ctx = idr_find(&amdgpu_ctx_idr, id); if (!ctx) { - mutex_unlock(&mgr->lock); + mutex_unlock(&amdgpu_ctx_lock); return -EINVAL; } @@ -173,7 +172,7 @@ static int amdgpu_ctx_query(struct amdgpu_device *adev, out->state.reset_status = AMDGPU_CTX_UNKNOWN_RESET; ctx->reset_counter = reset_counter; - mutex_unlock(&mgr->lock); + mutex_unlock(&amdgpu_ctx_lock); return 0; } @@ -211,18 +210,15 @@ int amdgpu_ctx_ioctl(struct drm_device *dev, void *data, struct amdgpu_ctx *amdgpu_ctx_get(struct amdgpu_fpriv *fpriv, uint32_t id) { struct amdgpu_ctx *ctx; - struct amdgpu_ctx_mgr *mgr; if (!fpriv) return NULL; - mgr = &fpriv->ctx_mgr; - - mutex_lock(&mgr->lock); - ctx = idr_find(&mgr->ctx_handles, id); + mutex_lock(&amdgpu_ctx_lock); + ctx = idr_find(&amdgpu_ctx_idr, id); if (ctx) kref_get(&ctx->refcount); - mutex_unlock(&mgr->lock); + mutex_unlock(&amdgpu_ctx_lock); return ctx; } @@ -291,23 +287,8 @@ struct fence *amdgpu_ctx_get_fence(struct amdgpu_ctx *ctx, void amdgpu_ctx_mgr_init(struct amdgpu_ctx_mgr *mgr) { - mutex_init(&mgr->lock); - idr_init(&mgr->ctx_handles); } void amdgpu_ctx_mgr_fini(struct amdgpu_ctx_mgr *mgr) { - struct amdgpu_ctx *ctx; - struct idr *idp; - uint32_t id; - - idp = &mgr->ctx_handles; - - idr_for_each_entry(idp, ctx, id) { - if (kref_put(&ctx->refcount, amdgpu_ctx_do_release) != 1) - DRM_ERROR("ctx %p is still alive\n", ctx); - } - - idr_destroy(&mgr->ctx_handles); - mutex_destroy(&mgr->lock); } diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c index 209a539..222da53 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c @@ -334,6 +334,8 @@ MODULE_DEVICE_TABLE(pci, pciidlist); static struct drm_driver kms_driver; +struct idr amdgpu_ctx_idr; + static int amdgpu_kick_out_firmware_fb(struct pci_dev *pdev) { struct apertures_struct *ap; @@ -624,6 +626,7 @@ static int __init amdgpu_init(void) pdriver = &amdgpu_kms_pci_driver; driver->num_ioctls = amdgpu_max_kms_ioctl; amdgpu_register_atpx_handler(); + idr_init(&amdgpu_ctx_idr); /* let modprobe override vga console setting */ return drm_pci_init(driver, pdriver); } -- 1.9.1 _______________________________________________ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx ^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 2/6] drm/amdgpu: clean up for amdgpu ctx [not found] ` <1471506618-29849-1-git-send-email-David1.Zhou-5C7GfCeVMHo@public.gmane.org> 2016-08-18 7:50 ` [PATCH 1/6] drm/amdgpu: use global ctx mgr instead of vm specified Chunming Zhou @ 2016-08-18 7:50 ` Chunming Zhou 2016-08-18 7:50 ` [PATCH 3/6] drm/amdgpu: allocate progressively higher ids for ctx until idr counter wraps Chunming Zhou ` (5 subsequent siblings) 7 siblings, 0 replies; 19+ messages in thread From: Chunming Zhou @ 2016-08-18 7:50 UTC (permalink / raw) To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW Cc: Chunming Zhou, David.Mao-5C7GfCeVMHo No used more. Change-Id: I54ddd3f492354863a055ad2356bccccc749ff420 Signed-off-by: Chunming Zhou <David1.Zhou@amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 13 +------------ drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 7 +++---- drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 27 ++++++--------------------- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 4 ---- 4 files changed, 10 insertions(+), 41 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h index b6552ed..049e1d6 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h @@ -1032,14 +1032,7 @@ struct amdgpu_ctx { struct amdgpu_ctx_ring rings[AMDGPU_MAX_RINGS]; }; -struct amdgpu_ctx_mgr { - struct amdgpu_device *adev; - struct mutex lock; - /* protected by lock */ - struct idr ctx_handles; -}; - -struct amdgpu_ctx *amdgpu_ctx_get(struct amdgpu_fpriv *fpriv, uint32_t id); +struct amdgpu_ctx *amdgpu_ctx_get(uint32_t id); int amdgpu_ctx_put(struct amdgpu_ctx *ctx); uint64_t amdgpu_ctx_add_fence(struct amdgpu_ctx *ctx, struct amdgpu_ring *ring, @@ -1050,9 +1043,6 @@ struct fence *amdgpu_ctx_get_fence(struct amdgpu_ctx *ctx, int amdgpu_ctx_ioctl(struct drm_device *dev, void *data, struct drm_file *filp); -void amdgpu_ctx_mgr_init(struct amdgpu_ctx_mgr *mgr); -void amdgpu_ctx_mgr_fini(struct amdgpu_ctx_mgr *mgr); - /* * file private structure */ @@ -1061,7 +1051,6 @@ struct amdgpu_fpriv { struct amdgpu_vm vm; struct mutex bo_list_lock; struct idr bo_list_handles; - struct amdgpu_ctx_mgr ctx_mgr; }; /* diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c index 3434098..cfae65d 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c @@ -133,7 +133,7 @@ int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, void *data) if (!chunk_array) return -ENOMEM; - p->ctx = amdgpu_ctx_get(fpriv, cs->in.ctx_id); + p->ctx = amdgpu_ctx_get(cs->in.ctx_id); if (!p->ctx) { ret = -EINVAL; goto free_chunk; @@ -804,7 +804,6 @@ static int amdgpu_cs_ib_fill(struct amdgpu_device *adev, static int amdgpu_cs_dependencies(struct amdgpu_device *adev, struct amdgpu_cs_parser *p) { - struct amdgpu_fpriv *fpriv = p->filp->driver_priv; int i, j, r; for (i = 0; i < p->nchunks; ++i) { @@ -832,7 +831,7 @@ static int amdgpu_cs_dependencies(struct amdgpu_device *adev, if (r) return r; - ctx = amdgpu_ctx_get(fpriv, deps[j].ctx_id); + ctx = amdgpu_ctx_get(deps[j].ctx_id); if (ctx == NULL) return -EINVAL; @@ -967,7 +966,7 @@ int amdgpu_cs_wait_ioctl(struct drm_device *dev, void *data, if (r) return r; - ctx = amdgpu_ctx_get(filp->driver_priv, wait->in.ctx_id); + ctx = amdgpu_ctx_get(wait->in.ctx_id); if (ctx == NULL) return -EINVAL; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c index bd74a57..963a14e 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c @@ -87,7 +87,6 @@ static void amdgpu_ctx_fini(struct amdgpu_ctx *ctx) } static int amdgpu_ctx_alloc(struct amdgpu_device *adev, - struct amdgpu_fpriv *fpriv, uint32_t *id) { struct amdgpu_ctx *ctx; @@ -126,7 +125,7 @@ static void amdgpu_ctx_do_release(struct kref *ref) kfree(ctx); } -static int amdgpu_ctx_free(struct amdgpu_fpriv *fpriv, uint32_t id) +static int amdgpu_ctx_free(uint32_t id) { struct amdgpu_ctx *ctx; @@ -143,15 +142,12 @@ static int amdgpu_ctx_free(struct amdgpu_fpriv *fpriv, uint32_t id) } static int amdgpu_ctx_query(struct amdgpu_device *adev, - struct amdgpu_fpriv *fpriv, uint32_t id, + uint32_t id, union drm_amdgpu_ctx_out *out) { struct amdgpu_ctx *ctx; unsigned reset_counter; - if (!fpriv) - return -EINVAL; - mutex_lock(&amdgpu_ctx_lock); ctx = idr_find(&amdgpu_ctx_idr, id); if (!ctx) { @@ -184,21 +180,20 @@ int amdgpu_ctx_ioctl(struct drm_device *dev, void *data, union drm_amdgpu_ctx *args = data; struct amdgpu_device *adev = dev->dev_private; - struct amdgpu_fpriv *fpriv = filp->driver_priv; r = 0; id = args->in.ctx_id; switch (args->in.op) { case AMDGPU_CTX_OP_ALLOC_CTX: - r = amdgpu_ctx_alloc(adev, fpriv, &id); + r = amdgpu_ctx_alloc(adev, &id); args->out.alloc.ctx_id = id; break; case AMDGPU_CTX_OP_FREE_CTX: - r = amdgpu_ctx_free(fpriv, id); + r = amdgpu_ctx_free(id); break; case AMDGPU_CTX_OP_QUERY_STATE: - r = amdgpu_ctx_query(adev, fpriv, id, &args->out); + r = amdgpu_ctx_query(adev, id, &args->out); break; default: return -EINVAL; @@ -207,13 +202,10 @@ int amdgpu_ctx_ioctl(struct drm_device *dev, void *data, return r; } -struct amdgpu_ctx *amdgpu_ctx_get(struct amdgpu_fpriv *fpriv, uint32_t id) +struct amdgpu_ctx *amdgpu_ctx_get(uint32_t id) { struct amdgpu_ctx *ctx; - if (!fpriv) - return NULL; - mutex_lock(&amdgpu_ctx_lock); ctx = idr_find(&amdgpu_ctx_idr, id); if (ctx) @@ -285,10 +277,3 @@ struct fence *amdgpu_ctx_get_fence(struct amdgpu_ctx *ctx, return fence; } -void amdgpu_ctx_mgr_init(struct amdgpu_ctx_mgr *mgr) -{ -} - -void amdgpu_ctx_mgr_fini(struct amdgpu_ctx_mgr *mgr) -{ -} diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c index 0fb5488..9cef83e 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c @@ -543,8 +543,6 @@ int amdgpu_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv) mutex_init(&fpriv->bo_list_lock); idr_init(&fpriv->bo_list_handles); - amdgpu_ctx_mgr_init(&fpriv->ctx_mgr); - file_priv->driver_priv = fpriv; pm_runtime_mark_last_busy(dev->dev); @@ -576,8 +574,6 @@ void amdgpu_driver_postclose_kms(struct drm_device *dev, if (!fpriv) return; - amdgpu_ctx_mgr_fini(&fpriv->ctx_mgr); - amdgpu_uvd_free_handles(adev, file_priv); amdgpu_vce_free_handles(adev, file_priv); -- 1.9.1 _______________________________________________ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx ^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 3/6] drm/amdgpu: allocate progressively higher ids for ctx until idr counter wraps [not found] ` <1471506618-29849-1-git-send-email-David1.Zhou-5C7GfCeVMHo@public.gmane.org> 2016-08-18 7:50 ` [PATCH 1/6] drm/amdgpu: use global ctx mgr instead of vm specified Chunming Zhou 2016-08-18 7:50 ` [PATCH 2/6] drm/amdgpu: clean up for amdgpu ctx Chunming Zhou @ 2016-08-18 7:50 ` Chunming Zhou 2016-08-18 7:50 ` [PATCH 4/6] drm/amdgpu: ctx id should be removed when ctx is freed Chunming Zhou ` (4 subsequent siblings) 7 siblings, 0 replies; 19+ messages in thread From: Chunming Zhou @ 2016-08-18 7:50 UTC (permalink / raw) To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW Cc: Chunming Zhou, David.Mao-5C7GfCeVMHo Change-Id: I0e36d8b842a29b67afcc411330700238b428e746 Signed-off-by: Chunming Zhou <David1.Zhou@amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c index 963a14e..35761bd 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c @@ -97,7 +97,8 @@ static int amdgpu_ctx_alloc(struct amdgpu_device *adev, return -ENOMEM; mutex_lock(&amdgpu_ctx_lock); - r = idr_alloc(&amdgpu_ctx_idr, ctx, 1, 0, GFP_KERNEL); + /* allocate progressively higher ids until idr counter wraps */ + r = idr_alloc_cyclic(&amdgpu_ctx_idr, ctx, 1, 0, GFP_KERNEL); if (r < 0) { mutex_unlock(&amdgpu_ctx_lock); kfree(ctx); -- 1.9.1 _______________________________________________ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx ^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 4/6] drm/amdgpu: ctx id should be removed when ctx is freed [not found] ` <1471506618-29849-1-git-send-email-David1.Zhou-5C7GfCeVMHo@public.gmane.org> ` (2 preceding siblings ...) 2016-08-18 7:50 ` [PATCH 3/6] drm/amdgpu: allocate progressively higher ids for ctx until idr counter wraps Chunming Zhou @ 2016-08-18 7:50 ` Chunming Zhou 2016-08-18 7:50 ` [PATCH 5/6] drm/amdgpu: use fence-array for ctx release Chunming Zhou ` (3 subsequent siblings) 7 siblings, 0 replies; 19+ messages in thread From: Chunming Zhou @ 2016-08-18 7:50 UTC (permalink / raw) To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW Cc: Chunming Zhou, David.Mao-5C7GfCeVMHo If ctx id is removed before ctx itself, the dependecy from umd couldnot be found although ctx is still alive. Change-Id: I129ce74f5524f74ef95a343444ba3fd9c0afdba5 Signed-off-by: Chunming Zhou <David1.Zhou@amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h index 049e1d6..6d770c2 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h @@ -1030,6 +1030,7 @@ struct amdgpu_ctx { spinlock_t ring_lock; struct fence **fences; struct amdgpu_ctx_ring rings[AMDGPU_MAX_RINGS]; + uint32_t idx; }; struct amdgpu_ctx *amdgpu_ctx_get(uint32_t id); diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c index 35761bd..01d5612 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c @@ -75,6 +75,9 @@ static void amdgpu_ctx_fini(struct amdgpu_ctx *ctx) if (!adev) return; + mutex_lock(&amdgpu_ctx_lock); + idr_remove(&amdgpu_ctx_idr, ctx->idx); + mutex_unlock(&amdgpu_ctx_lock); for (i = 0; i < AMDGPU_MAX_RINGS; ++i) for (j = 0; j < amdgpu_sched_jobs; ++j) @@ -84,6 +87,7 @@ static void amdgpu_ctx_fini(struct amdgpu_ctx *ctx) for (i = 0; i < adev->num_rings; i++) amd_sched_entity_fini(&adev->rings[i]->sched, &ctx->rings[i].entity); + kfree(ctx); } static int amdgpu_ctx_alloc(struct amdgpu_device *adev, @@ -111,6 +115,7 @@ static int amdgpu_ctx_alloc(struct amdgpu_device *adev, *id = 0; kfree(ctx); } + ctx->idx = *id; mutex_unlock(&amdgpu_ctx_lock); return r; } @@ -122,8 +127,6 @@ static void amdgpu_ctx_do_release(struct kref *ref) ctx = container_of(ref, struct amdgpu_ctx, refcount); amdgpu_ctx_fini(ctx); - - kfree(ctx); } static int amdgpu_ctx_free(uint32_t id) @@ -133,7 +136,6 @@ static int amdgpu_ctx_free(uint32_t id) mutex_lock(&amdgpu_ctx_lock); ctx = idr_find(&amdgpu_ctx_idr, id); if (ctx) { - idr_remove(&amdgpu_ctx_idr, id); kref_put(&ctx->refcount, amdgpu_ctx_do_release); mutex_unlock(&amdgpu_ctx_lock); return 0; -- 1.9.1 _______________________________________________ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx ^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 5/6] drm/amdgpu: use fence-array for ctx release [not found] ` <1471506618-29849-1-git-send-email-David1.Zhou-5C7GfCeVMHo@public.gmane.org> ` (3 preceding siblings ...) 2016-08-18 7:50 ` [PATCH 4/6] drm/amdgpu: ctx id should be removed when ctx is freed Chunming Zhou @ 2016-08-18 7:50 ` Chunming Zhou [not found] ` <1471506618-29849-6-git-send-email-David1.Zhou-5C7GfCeVMHo@public.gmane.org> 2016-08-18 7:50 ` [PATCH 6/6] drm/amdgpu: dependency is already signaled if ctx has been freed Chunming Zhou ` (2 subsequent siblings) 7 siblings, 1 reply; 19+ messages in thread From: Chunming Zhou @ 2016-08-18 7:50 UTC (permalink / raw) To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW Cc: Chunming Zhou, David.Mao-5C7GfCeVMHo benifits: 1. don't block userspace release at all. 2. make sure userspace can look up dependency if fence isn't signaled. If they cannot find ctx, that means the dependecy is signaled. Change-Id: I9184a7bb4f5bb6858c2dd49cfb113eeee159cf71 Signed-off-by: Chunming Zhou <David1.Zhou@amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 3 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 51 ++++++++++++++++++++++++++++++++- 2 files changed, 53 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h index 6d770c2..b6320e8 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h @@ -35,6 +35,7 @@ #include <linux/interval_tree.h> #include <linux/hashtable.h> #include <linux/fence.h> +#include <linux/fence-array.h> #include <ttm/ttm_bo_api.h> #include <ttm/ttm_bo_driver.h> @@ -1025,6 +1026,8 @@ struct amdgpu_ctx_ring { struct amdgpu_ctx { struct kref refcount; + struct fence_cb cb; + struct work_struct release_work; struct amdgpu_device *adev; unsigned reset_counter; spinlock_t ring_lock; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c index 01d5612..23afe92 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c @@ -27,6 +27,7 @@ static DEFINE_MUTEX(amdgpu_ctx_lock); extern struct idr amdgpu_ctx_idr; +static void amdgpu_ctx_release_work(struct work_struct *work); static int amdgpu_ctx_init(struct amdgpu_device *adev, struct amdgpu_ctx *ctx) { @@ -37,6 +38,7 @@ static int amdgpu_ctx_init(struct amdgpu_device *adev, struct amdgpu_ctx *ctx) ctx->adev = adev; kref_init(&ctx->refcount); spin_lock_init(&ctx->ring_lock); + INIT_WORK(&ctx->release_work, amdgpu_ctx_release_work); ctx->fences = kcalloc(amdgpu_sched_jobs * AMDGPU_MAX_RINGS, sizeof(struct fence*), GFP_KERNEL); if (!ctx->fences) @@ -120,13 +122,60 @@ static int amdgpu_ctx_alloc(struct amdgpu_device *adev, return r; } +static void amdgpu_ctx_release_work(struct work_struct *work) +{ + struct amdgpu_ctx *ctx = container_of(work, struct amdgpu_ctx, + release_work); + amdgpu_ctx_fini(ctx); +} + +static void amdgpu_ctx_release_cb(struct fence *f, struct fence_cb *cb) +{ + struct amdgpu_ctx *ctx = container_of(cb, struct amdgpu_ctx, + cb); + schedule_work(&ctx->release_work); + fence_put(f); +} + static void amdgpu_ctx_do_release(struct kref *ref) { struct amdgpu_ctx *ctx; + struct fence **fences; + struct fence_array *array; + int i, j, k = 0, r; ctx = container_of(ref, struct amdgpu_ctx, refcount); - amdgpu_ctx_fini(ctx); + fences = kmalloc_array(sizeof(void *), AMDGPU_MAX_RINGS * + amdgpu_sched_jobs, + GFP_KERNEL); + if (!fences) + return; + for (i = 0; i < AMDGPU_MAX_RINGS; ++i) { + for (j = 0; j < amdgpu_sched_jobs; ++j) { + if (ctx->rings[i].fences[j]) + fences[k++] = fence_get(ctx->rings[i].fences[j]); + } + } + if (k == 0) { + amdgpu_ctx_release_cb(NULL, &ctx->cb); + kfree(fences); + return; + } + + array = fence_array_create(k, fences, fence_context_alloc(1), + 1, false); + if (!array) { + for (j = 0; j < k; ++j) + fence_put(fences[j]); + kfree(fences); + return; + } + r = fence_add_callback(&array->base, &ctx->cb, amdgpu_ctx_release_cb); + if (r == -ENOENT) + amdgpu_ctx_release_cb(&array->base, &ctx->cb); + else if (r) + DRM_ERROR("fence add callback failed (%d)\n", r); } static int amdgpu_ctx_free(uint32_t id) -- 1.9.1 _______________________________________________ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx ^ permalink raw reply related [flat|nested] 19+ messages in thread
[parent not found: <1471506618-29849-6-git-send-email-David1.Zhou-5C7GfCeVMHo@public.gmane.org>]
* Re: [PATCH 5/6] drm/amdgpu: use fence-array for ctx release [not found] ` <1471506618-29849-6-git-send-email-David1.Zhou-5C7GfCeVMHo@public.gmane.org> @ 2016-08-21 6:42 ` Edward O'Callaghan [not found] ` <56580e14-9d77-f85c-20ce-a32971d9bce2-dczkZgxz+BNUPWh3PAxdjQ@public.gmane.org> 0 siblings, 1 reply; 19+ messages in thread From: Edward O'Callaghan @ 2016-08-21 6:42 UTC (permalink / raw) To: Chunming Zhou, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW Cc: David.Mao-5C7GfCeVMHo [-- Attachment #1.1.1: Type: text/plain, Size: 4050 bytes --] On 08/18/2016 05:50 PM, Chunming Zhou wrote: > benifits: > 1. don't block userspace release at all. > 2. make sure userspace can look up dependency if fence isn't signaled. > If they cannot find ctx, that means the dependecy is signaled. > > Change-Id: I9184a7bb4f5bb6858c2dd49cfb113eeee159cf71 > Signed-off-by: Chunming Zhou <David1.Zhou-5C7GfCeVMHo@public.gmane.org> > --- > drivers/gpu/drm/amd/amdgpu/amdgpu.h | 3 ++ > drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 51 ++++++++++++++++++++++++++++++++- > 2 files changed, 53 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h > index 6d770c2..b6320e8 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h > @@ -35,6 +35,7 @@ > #include <linux/interval_tree.h> > #include <linux/hashtable.h> > #include <linux/fence.h> > +#include <linux/fence-array.h> > > #include <ttm/ttm_bo_api.h> > #include <ttm/ttm_bo_driver.h> > @@ -1025,6 +1026,8 @@ struct amdgpu_ctx_ring { > > struct amdgpu_ctx { > struct kref refcount; > + struct fence_cb cb; > + struct work_struct release_work; > struct amdgpu_device *adev; > unsigned reset_counter; > spinlock_t ring_lock; > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c > index 01d5612..23afe92 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c > @@ -27,6 +27,7 @@ > > static DEFINE_MUTEX(amdgpu_ctx_lock); > extern struct idr amdgpu_ctx_idr; > +static void amdgpu_ctx_release_work(struct work_struct *work); > > static int amdgpu_ctx_init(struct amdgpu_device *adev, struct amdgpu_ctx *ctx) > { > @@ -37,6 +38,7 @@ static int amdgpu_ctx_init(struct amdgpu_device *adev, struct amdgpu_ctx *ctx) > ctx->adev = adev; > kref_init(&ctx->refcount); > spin_lock_init(&ctx->ring_lock); > + INIT_WORK(&ctx->release_work, amdgpu_ctx_release_work); > ctx->fences = kcalloc(amdgpu_sched_jobs * AMDGPU_MAX_RINGS, > sizeof(struct fence*), GFP_KERNEL); > if (!ctx->fences) > @@ -120,13 +122,60 @@ static int amdgpu_ctx_alloc(struct amdgpu_device *adev, > return r; > } > > +static void amdgpu_ctx_release_work(struct work_struct *work) > +{ > + struct amdgpu_ctx *ctx = container_of(work, struct amdgpu_ctx, > + release_work); > + amdgpu_ctx_fini(ctx); > +} > + > +static void amdgpu_ctx_release_cb(struct fence *f, struct fence_cb *cb) > +{ > + struct amdgpu_ctx *ctx = container_of(cb, struct amdgpu_ctx, > + cb); > + schedule_work(&ctx->release_work); > + fence_put(f); > +} > + > static void amdgpu_ctx_do_release(struct kref *ref) > { > struct amdgpu_ctx *ctx; > + struct fence **fences; > + struct fence_array *array; > + int i, j, k = 0, r; > > ctx = container_of(ref, struct amdgpu_ctx, refcount); > > - amdgpu_ctx_fini(ctx); > + fences = kmalloc_array(sizeof(void *), AMDGPU_MAX_RINGS * > + amdgpu_sched_jobs, > + GFP_KERNEL); > + if (!fences) > + return; > + for (i = 0; i < AMDGPU_MAX_RINGS; ++i) { > + for (j = 0; j < amdgpu_sched_jobs; ++j) { > + if (ctx->rings[i].fences[j]) > + fences[k++] = fence_get(ctx->rings[i].fences[j]); > + } > + } > + if (k == 0) { > + amdgpu_ctx_release_cb(NULL, &ctx->cb); > + kfree(fences); > + return; > + } > + > + array = fence_array_create(k, fences, fence_context_alloc(1), > + 1, false); > + if (!array) { > + for (j = 0; j < k; ++j) > + fence_put(fences[j]); > + kfree(fences); > + return; > + } > + r = fence_add_callback(&array->base, &ctx->cb, amdgpu_ctx_release_cb); > + if (r == -ENOENT) > + amdgpu_ctx_release_cb(&array->base, &ctx->cb); > + else if (r) Could be wrong but should this be (r < 0) ? Kind Regards, Edward. > + DRM_ERROR("fence add callback failed (%d)\n", r); > } > > static int amdgpu_ctx_free(uint32_t id) > [-- Attachment #1.2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 819 bytes --] [-- Attachment #2: Type: text/plain, Size: 154 bytes --] _______________________________________________ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx ^ permalink raw reply [flat|nested] 19+ messages in thread
[parent not found: <56580e14-9d77-f85c-20ce-a32971d9bce2-dczkZgxz+BNUPWh3PAxdjQ@public.gmane.org>]
* Re: [PATCH 5/6] drm/amdgpu: use fence-array for ctx release [not found] ` <56580e14-9d77-f85c-20ce-a32971d9bce2-dczkZgxz+BNUPWh3PAxdjQ@public.gmane.org> @ 2016-08-22 2:24 ` zhoucm1 0 siblings, 0 replies; 19+ messages in thread From: zhoucm1 @ 2016-08-22 2:24 UTC (permalink / raw) To: Edward O'Callaghan, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW Cc: David.Mao-5C7GfCeVMHo On 2016年08月21日 14:42, Edward O'Callaghan wrote: > > On 08/18/2016 05:50 PM, Chunming Zhou wrote: >> benifits: >> 1. don't block userspace release at all. >> 2. make sure userspace can look up dependency if fence isn't signaled. >> If they cannot find ctx, that means the dependecy is signaled. >> >> Change-Id: I9184a7bb4f5bb6858c2dd49cfb113eeee159cf71 >> Signed-off-by: Chunming Zhou <David1.Zhou@amd.com> >> --- >> drivers/gpu/drm/amd/amdgpu/amdgpu.h | 3 ++ >> drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 51 ++++++++++++++++++++++++++++++++- >> 2 files changed, 53 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h >> index 6d770c2..b6320e8 100644 >> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h >> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h >> @@ -35,6 +35,7 @@ >> #include <linux/interval_tree.h> >> #include <linux/hashtable.h> >> #include <linux/fence.h> >> +#include <linux/fence-array.h> >> >> #include <ttm/ttm_bo_api.h> >> #include <ttm/ttm_bo_driver.h> >> @@ -1025,6 +1026,8 @@ struct amdgpu_ctx_ring { >> >> struct amdgpu_ctx { >> struct kref refcount; >> + struct fence_cb cb; >> + struct work_struct release_work; >> struct amdgpu_device *adev; >> unsigned reset_counter; >> spinlock_t ring_lock; >> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c >> index 01d5612..23afe92 100644 >> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c >> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c >> @@ -27,6 +27,7 @@ >> >> static DEFINE_MUTEX(amdgpu_ctx_lock); >> extern struct idr amdgpu_ctx_idr; >> +static void amdgpu_ctx_release_work(struct work_struct *work); >> >> static int amdgpu_ctx_init(struct amdgpu_device *adev, struct amdgpu_ctx *ctx) >> { >> @@ -37,6 +38,7 @@ static int amdgpu_ctx_init(struct amdgpu_device *adev, struct amdgpu_ctx *ctx) >> ctx->adev = adev; >> kref_init(&ctx->refcount); >> spin_lock_init(&ctx->ring_lock); >> + INIT_WORK(&ctx->release_work, amdgpu_ctx_release_work); >> ctx->fences = kcalloc(amdgpu_sched_jobs * AMDGPU_MAX_RINGS, >> sizeof(struct fence*), GFP_KERNEL); >> if (!ctx->fences) >> @@ -120,13 +122,60 @@ static int amdgpu_ctx_alloc(struct amdgpu_device *adev, >> return r; >> } >> >> +static void amdgpu_ctx_release_work(struct work_struct *work) >> +{ >> + struct amdgpu_ctx *ctx = container_of(work, struct amdgpu_ctx, >> + release_work); >> + amdgpu_ctx_fini(ctx); >> +} >> + >> +static void amdgpu_ctx_release_cb(struct fence *f, struct fence_cb *cb) >> +{ >> + struct amdgpu_ctx *ctx = container_of(cb, struct amdgpu_ctx, >> + cb); >> + schedule_work(&ctx->release_work); >> + fence_put(f); >> +} >> + >> static void amdgpu_ctx_do_release(struct kref *ref) >> { >> struct amdgpu_ctx *ctx; >> + struct fence **fences; >> + struct fence_array *array; >> + int i, j, k = 0, r; >> >> ctx = container_of(ref, struct amdgpu_ctx, refcount); >> >> - amdgpu_ctx_fini(ctx); >> + fences = kmalloc_array(sizeof(void *), AMDGPU_MAX_RINGS * >> + amdgpu_sched_jobs, >> + GFP_KERNEL); >> + if (!fences) >> + return; >> + for (i = 0; i < AMDGPU_MAX_RINGS; ++i) { >> + for (j = 0; j < amdgpu_sched_jobs; ++j) { >> + if (ctx->rings[i].fences[j]) >> + fences[k++] = fence_get(ctx->rings[i].fences[j]); >> + } >> + } >> + if (k == 0) { >> + amdgpu_ctx_release_cb(NULL, &ctx->cb); >> + kfree(fences); >> + return; >> + } >> + >> + array = fence_array_create(k, fences, fence_context_alloc(1), >> + 1, false); >> + if (!array) { >> + for (j = 0; j < k; ++j) >> + fence_put(fences[j]); >> + kfree(fences); >> + return; >> + } >> + r = fence_add_callback(&array->base, &ctx->cb, amdgpu_ctx_release_cb); >> + if (r == -ENOENT) >> + amdgpu_ctx_release_cb(&array->base, &ctx->cb); >> + else if (r) > Could be wrong but should this be (r < 0) ? I don't think so, it's different with fence_wait_timeout, which returns the remaining jiffies. But this one will only return 0 or negative value. Regards, David Zhou > > Kind Regards, > Edward. > >> + DRM_ERROR("fence add callback failed (%d)\n", r); >> } >> >> static int amdgpu_ctx_free(uint32_t id) >> _______________________________________________ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx ^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 6/6] drm/amdgpu: dependency is already signaled if ctx has been freed [not found] ` <1471506618-29849-1-git-send-email-David1.Zhou-5C7GfCeVMHo@public.gmane.org> ` (4 preceding siblings ...) 2016-08-18 7:50 ` [PATCH 5/6] drm/amdgpu: use fence-array for ctx release Chunming Zhou @ 2016-08-18 7:50 ` Chunming Zhou 2016-08-18 8:15 ` [PATCH 0/6] make ctx mgr global Christian König 2016-08-24 10:45 ` Liu, Monk 7 siblings, 0 replies; 19+ messages in thread From: Chunming Zhou @ 2016-08-18 7:50 UTC (permalink / raw) To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW Cc: Chunming Zhou, David.Mao-5C7GfCeVMHo It makes sure userspace can look up dependency. Change-Id: Ie26086776de7df276fa041d977f0ea8264b32387 Signed-off-by: Chunming Zhou <David1.Zhou@amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c index cfae65d..f6dd530 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c @@ -833,7 +833,7 @@ static int amdgpu_cs_dependencies(struct amdgpu_device *adev, ctx = amdgpu_ctx_get(deps[j].ctx_id); if (ctx == NULL) - return -EINVAL; + continue;; fence = amdgpu_ctx_get_fence(ctx, ring, deps[j].handle); -- 1.9.1 _______________________________________________ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx ^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH 0/6] make ctx mgr global [not found] ` <1471506618-29849-1-git-send-email-David1.Zhou-5C7GfCeVMHo@public.gmane.org> ` (5 preceding siblings ...) 2016-08-18 7:50 ` [PATCH 6/6] drm/amdgpu: dependency is already signaled if ctx has been freed Chunming Zhou @ 2016-08-18 8:15 ` Christian König [not found] ` <3e0bb599-e8e3-2e66-909f-ed75ac87ab56-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org> 2016-08-24 10:45 ` Liu, Monk 7 siblings, 1 reply; 19+ messages in thread From: Christian König @ 2016-08-18 8:15 UTC (permalink / raw) To: Chunming Zhou, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW Cc: David.Mao-5C7GfCeVMHo NAK to the whole approach. If we want to share dependencies in the form of fences between devices and especially processes we must use android fences and the sync file framework. Sharing numbers in the form of the IDR is a security nightmare we already ran into with the GEM flink design. Regards, Christian. Am 18.08.2016 um 09:50 schrieb Chunming Zhou: > If we want to share semaphore/dependency across process across device, we > must make ctx id be global, so that we can index it everywhere. > > Chunming Zhou (6): > drm/amdgpu: use global ctx mgr instead of vm specified > drm/amdgpu: clean up for amdgpu ctx > drm/amdgpu: allocate progressively higher ids for ctx until idr > counter wraps > drm/amdgpu: ctx id should be removed when ctx is freed > drm/amdgpu: use fence-array for ctx release > drm/amdgpu: dependency is already signaled if ctx has been freed > > drivers/gpu/drm/amd/amdgpu/amdgpu.h | 17 ++-- > drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 9 +- > drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 142 ++++++++++++++++++-------------- > drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 3 + > drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 4 - > 5 files changed, 92 insertions(+), 83 deletions(-) > _______________________________________________ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx ^ permalink raw reply [flat|nested] 19+ messages in thread
[parent not found: <3e0bb599-e8e3-2e66-909f-ed75ac87ab56-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>]
* Re: [PATCH 0/6] make ctx mgr global [not found] ` <3e0bb599-e8e3-2e66-909f-ed75ac87ab56-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org> @ 2016-08-24 9:33 ` zhoucm1 [not found] ` <57BD69E4.9000609-5C7GfCeVMHo@public.gmane.org> 0 siblings, 1 reply; 19+ messages in thread From: zhoucm1 @ 2016-08-24 9:33 UTC (permalink / raw) To: Christian König, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW Cc: David.Mao-5C7GfCeVMHo On 2016年08月18日 16:15, Christian König wrote: > NAK to the whole approach. > > If we want to share dependencies in the form of fences between devices > and especially processes we must use android fences and the sync file > framework. Then if we want to share semaphore between devices and processes, we must re-implement semaphore and move it to kernel side from libdrm, right? then bind unused fd to semaphore object, and then export/import fd. What do you think of it? Regards, David Zhou > > Sharing numbers in the form of the IDR is a security nightmare we > already ran into with the GEM flink design. > > Regards, > Christian. > > Am 18.08.2016 um 09:50 schrieb Chunming Zhou: >> If we want to share semaphore/dependency across process across >> device, we >> must make ctx id be global, so that we can index it everywhere. >> >> Chunming Zhou (6): >> drm/amdgpu: use global ctx mgr instead of vm specified >> drm/amdgpu: clean up for amdgpu ctx >> drm/amdgpu: allocate progressively higher ids for ctx until idr >> counter wraps >> drm/amdgpu: ctx id should be removed when ctx is freed >> drm/amdgpu: use fence-array for ctx release >> drm/amdgpu: dependency is already signaled if ctx has been freed >> >> drivers/gpu/drm/amd/amdgpu/amdgpu.h | 17 ++-- >> drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 9 +- >> drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 142 >> ++++++++++++++++++-------------- >> drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 3 + >> drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 4 - >> 5 files changed, 92 insertions(+), 83 deletions(-) >> > _______________________________________________ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx ^ permalink raw reply [flat|nested] 19+ messages in thread
[parent not found: <57BD69E4.9000609-5C7GfCeVMHo@public.gmane.org>]
* Re: [PATCH 0/6] make ctx mgr global [not found] ` <57BD69E4.9000609-5C7GfCeVMHo@public.gmane.org> @ 2016-08-24 9:39 ` Christian König [not found] ` <ca1f322f-4c1e-c3cc-3a6d-7bab42d1fe41-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org> 0 siblings, 1 reply; 19+ messages in thread From: Christian König @ 2016-08-24 9:39 UTC (permalink / raw) To: zhoucm1, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: David.Mao-5C7GfCeVMHo Am 24.08.2016 um 11:33 schrieb zhoucm1: > > > On 2016年08月18日 16:15, Christian König wrote: >> NAK to the whole approach. >> >> If we want to share dependencies in the form of fences between >> devices and especially processes we must use android fences and the >> sync file framework. > Then if we want to share semaphore between devices and processes, we > must re-implement semaphore and move it to kernel side from libdrm, > right? > then bind unused fd to semaphore object, and then export/import fd. > What do you think of it? That is basically what sync_file does. It just doesn't call it semaphore and doesn't use the signal/wait semantic. Instead fences can be added to a sync_file and waited for completion before a command submission is made. Regards, Christian. > > Regards, > David Zhou >> >> Sharing numbers in the form of the IDR is a security nightmare we >> already ran into with the GEM flink design. >> >> Regards, >> Christian. >> >> Am 18.08.2016 um 09:50 schrieb Chunming Zhou: >>> If we want to share semaphore/dependency across process across >>> device, we >>> must make ctx id be global, so that we can index it everywhere. >>> >>> Chunming Zhou (6): >>> drm/amdgpu: use global ctx mgr instead of vm specified >>> drm/amdgpu: clean up for amdgpu ctx >>> drm/amdgpu: allocate progressively higher ids for ctx until idr >>> counter wraps >>> drm/amdgpu: ctx id should be removed when ctx is freed >>> drm/amdgpu: use fence-array for ctx release >>> drm/amdgpu: dependency is already signaled if ctx has been freed >>> >>> drivers/gpu/drm/amd/amdgpu/amdgpu.h | 17 ++-- >>> drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 9 +- >>> drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 142 >>> ++++++++++++++++++-------------- >>> drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 3 + >>> drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 4 - >>> 5 files changed, 92 insertions(+), 83 deletions(-) >>> >> > _______________________________________________ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx ^ permalink raw reply [flat|nested] 19+ messages in thread
[parent not found: <ca1f322f-4c1e-c3cc-3a6d-7bab42d1fe41-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>]
* Re: [PATCH 0/6] make ctx mgr global [not found] ` <ca1f322f-4c1e-c3cc-3a6d-7bab42d1fe41-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org> @ 2016-08-24 10:01 ` zhoucm1 [not found] ` <57BD7062.60408-5C7GfCeVMHo@public.gmane.org> 0 siblings, 1 reply; 19+ messages in thread From: zhoucm1 @ 2016-08-24 10:01 UTC (permalink / raw) To: Christian König, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW Cc: David.Mao-5C7GfCeVMHo On 2016年08月24日 17:39, Christian König wrote: > Am 24.08.2016 um 11:33 schrieb zhoucm1: >> >> >> On 2016年08月18日 16:15, Christian König wrote: >>> NAK to the whole approach. >>> >>> If we want to share dependencies in the form of fences between >>> devices and especially processes we must use android fences and the >>> sync file framework. >> Then if we want to share semaphore between devices and processes, we >> must re-implement semaphore and move it to kernel side from libdrm, >> right? >> then bind unused fd to semaphore object, and then export/import fd. >> What do you think of it? > > That is basically what sync_file does. It just doesn't call it > semaphore and doesn't use the signal/wait semantic. > > Instead fences can be added to a sync_file and waited for completion > before a command submission is made. I understand your mean, UMD don't want to touch command submission to semaphore, which isn't what semaphore want to do. semaphore does: 1. create a semaphore 2. signal semahore----append the last fence of that ctx to semaphore in lidrm 3. wait semaphore----add semaphore to ctx->semaphore_list in libdrm, when next submission is comming, then semaphore will be dependency of it. 4. destroy semaphore. the umd totally doesn't know what semaphore does, they just know the synchronization is completed after semaphore, then they can continue to do cs. sync_file seems cannot provide what semaphore does. So with thinking more, we seems have to move semaphore implementation to kernel, use unused fd and install it to fd like sync file mechanism to share semaphore between devices and processes, right? Regards, David Zhou > > Regards, > Christian. > >> >> Regards, >> David Zhou >>> >>> Sharing numbers in the form of the IDR is a security nightmare we >>> already ran into with the GEM flink design. >>> >>> Regards, >>> Christian. >>> >>> Am 18.08.2016 um 09:50 schrieb Chunming Zhou: >>>> If we want to share semaphore/dependency across process across >>>> device, we >>>> must make ctx id be global, so that we can index it everywhere. >>>> >>>> Chunming Zhou (6): >>>> drm/amdgpu: use global ctx mgr instead of vm specified >>>> drm/amdgpu: clean up for amdgpu ctx >>>> drm/amdgpu: allocate progressively higher ids for ctx until idr >>>> counter wraps >>>> drm/amdgpu: ctx id should be removed when ctx is freed >>>> drm/amdgpu: use fence-array for ctx release >>>> drm/amdgpu: dependency is already signaled if ctx has been freed >>>> >>>> drivers/gpu/drm/amd/amdgpu/amdgpu.h | 17 ++-- >>>> drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 9 +- >>>> drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 142 >>>> ++++++++++++++++++-------------- >>>> drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 3 + >>>> drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 4 - >>>> 5 files changed, 92 insertions(+), 83 deletions(-) >>>> >>> >> > _______________________________________________ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx ^ permalink raw reply [flat|nested] 19+ messages in thread
[parent not found: <57BD7062.60408-5C7GfCeVMHo@public.gmane.org>]
* Re: [PATCH 0/6] make ctx mgr global [not found] ` <57BD7062.60408-5C7GfCeVMHo@public.gmane.org> @ 2016-08-24 10:06 ` Christian König 0 siblings, 0 replies; 19+ messages in thread From: Christian König @ 2016-08-24 10:06 UTC (permalink / raw) To: zhoucm1, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: David.Mao-5C7GfCeVMHo Am 24.08.2016 um 12:01 schrieb zhoucm1: > > > On 2016年08月24日 17:39, Christian König wrote: >> Am 24.08.2016 um 11:33 schrieb zhoucm1: >>> >>> >>> On 2016年08月18日 16:15, Christian König wrote: >>>> NAK to the whole approach. >>>> >>>> If we want to share dependencies in the form of fences between >>>> devices and especially processes we must use android fences and the >>>> sync file framework. >>> Then if we want to share semaphore between devices and processes, we >>> must re-implement semaphore and move it to kernel side from libdrm, >>> right? >>> then bind unused fd to semaphore object, and then export/import fd. >>> What do you think of it? >> >> That is basically what sync_file does. It just doesn't call it >> semaphore and doesn't use the signal/wait semantic. >> >> Instead fences can be added to a sync_file and waited for completion >> before a command submission is made. > I understand your mean, UMD don't want to touch command submission to > semaphore, which isn't what semaphore want to do. > semaphore does: > 1. create a semaphore > 2. signal semahore----append the last fence of that ctx to semaphore > in lidrm > 3. wait semaphore----add semaphore to ctx->semaphore_list in libdrm, > when next submission is comming, then semaphore will be dependency of it. > 4. destroy semaphore. > the umd totally doesn't know what semaphore does, they just know the > synchronization is completed after semaphore, then they can continue > to do cs. > > sync_file seems cannot provide what semaphore does. So with thinking > more, we seems have to move semaphore implementation to kernel, use > unused fd and install it to fd like sync file mechanism to share > semaphore between devices and processes, right? No, as far as I can see sync_file does exactly the same thing as semaphores in libdrm, they just use a fd as handle. E.g. same concept, but different name and slightly different approaches of handling things (actually much saner ones, cause sync_file can't deadlock). Regards, Christian. > > > Regards, > David Zhou >> >> Regards, >> Christian. >> >>> >>> Regards, >>> David Zhou >>>> >>>> Sharing numbers in the form of the IDR is a security nightmare we >>>> already ran into with the GEM flink design. >>>> >>>> Regards, >>>> Christian. >>>> >>>> Am 18.08.2016 um 09:50 schrieb Chunming Zhou: >>>>> If we want to share semaphore/dependency across process across >>>>> device, we >>>>> must make ctx id be global, so that we can index it everywhere. >>>>> >>>>> Chunming Zhou (6): >>>>> drm/amdgpu: use global ctx mgr instead of vm specified >>>>> drm/amdgpu: clean up for amdgpu ctx >>>>> drm/amdgpu: allocate progressively higher ids for ctx until idr >>>>> counter wraps >>>>> drm/amdgpu: ctx id should be removed when ctx is freed >>>>> drm/amdgpu: use fence-array for ctx release >>>>> drm/amdgpu: dependency is already signaled if ctx has been freed >>>>> >>>>> drivers/gpu/drm/amd/amdgpu/amdgpu.h | 17 ++-- >>>>> drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 9 +- >>>>> drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 142 >>>>> ++++++++++++++++++-------------- >>>>> drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 3 + >>>>> drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 4 - >>>>> 5 files changed, 92 insertions(+), 83 deletions(-) >>>>> >>>> >>> >> > _______________________________________________ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx ^ permalink raw reply [flat|nested] 19+ messages in thread
* RE: [PATCH 0/6] make ctx mgr global [not found] ` <1471506618-29849-1-git-send-email-David1.Zhou-5C7GfCeVMHo@public.gmane.org> ` (6 preceding siblings ...) 2016-08-18 8:15 ` [PATCH 0/6] make ctx mgr global Christian König @ 2016-08-24 10:45 ` Liu, Monk [not found] ` <MWHPR12MB11825F3995323EB96C7E867984EA0-Gy0DoCVfaSVhjnLHdLm0OQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org> 7 siblings, 1 reply; 19+ messages in thread From: Liu, Monk @ 2016-08-24 10:45 UTC (permalink / raw) To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW Cc: Zhou, David(ChunMing), Mao, David David, No matter what's the initial purpose of this patch is, I think this patch is needed, otherwise context switch judgment will be incorrect , e.g. process1 and process2 can both have a context id 99, and that will Lead to incorrect skipping of PREAMBLE CE IB BR monk -----Original Message----- From: amd-gfx [mailto:amd-gfx-bounces@lists.freedesktop.org] On Behalf Of Chunming Zhou Sent: Thursday, August 18, 2016 3:50 PM To: amd-gfx@lists.freedesktop.org Cc: Zhou, David(ChunMing) <David1.Zhou@amd.com>; Mao, David <David.Mao@amd.com> Subject: [PATCH 0/6] make ctx mgr global If we want to share semaphore/dependency across process across device, we must make ctx id be global, so that we can index it everywhere. Chunming Zhou (6): drm/amdgpu: use global ctx mgr instead of vm specified drm/amdgpu: clean up for amdgpu ctx drm/amdgpu: allocate progressively higher ids for ctx until idr counter wraps drm/amdgpu: ctx id should be removed when ctx is freed drm/amdgpu: use fence-array for ctx release drm/amdgpu: dependency is already signaled if ctx has been freed drivers/gpu/drm/amd/amdgpu/amdgpu.h | 17 ++-- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 9 +- drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 142 ++++++++++++++++++-------------- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 3 + drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 4 - 5 files changed, 92 insertions(+), 83 deletions(-) -- 1.9.1 _______________________________________________ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx _______________________________________________ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx ^ permalink raw reply [flat|nested] 19+ messages in thread
[parent not found: <MWHPR12MB11825F3995323EB96C7E867984EA0-Gy0DoCVfaSVhjnLHdLm0OQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>]
* Re: [PATCH 0/6] make ctx mgr global [not found] ` <MWHPR12MB11825F3995323EB96C7E867984EA0-Gy0DoCVfaSVhjnLHdLm0OQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org> @ 2016-08-24 12:20 ` Christian König [not found] ` <df5ad8b0-a4b7-002d-732b-4cda97698199-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org> 0 siblings, 1 reply; 19+ messages in thread From: Christian König @ 2016-08-24 12:20 UTC (permalink / raw) To: Liu, Monk, Zhou, David(ChunMing), amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW Cc: Mao, David The context number isn't used for judgment if a switch is needed or not (or at least it shouldn't be). The numbers are just and IDR, e.g. they are just used to identify a kernel object from userspace. Regards, Christian. Am 24.08.2016 um 12:45 schrieb Liu, Monk: > David, > > No matter what's the initial purpose of this patch is, I think this patch is needed, otherwise context switch judgment will be incorrect , e.g. process1 and process2 can both have a context id 99, and that will > Lead to incorrect skipping of PREAMBLE CE IB > > BR monk > > -----Original Message----- > From: amd-gfx [mailto:amd-gfx-bounces@lists.freedesktop.org] On Behalf Of Chunming Zhou > Sent: Thursday, August 18, 2016 3:50 PM > To: amd-gfx@lists.freedesktop.org > Cc: Zhou, David(ChunMing) <David1.Zhou@amd.com>; Mao, David <David.Mao@amd.com> > Subject: [PATCH 0/6] make ctx mgr global > > If we want to share semaphore/dependency across process across device, we must make ctx id be global, so that we can index it everywhere. > > Chunming Zhou (6): > drm/amdgpu: use global ctx mgr instead of vm specified > drm/amdgpu: clean up for amdgpu ctx > drm/amdgpu: allocate progressively higher ids for ctx until idr > counter wraps > drm/amdgpu: ctx id should be removed when ctx is freed > drm/amdgpu: use fence-array for ctx release > drm/amdgpu: dependency is already signaled if ctx has been freed > > drivers/gpu/drm/amd/amdgpu/amdgpu.h | 17 ++-- > drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 9 +- > drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 142 ++++++++++++++++++-------------- > drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 3 + > drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 4 - > 5 files changed, 92 insertions(+), 83 deletions(-) > > -- > 1.9.1 > > _______________________________________________ > amd-gfx mailing list > amd-gfx@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/amd-gfx > _______________________________________________ > amd-gfx mailing list > amd-gfx@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/amd-gfx _______________________________________________ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx ^ permalink raw reply [flat|nested] 19+ messages in thread
[parent not found: <df5ad8b0-a4b7-002d-732b-4cda97698199-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>]
* RE: [PATCH 0/6] make ctx mgr global [not found] ` <df5ad8b0-a4b7-002d-732b-4cda97698199-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org> @ 2016-08-25 3:38 ` Liu, Monk [not found] ` <DM5PR12MB1178059E79C688636B77BD5584ED0-2J9CzHegvk8I8PWcjD5QtQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org> 0 siblings, 1 reply; 19+ messages in thread From: Liu, Monk @ 2016-08-25 3:38 UTC (permalink / raw) To: Christian König, Zhou, David(ChunMing), amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW Cc: Mao, David Sorry, I don't mean ctx-id, I'm talking about "job->ctx", which is a atomic_64t value, and it is initiated from entity->fence_context, As long as fence_context is unique cross whole system, we are safe to use it to judge context switch, I checked again the code, this fence_context is already globally unique, so never mind, our current code is okay! Thanks BR Monk -----Original Message----- From: amd-gfx [mailto:amd-gfx-bounces@lists.freedesktop.org] On Behalf Of Christian K?nig Sent: Wednesday, August 24, 2016 8:21 PM To: Liu, Monk <Monk.Liu@amd.com>; Zhou, David(ChunMing) <David1.Zhou@amd.com>; amd-gfx@lists.freedesktop.org Cc: Mao, David <David.Mao@amd.com> Subject: Re: [PATCH 0/6] make ctx mgr global The context number isn't used for judgment if a switch is needed or not (or at least it shouldn't be). The numbers are just and IDR, e.g. they are just used to identify a kernel object from userspace. Regards, Christian. Am 24.08.2016 um 12:45 schrieb Liu, Monk: > David, > > No matter what's the initial purpose of this patch is, I think this > patch is needed, otherwise context switch judgment will be incorrect , > e.g. process1 and process2 can both have a context id 99, and that > will Lead to incorrect skipping of PREAMBLE CE IB > > BR monk > > -----Original Message----- > From: amd-gfx [mailto:amd-gfx-bounces@lists.freedesktop.org] On Behalf > Of Chunming Zhou > Sent: Thursday, August 18, 2016 3:50 PM > To: amd-gfx@lists.freedesktop.org > Cc: Zhou, David(ChunMing) <David1.Zhou@amd.com>; Mao, David > <David.Mao@amd.com> > Subject: [PATCH 0/6] make ctx mgr global > > If we want to share semaphore/dependency across process across device, we must make ctx id be global, so that we can index it everywhere. > > Chunming Zhou (6): > drm/amdgpu: use global ctx mgr instead of vm specified > drm/amdgpu: clean up for amdgpu ctx > drm/amdgpu: allocate progressively higher ids for ctx until idr > counter wraps > drm/amdgpu: ctx id should be removed when ctx is freed > drm/amdgpu: use fence-array for ctx release > drm/amdgpu: dependency is already signaled if ctx has been freed > > drivers/gpu/drm/amd/amdgpu/amdgpu.h | 17 ++-- > drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 9 +- > drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 142 ++++++++++++++++++-------------- > drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 3 + > drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 4 - > 5 files changed, 92 insertions(+), 83 deletions(-) > > -- > 1.9.1 > > _______________________________________________ > amd-gfx mailing list > amd-gfx@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/amd-gfx > _______________________________________________ > amd-gfx mailing list > amd-gfx@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/amd-gfx _______________________________________________ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx _______________________________________________ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx ^ permalink raw reply [flat|nested] 19+ messages in thread
[parent not found: <DM5PR12MB1178059E79C688636B77BD5584ED0-2J9CzHegvk8I8PWcjD5QtQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>]
* Re: [PATCH 0/6] make ctx mgr global [not found] ` <DM5PR12MB1178059E79C688636B77BD5584ED0-2J9CzHegvk8I8PWcjD5QtQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org> @ 2016-08-25 8:08 ` Christian König [not found] ` <41c5e1d7-3903-0184-155b-2b3953f5cfa6-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org> 0 siblings, 1 reply; 19+ messages in thread From: Christian König @ 2016-08-25 8:08 UTC (permalink / raw) To: Liu, Monk, Zhou, David(ChunMing), amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW Cc: Mao, David Yeah, I wouldn't mind a patch renaming ctx to fence_context in the job and rign structure. This way we make it clear what is used here. Christian. Am 25.08.2016 um 05:38 schrieb Liu, Monk: > Sorry, > > I don't mean ctx-id, I'm talking about "job->ctx", which is a atomic_64t value, and it is initiated from entity->fence_context, > As long as fence_context is unique cross whole system, we are safe to use it to judge context switch, > I checked again the code, this fence_context is already globally unique, so never mind, our current code is okay! > > Thanks > BR Monk > > -----Original Message----- > From: amd-gfx [mailto:amd-gfx-bounces@lists.freedesktop.org] On Behalf Of Christian K?nig > Sent: Wednesday, August 24, 2016 8:21 PM > To: Liu, Monk <Monk.Liu@amd.com>; Zhou, David(ChunMing) <David1.Zhou@amd.com>; amd-gfx@lists.freedesktop.org > Cc: Mao, David <David.Mao@amd.com> > Subject: Re: [PATCH 0/6] make ctx mgr global > > The context number isn't used for judgment if a switch is needed or not (or at least it shouldn't be). > > The numbers are just and IDR, e.g. they are just used to identify a kernel object from userspace. > > Regards, > Christian. > > Am 24.08.2016 um 12:45 schrieb Liu, Monk: >> David, >> >> No matter what's the initial purpose of this patch is, I think this >> patch is needed, otherwise context switch judgment will be incorrect , >> e.g. process1 and process2 can both have a context id 99, and that >> will Lead to incorrect skipping of PREAMBLE CE IB >> >> BR monk >> >> -----Original Message----- >> From: amd-gfx [mailto:amd-gfx-bounces@lists.freedesktop.org] On Behalf >> Of Chunming Zhou >> Sent: Thursday, August 18, 2016 3:50 PM >> To: amd-gfx@lists.freedesktop.org >> Cc: Zhou, David(ChunMing) <David1.Zhou@amd.com>; Mao, David >> <David.Mao@amd.com> >> Subject: [PATCH 0/6] make ctx mgr global >> >> If we want to share semaphore/dependency across process across device, we must make ctx id be global, so that we can index it everywhere. >> >> Chunming Zhou (6): >> drm/amdgpu: use global ctx mgr instead of vm specified >> drm/amdgpu: clean up for amdgpu ctx >> drm/amdgpu: allocate progressively higher ids for ctx until idr >> counter wraps >> drm/amdgpu: ctx id should be removed when ctx is freed >> drm/amdgpu: use fence-array for ctx release >> drm/amdgpu: dependency is already signaled if ctx has been freed >> >> drivers/gpu/drm/amd/amdgpu/amdgpu.h | 17 ++-- >> drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 9 +- >> drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 142 ++++++++++++++++++-------------- >> drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 3 + >> drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 4 - >> 5 files changed, 92 insertions(+), 83 deletions(-) >> >> -- >> 1.9.1 >> >> _______________________________________________ >> amd-gfx mailing list >> amd-gfx@lists.freedesktop.org >> https://lists.freedesktop.org/mailman/listinfo/amd-gfx >> _______________________________________________ >> amd-gfx mailing list >> amd-gfx@lists.freedesktop.org >> https://lists.freedesktop.org/mailman/listinfo/amd-gfx > > _______________________________________________ > amd-gfx mailing list > amd-gfx@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/amd-gfx > _______________________________________________ > amd-gfx mailing list > amd-gfx@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/amd-gfx _______________________________________________ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx ^ permalink raw reply [flat|nested] 19+ messages in thread
[parent not found: <41c5e1d7-3903-0184-155b-2b3953f5cfa6-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>]
* RE: [PATCH 0/6] make ctx mgr global [not found] ` <41c5e1d7-3903-0184-155b-2b3953f5cfa6-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org> @ 2016-08-25 8:21 ` Liu, Monk 0 siblings, 0 replies; 19+ messages in thread From: Liu, Monk @ 2016-08-25 8:21 UTC (permalink / raw) To: Christian König, Zhou, David(ChunMing), amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW Cc: Mao, David Yeah, I was already doing that -----Original Message----- From: Christian König [mailto:deathsimple@vodafone.de] Sent: Thursday, August 25, 2016 4:08 PM To: Liu, Monk <Monk.Liu@amd.com>; Zhou, David(ChunMing) <David1.Zhou@amd.com>; amd-gfx@lists.freedesktop.org Cc: Mao, David <David.Mao@amd.com> Subject: Re: [PATCH 0/6] make ctx mgr global Yeah, I wouldn't mind a patch renaming ctx to fence_context in the job and rign structure. This way we make it clear what is used here. Christian. Am 25.08.2016 um 05:38 schrieb Liu, Monk: > Sorry, > > I don't mean ctx-id, I'm talking about "job->ctx", which is a > atomic_64t value, and it is initiated from entity->fence_context, As > long as fence_context is unique cross whole system, we are safe to use it to judge context switch, I checked again the code, this fence_context is already globally unique, so never mind, our current code is okay! > > Thanks > BR Monk > > -----Original Message----- > From: amd-gfx [mailto:amd-gfx-bounces@lists.freedesktop.org] On Behalf > Of Christian K?nig > Sent: Wednesday, August 24, 2016 8:21 PM > To: Liu, Monk <Monk.Liu@amd.com>; Zhou, David(ChunMing) > <David1.Zhou@amd.com>; amd-gfx@lists.freedesktop.org > Cc: Mao, David <David.Mao@amd.com> > Subject: Re: [PATCH 0/6] make ctx mgr global > > The context number isn't used for judgment if a switch is needed or not (or at least it shouldn't be). > > The numbers are just and IDR, e.g. they are just used to identify a kernel object from userspace. > > Regards, > Christian. > > Am 24.08.2016 um 12:45 schrieb Liu, Monk: >> David, >> >> No matter what's the initial purpose of this patch is, I think this >> patch is needed, otherwise context switch judgment will be incorrect >> , e.g. process1 and process2 can both have a context id 99, and that >> will Lead to incorrect skipping of PREAMBLE CE IB >> >> BR monk >> >> -----Original Message----- >> From: amd-gfx [mailto:amd-gfx-bounces@lists.freedesktop.org] On >> Behalf Of Chunming Zhou >> Sent: Thursday, August 18, 2016 3:50 PM >> To: amd-gfx@lists.freedesktop.org >> Cc: Zhou, David(ChunMing) <David1.Zhou@amd.com>; Mao, David >> <David.Mao@amd.com> >> Subject: [PATCH 0/6] make ctx mgr global >> >> If we want to share semaphore/dependency across process across device, we must make ctx id be global, so that we can index it everywhere. >> >> Chunming Zhou (6): >> drm/amdgpu: use global ctx mgr instead of vm specified >> drm/amdgpu: clean up for amdgpu ctx >> drm/amdgpu: allocate progressively higher ids for ctx until idr >> counter wraps >> drm/amdgpu: ctx id should be removed when ctx is freed >> drm/amdgpu: use fence-array for ctx release >> drm/amdgpu: dependency is already signaled if ctx has been freed >> >> drivers/gpu/drm/amd/amdgpu/amdgpu.h | 17 ++-- >> drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 9 +- >> drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 142 ++++++++++++++++++-------------- >> drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 3 + >> drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 4 - >> 5 files changed, 92 insertions(+), 83 deletions(-) >> >> -- >> 1.9.1 >> >> _______________________________________________ >> amd-gfx mailing list >> amd-gfx@lists.freedesktop.org >> https://lists.freedesktop.org/mailman/listinfo/amd-gfx >> _______________________________________________ >> amd-gfx mailing list >> amd-gfx@lists.freedesktop.org >> https://lists.freedesktop.org/mailman/listinfo/amd-gfx > > _______________________________________________ > amd-gfx mailing list > amd-gfx@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/amd-gfx > _______________________________________________ > amd-gfx mailing list > amd-gfx@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/amd-gfx _______________________________________________ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx ^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2016-08-25 8:21 UTC | newest] Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2016-08-18 7:50 [PATCH 0/6] make ctx mgr global Chunming Zhou [not found] ` <1471506618-29849-1-git-send-email-David1.Zhou-5C7GfCeVMHo@public.gmane.org> 2016-08-18 7:50 ` [PATCH 1/6] drm/amdgpu: use global ctx mgr instead of vm specified Chunming Zhou 2016-08-18 7:50 ` [PATCH 2/6] drm/amdgpu: clean up for amdgpu ctx Chunming Zhou 2016-08-18 7:50 ` [PATCH 3/6] drm/amdgpu: allocate progressively higher ids for ctx until idr counter wraps Chunming Zhou 2016-08-18 7:50 ` [PATCH 4/6] drm/amdgpu: ctx id should be removed when ctx is freed Chunming Zhou 2016-08-18 7:50 ` [PATCH 5/6] drm/amdgpu: use fence-array for ctx release Chunming Zhou [not found] ` <1471506618-29849-6-git-send-email-David1.Zhou-5C7GfCeVMHo@public.gmane.org> 2016-08-21 6:42 ` Edward O'Callaghan [not found] ` <56580e14-9d77-f85c-20ce-a32971d9bce2-dczkZgxz+BNUPWh3PAxdjQ@public.gmane.org> 2016-08-22 2:24 ` zhoucm1 2016-08-18 7:50 ` [PATCH 6/6] drm/amdgpu: dependency is already signaled if ctx has been freed Chunming Zhou 2016-08-18 8:15 ` [PATCH 0/6] make ctx mgr global Christian König [not found] ` <3e0bb599-e8e3-2e66-909f-ed75ac87ab56-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org> 2016-08-24 9:33 ` zhoucm1 [not found] ` <57BD69E4.9000609-5C7GfCeVMHo@public.gmane.org> 2016-08-24 9:39 ` Christian König [not found] ` <ca1f322f-4c1e-c3cc-3a6d-7bab42d1fe41-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org> 2016-08-24 10:01 ` zhoucm1 [not found] ` <57BD7062.60408-5C7GfCeVMHo@public.gmane.org> 2016-08-24 10:06 ` Christian König 2016-08-24 10:45 ` Liu, Monk [not found] ` <MWHPR12MB11825F3995323EB96C7E867984EA0-Gy0DoCVfaSVhjnLHdLm0OQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org> 2016-08-24 12:20 ` Christian König [not found] ` <df5ad8b0-a4b7-002d-732b-4cda97698199-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org> 2016-08-25 3:38 ` Liu, Monk [not found] ` <DM5PR12MB1178059E79C688636B77BD5584ED0-2J9CzHegvk8I8PWcjD5QtQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org> 2016-08-25 8:08 ` Christian König [not found] ` <41c5e1d7-3903-0184-155b-2b3953f5cfa6-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org> 2016-08-25 8:21 ` Liu, Monk
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.