05 Oct, 2013

1 commit

  • commit ce7eebe5c3deef8e19c177c24ee75843256e69ca upstream.

    The compilation only looks for linux/magic.h from the default include
    paths, which does not include the source tree. This results in a build
    error if linux/magic.h is not available or not installed.

    For example, this build error occurs on CentOS 5.

    $ make -C tools/lib/lk V=1
    [...]
    gcc -o debugfs.o -c -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6
    -D_FORTIFY_SOURCE=2 -Wbad-function-cast -Wdeclaration-after-statement
    -Wformat-security -Wformat-y2k -Winit-self -Wmissing-declarations
    -Wmissing-prototypes -Wnested-externs -Wno-system-headers
    -Wold-style-definition -Wpacked -Wredundant-decls -Wshadow
    -Wstrict-aliasing=3 -Wstrict-prototypes -Wswitch-default -Wswitch-enum
    -Wundef -Wwrite-strings -Wformat -fPIC -D_LARGEFILE64_SOURCE
    -D_FILE_OFFSET_BITS=64 debugfs.c
    debugfs.c:8:25: error: linux/magic.h: No such file or directory

    The only symbol from linux/magic.h needed by debugfs.c is DEBUGFS_MAGIC,
    and that is already defined in debugfs.h. linux/magic.h isn't providing
    any extra symbols and can unincluded. This is similar to the approach by
    perf, which has its own magic.h wrapper at
    tools/perf/util/include/linux/magic.h

    Signed-off-by: Vinson Lee
    Acked-by: Borislav Petkov
    Cc: Borislav Petkov
    Cc: Vinson Lee
    Link: http://lkml.kernel.org/r/1379546200-17028-1-git-send-email-vlee@freedesktop.org
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Greg Kroah-Hartman

    Vinson Lee
     

16 Mar, 2013

3 commits

  • Jiri Olsa triggers the following build error:

    SUBDIR ../lib/lk/
    CC debugfs.o
    In file included from /usr/include/errno.h:29:0,
    from debugfs.c:1:
    /usr/include/features.h:314:4: error: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Werror=cpp]

    This is because enabling buffer overflow checks through _FORTIFY_SOURCE
    require compiler optimizations to be enabled too. However, those are
    not. Enable them by simply copying the perf optimization level. It can
    be expanded later if we want to support debug builds, etc.

    Signed-off-by: Borislav Petkov
    Reported-by: Jiri Olsa
    Link: http://lkml.kernel.org/r/1362338733-8718-1-git-send-email-bp@alien8.de
    Signed-off-by: Arnaldo Carvalho de Melo

    Borislav Petkov
     
  • Move them to util.c and simplify code a bit.

    Signed-off-by: Borislav Petkov
    Cc: Ingo Molnar
    Cc: Steven Rostedt
    Link: http://lkml.kernel.org/r/1361374353-30385-6-git-send-email-bp@alien8.de
    Signed-off-by: Arnaldo Carvalho de Melo

    Borislav Petkov
     
  • This introduces the tools/lib/lk library, that will gradually have the
    routines that now are used in tools/perf/ and other tools and that can
    be shared.

    Start by carving out debugfs routines for general use.

    Signed-off-by: Borislav Petkov
    Cc: Ingo Molnar
    Cc: Steven Rostedt
    Link: http://lkml.kernel.org/r/1361374353-30385-5-git-send-email-bp@alien8.de
    [ committer note: Add tools/lib/lk/ to perf's MANIFEST so that its tarballs continue to build ]
    Signed-off-by: Arnaldo Carvalho de Melo

    Borislav Petkov
     

14 Mar, 2013

1 commit

  • having /usr/local/include hardcoded into the makefile is not necessary
    as this is automatically included by GCC. It also infects cross-compile
    builds with the host systems includes.

    Signed-off-by: Jack Mitchell
    Acked-by: Namhyung Kim
    Cc: Ingo Molnar
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1362741712-21308-1-git-send-email-ml@communistcode.co.uk
    Signed-off-by: Arnaldo Carvalho de Melo

    Jack Mitchell
     

25 Jan, 2013

6 commits

  • Fixing the dynamic array format field parsing.

    Currently the event_read_fields function could segfault while parsing
    dynamic array other than string type. The reason is the event->pevent
    does not need to be set and gets dereferenced unconditionaly.

    Also adding proper initialization of field->elementsize based on the
    parsed dynamic type.

    Signed-off-by: Jiri Olsa
    Acked-by: Steven Rostedt
    Cc: Corey Ashford
    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Steven Rostedt
    Link: http://lkml.kernel.org/r/1359060403-32422-1-git-send-email-jolsa@redhat.com
    [ committer note: Made a char pointer parameter const, as requested by Steven ]
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     
  • For some reason the libtraceevent tracepoint-parsing code is missing
    the FIELD_IS_SIGNED flag-setting code, which causes problems for the
    Perl trace event binding at least, since it ends up unable to
    recognize negative numbers.

    Things like checking for negative return values therefore fail, causing
    scripts like rwtop to instead interpret the negative return value as a
    large positive value, which in turn get added to e.g. read totals with
    insanely invalid results.

    So set the FIELD_IS_SIGNED flag for tracepoint events that specify
    "signed:1".

    Before:

    # perf script record rw-by-pid
    # perf script report rw-by-pid

    read counts by pid:

    pid comm # reads bytes_requested bytes_read
    ------ -------------------- ----------- ---------- ----------
    753 Xorg 88 512000 7.74763251095801e+20
    1619 firefox 42 462 2.58254417031934e+20
    1232 gnome-shell 11 176 1.10680464442257e+20
    1471 gnome-terminal 3 16366 18446744073709551615
    1408 libsocialweb-co 2 32 18446744073709551613

    After:

    # perf script report rw-by-pid

    read counts by pid:

    pid comm # reads bytes_requested bytes_read
    ------ -------------------- ----------- ---------- ----------
    753 Xorg 88 512000 2764
    1619 firefox 42 462 126
    1232 gnome-shell 11 176 40
    1471 gnome-terminal 3 16366 10
    1408 libsocialweb-co 2 32 8

    Signed-off-by: Tom Zanussi
    Link: http://lkml.kernel.org/r/1471b5968821a455cf5168bb4567964e74ecf530.1358527965.git.tom.zanussi@linux.intel.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Tom Zanussi
     
  • Although the '>=' (and '='
    Warning: unknown op '>='
    Warning: unknown op '>='
    Warning: unknown op '>='
    Warning: unknown op '>='
    Warning: unknown op '>='
    ...

    Add the operator to the checks.

    Signed-off-by: Namhyung Kim
    Acked-by: Steven Rostedt
    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Cc: Jiri Olsa
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Steven Rostedt
    Link: http://lkml.kernel.org/r/1358236939-17393-1-git-send-email-namhyung@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Namhyung Kim
     
  • Adding a missing copyright header to parse-utils.c. Assuminng that the
    license is LGPL like the rest of the trace-cmd library code.

    Signed-off-by: Jon Stanley
    Acked-by: Steven Rostedt
    Cc: Steven Rostedt
    Link: http://lkml.kernel.org/r/1347127251-4695-1-git-send-email-jonstanley@gmail.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Jon Stanley
     
  • The FSF now prefers to use URL's in copyright headers rather than
    their postal address. This change updates the address to be
    per http://www.gnu.org/licenses/gpl-howto.html

    Signed-off-by: Jon Stanley
    Acked-by: Steven Rostedt
    Cc: Steven Rostedt
    Link: http://lkml.kernel.org/r/1347049967-3143-1-git-send-email-jonstanley@gmail.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Jon Stanley
     
  • we've tested the wrong variable for allocation failure, fix it to
    test the right one.

    Cc: Frederic Weisbecker
    Cc: Namhyung Kim
    Cc: Steven Rostedt
    Link: http://lkml.kernel.org/r/1356120062-2648-1-git-send-email-sasha.levin@oracle.com
    Signed-off-by: Sasha Levin
    Signed-off-by: Arnaldo Carvalho de Melo

    Sasha Levin
     

10 Nov, 2012

5 commits

  • Fixing the build on fedora 14, 32-bit:

    tools/lib/traceevent/event-parse.c: In function ‘find_cmdline’:
    tools/lib/traceevent/event-parse.c:183:3: error: return discards qualifiers from pointer target type
    tools/lib/traceevent/event-parse.c:186:3: error: return discards qualifiers from pointer target type
    tools/lib/traceevent/event-parse.c:195:2: error: return discards qualifiers from pointer target type
    tools/lib/traceevent/event-parse.c: In function ‘process_func_handler’:
    tools/lib/traceevent/event-parse.c:2658:9: error: assignment discards qualifiers from pointer target type
    tools/lib/traceevent/event-parse.c:2660:9: error: assignment discards qualifiers from pointer target type
    tools/lib/traceevent/event-parse.c: In function ‘print_mac_arg’:
    tools/lib/traceevent/event-parse.c:3892:14: error: initialization discards qualifiers from pointer target type
    tools/lib/traceevent/event-parse.c:3906:7: error: assignment discards qualifiers from pointer target type
    tools/lib/traceevent/event-parse.c: In function ‘pevent_print_event’:
    tools/lib/traceevent/event-parse.c:4412:24: error: initialization discards qualifiers from pointer target type

    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Mike Galbraith
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Cc: Steven Rostedt
    Link: http://lkml.kernel.org/n/tip-0k5g8urwu7vwkgbcbt2x05fe@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • gcc on f14 32-bit rightly complains:

    tools/lib/traceevent/event-parse.c:5097:2: error: enumeration value ‘PEVENT_ERRNO__INVALID_ARG_TYPE’ not handled in switch

    The entry for it is in the error strings array pevent_error_str[]:

    _PE(INVALID_ARG_TYPE, "invalid argument type")

    It was just not being handled on the pevent_strerror switch, fix it.

    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Mike Galbraith
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Cc: Steven Rostedt
    Link: http://lkml.kernel.org/n/tip-c68zkvxw4289uqbosfkz963g@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • gcc on f14 32-bit complains:

    tools/lib/traceevent/event-parse.c: In function ‘pevent_register_print_function’:
    tools/lib/traceevent/event-parse.c:5366:3: error: comparison of unsigned expression < 0 is always false

    This is because:

    enum pevent_func_arg_type type;

    this enum doesn't have any negative value, so gcc makes it an 'unsigned
    int'. Fix it by removing the < 0 test.

    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Mike Galbraith
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Cc: Steven Rostedt
    Link: http://lkml.kernel.org/n/tip-6vnd6ud6fbpn48zax4a5ru01@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • Fixing this warning-as-error on f14 32-bit:

    tools/lib/traceevent/event-parse.c:5564:17: error: comparison between signed and unsigned integer expressions
    tools/lib/traceevent/event-parse.c:5586:17: error: comparison between signed and unsigned integer expressions

    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Mike Galbraith
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Cc: Steven Rostedt
    Link: http://lkml.kernel.org/n/tip-stmix8hy4nu5ervpynn8yj2z@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • Fixing the build on 32-bit Fedora 14:

    tools/lib/traceevent/event-parse.c: In function ‘print_event_fields’:
    tools/lib/traceevent/event-parse.c:3934:69: error: unused parameter ‘size’
    tools/lib/traceevent/event-parse.c: In function ‘pevent_strerror’:
    tools/lib/traceevent/event-parse.c:5074:36: error: unused parameter ‘pevent’

    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Mike Galbraith
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Cc: Steven Rostedt
    Link: http://lkml.kernel.org/n/tip-soe4gqcz8fd4ecik6exvyqox@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

26 Oct, 2012

1 commit

  • Ingo reported (again!) that 'make clean' on perf/traceevent does not
    work due to some reason with system header file. Quotes Ingo:

    "Note that the old dependency related build failure thought to be
    fixed in commit 860df5833e46 is back:

    make[1]: *** No rule to make target
    `/usr/lib/gcc/x86_64-redhat-linux/4.7.0/include/stddef.h', needed by `.trace-seq.d'. Stop.

    'make clean' itself does not work in libtraceevent:

    comet:~/tip/tools/lib/traceevent> make clean
    make: *** No rule to make target `/usr/lib/gcc/x86_64-redhat-linux/4.7.0/include/stddef.h', needed by `.trace-seq.d'. Stop.

    So I had to clean it out manually:

    comet:~/tip/tools/lib/traceevent> git ls-files --others | xargs rm
    comet:~/tip/tools/lib/traceevent>

    and then things build fine."

    Try to fix it by excluding system headers from dependency generation.

    Signed-off-by: Namhyung Kim
    Reported-by: Ingo Molnar
    Cc: Borislav Petkov
    Cc: Ingo Molnar
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Steven Rostedt
    Link: http://lkml.kernel.org/r/1351241752-2919-1-git-send-email-namhyung@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Namhyung Kim
     

17 Oct, 2012

2 commits

  • Some of args were missed in free_args(), as well as subargs.

    That is args like FILTER_ARG_NUM have left and right pointers to other
    args that also need to be freed.

    Signed-off-by: Steven Rostedt
    Cc: Ingo Molnar
    Cc: Namhyung Kim
    Link: http://lkml.kernel.org/r/1349137408.22822.135.camel@gandalf.local.home
    Signed-off-by: Arnaldo Carvalho de Melo

    Steven Rostedt
     
  • Even though with the change of commit commit 2b29175 "tools lib
    traceevent: Carve out events format parsing routine", allowed
    __pevent_parse_format() to parse an event without the need of a pevent
    handler, the event still needs to assign the pevent handed to it.

    There's no problem with assigning it if the pevent is NULL, as the
    event->pevent would be NULL without the assignment. But function parsing
    handlers may be assigned to the pevent handler to help in parsing the
    event. If there's no pevent then there would not be any function
    handlers, but if the pevent isn't assigned first before parsing the
    event, it wont honor the function handlers that were assigned.

    Worse yet, the current code crashes if an event has a function that it
    tries to parse. For example:

    # perf record -e scsi:scsi_dispatch_cmd_timeout
    Segmentation fault (core dumped)

    This happens because the scsi_dispatch_cmd_timeout event format has the following:

    scsi_trace_parse_cdb(p, __get_dynamic_array(cmnd), REC->cmd_len)

    which hasn't been defined by the pevent code.

    Signed-off-by: Steven Rostedt
    Reviewed-by: Namhyung Kim
    Cc: Ingo Molnar
    Cc: Namhyung Kim
    Link: http://lkml.kernel.org/r/1349136831.22822.133.camel@gandalf.local.home
    Signed-off-by: Arnaldo Carvalho de Melo

    Steven Rostedt
     

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

    Namhyung Kim
     

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

    Namhyung Kim
     
  • 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

    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

    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

    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

    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

    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

    Namhyung Kim
     
  • 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

    Namhyung Kim
     
  • 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

    Namhyung Kim
     
  • 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

    Namhyung Kim
     

15 Sep, 2012

1 commit

  • For the reasons stated on:

    commit 0a84f00
    Author: David Daney

    perf 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

    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

    Irina Tirdea
     

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

    Irina Tirdea
     

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

    Namhyung Kim
     
  • 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

    Namhyung Kim
     
  • 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

    Namhyung Kim
     

06 Sep, 2012

1 commit


23 Aug, 2012

3 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

    Namhyung Kim
     
  • 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

    Namhyung Kim
     
  • 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

    Namhyung Kim