linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Ahern <dsahern@gmail.com>
To: Frederic Weisbecker <fweisbec@gmail.com>
Cc: linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
	acme@ghostprotocols.net, mingo@elte.hu, peterz@infradead.org,
	paulus@samba.org
Subject: Re: [PATCH] perf tools: fix endian conversion reading event attr from header
Date: Fri, 15 Jul 2011 10:02:42 -0600	[thread overview]
Message-ID: <4E2064A2.10807@gmail.com> (raw)
In-Reply-To: <20110715154711.GB6590@somewhere>

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

      reply	other threads:[~2011-07-15 16:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-12 15:19 [PATCH] perf tools: fix endian conversion reading event attr from header David Ahern
2011-07-15 15:31 ` David Ahern
2011-07-15 15:47 ` Frederic Weisbecker
2011-07-15 16:02   ` David Ahern [this message]

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=4E2064A2.10807@gmail.com \
    --to=dsahern@gmail.com \
    --cc=acme@ghostprotocols.net \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.org \
    --cc=peterz@infradead.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;
as well as URLs for NNTP newsgroup(s).