Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1425312

Re: [RFC/PATCH] perf: Add sizeof operator support

From Jeremy Linton <jeremy.linton@arm.com>
Newsgroups linux.kernel
Subject Re: [RFC/PATCH] perf: Add sizeof operator support
Date 2016-06-17 18:40 +0200
Message-ID <rL4Yh-tv-17@gated-at.bofh.it> (permalink)
References <rJZxD-7jp-17@gated-at.bofh.it> <rL4EW-my-43@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi Steven,

On 06/17/2016 11:17 AM, Steven Rostedt wrote:
> On Tue, 14 Jun 2016 11:38:32 -0500
> Jeremy Linton <jeremy.linton@arm.com> wrote:
>
>> There are a fair number of tracepoints in the kernel making
>> use of the sizeof operator. Allow perf to understand some of
>> those cases, and report a more informative error message for
>> the ones it cannot understand.
>>
>> Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
>> ---
>>
>> So this is as much a RFC as a patch because the use of sizeof
>> seems to extend to structures, pointers, etc that aren't easy
>> to deduce from userspace. I'm not sure what the correct solution
>> should be in those cases.
>>
>>   tools/lib/traceevent/event-parse.c | 46 ++++++++++++++++++++++++++++++++++++++

(trimming)

>> +
>> +	if (strcmp(token, "__u64") == 0) {
>> +		if (asprintf(&arg->atom.atom, "%zd", sizeof(__u64)) < 0)
>> +			goto out_free_atom;
>> +	} else if (strcmp(token, "__u32") == 0) {
>> +		if (asprintf(&arg->atom.atom, "%zd", sizeof(__u32)) < 0)
>> +			goto out_free_atom;
>
> What events are doing sizeof(__u64) and sizeof(__u32)?
>
> First, that's useless, as sizeof(__u64) will always be 8, and
> sizeof(__u32) will always be 4.
>
> What exactly is this fixing?

It starts to fix things like:

kmem:mm_page_alloc
   Warning: [kmem:mm_page_alloc] function sizeof not defined

or:

# perf stat -e kvm:kvm_arm_set_regset -- true
   Warning: [kvm:kvm_arm_set_regset] function sizeof not defined
   Warning: Error: expected type 5 but read 0
*** Error in `perf': double free or corruption (fasttop): 
0x00000000303f5930 ***

There is a RH bug about it (and the "~" operator, which has been fixed) 
here: https://bugzilla.redhat.com/show_bug.cgi?id=1298229

Thanks for taking a look at this,

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC/PATCH] perf: Add sizeof operator support Jeremy Linton <jeremy.linton@arm.com> - 2016-06-14 18:40 +0200
  Re: [RFC/PATCH] perf: Add sizeof operator support Steven Rostedt <rostedt@goodmis.org> - 2016-06-17 18:20 +0200
    Re: [RFC/PATCH] perf: Add sizeof operator support Jeremy Linton <jeremy.linton@arm.com> - 2016-06-17 18:40 +0200
      Re: [RFC/PATCH] perf: Add sizeof operator support Steven Rostedt <rostedt@goodmis.org> - 2016-06-17 19:00 +0200
        Re: [RFC/PATCH] perf: Add sizeof operator support Jeremy Linton <jeremy.linton@arm.com> - 2016-06-17 21:00 +0200
          Re: [RFC/PATCH] perf: Add sizeof operator support Steven Rostedt <rostedt@goodmis.org> - 2016-06-17 21:10 +0200
            Re: [RFC/PATCH] perf: Add sizeof operator support Namhyung Kim <namhyung@kernel.org> - 2016-06-20 02:50 +0200

csiph-web