Re: [PATCH] [RFC] perf: robustify proc and debugfs file recording

From: Sonny Rao
Date: Wed Jul 13 2011 - 16:59:25 EST


On Wed, Jul 13, 2011 at 1:49 PM, Sonny Rao <sonnyrao@xxxxxxxxxxxx> wrote:
> On Wed, Jul 13, 2011 at 1:38 PM, Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
>> On Wed, 2011-07-13 at 20:52 +1000, Michael Neuling wrote:
>>
>>> Actually, here's an updated patch to fix these..
>>>
>>> FYI perf record/annotate/report works fine on my powerpc box here with
>>> this.  I don't have modules handy so I've not tested that aspect.
>>
>> Sure it worked for you...
>>
>>
>>> -static unsigned long get_size(const char *file)
>>> -{
>>> -     unsigned long long size = 0;
>>> -     int fd;
>>> -
>>> -     fd = open(file, O_RDONLY);
>>> -     if (fd < 0)
>>> -             die("Can't read '%s'", file);
>>> -     size = get_size_fd(fd);
>>>       close(fd);
>>>
>>> -     return size;
>>> +     /* ugh, handle big-endian hdr_size == 4 */
>>> +     sizep = (char*)&size;
>>> +     if (bigendian())
>>> +             sizep += sizeof(u64) - hdr_sz;
>>> +
>>> +     if (pwrite(output_fd, &size, hdr_sz, hdr_pos) < 0)
>>
>> s/&size/sizep/
>
> Argh, I'm really messing this up... so yeah this shouldn't have worked
> on big-endian without that fix..
> Mikey, are you sure it worked?

Actually, I think you need to use tracepoints or this code won't be invoked.
So, please try with some tracepoints, thanks.

Sonny
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/