20 Apr, 2017

2 commits


14 Mar, 2017

1 commit

  • Introduce a new option to record PERF_RECORD_NAMESPACES events emitted
    by the kernel when fork, clone, setns or unshare are invoked. And update
    perf-record documentation with the new option to record namespace
    events.

    Committer notes:

    Combined it with a later patch to allow printing it via 'perf report -D'
    and be able to test the feature introduced in this patch. Had to move
    here also perf_ns__name(), that was introduced in another later patch.

    Also used PRIu64 and PRIx64 to fix the build in some enfironments wrt:

    util/event.c:1129:39: error: format '%lx' expects argument of type 'long unsigned int', but argument 6 has type 'long long unsigned int' [-Werror=format=]
    ret += fprintf(fp, "%u/%s: %lu/0x%lx%s", idx
    ^
    Testing it:

    # perf record --namespaces -a
    ^C[ perf record: Woken up 1 times to write data ]
    [ perf record: Captured and wrote 1.083 MB perf.data (423 samples) ]
    #
    # perf report -D

    3 2028902078892 0x115140 [0xa0]: PERF_RECORD_NAMESPACES 14783/14783 - nr_namespaces: 7
    [0/net: 3/0xf0000081, 1/uts: 3/0xeffffffe, 2/ipc: 3/0xefffffff, 3/pid: 3/0xeffffffc,
    4/user: 3/0xeffffffd, 5/mnt: 3/0xf0000000, 6/cgroup: 3/0xeffffffb]

    0x1151e0 [0x30]: event: 9
    .
    . ... raw event: size 48 bytes
    . 0000: 09 00 00 00 02 00 30 00 c4 71 82 68 0c 7f 00 00 ......0..q.h....
    . 0010: a9 39 00 00 a9 39 00 00 94 28 fe 63 d8 01 00 00 .9...9...(.c....
    . 0020: 03 00 00 00 00 00 00 00 ce c4 02 00 00 00 00 00 ................

    NAMESPACES events: 1

    #

    Signed-off-by: Hari Bathini
    Acked-by: Jiri Olsa
    Tested-by: Arnaldo Carvalho de Melo
    Cc: Alexander Shishkin
    Cc: Alexei Starovoitov
    Cc: Ananth N Mavinakayanahalli
    Cc: Aravinda Prasad
    Cc: Brendan Gregg
    Cc: Daniel Borkmann
    Cc: Eric Biederman
    Cc: Peter Zijlstra
    Cc: Sargun Dhillon
    Cc: Steven Rostedt
    Link: http://lkml.kernel.org/r/148891930386.25309.18412039920746995488.stgit@hbathini.in.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Hari Bathini
     

04 Mar, 2017

1 commit

  • The refcount_t type and corresponding API should be used instead of atomic_t
    when the variable is used as a reference counter.

    This allows to avoid accidental refcounter overflows that might lead to
    use-after-free situations.

    Signed-off-by: Elena Reshetova
    Signed-off-by: David Windsor
    Signed-off-by: Hans Liljestrand
    Signed-off-by: Kees Kook
    Tested-by: Arnaldo Carvalho de Melo
    Cc: Alexander Shishkin
    Cc: Andrew Morton
    Cc: David Windsor
    Cc: Greg Kroah-Hartman
    Cc: Hans Liljestrand
    Cc: Jiri Olsa
    Cc: Kees Kook
    Cc: Mark Rutland
    Cc: Matija Glavinic Pecotic
    Cc: Peter Zijlstra
    Cc: alsa-devel@alsa-project.org
    Link: http://lkml.kernel.org/r/1487691303-31858-9-git-send-email-elena.reshetova@intel.com
    [ Did missing conversion in __machine__remove_thread() ]
    Signed-off-by: Arnaldo Carvalho de Melo

    Elena Reshetova
     

03 Oct, 2016

1 commit

  • Experimenting a bit using cppcheck[1], a static checker brought to my
    attention by Colin, reducing the scope of some variables, reducing the
    line of source code lines in the process:

    $ cppcheck --enable=style tools/perf/util/thread.c
    Checking tools/perf/util/thread.c...
    [tools/perf/util/thread.c:17]: (style) The scope of the variable 'leader' can be reduced.
    [tools/perf/util/thread.c:133]: (style) The scope of the variable 'err' can be reduced.
    [tools/perf/util/thread.c:273]: (style) The scope of the variable 'err' can be reduced.

    Will continue later, but these are already useful, keep them.

    1: https://sourceforge.net/p/cppcheck/wiki/Home/

    Cc: Adrian Hunter
    Cc: Colin Ian King
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-ixws7lbycihhpmq9cc949ti6@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

05 Jul, 2016

2 commits

  • Currently we call unwind__prepare_access for map event. In case we
    report fork event the thread inherits its parent's maps and
    unwind__prepare_access is never called for the thread.

    This causes unwind__get_entries seeing uninitialized
    unwind_libunwind_ops and thus returning no callchain.

    Adding unwind__prepare_access calls for fork even processing.

    Signed-off-by: Jiri Olsa
    Cc: David Ahern
    Cc: He Kuang
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1467634583-29147-5-git-send-email-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     
  • Adding initialized arg into unwind__prepare_access to get feedback about
    the initialization state.

    It's not possible to get it from error code, because we return 0 even in
    case we don't recognize dso, which is valid.

    The 'initialized' value is used in following patch to speedup
    unwind__prepare_access calls logic in fork path.

    Signed-off-by: Jiri Olsa
    Cc: David Ahern
    Cc: He Kuang
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1467634583-29147-4-git-send-email-jolsa@kernel.org
    [ Remove ; after static inline function signatures, fixes build break ]
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     

08 Jun, 2016

1 commit

  • Currently, 'perf script' uses host unwind methods to parse perf.data
    callchain info without taking the target architecture into account, i.e.
    assuming the perf.data file was generated on the same machine where the
    analysis is being performed. So we get wrong result without any warnings
    when unwinding callchains of x86(32-bit) on x86(64-bit) machine.

    This patch adds an extra step that checks the target platform before
    assigning unwind methods. In later patches in this series, we can use
    this info to assign the right unwind methods for supported platforms.

    Committer note:

    After fixing it to register the local unwinder for live mode tools
    ('perf trace', 'perf top'), i.e. tools that don't use a perf.data file,
    it works as intended and passes the 'perf test unwind' test:

    # perf trace -e nanosleep --call dwarf usleep 1
    0.328 ( 0.058 ms): usleep/11115 nanosleep(rqtp: 0x7fff083fa480) = 0
    __nanosleep_nocancel+0x7 (/usr/lib64/libc-2.22.so)
    usleep+0x34 (/usr/lib64/libc-2.22.so)
    main+0x1eb (/usr/bin/usleep)
    __libc_start_main+0xf0 (/usr/lib64/libc-2.22.so)
    _start+0x29 (/usr/bin/usleep)
    # perf test 48
    48: Test dwarf unwind : Ok
    #

    Signed-off-by: He Kuang
    Acked-by: Jiri Olsa
    Tested-by: Arnaldo Carvalho de Melo
    Cc: Adrian Hunter
    Cc: Alexander Shishkin
    Cc: Andi Kleen
    Cc: David Ahern
    Cc: Ekaterina Tumanova
    Cc: Josh Poimboeuf
    Cc: Kan Liang
    Cc: Masami Hiramatsu
    Cc: Namhyung Kim
    Cc: Pekka Enberg
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Cc: Sukadev Bhattiprolu
    Cc: Wang Nan
    Link: http://lkml.kernel.org/r/1464924803-22214-11-git-send-email-hekuang@huawei.com
    [ Fixed exit path for 'live' mode tools, where we need to default to local unwinding ]
    Signed-off-by: Arnaldo Carvalho de Melo

    He Kuang
     

07 Jun, 2016

1 commit

  • To determine the libunwind methods to use, we should get the
    32bit/64bit information from maps of a thread. When a thread is newly
    created, the information is not prepared. This patch moves
    unwind__prepare_access() into thread__insert_map() so we can get the
    information we need from maps. Meanwhile, let thread__insert_map()
    return value and show messages on error.

    Signed-off-by: He Kuang
    Acked-by: Jiri Olsa
    Cc: Adrian Hunter
    Cc: Alexander Shishkin
    Cc: Andi Kleen
    Cc: David Ahern
    Cc: Ekaterina Tumanova
    Cc: Josh Poimboeuf
    Cc: Kan Liang
    Cc: Masami Hiramatsu
    Cc: Namhyung Kim
    Cc: Pekka Enberg
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Cc: Sukadev Bhattiprolu
    Cc: Wang Nan
    Link: http://lkml.kernel.org/r/1464924803-22214-5-git-send-email-hekuang@huawei.com
    Signed-off-by: Arnaldo Carvalho de Melo

    He Kuang
     

30 May, 2016

1 commit

  • Move the get_main_thread function from db-export.c to thread.c so that
    it can be used elsewhere.

    Signed-off-by: Andi Kleen
    Cc: Jiri Olsa
    Link: http://lkml.kernel.org/r/1464051145-19968-2-git-send-email-andi@firstfloor.org
    [ Removed leftover bits from db-export.h ]
    Signed-off-by: Arnaldo Carvalho de Melo

    Andi Kleen
     

27 Apr, 2016

1 commit


26 Apr, 2016

1 commit


14 Dec, 2015

1 commit

  • We should always return from thread__new(), the constructor, with the
    object with a reference count of one, so that:

    struct thread *thread = thread__new();
    thread__put(thread);

    Will call thread__delete().

    If any reference is made to that 'thread' variable, it better use
    thread__get(thread) to hold a reference.

    We were returning with thread->refcnt set to zero, fix it and some cases
    where thread__delete() was being called, which were not a problem
    because just one reference was being used, now that we set it to 1, use
    thread__put() instead.

    Reported-by: Masami Hiramatsu
    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-4b9mkuk66to4ecckpmpvqx6s@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

20 Aug, 2015

1 commit

  • Attempting to clone map groups onto themselves will deadlock.

    It only happens because of other bugs, but the code should protect
    itself anyway.

    Reported-by: Linus Torvalds
    Signed-off-by: Adrian Hunter
    Tested-by: Jiri Olsa
    Link: http://lkml.kernel.org/r/1439994561-27436-2-git-send-email-adrian.hunter@intel.com
    [ Use pr_debug() instead of dump_fprintf() ]
    Signed-off-by: Arnaldo Carvalho de Melo

    Adrian Hunter
     

27 May, 2015

1 commit

  • A thread moves from a rb tree to a list, but can't be on both, because
    those linkage members are in a union. This is leftover from when I was
    debugging thread refcounting and had nuked that union.

    It is harmless duplication, as RB_CLEAR_NODE() does again what
    INIT_LIST_HEAD does.

    Cc: Adrian Hunter
    Cc: Borislav Petkov
    Cc: David Ahern
    Cc: Don Zickus
    Cc: Frederic Weisbecker
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/n/tip-hmma9lmip6qlhzhgkhp9tzd1@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

09 May, 2015

2 commits

  • In addition to using refcounts for the struct thread lifetime
    management, we need to protect access to machine->threads from
    concurrent access.

    That happens in 'perf top', where a thread processes events, inserting
    and deleting entries from that rb_tree while another thread decays
    hist_entries, that end up dropping references and ultimately deleting
    threads from the rb_tree and releasing its resources when no further
    hist_entry (or other data structures, like in 'perf sched') references
    it.

    So the rule is the same for refcounts + protected trees in the kernel,
    get the tree lock, find object, bump the refcount, drop the tree lock,
    return, use object, drop the refcount if no more use of it is needed,
    keep it if storing it in some other data structure, drop when releasing
    that data structure.

    I.e. pair "t = machine__find(new)_thread()" with a "thread__put(t)", and
    "perf_event__preprocess_sample(&al)" with "addr_location__put(&al)".

    The addr_location__put() one is because as we return references to
    several data structures, we may end up adding more reference counting
    for the other data structures and then we'll drop it at
    addr_location__put() time.

    Acked-by: David Ahern
    Cc: Adrian Hunter
    Cc: Borislav Petkov
    Cc: Don Zickus
    Cc: Frederic Weisbecker
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/n/tip-bs9rt4n0jw3hi9f3zxyy3xln@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • Fixing bugs in 'perf top' where the used thread unsafe 'struct thread'
    refcount implementation was falling apart because we really use two
    threads.

    Acked-by: David Ahern
    Cc: Adrian Hunter
    Cc: Borislav Petkov
    Cc: Don Zickus
    Cc: Frederic Weisbecker
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/n/tip-hil2hol294u5ntcuof4jhmn6@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

12 Mar, 2015

1 commit

  • It is set by calling thread__set_comm right before the removed line.

    Signed-off-by: Jiri Olsa
    Cc: Adrian Hunter
    Cc: Corey Ashford
    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/r/1425396581-17716-2-git-send-email-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     

03 Mar, 2015

1 commit

  • We need to do that to stop accumulating entries in the dead_threads
    linked list, i.e. we were keeping references to threads in struct hists
    that continue to exist even after a thread exited and was removed from
    the machine threads rbtree.

    We still keep the dead_threads list, but just for debugging, allowing us
    to iterate at any given point over the threads that still are referenced
    by things like struct hist_entry.

    Cc: Adrian Hunter
    Cc: Borislav Petkov
    Cc: David Ahern
    Cc: Don Zickus
    Cc: Frederic Weisbecker
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/n/tip-3ejvfyed0r7ue61dkurzjux4@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

19 Nov, 2014

1 commit

  • Events may still be ordered even if there are no timestamps e.g. if the
    data is recorded per-thread.

    Also synthesized COMM events have a timestamp of zero.

    Consequently it is better to keep comm entries even if they have a
    timestamp of zero.

    However, when a struct thread is created the command string is not known
    and a comm entry with a string of the form ":" is used.

    In that case thread->comm_set is false and the comm entry should be
    overridden.

    Signed-off-by: Adrian Hunter
    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/r/1415715423-15563-4-git-send-email-adrian.hunter@intel.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Adrian Hunter
     

04 Nov, 2014

1 commit

  • Add a thread stack for synthesizing call chains from call and return
    events.

    Signed-off-by: Adrian Hunter
    Acked-by: Jiri Olsa
    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/r/1414678188-14946-2-git-send-email-adrian.hunter@intel.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Adrian Hunter
     

29 Oct, 2014

3 commits

  • So stop passing both machine and thread to several thread methods,
    reducing function signature length.

    Cc: Adrian Hunter
    Cc: Borislav Petkov
    Cc: David Ahern
    Cc: Don Zickus
    Cc: Frederic Weisbecker
    Cc: Jean Pihet
    Cc: Jiri Olsa
    Cc: Mike Galbraith
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/n/tip-ckcy19dcp1jfkmdihdjcqdn1@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • We were setting this only in machine__init(), i.e. for the map_groups that
    holds the kernel module maps, not for the one used for a thread's executable
    mmaps.

    Now we are sure that we can obtain the machine where a thread is by going
    via thread->mg->machine, thus we can, in the following patch, make all
    codepaths that receive machine _and_ thread, drop the machine one.

    Cc: Adrian Hunter
    Cc: Borislav Petkov
    Cc: David Ahern
    Cc: Don Zickus
    Cc: Frederic Weisbecker
    Cc: Jean Pihet
    Cc: Jiri Olsa
    Cc: Mike Galbraith
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/n/tip-y6zgaqsvhrf04v57u15e4ybm@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • The libunwind provides two caching policy which are global and
    per-thread. As perf unwinds callchains in a single thread, it'd
    sufficient to use global caching.

    This speeds up my perf report from 14s to 7s on a ~260MB data file.
    Although the output sometimes contains a slight difference (~0.01% in
    terms of number of lines printed) on callchains which were not resolved.

    Signed-off-by: Namhyung Kim
    Acked-by: Jean Pihet
    Cc: Arun Sharma
    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Cc: Jean Pihet
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1412556363-26229-4-git-send-email-namhyung@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Namhyung Kim
     

16 Oct, 2014

1 commit

  • The unw_addr_space_t in libunwind represents an address space to be used
    for stack unwinding. It doesn't need to be create/destory everytime to
    unwind callchain (as in get_entries) and can have a same lifetime as
    thread (unless exec called).

    So move the address space construction/destruction logic to the thread
    lifetime handling functions. This is a preparation to enable caching in
    the unwind library.

    Note that it saves unw_addr_space_t object using thread__set_priv(). It
    seems currently only used by perf trace and perf kvm stat commands which
    don't use callchain.

    Signed-off-by: Namhyung Kim
    Acked-by: Jean Pihet
    Acked-by: Jiri Olsa
    Cc: Arun Sharma
    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Cc: Jean Pihet
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1412556363-26229-3-git-send-email-namhyung@kernel.org
    [ Fixup unwind-libunwind.c missing CALLCHAIN_DWARF definition, added
    missing __maybe_unused on unused parameters in stubs at util/unwind.h ]
    Signed-off-by: Arnaldo Carvalho de Melo

    Namhyung Kim
     

14 Aug, 2014

1 commit

  • For grouping together all the data from a single execution, which is
    needed for pairing calls and returns e.g. any outstanding calls when a
    process exec's will never return.

    Signed-off-by: Adrian Hunter
    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/r/1406786474-9306-2-git-send-email-adrian.hunter@intel.com
    [ Remove testing if comm->exec is false before setting it to true ]
    Signed-off-by: Arnaldo Carvalho de Melo

    Adrian Hunter
     

23 Jul, 2014

1 commit

  • Tools may wish to track on which cpu a thread is running. Add 'cpu' to
    struct thread for that purpose.

    This will be used to determine the cpu when decoding a per-thread
    Instruction Trace.

    E.g: Intel PT decoding uses sched_switch events to determine which task
    is running on which cpu. The Intel PT data comes straight from the
    hardware which doesn't know about linux threads.

    Signed-off-by: Adrian Hunter
    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/r/1406035081-14301-16-git-send-email-adrian.hunter@intel.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Adrian Hunter
     

17 Jul, 2014

3 commits

  • And use verbose as an global object in following functions:

    __map_groups__fprintf_maps
    __map_groups__fprintf_removed_maps
    map_groups__fprintf_maps
    map_groups__fprintf

    Also making map_groups__fprintf_maps static.

    Signed-off-by: Jiri Olsa
    Cc: Corey Ashford
    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1405374411-29012-2-git-send-email-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     
  • It needs to be possible to call thread__delete() on a thread with no map
    groups.

    This is needed for a subsequent patch which deletes a thread on the
    error path before map groups have been attached.

    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/r/1405495184-20441-2-git-send-email-adrian.hunter@intel.com
    Signed-off-by: Adrian Hunter
    Signed-off-by: Arnaldo Carvalho de Melo

    Adrian Hunter
     
  • The value used for unknown pids cannot be zero because that is used by
    the "idle" task.

    Use -1 instead. Also handle the unknown pid case when creating map
    groups.

    Note that, threads with an unknown pid should not occur because fork (or
    synthesized) events precede the thread's existence.

    Signed-off-by: Adrian Hunter
    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/r/1405332185-4050-2-git-send-email-adrian.hunter@intel.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Adrian Hunter
     

28 Apr, 2014

3 commits

  • Sharing map groups within all process threads. This way
    there's only one copy of mmap info and it's reachable
    from any thread within the process.

    Original-patch-by: Arnaldo Carvalho de Melo
    Acked-by: Namhyung Kim
    Cc: Adrian Hunter
    Cc: Corey Ashford
    Cc: David Ahern
    Cc: Don Zickus
    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Cc: Mike Galbraith
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/r/1397490723-1992-5-git-send-email-jolsa@redhat.com
    Signed-off-by: Jiri Olsa

    Jiri Olsa
     
  • We will share it among threads in the same process.
    Adding map_groups__get/map_groups__put interface for that.

    Signed-off-by: Arnaldo Carvalho de Melo
    Acked-by: Namhyung Kim
    Cc: Adrian Hunter
    Cc: Corey Ashford
    Cc: David Ahern
    Cc: Don Zickus
    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Cc: Mike Galbraith
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/r/1397490723-1992-4-git-send-email-jolsa@redhat.com
    Signed-off-by: Jiri Olsa

    Arnaldo Carvalho de Melo
     
  • Moving towards sharing map groups within a process threads.

    Because of this we need the map groups to be dynamically allocated. No
    other functional change is intended in here.

    Based on a patch by Jiri Olsa, but this time _just_ making the
    conversion from statically allocating thread->mg to turning it into a
    pointer and instead of initializing it at thread's constructor,
    introduce a constructor/destructor for the map_groups class and
    call at thread creation time.

    Later we will introduce the get/put methods when we move to sharing
    those map_groups, when the get/put refcounting semantics will be needed.

    Signed-off-by: Arnaldo Carvalho de Melo
    Acked-by: Namhyung Kim
    Cc: Adrian Hunter
    Cc: Corey Ashford
    Cc: David Ahern
    Cc: Don Zickus
    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Cc: Mike Galbraith
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/r/1397490723-1992-3-git-send-email-jolsa@redhat.com
    Signed-off-by: Jiri Olsa

    Arnaldo Carvalho de Melo
     

15 Mar, 2014

1 commit

  • Its one level up thread__find_addr_location, where it will look in
    different domains for a sample: user, kernel, hypervisor, etc.

    Will soon be used by a patchkit by Andi Kleen.

    Cc: Adrian Hunter
    Cc: Andi Kleen
    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Jiri Olsa
    Cc: Mike Galbraith
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/n/tip-so6nxkh7xj48bc5kq4jpj991@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

17 Jan, 2014

1 commit

  • The comm overriding API ignores memory allocation failures by silently
    keeping the previous and out of date comm.

    As a result, the user may get buggy events without ever being notified
    about the problem and its source.

    Lets start to fix this by propagating the error from the API. Not all
    callers may be doing proper error handling on comm set yet but this is
    the first step toward it.

    Signed-off-by: Frederic Weisbecker
    Acked-by: Namhyung Kim
    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Ingo Molnar
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/r/1389713836-13375-2-git-send-email-fweisbec@gmail.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Frederic Weisbecker
     

13 Dec, 2013

1 commit

  • Commit 1902efe7f for the new comm infra added the wrong check for return
    code on thread__set_comm. err == 0 is normal, so don't return at that
    point unless err != 0.

    Signed-off-by: David Ahern
    Cc: Frederic Weisbecker
    Link: http://lkml.kernel.org/r/1386736538-23525-1-git-send-email-dsahern@gmail.com
    Signed-off-by: Arnaldo Carvalho de Melo

    David Ahern
     

19 Nov, 2013

1 commit

  • The problem is that when a thread overrides its default ":%pid" comm, we
    forget to tag the thread comm as overriden. Hence, this overriden comm
    is not inherited on future forks. Fix it.

    Signed-off-by: Frederic Weisbecker
    Tested-by: David Ahern
    Acked-by: Namhyung Kim
    Cc: David Ahern
    Cc: Ingo Molnar
    Cc: Namhyung Kim
    Link: http://lkml.kernel.org/r/20131116010207.GA18855@localhost.localdomain
    Signed-off-by: Arnaldo Carvalho de Melo

    Frederic Weisbecker
     

04 Nov, 2013

3 commits

  • At insert time, a hist entry should reference comm at the time otherwise
    it'll get the last comm anyway.

    Signed-off-by: Namhyung Kim
    Acked-by: Frederic Weisbecker
    Tested-by: Jiri Olsa
    Cc: Frederic Weisbecker
    Link: http://lkml.kernel.org/n/tip-n6pykiiymtgmcjs834go2t8x@git.kernel.org
    [ Fixed up const pointer issues ]
    Signed-off-by: Arnaldo Carvalho de Melo

    Namhyung Kim
     
  • This new COMM infrastructure provides two features:

    1) It keeps track of all comms lifecycle for a given thread. This way we
    can associate a timeframe to any thread COMM, as long as
    PERF_SAMPLE_TIME samples are joined to COMM and fork events.

    As a result we should have more precise COMM sorted hists with seperated
    entries for pre and post exec time after a fork.

    2) It also makes sure that a given COMM string is not duplicated but
    rather shared among the threads that refer to it. This way the threads
    COMM can be compared against pointer values from the sort
    infrastructure.

    Signed-off-by: Frederic Weisbecker
    Tested-by: Jiri Olsa
    Cc: Jiri Olsa
    Cc: David Ahern
    Cc: Ingo Molnar
    Cc: Peter Zijlstra
    Cc: Arnaldo Carvalho de Melo
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/n/tip-hwjf70b2wve9m2kosxiq8bb3@git.kernel.org
    [ Rename some accessor functions ]
    Signed-off-by: Namhyung Kim
    [ Use __ as separator for class__method for private comm_str methods ]
    Signed-off-by: Arnaldo Carvalho de Melo

    Frederic Weisbecker
     
  • This way we can later delimit a lifecycle for the COMM and map a hist to
    a precise COMM:timeslice couple.

    PERF_RECORD_COMM and PERF_RECORD_FORK events that don't have
    PERF_SAMPLE_TIME samples can only send 0 value as a timestamp and thus
    should overwrite any previous COMM on a given thread because there is no
    sensible way to keep track of all the comms lifecycles in a thread
    without time informations.

    Signed-off-by: Frederic Weisbecker
    Tested-by: Jiri Olsa
    Cc: Jiri Olsa
    Cc: David Ahern
    Cc: Ingo Molnar
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/n/tip-6tyow99vgmmtt9qwr2u2lqd7@git.kernel.org
    [ Made it cope with PERF_RECORD_MMAP2 ]
    Signed-off-by: Arnaldo Carvalho de Melo

    Frederic Weisbecker