From: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, igt-dev@lists.freedesktop.org
Subject: Re: [igt-dev] [PATCH i-g-t] tools/i915-perf-recorder: fix topology alignment issue
Date: Wed, 1 Apr 2020 14:19:37 +0300 [thread overview]
Message-ID: <60809636-b170-dd21-aa13-63d2945db3c6@intel.com> (raw)
In-Reply-To: <158573974814.5852.4343487493123615703@build.alporthouse.com>
On 01/04/2020 14:15, Chris Wilson wrote:
> 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@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
We get the result of the query from the kernel and write it to the file.
To keep structures in the file aligned to 8 bytes (so that we can mmap
stuff and it doesn't fall on weird alignments), the topology data size
has to be aligned as well.
The problem is that we align the data when writing it to the file, but
fail to update the header.size field properly written just before the
topology data.
-Lionel
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next prev parent reply other threads:[~2020-04-01 11:19 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-01 10:36 [igt-dev] [PATCH i-g-t] tools/i915-perf-recorder: fix topology alignment issue Lionel Landwerlin
2020-04-01 11:13 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2020-04-01 11:15 ` [igt-dev] [PATCH i-g-t] " Chris Wilson
2020-04-01 11:19 ` Lionel Landwerlin [this message]
2020-04-01 11:53 ` Chris Wilson
2020-04-01 11:54 ` Lionel Landwerlin
2020-04-02 8:32 ` [igt-dev] ✓ Fi.CI.IGT: success for " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=60809636-b170-dd21-aa13-63d2945db3c6@intel.com \
--to=lionel.g.landwerlin@intel.com \
--cc=chris@chris-wilson.co.uk \
--cc=igt-dev@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox