[igt-dev] [PATCH i-g-t] tools/i915-perf-recorder: fix topology alignment issue

Chris Wilson chris at chris-wilson.co.uk
Wed Apr 1 11:15:48 UTC 2020


Quoting Lionel Landwerlin (2020-04-01 11:36:06)
> The additional alignment added when writing into the output was not
> accounted in the header. This is preventing reading the recorded data.
> 
> Instead of adding the alignment when writing, just account for it when
> querying the topology.
> 
> Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
> Fixes: f08865e58cd3 ("tools: add i915 perf recorder tool")
> ---
>  tools/i915-perf/i915_perf_recorder.c | 10 ++--------
>  1 file changed, 2 insertions(+), 8 deletions(-)
> 
> diff --git a/tools/i915-perf/i915_perf_recorder.c b/tools/i915-perf/i915_perf_recorder.c
> index 4d729b0e..104a425b 100644
> --- a/tools/i915-perf/i915_perf_recorder.c
> +++ b/tools/i915-perf/i915_perf_recorder.c
> @@ -485,8 +485,8 @@ get_topology(int drm_fd, uint32_t *topology_size)
>                 return NULL;
>  
>         assert(item.length > 0);
> -       *topology_size = item.length;
> -       topo_info = malloc(item.length);
> +       *topology_size = ALIGN(item.length, 8);
> +       topo_info = malloc(*topology_size);
>         item.data_ptr = (uintptr_t) topo_info;

As I understand the problem statement, when we used the length the
kernel told us to use, the kernel rejected the query?

Could you clarify as that sounds like a kernel bug.
-Chris


More information about the igt-dev mailing list