[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <4E2064A2.10807@gmail.com>
Date: Fri, 15 Jul 2011 10:02:42 -0600
From: David Ahern <dsahern@...il.com>
To: Frederic Weisbecker <fweisbec@...il.com>
CC: linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org,
acme@...stprotocols.net, mingo@...e.hu, peterz@...radead.org,
paulus@...ba.org
Subject: Re: [PATCH] perf tools: fix endian conversion reading event attr
from header
On 07/15/2011 09:47 AM, Frederic Weisbecker wrote:
>> - if (perf_header__getbuffer64(header, fd, &f_attr, sizeof(f_attr)))
>> + if (readn(fd, &f_attr, sizeof(f_attr)) <= 0)
>> goto out_errno;
>>
>> + if (header->needs_swap) {
>> + f_attr.attr.type = bswap_32(f_attr.attr.type);
>> + f_attr.attr.size = bswap_32(f_attr.attr.size);
>> + mem_bswap_64(&f_attr.attr.config,
>> + sizeof(struct perf_event_attr) - 8);
>> + }
>> +
>
> Good catch!
A long, painful discovery
> But would be nice to also handle the wakeup_events and bp_type fields.
>
I did not think those values were used in userspace, so did not touch
them. But then your inquiry pushed me into cscope and I found the
perf_event__attr_swap() function. I'll redo the patch leveraging the
swapping done there.
David
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists