Skip to contentSkip to conversation

Revert lima fdinfo patchset

PATCH Applied [email protected] 4 participants 9 messages Apr 4, 2023 – Apr 5, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover Revert lima fdinfo patchset

From: Qiang Yu <[email protected]>

Upstream has reverted the dependant commit
df622729ddbf ("drm/scheduler: track GPU active time per entity""), but this patchset has been pushed to drm-misc-next which still has that commit. To avoid other branch build fail after merge drm-misc-next, just revert the lima patchset on drm-misc-next too.

Qiang Yu (3):
Revert "drm/lima: add show_fdinfo for drm usage stats" Revert "drm/lima: allocate unique id per drm_file" Revert "drm/lima: add usage counting method to ctx_mgr"

 drivers/gpu/drm/lima/lima_ctx.c    | 30 +--------------------
 drivers/gpu/drm/lima/lima_ctx.h    |  3 ---
 drivers/gpu/drm/lima/lima_device.h |  3 ---
 drivers/gpu/drm/lima/lima_drv.c    | 43 +-----------------------------
 drivers/gpu/drm/lima/lima_drv.h    |  1 -
 5 files changed, 2 insertions(+), 78 deletions(-)
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/3 Revert "drm/lima: add show_fdinfo for drm usage stats"

From: Qiang Yu <[email protected]>

This reverts commit 4a66f3da99dcb4dcbd28544110636b50adfb0f0d.

This is due to the depend commit has been reverted on upstream:
baad10973fdb ("Revert "drm/scheduler: track GPU active time per entity"")

---
 drivers/gpu/drm/lima/lima_drv.c | 31 +------------------------------
 1 file changed, 1 insertion(+), 30 deletions(-)
drivers/gpu/drm/lima/lima_drv.c +1 -30
index 3420875d6fc6..f456a471216b 100644
@@ -261,36 +261,7 @@ static const struct drm_ioctl_desc lima_drm_driver_ioctls[] = {
 	DRM_IOCTL_DEF_DRV(LIMA_CTX_FREE, lima_ioctl_ctx_free, DRM_RENDER_ALLOW),
 };
 
-static void lima_drm_driver_show_fdinfo(struct seq_file *m, struct file *filp)
-{
-	struct drm_file *file = filp->private_data;
-	struct drm_device *dev = file->minor->dev;
-	struct lima_device *ldev = to_lima_dev(dev);
-	struct lima_drm_priv *priv = file->driver_priv;
-	struct lima_ctx_mgr *ctx_mgr = &priv->ctx_mgr;
-	u64 usage[lima_pipe_num];
-
-	lima_ctx_mgr_usage(ctx_mgr, usage);
-
-	/*
-	 * For a description of the text output format used here, see
-	 * Documentation/gpu/drm-usage-stats.rst.
-	 */
-	seq_printf(m, "drm-driver:\t%s\n", dev->driver->name);
-	seq_printf(m, "drm-client-id:\t%u\n", priv->id);
-	for (int i = 0; i < lima_pipe_num; i++) {
-		struct lima_sched_pipe *pipe = &ldev->pipe[i];
-		struct drm_gpu_scheduler *sched = &pipe->base;
-
-		seq_printf(m, "drm-engine-%s:\t%llu ns\n", sched->name, usage[i]);
-	}
-}
-
-static const struct file_operations lima_drm_driver_fops = {
-	.owner = THIS_MODULE,
-	DRM_GEM_FOPS,
-	.show_fdinfo = lima_drm_driver_show_fdinfo,
-};
+DEFINE_DRM_GEM_FOPS(lima_drm_driver_fops);
 
 /*
  * Changelog:
Signature · 1 line
2.25.1
#2 lore raw

Re: [PATCH 1/3] Revert "drm/lima: add show_fdinfo for drm usage stats"

Quoted 8 lines · On Tue, Apr 04, 2023 at 08:25:59AM +0800, [email protected] wrote:

From: Qiang Yu <[email protected]>

This reverts commit 4a66f3da99dcb4dcbd28544110636b50adfb0f0d.

This is due to the depend commit has been reverted on upstream:
baad10973fdb ("Revert "drm/scheduler: track GPU active time per entity"")

A bit an aside, but it feels like a lot more of the fdinfo scheduler code should be common, and not just the minimal timekeeping? Just a thought for the next round.
-Daniel

Quoted 49 lines
---
 drivers/gpu/drm/lima/lima_drv.c | 31 +------------------------------
 1 file changed, 1 insertion(+), 30 deletions(-)
drivers/gpu/drm/lima/lima_drv.c +1 -30
index 3420875d6fc6..f456a471216b 100644
@@ -261,36 +261,7 @@ static const struct drm_ioctl_desc lima_drm_driver_ioctls[] = {
 	DRM_IOCTL_DEF_DRV(LIMA_CTX_FREE, lima_ioctl_ctx_free, DRM_RENDER_ALLOW),
 };
 
-static void lima_drm_driver_show_fdinfo(struct seq_file *m, struct file *filp)
-{
-	struct drm_file *file = filp->private_data;
-	struct drm_device *dev = file->minor->dev;
-	struct lima_device *ldev = to_lima_dev(dev);
-	struct lima_drm_priv *priv = file->driver_priv;
-	struct lima_ctx_mgr *ctx_mgr = &priv->ctx_mgr;
-	u64 usage[lima_pipe_num];
-
-	lima_ctx_mgr_usage(ctx_mgr, usage);
-
-	/*
-	 * For a description of the text output format used here, see
-	 * Documentation/gpu/drm-usage-stats.rst.
-	 */
-	seq_printf(m, "drm-driver:\t%s\n", dev->driver->name);
-	seq_printf(m, "drm-client-id:\t%u\n", priv->id);
-	for (int i = 0; i < lima_pipe_num; i++) {
-		struct lima_sched_pipe *pipe = &ldev->pipe[i];
-		struct drm_gpu_scheduler *sched = &pipe->base;
-
-		seq_printf(m, "drm-engine-%s:\t%llu ns\n", sched->name, usage[i]);
-	}
-}
-
-static const struct file_operations lima_drm_driver_fops = {
-	.owner = THIS_MODULE,
-	DRM_GEM_FOPS,
-	.show_fdinfo = lima_drm_driver_show_fdinfo,
-};
+DEFINE_DRM_GEM_FOPS(lima_drm_driver_fops);
 
 /*
  * Changelog:
Signature · 1 line
2.25.1
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
#3 lore raw

PATCH 2/3 Revert "drm/lima: allocate unique id per drm_file"

In reply to [email protected]

From: Qiang Yu <[email protected]>

This reverts commit 87767de835edf527b879a363d518c33da68adb81.

This is due to the depend commit has been reverted on upstream:
baad10973fdb ("Revert "drm/scheduler: track GPU active time per entity"")

---
 drivers/gpu/drm/lima/lima_device.h |  3 ---
 drivers/gpu/drm/lima/lima_drv.c    | 12 ------------
 drivers/gpu/drm/lima/lima_drv.h    |  1 -
 3 files changed, 16 deletions(-)
drivers/gpu/drm/lima/lima_device.h +0 -3
index 71b2db60d161..41b9d7b4bcc7 100644
@@ -106,9 +106,6 @@ struct lima_device {
 	struct lima_dump_head dump;
 	struct list_head error_task_list;
 	struct mutex error_task_list_lock;
-
-	struct xarray active_contexts;
-	u32 next_context_id;
 };
 
 static inline struct lima_device *
drivers/gpu/drm/lima/lima_drv.c +0 -12
index f456a471216b..39cab4a55f57 100644
@@ -218,11 +218,6 @@ static int lima_drm_driver_open(struct drm_device *dev, struct drm_file *file)
 	if (!priv)
 		return -ENOMEM;
 
-	err = xa_alloc_cyclic(&ldev->active_contexts, &priv->id, priv,
-			      xa_limit_32b, &ldev->next_context_id, GFP_KERNEL);
-	if (err < 0)
-		goto err_out0;
-
 	priv->vm = lima_vm_create(ldev);
 	if (!priv->vm) {
 		err = -ENOMEM;
@@ -242,9 +237,6 @@ static int lima_drm_driver_open(struct drm_device *dev, struct drm_file *file)
 static void lima_drm_driver_postclose(struct drm_device *dev, struct drm_file *file)
 {
 	struct lima_drm_priv *priv = file->driver_priv;
-	struct lima_device *ldev = to_lima_dev(dev);
-
-	xa_erase(&ldev->active_contexts, priv->id);
 
 	lima_ctx_mgr_fini(&priv->ctx_mgr);
 	lima_vm_put(priv->vm);
@@ -396,8 +388,6 @@ static int lima_pdev_probe(struct platform_device *pdev)
 	ldev->dev = &pdev->dev;
 	ldev->id = (enum lima_gpu_id)of_device_get_match_data(&pdev->dev);
 
-	xa_init_flags(&ldev->active_contexts, XA_FLAGS_ALLOC);
-
 	platform_set_drvdata(pdev, ldev);
 
 	/* Allocate and initialize the DRM device. */
@@ -456,8 +446,6 @@ static int lima_pdev_remove(struct platform_device *pdev)
 	struct lima_device *ldev = platform_get_drvdata(pdev);
 	struct drm_device *ddev = ldev->ddev;
 
-	xa_destroy(&ldev->active_contexts);
-
 	sysfs_remove_bin_file(&ldev->dev->kobj, &lima_error_state_attr);
 
 	drm_dev_unregister(ddev);
drivers/gpu/drm/lima/lima_drv.h +0 -1
index e49b7ab651d0..c738d288547b 100644
@@ -20,7 +20,6 @@ struct lima_sched_task;
 struct drm_lima_gem_submit_bo;
 
 struct lima_drm_priv {
-	int id;
 	struct lima_vm *vm;
 	struct lima_ctx_mgr ctx_mgr;
 };
Signature · 1 line
2.25.1
#4 lore raw

PATCH 3/3 Revert "drm/lima: add usage counting method to ctx_mgr"

In reply to [email protected]

From: Qiang Yu <[email protected]>

This reverts commit bccafec957a5c4b22ac29e53a39e82d0a0008348.

This is due to the depend commit has been reverted on upstream:
baad10973fdb ("Revert "drm/scheduler: track GPU active time per entity"")

---
 drivers/gpu/drm/lima/lima_ctx.c | 30 +-----------------------------
 drivers/gpu/drm/lima/lima_ctx.h |  3 ---
 2 files changed, 1 insertion(+), 32 deletions(-)
drivers/gpu/drm/lima/lima_ctx.c +1 -29
index e008e586fad0..891d5cd5019a 100644
@@ -15,7 +15,6 @@ int lima_ctx_create(struct lima_device *dev, struct lima_ctx_mgr *mgr, u32 *id)
 	if (!ctx)
 		return -ENOMEM;
 	ctx->dev = dev;
-	ctx->mgr = mgr;
 	kref_init(&ctx->refcnt);
 
 	for (i = 0; i < lima_pipe_num; i++) {
@@ -43,17 +42,10 @@ int lima_ctx_create(struct lima_device *dev, struct lima_ctx_mgr *mgr, u32 *id)
 static void lima_ctx_do_release(struct kref *ref)
 {
 	struct lima_ctx *ctx = container_of(ref, struct lima_ctx, refcnt);
-	struct lima_ctx_mgr *mgr = ctx->mgr;
 	int i;
 
-	for (i = 0; i < lima_pipe_num; i++) {
-		struct lima_sched_context *context = &ctx->context[i];
-		struct drm_sched_entity *entity = &context->base;
-
-		mgr->elapsed_ns[i] += entity->elapsed_ns;
-
+	for (i = 0; i < lima_pipe_num; i++)
 		lima_sched_context_fini(ctx->dev->pipe + i, ctx->context + i);
-	}
 	kfree(ctx);
 }
 
@@ -107,23 +99,3 @@ void lima_ctx_mgr_fini(struct lima_ctx_mgr *mgr)
 	xa_destroy(&mgr->handles);
 	mutex_destroy(&mgr->lock);
 }
-
-void lima_ctx_mgr_usage(struct lima_ctx_mgr *mgr, u64 usage[lima_pipe_num])
-{
-	struct lima_ctx *ctx;
-	unsigned long id;
-
-	for (int i = 0; i < lima_pipe_num; i++)
-		usage[i] = mgr->elapsed_ns[i];
-
-	mutex_lock(&mgr->lock);
-	xa_for_each(&mgr->handles, id, ctx) {
-		for (int i = 0; i < lima_pipe_num; i++) {
-			struct lima_sched_context *context = &ctx->context[i];
-			struct drm_sched_entity *entity = &context->base;
-
-			usage[i] += entity->elapsed_ns;
-		}
-	}
-	mutex_unlock(&mgr->lock);
-}
drivers/gpu/drm/lima/lima_ctx.h +0 -3
index 6068863880eb..74e2be09090f 100644
@@ -12,7 +12,6 @@
 struct lima_ctx {
 	struct kref refcnt;
 	struct lima_device *dev;
-	struct lima_ctx_mgr *mgr;
 	struct lima_sched_context context[lima_pipe_num];
 	atomic_t guilty;
 
@@ -24,7 +23,6 @@ struct lima_ctx {
 struct lima_ctx_mgr {
 	struct mutex lock;
 	struct xarray handles;
-	u64 elapsed_ns[lima_pipe_num];
 };
 
 int lima_ctx_create(struct lima_device *dev, struct lima_ctx_mgr *mgr, u32 *id);
@@ -33,6 +31,5 @@ struct lima_ctx *lima_ctx_get(struct lima_ctx_mgr *mgr, u32 id);
 void lima_ctx_put(struct lima_ctx *ctx);
 void lima_ctx_mgr_init(struct lima_ctx_mgr *mgr);
 void lima_ctx_mgr_fini(struct lima_ctx_mgr *mgr);
-void lima_ctx_mgr_usage(struct lima_ctx_mgr *mgr, u64 usage[lima_pipe_num]);
 
 #endif
Signature · 1 line
2.25.1
Acked-by on the v1 series
#5 lore raw
In reply to [email protected]
Quoted 9 lines · On Tue, 4 Apr 2023 at 08:13, <[email protected]> wrote:

From: Qiang Yu <[email protected]>

Upstream has reverted the dependant commit
df622729ddbf ("drm/scheduler: track GPU active time per entity""), but this patchset has been pushed to drm-misc-next which still has that commit. To avoid other branch build fail after merge drm-misc-next, just revert the lima patchset on drm-misc-next too.

The bug/revert is unfortunate, although we better keep the build clean or Linus will go bananas ^_^

Fwiw for the series:

HTH
-Emil

#6 lore raw
Quoted 11 lines · Emil Velikov
Quoted 9 lines · On Tue, 4 Apr 2023 at 08:13, <[email protected]> wrote:

From: Qiang Yu <[email protected]>

Upstream has reverted the dependant commit
df622729ddbf ("drm/scheduler: track GPU active time per entity""), but this patchset has been pushed to drm-misc-next which still has that commit. To avoid other branch build fail after merge drm-misc-next, just revert the lima patchset on drm-misc-next too.

Quoted 5 lines

The bug/revert is unfortunate, although we better keep the build clean or Linus will go bananas ^_^

Fwiw for the series:

Can you (eitehr of you really) please push asap and make sure this doesn't miss the last drm-misc-next pull (-rc6 is this w/e)? Otherwise we'll have a bit a mess.
-Daniel

Quoted 3 lines

HTH
-Emil

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
maintainer Applied
#7 lore raw

Applied to drm-misc-next, sorry for the trouble.

Regards,
Qiang

Quoted 32 lines · Daniel Vetter
Quoted 11 lines · Emil Velikov
Quoted 9 lines · On Tue, 4 Apr 2023 at 08:13, <[email protected]> wrote:

From: Qiang Yu <[email protected]>

Upstream has reverted the dependant commit
df622729ddbf ("drm/scheduler: track GPU active time per entity""), but this patchset has been pushed to drm-misc-next which still has that commit. To avoid other branch build fail after merge drm-misc-next, just revert the lima patchset on drm-misc-next too.

Quoted 5 lines

The bug/revert is unfortunate, although we better keep the build clean or Linus will go bananas ^_^

Fwiw for the series:

Can you (eitehr of you really) please push asap and make sure this doesn't miss the last drm-misc-next pull (-rc6 is this w/e)? Otherwise we'll have a bit a mess.
-Daniel

Quoted 3 lines

HTH
-Emil

--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

#8 lore raw
Quoted 1 line · Qiang Yu

Applied to drm-misc-next, sorry for the trouble.

No worries, I already complained to Lucas/etnaviv people that the sched revert should have been at least posted/discussed on dri-devel. Imo this isn't on you.
-Daniel

Quoted 37 lines

Regards,
Qiang

Quoted 32 lines · Daniel Vetter
Quoted 11 lines · Emil Velikov
Quoted 9 lines · On Tue, 4 Apr 2023 at 08:13, <[email protected]> wrote:

From: Qiang Yu <[email protected]>

Upstream has reverted the dependant commit
df622729ddbf ("drm/scheduler: track GPU active time per entity""), but this patchset has been pushed to drm-misc-next which still has that commit. To avoid other branch build fail after merge drm-misc-next, just revert the lima patchset on drm-misc-next too.

Quoted 5 lines

The bug/revert is unfortunate, although we better keep the build clean or Linus will go bananas ^_^

Fwiw for the series:

Can you (eitehr of you really) please push asap and make sure this doesn't miss the last drm-misc-next pull (-rc6 is this w/e)? Otherwise we'll have a bit a mess.
-Daniel

Quoted 3 lines

HTH
-Emil

--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch