23 Jan, 2011

15 commits

  • Close to perf_mmap__read_head() and the perf_mmap struct definition.
    This is useful for any recorder, and we will need it in 'perf test'.

    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Cc: Mike Galbraith
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Cc: Tom Zanussi
    LKML-Reference:
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • Paving the way to using perf_evsel->mmap, do this to reduce the patch
    noise in the next ones.

    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Cc: Mike Galbraith
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Cc: Tom Zanussi
    LKML-Reference:
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • Out of the code in 'perf top'. Record is next in line.

    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Cc: Mike Galbraith
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Cc: Tom Zanussi
    LKML-Reference:
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • Now its time to factor out the mmap handling bits into the perf_evsel
    class.

    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Cc: Mike Galbraith
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Cc: Tom Zanussi
    LKML-Reference:
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • Now that it handles group_fd and inherit we can use it, sharing it with
    stat.

    Next step: 'perf record' should use, then move the mmap_array out of
    ->priv and into perf_evsel, with top and record sharing this, and at the
    same time, write a 'perf test' stress test.

    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Cc: Mike Galbraith
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Cc: Tom Zanussi
    LKML-Reference:
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • As this is a per-cpu attribute, we can't set it up in advance and use it
    for all the calls.

    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Cc: Mike Galbraith
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Cc: Tom Zanussi
    LKML-Reference:
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • The perf_evsel__open now have an extra boolean argument specifying if
    event grouping is desired.

    The first file descriptor created on a CPU becomes the group leader.

    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Cc: Mike Galbraith
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Cc: Tom Zanussi
    LKML-Reference:
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • Allocating just the space needed for nr_cpus * nr_threads * nr_evsels,
    not the MAX_NR_CPUS and counters.

    LKML-Reference:
    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Cc: Mike Galbraith
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Cc: Tom Zanussi
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • Killing two more perf wide global variables: nr_counters and evsel_list
    as a list_head.

    There are more operations that will need more fields in perf_evlist,
    like the pollfd for polling all the fds in a list of evsel instances.

    Use option->value to pass the evsel_list to parse_{events,filters}.

    LKML-Reference:
    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Cc: Mike Galbraith
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Cc: Tom Zanussi
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • It's enough to include the local "debug.h" file to trigger it.

    man time reveals this is already declared in glibc:

    time - get time in seconds
    -> rename the variable.

    Cc: Ingo Molnar
    Cc: arjan@infradead.org
    LPU-Reference:
    Signed-off-by: Thomas Renninger
    Signed-off-by: Arnaldo Carvalho de Melo

    Thomas Renninger
     
  • The -Wstack-protector and -Wvolatile-register-var warnings, for
    instance, are not supported by gcc 3.4.6.

    So fix by doing the same check we already do for -fstack-protector-all.

    With this and the other patches in this series, perf builds unmodified
    on, for instance, RHEL4.

    Cc: Eric Dumazet
    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Cc: Mike Galbraith
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Cc: Tom Zanussi
    LKML-Reference:
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • [acme@localhost linux]$ make O=~acme/git/build/perf -C tools/perf
    make: Entering directory `/home/acme/git/linux/tools/perf'
    Makefile:526: No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev
    Makefile:582: newt not found, disables TUI support. Please install newt-devel or libnewt-dev
    CC /home/acme/git/build/perf/builtin-annotate.o
    In file included from builtin-annotate.c:23:
    util/parse-events.h:26: warning: declaration of 'evsel_list' shadows a global declaration
    util/parse-events.h:12: warning: shadowed declaration is here
    make: *** [/home/acme/git/build/perf/builtin-annotate.o] Error 1
    make: Leaving directory `/home/acme/git/linux/tools/perf'
    [acme@localhost linux]$ gcc --version | head -1
    gcc (GCC) 3.4.6 20060404 (Red Hat 3.4.6-11)
    [acme@localhost linux]$

    Fix it by renaming the parameter to evlist.

    Cc: Eric Dumazet
    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Cc: Mike Galbraith
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Cc: Tom Zanussi
    LKML-Reference:
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • We need the definiton for __always_inline in bitops.h to fix the build
    on distros where it isn't available or compiler.h doesn't get included
    indirectly.

    One of the fixes needed to build perf on RHEL4 systems, for instance.

    Cc: Eric Dumazet
    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Cc: Mike Galbraith
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Cc: Tom Zanussi
    LKML-Reference:
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • Using %L[uxd] has issues in some architectures, like on ppc64. Fix it
    by making our 64 bit integers typedefs of stdint.h types and using
    PRI[ux]64 like, for instance, git does.

    Reported by Denis Kirjanov that provided a patch for one case, I went
    and changed all cases.

    Reported-by: Denis Kirjanov
    Tested-by: Denis Kirjanov
    LKML-Reference:
    Cc: Denis Kirjanov
    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Cc: Mike Galbraith
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Pingtian Han
    Cc: Stephane Eranian
    Cc: Tom Zanussi
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • Where we don't have CPU_ALLOC & friends. As the tools are being used in older
    distros where the only allowed change are to replace the kernel, like RHEL4 and
    5.

    Reported-by: Eric Dumazet
    Cc: Eric Dumazet
    Cc: Frederic Weisbecker
    Cc: Mike Galbraith
    Cc: Peter Zijlstra
    Cc: Paul Mackerras
    Cc: Stephane Eranian
    LKML-Reference:
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

22 Jan, 2011

4 commits

  • …/linux-2.6 into perf/urgent

    Ingo Molnar
     
  • In theory, almost every user of task->child->perf_event_ctxp[]
    is wrong. find_get_context() can install the new context at any
    moment, we need read_barrier_depends().

    dbe08d82ce3967ccdf459f7951d02589cf967300 "perf: Fix
    find_get_context() vs perf_event_exit_task() race" added
    rcu_dereference() into perf_event_exit_task_context() to make
    the precedent, but this makes __rcu_dereference_check() unhappy.
    Use rcu_dereference_raw() to shut up the warning.

    Reported-by: Ingo Molnar
    Signed-off-by: Oleg Nesterov
    Cc: acme@redhat.com
    Cc: paulus@samba.org
    Cc: stern@rowland.harvard.edu
    Cc: a.p.zijlstra@chello.nl
    Cc: fweisbec@gmail.com
    Cc: roland@redhat.com
    Cc: prasad@linux.vnet.ibm.com
    Cc: Paul E. McKenney
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Oleg Nesterov
     
  • When some of CPUs are offline:

    # cat /sys/devices/system/cpu/online
    0,6-31

    perf test will fail on #3 testcase:

    3: detect open syscall event on all cpus:
    --- start ---
    perf_evsel__read_on_cpu: expected to intercept 111 calls on cpu 0, got 681
    perf_evsel__read_on_cpu: expected to intercept 112 calls on cpu 1, got 117
    perf_evsel__read_on_cpu: expected to intercept 113 calls on cpu 2, got 118
    perf_evsel__read_on_cpu: expected to intercept 114 calls on cpu 3, got 119
    perf_evsel__read_on_cpu: expected to intercept 115 calls on cpu 4, got 120
    perf_evsel__read_on_cpu: expected to intercept 116 calls on cpu 5, got 121
    perf_evsel__read_on_cpu: expected to intercept 117 calls on cpu 6, got 122
    perf_evsel__read_on_cpu: expected to intercept 118 calls on cpu 7, got 123
    perf_evsel__read_on_cpu: expected to intercept 119 calls on cpu 8, got 124
    perf_evsel__read_on_cpu: expected to intercept 120 calls on cpu 9, got 125
    perf_evsel__read_on_cpu: expected to intercept 121 calls on cpu 10, got 126
    ....

    This patch try to use 'cpus->map[cpu]' when setting cpu affinity, and
    will check the return code of sched_setaffinity()

    LKML-Reference:
    Signed-off-by: Han Pingtian
    Signed-off-by: Arnaldo Carvalho de Melo

    Han Pingtian
     
  • In ARM's Thumb mode the bottom bit of the symbol address is set to mark
    the function as Thumb; the instructions are in reality 2 or 4 byte on 2
    byte alignments, and when the +1 address is used in annotate it causes
    objdump to disassemble invalid instructions.

    The patch removes that bottom bit during symbol loading.

    Many thinks to Dave Martin for comments on an initial version of the
    patch.

    (For reference this corresponds to this bug
    https://bugs.launchpad.net/linux-linaro/+bug/677547 )

    Cc: Ingo Molnar
    Cc: Dave Martin
    LKML-Reference:
    Signed-off-by: Dr. David Alan Gilbert
    Signed-off-by: Arnaldo Carvalho de Melo

    Dr. David Alan Gilbert
     

21 Jan, 2011

1 commit

  • Lockdep spotted:

    loop_1b_instruc/1899 is trying to acquire lock:
    (event_mutex){+.+.+.}, at: [] perf_trace_init+0x3b/0x2f7

    but task is already holding lock:
    (&ctx->mutex){+.+.+.}, at: [] perf_event_init_context+0xc0/0x218

    which lock already depends on the new lock.

    the existing dependency chain (in reverse order) is:

    -> #3 (&ctx->mutex){+.+.+.}:
    -> #2 (cpu_hotplug.lock){+.+.+.}:
    -> #1 (module_mutex){+.+...}:
    -> #0 (event_mutex){+.+.+.}:

    But because the deadlock would be cpuhotplug (cpu-event) vs fork
    (task-event) it cannot, in fact, happen. We can annotate this by giving the
    perf_event_context used for the cpuctx a different lock class from those
    used by tasks.

    Signed-off-by: Peter Zijlstra
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Peter Zijlstra
     

20 Jan, 2011

3 commits

  • When fixing the frequency calculations for perf on powerpc I
    forgot to fix the FSL version.

    If we dont set event->hw.last_period the frequency to period
    calculations in perf go haywire and we continually
    throttle/unthrottle the PMU.

    Signed-off-by: Anton Blanchard
    Acked-by: Benjamin Herrenschmidt
    Cc: Scott Wood
    Cc: Paul Mackerras
    Cc: Arnaldo Carvalho de Melo
    Cc: linuxppc-dev@lists.ozlabs.org
    Cc: Peter Zijlstra
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Anton Blanchard
     
  • perf_event_init_task() should clear child->perf_event_ctxp[]
    before anything else. Otherwise, if
    perf_event_init_context(perf_hw_context) fails,
    perf_event_free_task() can free perf_event_ctxp[perf_sw_context]
    copied from parent->perf_event_ctxp[] by dup_task_struct().

    Also move the initialization of perf_event_mutex and
    perf_event_list from perf_event_init_context() to
    perf_event_init_context().

    Signed-off-by: Oleg Nesterov
    Acked-by: Peter Zijlstra
    Cc: Alan Stern
    Cc: Arnaldo Carvalho de Melo
    Cc: Frederic Weisbecker
    Cc: Paul Mackerras
    Cc: Prasad
    Cc: Roland McGrath
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Oleg Nesterov
     
  • find_get_context() must not install the new perf_event_context
    if the task has already passed perf_event_exit_task().

    If nothing else, this means the memory leak. Initially
    ctx->refcount == 2, it is supposed that
    perf_event_exit_task_context() should participate and do the
    necessary put_ctx().

    find_lively_task_by_vpid() checks PF_EXITING but this buys
    nothing, by the time we call find_get_context() this task can be
    already dead. To the point, cmpxchg() can succeed when the task
    has already done the last schedule().

    Change find_get_context() to populate task->perf_event_ctxp[]
    under task->perf_event_mutex, this way we can trust PF_EXITING
    because perf_event_exit_task() takes the same mutex.

    Also, change perf_event_exit_task_context() to use
    rcu_dereference(). Probably this is not strictly needed, but
    with or without this change find_get_context() can race with
    setup_new_exec()->perf_event_exit_task(), rcu_dereference()
    looks better.

    Signed-off-by: Oleg Nesterov
    Acked-by: Peter Zijlstra
    Cc: Alan Stern
    Cc: Arnaldo Carvalho de Melo
    Cc: Frederic Weisbecker
    Cc: Paul Mackerras
    Cc: Prasad
    Cc: Roland McGrath
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Oleg Nesterov
     

19 Jan, 2011

17 commits

  • Linus Torvalds
     
  • * 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/staging:
    hwmon: (lm93) Add support for LM94

    Linus Torvalds
     
  • …/git/tip/linux-2.6-tip

    * 'perf-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
    perf: Validate cpu early in perf_event_alloc()
    perf: Find_get_context: fix the per-cpu-counter check
    perf: Fix contexted inheritance

    Linus Torvalds
     
  • …git/tip/linux-2.6-tip

    * 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
    x86: Clear irqstack thread_info
    x86: Make relocatable kernel work with new binutils

    Linus Torvalds
     
  • * 'upstream' of git://git.linux-mips.org/pub/scm/upstream-linus: (26 commits)
    MIPS: Malta: enable Cirrus FB console
    MIPS: add CONFIG_VIRTUALIZATION for virtio support
    MIPS: Implement __read_mostly
    MIPS: ath79: add common WMAC device for AR913X based boards
    MIPS: ath79: Add initial support for the Atheros AP81 reference board
    MIPS: ath79: add common SPI controller device
    SPI: Add SPI controller driver for the Atheros AR71XX/AR724X/AR913X SoCs
    MIPS: ath79: add common GPIO buttons device
    MIPS: ath79: add common watchdog device
    MIPS: ath79: add common GPIO LEDs device
    MIPS: ath79: add initial support for the Atheros PB44 reference board
    MIPS: ath79: utilize the MIPS multi-machine support
    MIPS: ath79: add GPIOLIB support
    MIPS: Add initial support for the Atheros AR71XX/AR724X/AR931X SoCs
    MIPS: jump label: Add MIPS support.
    MIPS: Use WARN() in uasm for better diagnostics.
    MIPS: Optimize TLB handlers for Octeon CPUs
    MIPS: Add LDX and LWX instructions to uasm.
    MIPS: Use BBIT instructions in TLB handlers
    MIPS: Declare uasm bbit0 and bbit1 functions.
    ...

    Linus Torvalds
     
  • This patch adds basic support for LM94 to the LM93 driver. LM94 specific
    sensors and features are not supported.

    Signed-off-by: Guenter Roeck
    Acked-by: Jean Delvare

    Guenter Roeck
     
  • Starting from perf_event_alloc()->perf_init_event(), the kernel
    assumes that event->cpu is either -1 or the valid CPU number.

    Change perf_event_alloc() to validate this argument early. This
    also means we can remove the similar check in
    find_get_context().

    Signed-off-by: Oleg Nesterov
    Acked-by: Peter Zijlstra
    Cc: Alan Stern
    Cc: Arnaldo Carvalho de Melo
    Cc: Frederic Weisbecker
    Cc: Paul Mackerras
    Cc: Prasad
    Cc: Roland McGrath
    Cc: gregkh@suse.de
    Cc: stable@kernel.org
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Oleg Nesterov
     
  • If task == NULL, find_get_context() should always check that cpu
    is correct.

    Afaics, the bug was introduced by 38a81da2 "perf events: Clean
    up pid passing", but even before that commit "&& cpu != -1" was
    not exactly right, -ESRCH from find_task_by_vpid() is not
    accurate.

    Signed-off-by: Oleg Nesterov
    Acked-by: Peter Zijlstra
    Cc: Alan Stern
    Cc: Arnaldo Carvalho de Melo
    Cc: Frederic Weisbecker
    Cc: Paul Mackerras
    Cc: Prasad
    Cc: Roland McGrath
    Cc: gregkh@suse.de
    Cc: stable@kernel.org
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Oleg Nesterov
     
  • While most users of a physical Malta board are using the serial port
    as the console, a lot of QEMU users would prefer to interact with a
    graphical console. Enable the Cirrus FB support in the Malta default
    configuration to make that possible. Note that the default console will
    still be the serial port, users have to pass "console=tty0" to the
    kernel to use the Cirrus FB.

    Signed-off-by: Aurelien Jarno
    To: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/2001/
    Signed-off-by: Ralf Baechle

    Aurelien Jarno
     
  • Add CONFIG_VIRTUALIZATION to the MIPS architecture and include the
    the virtio code there. Used to enable the virtio drivers under QEMU.

    Signed-off-by: Aurelien Jarno
    To: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/2002/
    Signed-off-by: Ralf Baechle

    Aurelien Jarno
     
  • Just do what everyone else is doing by placing __read_mostly things in
    the .data.read_mostly section.

    mips_io_port_base can not be read-only (const) and writable
    (__read_mostly) at the same time. One of them has to go, so I chose
    to eliminate the __read_mostly. It will still get stuck in a portion
    of memory that is not adjacent to things that are written, and thus
    not be on a dirty cache line, for whatever that is worth.

    Signed-off-by: David Daney
    To: linux-mips@linux-mips.org
    Patchwork: http://patchwork.linux-mips.org/patch/1702/
    Signed-off-by: Ralf Baechle

    David Daney
     
  • Add common platform_device and helper code to make the registration
    of the built-in wireless MAC easier on the Atheros AR9130/AR9132
    based boards. Also register the WMAC device on the AR81 board.

    Signed-off-by: Gabor Juhos
    Cc: linux-mips@linux-mips.org
    Cc: Imre Kaloz ,
    Cc: Luis R. Rodriguez
    Cc: Cliff Holden
    Cc: Kathy Giori
    Patchwork: https://patchwork.linux-mips.org/patch/1962/
    Signed-off-by: Ralf Baechle

    Gabor Juhos
     
  • Signed-off-by: Gabor Juhos
    Signed-off-by: Imre Kaloz
    Cc: linux-mips@linux-mips.org
    Cc: Luis R. Rodriguez
    Cc: Cliff Holden
    Cc: Kathy Giori
    Patchwork: https://patchwork.linux-mips.org/patch/1952/
    Signed-off-by: Ralf Baechle

    Gabor Juhos
     
  • Several boards are using the built-in SPI controller of the
    AR71XX/AR724X/AR913X SoCs. This patch adds common platform_device
    and helper code to register it. Additionally, the patch registers
    the SPI bus on the PB44 board.

    Signed-off-by: Gabor Juhos
    Cc: linux-mips@linux-mips.org
    Cc: Imre Kaloz
    Cc: Luis R. Rodriguez
    Cc: Cliff Holden
    Cc: Kathy Giori
    Patchwork: https://patchwork.linux-mips.org/patch/1956/
    Signed-off-by: Ralf Baechle

    Gabor Juhos
     
  • The Atheros AR71XX/AR724X/AR913X SoCs have a built-in SPI controller. This
    patch implements a driver for that.

    Signed-off-by: Gabor Juhos
    Cc: David Brownell
    Cc: spi-devel-general@lists.sourceforge.net
    Acked-by: Grant Likely
    Cc: linux-mips@linux-mips.org
    Cc: Imre Kaloz
    Cc: Luis R. Rodriguez
    Cc: Cliff Holden
    Cc: Kathy Giori
    Patchwork: https://patchwork.linux-mips.org/patch/1960/
    Signed-off-by: Ralf Baechle

    Gabor Juhos
     
  • Almost all boards have one or more push buttons connected to GPIO lines.
    This patch adds common code to register a platform_device for them.

    The patch also adds support for the buttons on the PB44 board.

    Signed-off-by: Gabor Juhos
    Signed-off-by: Imre Kaloz
    Cc: linux-mips@linux-mips.org
    Cc: Luis R. Rodriguez
    Cc: Cliff Holden
    Cc: Kathy Giori
    Patchwork: https://patchwork.linux-mips.org/patch/1954/
    Signed-off-by: Ralf Baechle

    Gabor Juhos
     
  • All supported SoCs have a built-in hardware watchdog driver. This patch
    registers a platform_device for that to make it usable.

    Signed-off-by: Gabor Juhos
    Signed-off-by: Imre Kaloz
    Cc: linux-mips@linux-mips.org
    Cc: Luis R. Rodriguez
    Cc: Cliff Holden
    Cc: Kathy Giori
    Patchwork: https://patchwork.linux-mips.org/patch/1955/
    Signed-off-by: Ralf Baechle

    Gabor Juhos