[PATCH v2] drm/amdgpu: add condition check for trace_amdgpu_cs()
Christian König
christian.koenig at amd.com
Mon Aug 17 10:57:11 UTC 2020
Am 17.08.20 um 12:34 schrieb Kevin Wang:
> v1:
> add trace event enabled check to avoid nop loop when submit multi ibs
> in amdgpu_cs_ioctl() function.
>
> v2:
> add a new wrapper function to trace all amdgpu cs ibs.
>
> Signed-off-by: Kevin Wang <kevin1.wang at amd.com>
Reviewed-by: Christian König <christian.koenig at amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 16 +++++++++++++---
> 1 file changed, 13 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> index ffbcaf4bfb8b..1921e61a37b9 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> @@ -1275,13 +1275,24 @@ static int amdgpu_cs_submit(struct amdgpu_cs_parser *p,
> return r;
> }
>
> +static void trace_amdgpu_cs_ibs(struct amdgpu_cs_parser *parser)
> +{
> + int i;
> +
> + if (!trace_amdgpu_cs_enabled())
> + return;
> +
> + for (i = 0; i < parser->job->num_ibs; i++)
> + trace_amdgpu_cs(parser, i);
> +}
> +
> int amdgpu_cs_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
> {
> struct amdgpu_device *adev = dev->dev_private;
> union drm_amdgpu_cs *cs = data;
> struct amdgpu_cs_parser parser = {};
> bool reserved_buffers = false;
> - int i, r;
> + int r;
>
> if (amdgpu_ras_intr_triggered())
> return -EHWPOISON;
> @@ -1319,8 +1330,7 @@ int amdgpu_cs_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
>
> reserved_buffers = true;
>
> - for (i = 0; i < parser.job->num_ibs; i++)
> - trace_amdgpu_cs(&parser, i);
> + trace_amdgpu_cs_ibs(&parser);
>
> r = amdgpu_cs_vm_handling(&parser);
> if (r)
More information about the amd-gfx
mailing list