Skip to contentSkip to conversation

drm/msm/rd: Check PT_PTRACED for cmdstream dumping

RFC In review Rob Clark 2 participants 2 messages Sep 14, 2023 – Dec 3, 2023

Subsystems (3)
lore
Share & tools
lore

Rob Clark

author
#0 lore raw

RFC 1/1 drm/msm/rd: Check PT_PTRACED for cmdstream dumping

From: Rob Clark <[email protected]>

So, when you want to get a cmdstream trace of some deqp or piglit test, but you happen to be running it on the same laptop with full desktop env, the current dump-everything firehose of cat $debugfs/dri/n/rd is quite a bit too much. Ptrace seemed kind of a natural way to control it, ie. either run what you want to trace under gdb or hack in a ptrace(PTRACE_TRACEME) call.

---
 drivers/gpu/drm/msm/msm_gem_submit.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/msm_gem_submit.c +2 -1
index a908373cf34b..a105ca1f2102 100644
@@ -979,7 +979,8 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data,
 	/* The scheduler owns a ref now: */
 	msm_gem_submit_get(submit);
 
-	msm_rd_dump_submit(priv->rd, submit, NULL);
+	if (current->ptrace & PT_PTRACED)
+		msm_rd_dump_submit(priv->rd, submit, NULL);
 
 	pm_runtime_get_sync(&gpu->pdev->dev);
 
Signature · 1 line
2.41.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Rob Clark

From: Rob Clark <[email protected]>

So, when you want to get a cmdstream trace of some deqp or piglit test, but you happen to be running it on the same laptop with full desktop env, the current dump-everything firehose of cat $debugfs/dri/n/rd is quite a bit too much. Ptrace seemed kind of a natural way to control it, ie. either run what you want to trace under gdb or hack in a ptrace(PTRACE_TRACEME) call.

Quoted 4 lines
---
  drivers/gpu/drm/msm/msm_gem_submit.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

I think this is a good idea, to be able to separate process being debugged and all other tasks.

Quoted 15 lines
drivers/gpu/drm/msm/msm_gem_submit.c +2 -1
index a908373cf34b..a105ca1f2102 100644
@@ -979,7 +979,8 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data,
  	/* The scheduler owns a ref now: */
  	msm_gem_submit_get(submit);
 
-	msm_rd_dump_submit(priv->rd, submit, NULL);
+	if (current->ptrace & PT_PTRACED)
+		msm_rd_dump_submit(priv->rd, submit, NULL);
 
  	pm_runtime_get_sync(&gpu->pdev->dev);
 
Signature · 2 lines
With best wishes
Dmitry