21 Oct, 2014

2 commits

  • Eliminate an error message for batch-mode processing on unix
    systems. ACPICA BZ 1114.

    This patch is mainly for fixing the issues of acpiexec which is not in the
    Linux upstream.

    Link: https://bugs.acpica.org/show_bug.cgi?id=1114
    Signed-off-by: Bob Moore
    Signed-off-by: Lv Zheng
    Signed-off-by: Rafael J. Wysocki

    Bob Moore
     
  • The acpidump currently always uses ACPI 2.0 format to dump RSDP, this patch
    adds ACPI 1.0 RSDP support.

    Link: https://bugs.acpica.org/show_bug.cgi?id=1097
    Link: https://bugs.acpica.org/show_bug.cgi?id=1103
    Signed-off-by: Lv Zheng
    Reported-and-tested-by: Rudolf Marek
    Reported-and-tested-by: Rafal
    Signed-off-by: Bob Moore
    Signed-off-by: Rafael J. Wysocki

    Lv Zheng
     

18 Oct, 2014

2 commits

  • Adding period as a default output column in script command fo hardware,
    software and raw events.

    If PERF_SAMPLE_PERIOD sample type is defined in perf.data, following
    will be displayed in perf script output:

    $ perf script
    ls 8034 57477.887209: 250000 task-clock: ffffffff81361d72 memset ([kernel.kallsyms])
    ls 8034 57477.887464: 250000 task-clock: ffffffff816f6d92 _raw_spin_unlock_irqrestore ([kernel.kallsyms])
    ls 8034 57477.887708: 250000 task-clock: ffffffff811a94f0 do_munmap ([kernel.kallsyms])
    ls 8034 57477.887959: 250000 task-clock: 34080916c6 get_next_seq (/usr/lib64/libc-2.17.so)
    ls 8034 57477.888208: 250000 task-clock: 3408079230 _IO_doallocbuf (/usr/lib64/libc-2.17.so)
    ls 8034 57477.888717: 250000 task-clock: ffffffff814242c8 n_tty_write ([kernel.kallsyms])
    ls 8034 57477.889285: 250000 task-clock: 3408076402 fwrite_unlocked (/usr/lib64/libc-2.17.so)

    Signed-off-by: Jiri Olsa
    Cc: David Ahern
    Cc: "Jen-Cheng(Tommy) Huang"
    Cc: Andi Kleen
    Cc: Corey Ashford
    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Cc: Jen-Cheng(Tommy) Huang
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/r/1408977943-16594-10-git-send-email-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     
  • Adding period data column to be displayed in perf script. It's possible
    to get period values using -f option, like:

    $ perf script -f comm,tid,time,period,ip,sym,dso
    :26019 26019 52414.329088: 3707 ffffffff8105443a native_write_msr_safe ([kernel.kallsyms])
    :26019 26019 52414.329088: 44 ffffffff8105443a native_write_msr_safe ([kernel.kallsyms])
    :26019 26019 52414.329093: 1987 ffffffff8105443a native_write_msr_safe ([kernel.kallsyms])
    :26019 26019 52414.329093: 6 ffffffff8105443a native_write_msr_safe ([kernel.kallsyms])
    ls 26019 52414.329442: 537558 3407c0639c _dl_map_object_from_fd (/usr/lib64/ld-2.17.so)
    ls 26019 52414.329442: 2099 3407c0639c _dl_map_object_from_fd (/usr/lib64/ld-2.17.so)
    ls 26019 52414.330181: 1242100 34080917bb get_next_seq (/usr/lib64/libc-2.17.so)
    ls 26019 52414.330181: 3774 34080917bb get_next_seq (/usr/lib64/libc-2.17.so)
    ls 26019 52414.331427: 1083662 ffffffff810c7dc2 update_curr ([kernel.kallsyms])
    ls 26019 52414.331427: 360 ffffffff810c7dc2 update_curr ([kernel.kallsyms])

    Signed-off-by: Jiri Olsa
    Acked-by: David Ahern
    Cc: "Jen-Cheng(Tommy) Huang"
    Cc: Andi Kleen
    Cc: Corey Ashford
    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Cc: Jen-Cheng(Tommy) Huang
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/r/1408977943-16594-9-git-send-email-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     

17 Oct, 2014

3 commits

  • The only thing we need is a forward declaration for 'struct cgroup_sel',
    that is inside 'struct perf_evsel'.

    Include cgroup.h instead on the tools that support cgroups.

    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-b7kuymbgf0zxi5viyjjtu5hk@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • It was being found, by chance, because evsel.h needlessly includes
    util/cgroup.h, which will be sorted out in a following patch.

    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-xsvxr747wkkpg1ay9dramorr@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • So that when an evsel is embedded into other struct it can free up
    resources calling perf_evsel__exit().

    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-n1w68pfe9m2vkhm4sqs8y1en@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

16 Oct, 2014

13 commits

  • Process of analyzing events caused by 2 functions: mmap_read() and
    finished_round().

    During mmap_read(), perf receives events from shared memory, queues
    their pointers for further processing in finished_round() and notifies
    the kernel that the events have been processed.

    By the time when finished_round() is invoked, queued events can be
    overwritten by the kernel, so the finished_round() occurs on potentially
    corrupted memory.

    Since there is no place where the event can be safely consumed, let's
    copy events when queueing.

    Signed-off-by: Alexander Yarygin
    Cc: Christian Borntraeger
    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
    Link: http://lkml.kernel.org/r/1412347212-28237-3-git-send-email-yarygin@linux.vnet.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Alexander Yarygin
     
  • When processing events the session code has an ordered samples queue
    which is used to time-sort events coming in across multiple mmaps. At a
    later point in time samples on the queue are flushed up to some
    timestamp at which point the event is actually processed.

    When analyzing events live (ie., record/analysis path in the same
    command) there is a race that leads to corrupted events and parse errors
    which cause perf to terminate. The problem is that when the event is
    placed in the ordered samples queue it is only a reference to the event
    which is really sitting in the mmap buffer. Even though the event is
    queued for later processing the mmap tail pointer is updated which
    indicates to the kernel that the event has been processed. The race is
    flushing the event from the queue before it gets overwritten by some
    other event. For commands trying to process events live (versus just
    writing to a file) and processing a high rate of events this leads to
    parse failures and perf terminates.

    Examples hitting this problem are 'perf kvm stat live', especially with
    nested VMs which generate 100,000+ traces per second, and a command
    processing scheduling events with a high rate of context switching --
    e.g., running 'perf bench sched pipe'.

    This patch offers live commands an option to copy the event when it is
    placed in the ordered samples queue.

    Based on a patch from David Ahern

    Signed-off-by: Alexander Yarygin
    Acked-by: Jiri Olsa
    Cc: Christian Borntraeger
    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
    Link: http://lkml.kernel.org/r/1412347212-28237-2-git-send-email-yarygin@linux.vnet.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Alexander Yarygin
     
  • This patch fix spelling typos found in tool/perf/Documentation.

    Signed-off-by: Masanari Iida
    Acked-by: Randy Dunlap
    Cc: Ingo Molnar
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Randy Dunlap
    Link: http://lkml.kernel.org/r/1410275930-17207-1-git-send-email-standby24x7@gmail.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Masanari Iida
     
  • This is mechanical changes only for accounting access to thread->priv
    properly in the source level.

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

    Namhyung Kim
     
  • This is mechanical changes only for accounting access to thread->priv
    properly in the source level.

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

    Namhyung Kim
     
  • 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
     
  • Normally the callchain_param.record_mode is used only for record path.
    But as it might need to prepare something for dwarf unwinding, setup
    this info for perf report too.

    Signed-off-by: Namhyung Kim
    Acked-by: Jiri Olsa
    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-2-git-send-email-namhyung@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Namhyung Kim
     
  • Fix for double free bug in tools/perf due to dangling thread_map pointer
    in perf_evlist struct.

    Code path excercised when perf stat -C switch is used but not set and is
    followed by another switch.

    Example:

    perf stat -C -e.

    Signed-off-by: Yasser Shalabi
    Acked-by: Namhyung Kim
    Cc: Ingo Molnar
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1412437077-13109-1-git-send-email-yassershalabi@gmail.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Yasser Shalabi
     
  • Add test case in automated tests suite. It checks not only the two types
    of pmu event stytle formats "pmu_event_name" and "cpu/pmu_event_name/",
    but also the different formats mixtures which are more likely to trigger
    parse issue.

    The patch set including this one has been tested by the perf automated
    test:

    ./perf test parse -v"

    On haswell, ivybridge and Romley platform.

    The patch set also has been tested on haswell by the following script.

    Note: please make sure that your test system support TSX and
    L1-dcache-loads events. Otherwise, you may want to change the events to
    other pmu events.

    [lk@localhost ~]$ cat perf_style_test.sh
    # hardware events + kernel pmu event with different style
    perf stat -x, -e cycles,mem-stores,tx-start sleep 2
    perf stat -x, -e cpu-cycles,cycles-ct,cycles-t sleep 2
    perf stat -x, -e cycles,cpu/cycles-ct/,cpu/cycles-t/ sleep 2
    perf stat -x, -e instructions,cpu/tx-start/ sleep 2
    perf stat -x, -e '{cycles,tx-start}' sleep 2
    perf stat -x, -e '{cycles,cpu/tx-start/}' sleep 2

    # HW Cache event + kernel pmu event with different style
    perf stat -x, -e L1-dcache-loads,cpu/mem-stores/,tx-start sleep 2
    perf stat -x, -e L1-dcache-loads,mem-stores,cpu/tx-start/ sleep 2
    perf stat -x, -e '{L1-dcache-loads,mem-stores}' sleep 2
    perf stat -x, -e '{L1-dcache-loads,cpu/tx-start/}' sleep 2

    # Raw event + kernel pmu event with different style:
    perf stat -x, -e cpu/event=0xc0,umask=0x00/,mem-loads,cpu/mem-stores/ sleep 2
    perf stat -x, -e cpu/event=0xc0,umask=0x00/,tx-start,cpu/el-start/ sleep 2
    perf stat -x, -e '{cpu/event=0xc0,umask=0x00/,tx-start}' sleep 2

    Signed-off-by: Kan Liang
    Acked-by: Jiri Olsa
    Cc: Andi Kleen
    Cc: Jiri Olsa
    Link: http://lkml.kernel.org/r/1412694532-23391-5-git-send-email-kan.liang@intel.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Kan Liang
     
  • Add new rules for kernel PMU event.

    Currently, the patch only want to handle the PMU event name as "a-b" and
    "a".

    event_pmu:
    PE_KERNEL_PMU_EVENT sep_dc
    |
    PE_PMU_EVENT_PRE '-' PE_PMU_EVENT_SUF sep_dc

    PE_KERNEL_PMU_EVENT token is for
    cycles-ct/cycles-t/mem-loads/mem-stores.

    The prefix cycles is mixed up with cpu-cycles. loads and stores are
    mixed up with cache event So they have to be hardcode in lex.

    PE_PMU_EVENT_PRE and PE_PMU_EVENT_SUF tokens are for other PMU events.

    The lex looks generic identifier up in the table and return the matched
    token. If there is no match, generic PE_NAME token will be return.

    Using the rules, kernel PMU event could use new style format without //

    so you can use:

    perf record -e mem-loads ...

    instead of:

    perf record -e cpu/mem-loads/

    Signed-off-by: Kan Liang
    Acked-by: Jiri Olsa
    Cc: Andi Kleen
    Cc: Jiri Olsa
    Link: http://lkml.kernel.org/r/1412694532-23391-4-git-send-email-kan.liang@intel.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Kan Liang
     
  • There are two types of event formats for PMU events. E.g. el-abort OR
    cpu/el-abort/. However, the lexer mistakenly recognizes the simple style
    format as two events.

    The parse_events_pmu_check function uses bsearch to search the name in
    known pmu event list. It can tell the lexer that the name is a PE_NAME
    or a PMU event name prefix or a PMU event name suffix. All these
    information will be used for accurately parsing kernel PMU events.

    The pmu events list will be read from sysfs at runtime.

    Note: Currently, the patch only want to handle the PMU event name as
    "a-b" and "a". The only exception, "stalled-cycles-frontend" and
    "stalled-cycles-fronted", are already hardcoded in lexer.

    Signed-off-by: Kan Liang
    Acked-by: Jiri Olsa
    Cc: Andi Kleen
    Cc: Jiri Olsa
    Link: http://lkml.kernel.org/r/1412694532-23391-3-git-send-email-kan.liang@intel.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Kan Liang
     
  • This reverts commit 50e200f07948 ("perf tools: Default to cpu// for
    events v5")

    The fixup cannot handle the case that
    new style format(which without //) mixed with
    other different formats.

    For example,
    group events with new style format: {mem-stores,mem-loads}
    some hardware event + new style event: cycles,mem-loads
    Cache event + new style event: LLC-loads,mem-loads
    Raw event + new style event:
    cpu/event=0xc8,umask=0x08/,mem-loads
    old style event and new stytle mixture: mem-stores,cpu/mem-loads/

    Signed-off-by: Kan Liang
    Acked-by: Jiri Olsa
    Cc: Andi Kleen
    Cc: Jiri Olsa
    Link: http://lkml.kernel.org/r/1412694532-23391-2-git-send-email-kan.liang@intel.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Kan Liang
     
  • When 'perf top' is run, one can't easily find a difference
    between -z option and normal output.
    So I added a visual cue to know whether it is the zeroing or not.

    Output is as below.

    Before:
    $ perf top

    Samples: 61K of event 'cycles', Event count (approx.): 3908136933
    Overhead Shared Object Symbol
    1.42% firefox [.] 0x0000000000011e76
    1.32% libpthread-2.17.so [.] pthread_mutex_lock

    If you press key 'z' or run with zero option like '$ perf top --zero', it is as below.

    After:
    Samples: 61K of event 'cycles', Event count (approx.): 3908136933 [z]
    Overhead Shared Object Symbol
    1.42% firefox [.] 0x0000000000011e76
    1.32% libpthread-2.17.so [.] pthread_mutex_lock

    Signed-off-by: Taeung Song
    Acked-by: Namhyung Kim
    Cc: Namhyung Kim
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/r/1412665995-26359-1-git-send-email-treeze.taeung@gmail.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Taeung Song
     

15 Oct, 2014

14 commits

  • …/acme/linux into perf/urgent

    Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo:

    Infrastructure fixes and changes:

    * Fix off-by-one bugs in map->end handling (Stephane Eranian)

    * Fix off-by-one bug in maps__find(), also related to map->end handling (Namhyung Kim)

    * Make struct symbol->end be the first addr after the symbol range, to make it
    match the convention used for struct map->end. (Arnaldo Carvalho de Melo)

    * Fix perf_evlist__add_pollfd() error handling in 'perf kvm stat live' (Jiri Olsa)

    * Fix python test build by moving callchain_param to an object linked into the
    python binding (Jiri Olsa)

    * Do not include a struct hists per perf_evsel, untangling the histogram code
    from perf_evsel, to pave the way for exporting a minimalistic
    tools/lib/api/perf/ library usable by tools/perf and initially by the rasd
    daemon being developed by Borislav Petkov, Robert Richter and Jean Pihet.
    (Arnaldo Carvalho de Melo)

    * Make perf_evlist__open(evlist, NULL, NULL), i.e. without cpu and thread
    maps mean syswide monitoring, reducing the boilerplate for tools that
    only want system wide mode. (Arnaldo Carvalho de Melo)

    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>

    Ingo Molnar
     
  • To follow vm_area_struct->vm_end convention.

    By adhering to the convention that ->end is the first address outside
    the symbol's range we can do things like:

    sym->end = start + len;
    len = sym->end - sym->start;

    This is also now the convention used for struct map->end, fixing some
    off-by-one bugs.

    Cc: Adrian Hunter
    Cc: Chuck Ebbert
    Cc: David Ahern
    Cc: Ingo Molnar
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/n/tip-agomujr7tuqaq6lu7kr6z7h6@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • When synthesizing maps from files that have incomplete symbol
    information, like kallsyms, we need to fixup the end of maps by seting
    its end from the ->start of the next map, fix it to set prev_map->end to
    curr_map->start, since ->end is the first byte outside prev_map address
    range.

    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/n/tip-ivbrj08sjakxdwkrcndbkoig@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • map->end is the first addr _outside_ the a map, following the convention
    of vm_area_struct->vm_end.

    Signed-off-by: Namhyung Kim
    Acked-by: Stephane Eranian
    Cc: David Ahern
    Cc: Ingo Molnar
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/r/8761fwh1nc.fsf@sejong.aot.lge.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Namhyung Kim
     
  • This patch fixes off-by-one errors in the management of maps.

    A map is defined by start address and length as implemented by
    map__new():

    map__init(map, type, start, start + len, pgoff, dso);

    map->start = addr;
    map->end = end;

    Consequently, the actual address range is [start; end[ map->end is the
    first byte outside the range.

    This patch fixes two bugs where upper bound checking was off-by-one.

    In V2, we fix map_groups__fixup_overlappings() some more where
    map->start was off-by-one as reported by Jiri.

    Signed-off-by: Stephane Eranian
    Acked-by: Namhyung Kim
    Cc: David Ahern
    Cc: Ingo Molnar
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20141006083532.GA4850@quad
    Signed-off-by: Arnaldo Carvalho de Melo

    Stephane Eranian
     
  • A segfault happens on 'perf test hists_link' because we end up using a
    struct machines on the stack, and then machines__init() was not
    initializing the newly introduced rb_root, just the existing list_head.

    When we introduced struct dsos, to group the two ways to store dsos,
    i.e. the linked list and the rbtree, we didn't turned the initialization
    done in:

    machines__init(machines->host) ->
    machine__init() ->
    INIT_LIST_HEAD

    into a dsos__init() to keep on initializing the list_head but _as well_
    initializing the rb_root, oops.

    All worked because outside perf-test we probably zalloc the whole thing
    which ends up initializing it in to NULL.

    So the problem looks contained to 'perf test' that uses it on stack,
    etc.

    Reported-by: Jiri Olsa
    Acked-by: Waiman Long ,
    Cc: Adrian Hunter ,
    Cc: Don Zickus
    Cc: Douglas Hatch
    Cc: Ingo Molnar
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Scott J Norton
    Cc: Waiman Long ,
    Link: http://lkml.kernel.org/r/20141014180353.GF3198@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • Since they are automatically called by other methods used by tools.

    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-ne3g4any7q6ty5d6yv8t1wws@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • We use it in evsel.h but were getting it indirectly, fix it.

    Noticed while working on having evsel.h usable by rasd.c.

    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-94t3jvw4tmzrq3dnovvpl65e@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • If all a tool wants is to do system wide event monitoring, there is no
    more the need to setup thread_map and cpu_map objects, just call
    perf_evlist__open() and it will do create one fd per CPU monitoring all
    threads.

    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-poovolkigu72brx4783uq4cf@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • The perf_evlist__prepare_workload expects a thread map to be in place
    so that it can store the pid of the workload being started, so check it
    and tell the developer about it instead of segfaulting.

    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-jvlz2f264e7kpmhjmwltikqw@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • Create a dummy thread_map, one that has just one entry and it is -1,
    meaning 'all threads', as this ends up going down to perf_event_open().

    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-8av26cz8uxmbnihl5mmrygp9@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • Now tools that deals want to have an hists per evsel need to call
    hists__init() before creating any evsels, which can be as early as when
    parsing the command line, so do it before calling parse_options().

    The current tools using hists/hist_entries are report, top and annotate,
    change them to request per evsel hists.

    This is in preparation for making evsels usable by 3rd party tools, that
    not necessarily live in perf's source code repository.

    Acked-by: Borislav Petkov
    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-usjx2la743f10ippj7p1b20x@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • It was lost in hist.h, move it to where it belongs, callchain.h, as
    there are places that gets hist.h by means of evsel.h, and since evsel.h
    is being untangled from hist.h...

    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-0rg7ji1jnbm6q6gj35j37jby@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • Provide a method to be called at tool start to config the perf_evsel
    instance size, together with optional constructor and destructor.

    This will be used so that perf_evsel doesn't always include a struct
    hists, tools that works with hists/hist_entries, like report, top and
    annotate, will, at start, tell the evsel class the size they need per
    instance.

    v2: Don't use exit as a name of a member of function parameter, as this
    breaks the build on at least fedora14 and rhel6.

    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-7t8cay0ieryox4gqosie85ek@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

14 Oct, 2014

1 commit

  • Now perf_session doesn't require that the evsels in its evlist are hists
    containing ones.

    Tools that are hists based and want to do per evsel events_stats
    updates, if at some point this turns into a necessity, should do it in
    the tool specific code, keeping the session class hists agnostic.

    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-cli1bgwpo82mdikuhy3djsuy@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

13 Oct, 2014

3 commits

  • Pull perf updates from Ingo Molnar:
    "Kernel side updates:

    - Fix and enhance poll support (Jiri Olsa)

    - Re-enable inheritance optimization (Jiri Olsa)

    - Enhance Intel memory events support (Stephane Eranian)

    - Refactor the Intel uncore driver to be more maintainable (Zheng
    Yan)

    - Enhance and fix Intel CPU and uncore PMU drivers (Peter Zijlstra,
    Andi Kleen)

    - [ plus various smaller fixes/cleanups ]

    User visible tooling updates:

    - Add +field argument support for --field option, so that one can add
    fields to the default list of fields to show, ie now one can just
    do:

    perf report --fields +pid

    And the pid will appear in addition to the default fields (Jiri
    Olsa)

    - Add +field argument support for --sort option (Jiri Olsa)

    - Honour -w in the report tools (report, top), allowing to specify
    the widths for the histogram entries columns (Namhyung Kim)

    - Properly show submicrosecond times in 'perf kvm stat' (Christian
    Borntraeger)

    - Add beautifier for mremap flags param in 'trace' (Alex Snast)

    - perf script: Allow callchains if any event samples them

    - Don't truncate Intel style addresses in 'annotate' (Alex Converse)

    - Allow profiling when kptr_restrict == 1 for non root users, kernel
    samples will just remain unresolved (Andi Kleen)

    - Allow configuring default options for callchains in config file
    (Namhyung Kim)

    - Support operations for shared futexes. (Davidlohr Bueso)

    - "perf kvm stat report" improvements by Alexander Yarygin:
    - Save pid string in opts.target.pid
    - Enable the target.system_wide flag
    - Unify the title bar output

    - [ plus lots of other fixes and small improvements. ]

    Tooling infrastructure changes:

    - Refactor unit and scale function parameters for PMU parsing
    routines (Matt Fleming)

    - Improve DSO long names lookup with rbtree, resulting in great
    speedup for workloads with lots of DSOs (Waiman Long)

    - We were not handling POLLHUP notifications for event file
    descriptors

    Fix it by filtering entries in the events file descriptor array
    after poll() returns, refcounting mmaps so that when the last fd
    pointing to a perf mmap goes away we do the unmap (Arnaldo Carvalho
    de Melo)

    - Intel PT prep work, from Adrian Hunter, including:
    - Let a user specify a PMU event without any config terms
    - Add perf-with-kcore script
    - Let default config be defined for a PMU
    - Add perf_pmu__scan_file()
    - Add a 'perf test' for tracking with sched_switch
    - Add 'flush' callback to scripting API

    - Use ring buffer consume method to look like other tools (Arnaldo
    Carvalho de Melo)

    - hists browser (used in top and report) refactorings, getting rid of
    unused variables and reducing source code size by handling similar
    cases in a fewer functions (Namhyung Kim).

    - Replace thread unsafe strerror() with strerror_r() accross the
    whole tools/perf/ tree (Masami Hiramatsu)

    - Rename ordered_samples to ordered_events and allow setting a queue
    size for ordering events (Jiri Olsa)

    - [ plus lots of fixes, cleanups and other improvements ]"

    * 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (198 commits)
    perf/x86: Tone down kernel messages when the PMU check fails in a virtual environment
    perf/x86/intel/uncore: Fix minor race in box set up
    perf record: Fix error message for --filter option not coming after tracepoint
    perf tools: Fix build breakage on arm64 targets
    perf symbols: Improve DSO long names lookup speed with rbtree
    perf symbols: Encapsulate dsos list head into struct dsos
    perf bench futex: Sanitize -q option in requeue
    perf bench futex: Support operations for shared futexes
    perf trace: Fix mmap return address truncation to 32-bit
    perf tools: Refactor unit and scale function parameters
    perf tools: Fix line number in the config file error message
    perf tools: Convert {record,top}.call-graph option to call-graph.record-mode
    perf tools: Introduce perf_callchain_config()
    perf callchain: Move some parser functions to callchain.c
    perf tools: Move callchain config from record_opts to callchain_param
    perf hists browser: Fix callchain print bug on TUI
    perf tools: Use ACCESS_ONCE() instead of volatile cast
    perf tools: Modify error code for when perf_session__new() fails
    perf tools: Fix perf record as non root with kptr_restrict == 1
    perf stat: Fix --per-core on multi socket systems
    ...

    Linus Torvalds
     
  • Pull RCU updates from Ingo Molnar:
    "The main changes in this cycle were:

    - changes related to No-CBs CPUs and NO_HZ_FULL

    - RCU-tasks implementation

    - torture-test updates

    - miscellaneous fixes

    - locktorture updates

    - RCU documentation updates"

    * 'core-rcu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (81 commits)
    workqueue: Use cond_resched_rcu_qs macro
    workqueue: Add quiescent state between work items
    locktorture: Cleanup header usage
    locktorture: Cannot hold read and write lock
    locktorture: Fix __acquire annotation for spinlock irq
    locktorture: Support rwlocks
    rcu: Eliminate deadlock between CPU hotplug and expedited grace periods
    locktorture: Document boot/module parameters
    rcutorture: Rename rcutorture_runnable parameter
    locktorture: Add test scenario for rwsem_lock
    locktorture: Add test scenario for mutex_lock
    locktorture: Make torture scripting account for new _runnable name
    locktorture: Introduce torture context
    locktorture: Support rwsems
    locktorture: Add infrastructure for torturing read locks
    torture: Address race in module cleanup
    locktorture: Make statistics generic
    locktorture: Teach about lock debugging
    locktorture: Support mutexes
    locktorture: Add documentation
    ...

    Linus Torvalds
     
  • Pull vfs updates from Al Viro:
    "The big thing in this pile is Eric's unmount-on-rmdir series; we
    finally have everything we need for that. The final piece of prereqs
    is delayed mntput() - now filesystem shutdown always happens on
    shallow stack.

    Other than that, we have several new primitives for iov_iter (Matt
    Wilcox, culled from his XIP-related series) pushing the conversion to
    ->read_iter()/ ->write_iter() a bit more, a bunch of fs/dcache.c
    cleanups and fixes (including the external name refcounting, which
    gives consistent behaviour of d_move() wrt procfs symlinks for long
    and short names alike) and assorted cleanups and fixes all over the
    place.

    This is just the first pile; there's a lot of stuff from various
    people that ought to go in this window. Starting with
    unionmount/overlayfs mess... ;-/"

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (60 commits)
    fs/file_table.c: Update alloc_file() comment
    vfs: Deduplicate code shared by xattr system calls operating on paths
    reiserfs: remove pointless forward declaration of struct nameidata
    don't need that forward declaration of struct nameidata in dcache.h anymore
    take dname_external() into fs/dcache.c
    let path_init() failures treated the same way as subsequent link_path_walk()
    fix misuses of f_count() in ppp and netlink
    ncpfs: use list_for_each_entry() for d_subdirs walk
    vfs: move getname() from callers to do_mount()
    gfs2_atomic_open(): skip lookups on hashed dentry
    [infiniband] remove pointless assignments
    gadgetfs: saner API for gadgetfs_create_file()
    f_fs: saner API for ffs_sb_create_file()
    jfs: don't hash direct inode
    [s390] remove pointless assignment of ->f_op in vmlogrdr ->open()
    ecryptfs: ->f_op is never NULL
    android: ->f_op is never NULL
    nouveau: __iomem misannotations
    missing annotation in fs/file.c
    fs: namespace: suppress 'may be used uninitialized' warnings
    ...

    Linus Torvalds
     

12 Oct, 2014

2 commits

  • …l/git/shuah/linux-kselftest

    Pull kselftest updates from Shuah Khan:
    - fix for missing arguments to printf
    - fix to build failures on 32-bit systems.
    - enhancement to run memfd_test run on all architectures as most
    architectures support __NR_memfd_create

    * tag 'kselftest-3.18-updates-1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
    selftests/memfd: Run test on all architectures
    memfd_test: Add missing argument to printf()
    memfd_test: Make it work on 32-bit systems

    Linus Torvalds
     
  • Pull ftrace test code from Steven Rostedt:
    "This patch series starts a new selftests section in the
    tools/testing/selftest directory called "ftrace" that holds tests
    aimed at testing ftrace and subsystems that use ftrace (like kprobes).

    So far only a few tests were written (by Masami Hiramatsu), but more
    will be added in the near future (3.19)"

    * tag 'ftracetest-3.18' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
    tracing/kprobes: Add selftest scripts testing kprobe-tracer as startup test
    ftracetest: Add POSIX.3 standard and XFAIL result codes
    ftracetest: Add kprobe basic testcases
    ftracetest: Add ftrace basic testcases
    ftracetest: Initial commit for ftracetest

    Linus Torvalds