public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC] drm/msm/rd: Check PT_PTRACED for cmdstream dumping
@ 2023-09-14 17:24 Rob Clark
  2023-12-03  0:08 ` Dmitry Baryshkov
  0 siblings, 1 reply; 2+ messages in thread
From: Rob Clark @ 2023-09-14 17:24 UTC (permalink / raw)
  To: dri-devel
  Cc: freedreno, Rob Clark, Rob Clark, Abhinav Kumar, Dmitry Baryshkov,
	Sean Paul, Marijn Suijten, David Airlie, Daniel Vetter,
	open list:DRM DRIVER FOR MSM ADRENO GPU, open list

From: Rob Clark <robdclark@chromium.org>

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.

Signed-off-by: Rob Clark <robdclark@chromium.org>
---
 drivers/gpu/drm/msm/msm_gem_submit.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/msm_gem_submit.c b/drivers/gpu/drm/msm/msm_gem_submit.c
index a908373cf34b..a105ca1f2102 100644
--- a/drivers/gpu/drm/msm/msm_gem_submit.c
+++ b/drivers/gpu/drm/msm/msm_gem_submit.c
@@ -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);
 
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [RFC] drm/msm/rd: Check PT_PTRACED for cmdstream dumping
  2023-09-14 17:24 [RFC] drm/msm/rd: Check PT_PTRACED for cmdstream dumping Rob Clark
@ 2023-12-03  0:08 ` Dmitry Baryshkov
  0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Baryshkov @ 2023-12-03  0:08 UTC (permalink / raw)
  To: Rob Clark, dri-devel
  Cc: freedreno, Rob Clark, Abhinav Kumar, Sean Paul, Marijn Suijten,
	David Airlie, Daniel Vetter,
	open list:DRM DRIVER FOR MSM ADRENO GPU, open list

On 14/09/2023 20:24, Rob Clark wrote:
> From: Rob Clark <robdclark@chromium.org>
> 
> 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.
> 
> Signed-off-by: Rob Clark <robdclark@chromium.org>
> ---
>   drivers/gpu/drm/msm/msm_gem_submit.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>

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

> 
> diff --git a/drivers/gpu/drm/msm/msm_gem_submit.c b/drivers/gpu/drm/msm/msm_gem_submit.c
> index a908373cf34b..a105ca1f2102 100644
> --- a/drivers/gpu/drm/msm/msm_gem_submit.c
> +++ b/drivers/gpu/drm/msm/msm_gem_submit.c
> @@ -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);
>   

-- 
With best wishes
Dmitry


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-12-03  0:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-14 17:24 [RFC] drm/msm/rd: Check PT_PTRACED for cmdstream dumping Rob Clark
2023-12-03  0:08 ` Dmitry Baryshkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox