25 Sep, 2012
1 commit
-
If __pevent_parse_format() succeeded but add_event() failed, 'ret' didn't
have a proper error code. Set it to PEVENT_ERRNO__MEM_ALLOC_FAILED.In addition, at that point 'event' also has fields and format
information and they all need to be freed. Call pevent_free_format() to
handle it.Signed-off-by: Namhyung Kim
Cc: Ingo Molnar
Cc: Peter Zijlstra
Link: http://lkml.kernel.org/r/1348575919-4954-1-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo
24 Sep, 2012
10 commits
-
Now alloc_arg returns NULL if memory allocation failed, it should be
handled on callsites properly.Signed-off-by: Namhyung Kim
Cc: David Ahern
Cc: Frederic Weisbecker
Cc: Ingo Molnar
Cc: Jiri Olsa
Cc: Mike Galbraith
Cc: Namhyung Kim
Cc: Paul Mackerras
Cc: Peter Zijlstra
Cc: Stephane Eranian
Cc: Steven Rostedt
Link: http://lkml.kernel.org/r/87k3vpzbqo.fsf_-_@sejong.aot.lge.com
Signed-off-by: Arnaldo Carvalho de Melo -
The pevent_parse_event() routine will parse a events/sys/tp/format file
and add an event_format instance to the pevent struct.This patch introduces a pevent_parse_format() routine with just the bits
needed to parse the event/sys/tp/format file and just return the
event_format instance, useful for when all we want is to parse the
format file, without requiring the pevent struct.Acked-by: Steven Rostedt
Cc: David Ahern
Cc: Frederic Weisbecker
Cc: Jiri Olsa
Cc: Mike Galbraith
Cc: Namhyung Kim
Cc: Paul Mackerras
Cc: Peter Zijlstra
Cc: Stephane Eranian
Cc: Steven Rostedt
Link: http://lkml.kernel.org/n/tip-lge0afl47arh86om0m6a5bqr@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo -
Cleaned event-parse.c this time, just propagate the errors and in handle
them the call sites.Reviewed-by: Namhyung Kim
Cc: David Ahern
Cc: Frederic Weisbecker
Cc: Jiri Olsa
Cc: Mike Galbraith
Cc: Namhyung Kim
Cc: Paul Mackerras
Cc: Peter Zijlstra
Cc: Stephane Eranian
Cc: Steven Rostedt
Link: http://lkml.kernel.org/n/tip-9ebpr2vgfk2qs2841i99sa8y@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo -
Instead of dying, just use do_warning and let the goto that is there to
take place.Reviewed-by: Namhyung Kim
Cc: David Ahern
Cc: Frederic Weisbecker
Cc: Jiri Olsa
Cc: Mike Galbraith
Cc: Namhyung Kim
Cc: Paul Mackerras
Cc: Peter Zijlstra
Cc: Stephane Eranian
Cc: Steven Rostedt
Link: http://lkml.kernel.org/n/tip-aoaus46ngnt9oc2pt7ckot5d@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo -
Replacing the equivalent open coded malloc + memset bits.
Reviewed-by: Namhyung Kim
Cc: David Ahern
Cc: Frederic Weisbecker
Cc: Jiri Olsa
Cc: Mike Galbraith
Cc: Namhyung Kim
Cc: Paul Mackerras
Cc: Peter Zijlstra
Cc: Stephane Eranian
Cc: Steven Rostedt
Link: http://lkml.kernel.org/n/tip-598fjtjbzal4wxh7fp0yv0q1@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo -
Replacing the equivalent open coded malloc + sprintf bits.
Reviewed-by: Namhyung Kim
Cc: David Ahern
Cc: Frederic Weisbecker
Cc: Jiri Olsa
Cc: Mike Galbraith
Cc: Namhyung Kim
Cc: Paul Mackerras
Cc: Peter Zijlstra
Cc: Stephane Eranian
Cc: Steven Rostedt
Link: http://lkml.kernel.org/n/tip-ghokwtdw2hgmmmn7oa9s03r4@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo -
The field should be freed on error paths.
Signed-off-by: Namhyung Kim
Cc: Frederic Weisbecker
Cc: Ingo Molnar
Cc: Peter Zijlstra
Cc: Steven Rostedt
Link: http://lkml.kernel.org/r/1348037924-17568-5-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo -
The field should be freed on error paths.
Signed-off-by: Namhyung Kim
Cc: Frederic Weisbecker
Cc: Ingo Molnar
Cc: Peter Zijlstra
Cc: Steven Rostedt
Link: http://lkml.kernel.org/r/1348037924-17568-4-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo -
When process_op failed, @arg will be freed on a caller with type of
PRINT_OP. Thus free_arg() will try to free ->op.right field which can
have stale value if something bad happens in the middle.Signed-off-by: Namhyung Kim
Cc: Frederic Weisbecker
Cc: Ingo Molnar
Cc: Peter Zijlstra
Cc: Steven Rostedt
Link: http://lkml.kernel.org/r/1348037924-17568-3-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo -
free_token() under out_free should be called with 'token' and no need
to set *tok to NULL since it's set already.Signed-off-by: Namhyung Kim
Cc: Frederic Weisbecker
Cc: Ingo Molnar
Cc: Peter Zijlstra
Cc: Steven Rostedt
Link: http://lkml.kernel.org/r/1348037924-17568-2-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo
15 Sep, 2012
1 commit
-
For the reasons stated on:
commit 0a84f00
Author: David Daneyperf tools: Fix broken build by defining _GNU_SOURCE in Makefile
Acked-by: Steven Rostedt
Cc: David Ahern
Cc: David Daney
Cc: Frederic Weisbecker
Cc: Jiri Olsa
Cc: Mike Galbraith
Cc: Namhyung Kim
Cc: Paul Mackerras
Cc: Peter Zijlstra
Cc: Stephane Eranian
Cc: Steven Rostedt
Link: http://lkml.kernel.org/n/tip-e2nofbmj4uf0ykgsytxvt9pu@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo
11 Sep, 2012
1 commit
-
perf defines both __used and __unused variables to use for marking
unused variables. The variable __used is defined to
__attribute__((__unused__)), which contradicts the kernel definition to
__attribute__((__used__)) for new gcc versions. On Android, __used is
also defined in system headers and this leads to warnings like: warning:
'__used__' attribute ignored__unused is not defined in the kernel and is not a standard definition.
If __unused is included everywhere instead of __used, this leads to
conflicts with glibc headers, since glibc has a variables with this name
in its headers.The best approach is to use __maybe_unused, the definition used in the
kernel for __attribute__((unused)). In this way there is only one
definition in perf sources (instead of 2 definitions that point to the
same thing: __used and __unused) and it works on both Linux and Android.
This patch simply replaces all instances of __used and __unused with
__maybe_unused.Signed-off-by: Irina Tirdea
Acked-by: Pekka Enberg
Cc: David Ahern
Cc: Ingo Molnar
Cc: Namhyung Kim
Cc: Paul Mackerras
Cc: Peter Zijlstra
Cc: Steven Rostedt
Link: http://lkml.kernel.org/r/1347315303-29906-7-git-send-email-irina.tirdea@intel.com
[ committer note: fixed up conflict with a116e05 in builtin-sched.c ]
Signed-off-by: Arnaldo Carvalho de Melo
08 Sep, 2012
1 commit
-
The mempcpy function is not supported by bionic in Android and will lead
to compilation errors.Replacing mempcpy with memcpy so it will work in Android.
Signed-off-by: Irina Tirdea
Cc: David Ahern
Cc: Ingo Molnar
Cc: Namhyung Kim
Cc: Paul Mackerras
Cc: Peter Zijlstra
Cc: Steven Rostedt
Link: http://lkml.kernel.org/r/1347065004-15306-11-git-send-email-irina.tirdea@intel.com
Signed-off-by: Arnaldo Carvalho de Melo
07 Sep, 2012
3 commits
-
If memory allocation for handler fails or argument type is not match,
return gracefully instead of calling die(). Also add an new error code
for the later case.Signed-off-by: Namhyung Kim
Acked-by: Steven Rostedt
Cc: Frederic Weisbecker
Cc: Ingo Molnar
Cc: Peter Zijlstra
Cc: Steven Rostedt
Link: http://lkml.kernel.org/r/1346986187-5170-3-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo -
If memory allocation for handler fails, return gracefully instead of
calling die(). Note that casts to void * are needed because gcc
complained about discarding 'const' qualifier during implicit argument
cast.Signed-off-by: Namhyung Kim
Acked-by: Steven Rostedt
Cc: Frederic Weisbecker
Cc: Ingo Molnar
Cc: Peter Zijlstra
Cc: Steven Rostedt
Link: http://lkml.kernel.org/r/1346986187-5170-2-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo -
There are three cases that call die() in the pretty_print.
1. insufficient number of argument: cannot proceed anymore.
2. too long format conversion specifier: truncate and proceed.
3. bad size specifier in format string: skip and proceed.For all cases, convert die to do_warning, mark the event as
EVENT_FL_FAILED and print error message at the last.Signed-off-by: Namhyung Kim
Acked-by: Steven Rostedt
Cc: Frederic Weisbecker
Cc: Ingo Molnar
Cc: Peter Zijlstra
Cc: Steven Rostedt
Link: http://lkml.kernel.org/r/1346986187-5170-1-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo
06 Sep, 2012
1 commit
-
Replace keyword "private" to "priv" in event-parse.h to allow it to be
used in C++ programs.Signed-off-by: Steven Rostedt
Cc: Frederic Weisbecker
Cc: Ingo Molnar
Cc: Namhyung Kim
Cc: Peter Zijlstra
Link: http://lkml.kernel.org/r/1345735321.5069.62.camel@gandalf.local.home
Signed-off-by: Arnaldo Carvalho de Melo
23 Aug, 2012
5 commits
-
As pevent_errno is defined using PEVENT_ERRORS which uses _PE macro
magic, the first errno is bigger than __PEVENT_ERRNO_START by 1. So we
need to subtract the 1 also when calculating the index of the error
strings.Signed-off-by: Namhyung Kim
Cc: Frederic Weisbecker
Cc: Ingo Molnar
Cc: Peter Zijlstra
Cc: Steven Rostedt
Link: http://lkml.kernel.org/r/1345707420-21767-1-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo -
glibc-2.16 starts to mark the function with attribute warn_unused_result
so that it can cause a build warning.Since GNU version of strerror_r() can return a pointer to a string
without setting @buf, check the return value and copy/truncate it to our
buffer if needed.Signed-off-by: Namhyung Kim
Acked-by: Kirill A. Shutemov
Cc: Frederic Weisbecker
Cc: Ingo Molnar
Cc: Kirill A. Shutemov
Cc: Peter Zijlstra
Cc: Steven Rostedt
Link: http://lkml.kernel.org/r/1345618831-9148-5-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo -
The pevent_strerror() sets @buf to a string that describes the
(libtraceevent-specific) error condition that is passed via @errnum.This is similar to strerror_r() and does same thing if @errnum has a
standard errno value.To sync error string with its code, define PEVENT_ERRORS with _PE()
macro and use it as suggested by Steven.Signed-off-by: Namhyung Kim
Acked-by: Steven Rostedt
Cc: Frederic Weisbecker
Cc: Ingo Molnar
Cc: Peter Zijlstra
Cc: Steven Rostedt
Link: http://lkml.kernel.org/r/1345618831-9148-4-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo -
Define and use error numbers for pevent_parse_event() and get rid of
die() and do_warning() calls. If the function returns non-zero value,
the caller can check the return code and do appropriate things.I chose the error numbers to be negative not to clash with standard
errno, and as usual, 0 for success.Signed-off-by: Namhyung Kim
Acked-by: Steven Rostedt
Cc: Frederic Weisbecker
Cc: Ingo Molnar
Cc: Peter Zijlstra
Cc: Steven Rostedt
Link: http://lkml.kernel.org/r/1345618831-9148-3-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo -
Defer linking a newly allocated arg to print_fmt.args until all of its
field is setup so that later access to ->field.name cannot be NULL.Signed-off-by: Namhyung Kim
Acked-by: Steven Rostedt
Cc: Frederic Weisbecker
Cc: Ingo Molnar
Cc: Peter Zijlstra
Cc: Steven Rostedt
Link: http://lkml.kernel.org/r/1345618831-9148-2-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo
08 Aug, 2012
1 commit
-
Fixing the integer cast reported by the following warning:
tools/lib/traceevent/event-parse.c:3488:14: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
Signed-off-by: Robert Richter
Cc: Ingo Molnar
Link: http://lkml.kernel.org/r/1344361396-7237-5-git-send-email-robert.richter@amd.com
Signed-off-by: Arnaldo Carvalho de Melo
25 Jul, 2012
2 commits
-
The TRACEEVENT-CFLAGS file is used to detect any change on compiler
flags. Just ignore it.Signed-off-by: Namhyung Kim
Cc: David Ahern
Cc: Ingo Molnar
Cc: Jiri Olsa
Cc: Paul Mackerras
Cc: Peter Zijlstra
Link: http://lkml.kernel.org/r/1341559297-25725-3-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo -
Cross compiling perf requires setting ARCH and CROSS_COMPILE variables,
but libtraceevent couldn't detect the changes so it ends up believing no
recompiling is required. Thus the linker failed like:LINK perf
../lib/traceevent//libtraceevent.a: member ../lib/traceevent//libtraceevent.a(event-parse.o) in archive is not an object
collect2: ld returned 1 exit status
make: *** [perf] Error 1This patch fixes this by adding TRACEEVENT-CFLAGS file like
PERF-CFLAGS to track those changes.Signed-off-by: Namhyung Kim
Cc: David Ahern
Cc: Ingo Molnar
Cc: Jiri Olsa
Cc: Paul Mackerras
Cc: Peter Zijlstra
Link: http://lkml.kernel.org/r/1341559297-25725-2-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo
04 Jul, 2012
14 commits
-
The if branch is completely unnecessary since 'realloc' can handle
NULL pointers for the first parameter.This patch is just an adoption of Ulrich Drepper's recent patch on
perf tools.Signed-off-by: Namhyung Kim
Cc: Frederic Weisbecker
Cc: Ulrich Drepper
Link: http://lkml.kernel.org/r/1335230984-7613-1-git-send-email-namhyung.kim@lge.com
Signed-off-by: Steven Rostedt
Signed-off-by: Namhyung Kim -
In the current code we assign vsize=8 and then fall through to the
default and assign vsize=1. -> probably the break is missing here,
otherwise we can remove the case.Signed-off-by: Peter Huewe
Signed-off-by: Steven Rostedt
Link: http://lkml.kernel.org/n/tip-3fxjy46h2tr9pl0spv7tems6@git.kernel.org
Signed-off-by: Namhyung Kim -
The arg_to_str() can fail so we should handle that case properly.
Signed-off-by: Namhyung Kim
Cc: Frederic Weisbecker
Cc: Namhyung Kim
Cc: Ingo Molnar
Cc: Arnaldo Carvalho de Melo
Cc: Borislav Petkov
Cc: David Ahern
Link: http://lkml.kernel.org/r/1335157118-14658-12-git-send-email-namhyung.kim@lge.com
Signed-off-by: Steven Rostedt
Signed-off-by: Namhyung Kim -
The malloc can fail so the return value should be checked. For now,
just use malloc_or_die().Signed-off-by: Namhyung Kim
Cc: Frederic Weisbecker
Cc: Namhyung Kim
Cc: Ingo Molnar
Cc: Arnaldo Carvalho de Melo
Cc: Borislav Petkov
Cc: David Ahern
Link: http://lkml.kernel.org/r/1335157118-14658-10-git-send-email-namhyung.kim@lge.com
Signed-off-by: Steven Rostedt
Signed-off-by: Namhyung Kim -
Update and add missing argument descriptions and fix some typo on
function comments.Signed-off-by: Namhyung Kim
Cc: Frederic Weisbecker
Cc: Namhyung Kim
Cc: Ingo Molnar
Cc: Arnaldo Carvalho de Melo
Cc: Borislav Petkov
Cc: David Ahern
Link: http://lkml.kernel.org/r/1335157118-14658-9-git-send-email-namhyung.kim@lge.com
Signed-off-by: Steven Rostedt
Signed-off-by: Namhyung Kim -
When memory allocation for the field name is failed, do not goto
event_failed since we added the event already.Signed-off-by: Namhyung Kim
Cc: Frederic Weisbecker
Cc: Namhyung Kim
Cc: Ingo Molnar
Cc: Arnaldo Carvalho de Melo
Cc: Borislav Petkov
Cc: David Ahern
Link: http://lkml.kernel.org/r/1335157118-14658-8-git-send-email-namhyung.kim@lge.com
Signed-off-by: Steven Rostedt
Signed-off-by: Namhyung Kim -
It seems PEVENT_FUNC_ARG_STRING missed passing the allocated string to
the args array. Fix it.Signed-off-by: Namhyung Kim
Cc: Frederic Weisbecker
Cc: Namhyung Kim
Cc: Ingo Molnar
Cc: Arnaldo Carvalho de Melo
Cc: Borislav Petkov
Cc: David Ahern
Link: http://lkml.kernel.org/r/1335157118-14658-7-git-send-email-namhyung.kim@lge.com
Signed-off-by: Steven Rostedt
Signed-off-by: Namhyung Kim -
The realloc can fail so that we should handle it properly.
Signed-off-by: Namhyung Kim
Cc: Frederic Weisbecker
Cc: Ingo Molnar
Cc: Arnaldo Carvalho de Melo
Cc: Borislav Petkov
Cc: David Ahern
Link: http://lkml.kernel.org/r/1333940074-19052-7-git-send-email-namhyung.kim@lge.com
Signed-off-by: Steven Rostedt
Signed-off-by: Namhyung Kim -
There were some places didn't check return value of the strdup and had
unneeded/duplicated checks. Fix it.Signed-off-by: Namhyung Kim
Cc: Frederic Weisbecker
Cc: Ingo Molnar
Cc: Arnaldo Carvalho de Melo
Cc: Borislav Petkov
Cc: David Ahern
Link: http://lkml.kernel.org/r/1333940074-19052-5-git-send-email-namhyung.kim@lge.com
Signed-off-by: Steven Rostedt
Signed-off-by: Namhyung Kim -
The __read_token() function has some duplicated code to handle
internal buffer overflow. Factor them out to new extend_token().According to the man pages of realloc/free(3), they can handle NULL
pointer input so that it can be ended up to compact the code. Also
handle error path correctly.Signed-off-by: Namhyung Kim
Cc: Frederic Weisbecker
Cc: Ingo Molnar
Cc: Arnaldo Carvalho de Melo
Cc: Borislav Petkov
Cc: David Ahern
Link: http://lkml.kernel.org/r/1333940074-19052-4-git-send-email-namhyung.kim@lge.com
[rostedt@goodmis.org: added some extra whitespace]
Signed-off-by: Steven Rostedt
Signed-off-by: Namhyung Kim -
The printk_cmp function should use printk_map instead of func_map.
Also rename the variables for consistency.Signed-off-by: Namhyung Kim
Cc: Frederic Weisbecker
Cc: Ingo Molnar
Cc: Arnaldo Carvalho de Melo
Cc: Borislav Petkov
Cc: David Ahern
Link: http://lkml.kernel.org/r/1333940074-19052-3-git-send-email-namhyung.kim@lge.com
Signed-off-by: Steven Rostedt
Signed-off-by: Namhyung Kim -
On 32 bit systems, a conversion of the trace_printk format string
"%lu" -> "%llu" is intended (similar for %lx etc.) when a trace was
taken on a machine with 64 bit long integers. However, the current
code computes the bogus transformation "%lu" -> "%u". Fix this.Besides that, the transformation is only required on systems that don't
use 64 bits for long integers natively.Signed-off-by: Wolfgang Mauerer
Signed-off-by: Steven Rostedt
Link: http://lkml.kernel.org/r/1332411501-8059-3-git-send-email-wolfgang.mauerer@siemens.com
Signed-off-by: Namhyung Kim -
When %pM is used, the arg value must be a 6 byte character that will
be printed as a 6 byte MAC address. But the code does a break over the
main code which updates the current processing arg to point to the
next arg. If there are other print arguments after a %pM, they will be
off by one. The next arg will still be processing the %pM arg.Reported-by: Johannes Berg
Signed-off-by: Steven Rostedt
Link: http://lkml.kernel.org/n/tip-q3g0n1espikynsdkpbi6ue6t@git.kernel.org
Signed-off-by: Namhyung Kim -
The RT kernel added a migrate disable counter in all events. Add
support to show this in the latency format.Signed-off-by: Steven Rostedt
Link: http://lkml.kernel.org/n/tip-l6ulxyda952g7kua4pfsh73k@git.kernel.org
Signed-off-by: Namhyung Kim