Skip to content
  1. Jun 18, 2012
    • Yan, Zheng's avatar
      perf: Avoid race between cpu hotplug and installing event · fbfc623f
      Yan, Zheng authored
      
      
      perf_event_open() requires the cpu on which to install event is online,
      but the cpu can go offline after perf_event_open checks that. Add a
      get_online_cpus()/put_online_cpus() pair to avoid the race.
      
      Signed-off-by: default avatarZheng Yan <zheng.z.yan@intel.com>
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/1339741902-8449-3-git-send-email-zheng.z.yan@intel.com
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      fbfc623f
    • Yan, Zheng's avatar
      perf: Export perf_assign_events() · 4b4969b1
      Yan, Zheng authored
      
      
      Export perf_assign_events() so the uncore code can use it to
      schedule events.
      
      Signed-off-by: default avatarZheng Yan <zheng.z.yan@intel.com>
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/1339741902-8449-2-git-send-email-zheng.z.yan@intel.com
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      4b4969b1
    • Ingo Molnar's avatar
      Merge branch 'perf/urgent' into perf/core · d1ece099
      Ingo Molnar authored
      
      
      Merge in all fixes before applying more changes.
      
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      d1ece099
    • Salman Qazi's avatar
      perf: Use css_tryget() to avoid propping up css refcount · 9c5da09d
      Salman Qazi authored
      
      
      An rmdir pushes css's ref count to zero.  However, if the associated
      directory is open at the time, the dentry ref count is non-zero.  If
      the fd for this directory is then passed into perf_event_open, it
      does a css_get().  This bounces the ref count back up from zero.  This
      is a problem by itself.  But what makes it turn into a crash is the
      fact that we end up doing an extra dput, since we perform a dput
      when css_put sees the ref count go down to zero.
      
      css_tryget() does not fall into that trap. So, we use that instead.
      
      Reproduction test-case for the bug:
      
       #include <unistd.h>
       #include <sys/types.h>
       #include <sys/stat.h>
       #include <fcntl.h>
       #include <linux/unistd.h>
       #include <linux/perf_event.h>
       #include <string.h>
       #include <errno.h>
       #include <stdio.h>
      
       #define PERF_FLAG_PID_CGROUP    (1U << 2)
      
       int perf_event_open(struct perf_event_attr *hw_event_uptr,
                           pid_t pid, int cpu, int group_fd, unsigned long flags) {
               return syscall(__NR_perf_event_open,hw_event_uptr, pid, cpu,
                       group_fd, flags);
       }
      
       /*
        * Directly poke at the perf_event bug, since it's proving hard to repro
        * depending on where in the kernel tree.  what moved?
        */
       int main(int argc, char **argv)
       {
              int fd;
              struct perf_event_attr attr;
              memset(&attr, 0, sizeof(attr));
              attr.exclude_kernel = 1;
              attr.size = sizeof(attr);
              mkdir("/dev/cgroup/perf_event/blah", 0777);
              fd = open("/dev/cgroup/perf_event/blah", O_RDONLY);
              perror("open");
              rmdir("/dev/cgroup/perf_event/blah");
              sleep(2);
              perf_event_open(&attr, fd, 0, -1,  PERF_FLAG_PID_CGROUP);
              perror("perf_event_open");
              close(fd);
              return 0;
       }
      
      Signed-off-by: default avatarSalman Qazi <sqazi@google.com>
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Acked-by: default avatarTejun Heo <tj@kernel.org>
      Link: http://lkml.kernel.org/r/20120614223108.1025.2503.stgit@dungbeetle.mtv.corp.google.com
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      9c5da09d
    • Robert Richter's avatar
      perf/x86/amd: Fix RDPMC index calculation for AMD family 15h · 76958a61
      Robert Richter authored
      
      
      The RDPMC index calculation is wrong for AMD family 15h
      (X86_FEATURE_ PERFCTR_CORE set). This leads to a #GP when
      accessing the counter:
      
       Pid: 2237, comm: syslog-ng Not tainted 3.5.0-rc1-perf-x86_64-standard-g130ff90 #135 AMD Pike/Pike
       RIP: 0010:[<ffffffff8100dc33>]  [<ffffffff8100dc33>] x86_perf_event_update+0x27/0x66
      
      While the msr address offset is (index << 1) we must use index to
      select the correct rdpmc.
      
      Signed-off-by: default avatarRobert Richter <robert.richter@amd.com>
      Acked-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Vince Weaver <vweaver1@eecs.utk.edu>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      76958a61
    • Ingo Molnar's avatar
      Merge branch 'tip/perf/core' of... · 4983955c
      Ingo Molnar authored
      
      Merge branch 'tip/perf/core' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace into perf/core
      
      Pull ftrace robustization fixes from Steve Rostedt.
      
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      4983955c
  2. Jun 16, 2012
  3. Jun 15, 2012
    • Steven Rostedt's avatar
      tracing: Register the ftrace internal events during early boot · 7374e827
      Steven Rostedt authored
      
      
      All trace events including ftrace internel events (like trace_printk
      and function tracing), register functions that describe how to print
      their output. The events may be recorded as soon as the ring buffer
      is allocated, but they are just raw binary in the buffer. The mapping
      of event ids to how to print them are held within a structure that
      is registered on system boot.
      
      If a crash happens in boot up before these functions are registered
      then their output (via ftrace_dump_on_oops) will be useless:
      
      Dumping ftrace buffer:
      ---------------------------------
         <...>-1       0.... 319705us : Unknown type 6
      ---------------------------------
      
      This can be quite frustrating for a kernel developer trying to see
      what is going wrong.
      
      There's no reason to register them so late in the boot up process.
      They can be registered by early_initcall().
      
      Reported-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      7374e827
    • Steven Rostedt's avatar
      tracing: Add comments for the other bits of ftrace_event_call.flags · 5da43bed
      Steven Rostedt authored
      
      
      	TRACE_EVENT_FL_ENABLED_BIT,
      	TRACE_EVENT_FL_FILTERED_BIT,
      	TRACE_EVENT_FL_RECORDED_CMD_BIT,
      
      Have comments about what they are, but:
      
      	TRACE_EVENT_FL_CAP_ANY_BIT,
      	TRACE_EVENT_FL_NO_SET_FILTER_BIT,
      	TRACE_EVENT_FL_IGNORE_ENABLE_BIT,
      
      do not, making them second class citizens. To prevent another
      class warfare, these bits have protested for their right to be
      commented. And By Golly! I'll give them what they want!
      
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      5da43bed
    • Borislav Petkov's avatar
      ftrace: Remove a superfluous check · 8d240dd8
      Borislav Petkov authored
      
      
      register_ftrace_function() checks ftrace_disabled and calls
      __register_ftrace_function which does it again.
      
      Drop the first check and add the unlikely hint to the second one. Also,
      drop the label as John correctly notices.
      
      No functional change.
      
      Link: http://lkml.kernel.org/r/20120329171140.GE6409@aftab
      
      Cc: Borislav Petkov <bp@amd64.org>
      Cc: John Kacur <jkacur@redhat.com>
      Signed-off-by: default avatarBorislav Petkov <borislav.petkov@amd.com>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      8d240dd8
  4. Jun 14, 2012
    • Don Zickus's avatar
      watchdog: Quiet down the boot messages · a7027046
      Don Zickus authored
      
      
      A bunch of bugzillas have complained how noisy the nmi_watchdog
      is during boot-up especially with its expected failure cases
      (like virt and bios resource contention).
      
      This is my attempt to quiet them down and keep it less confusing
      for the end user.  What I did is print the message for cpu0 and
      save it for future comparisons.  If future cpus have an
      identical message as cpu0, then don't print the redundant info.
      However, if a future cpu has a different message, happily print
      that loudly.
      
      Before the change, you would see something like:
      
          ..TIMER: vector=0x30 apic1=0 pin1=2 apic2=-1 pin2=-1
          CPU0: Intel(R) Core(TM)2 Quad CPU    Q9550  @ 2.83GHz stepping 0a
          Performance Events: PEBS fmt0+, Core2 events, Intel PMU driver.
          ... version:                2
          ... bit width:              40
          ... generic registers:      2
          ... value mask:             000000ffffffffff
          ... max period:             000000007fffffff
          ... fixed-purpose events:   3
          ... event mask:             0000000700000003
          NMI watchdog enabled, takes one hw-pmu counter.
          Booting Node   0, Processors  #1
          NMI watchdog enabled, takes one hw-pmu counter.
           #2
          NMI watchdog enabled, takes one hw-pmu counter.
           #3 Ok.
          NMI watchdog enabled, takes one hw-pmu counter.
          Brought up 4 CPUs
          Total of 4 processors activated (22607.24 BogoMIPS).
      
      After the change, it is simplified to:
      
          ..TIMER: vector=0x30 apic1=0 pin1=2 apic2=-1 pin2=-1
          CPU0: Intel(R) Core(TM)2 Quad CPU    Q9550  @ 2.83GHz stepping 0a
          Performance Events: PEBS fmt0+, Core2 events, Intel PMU driver.
          ... version:                2
          ... bit width:              40
          ... generic registers:      2
          ... value mask:             000000ffffffffff
          ... max period:             000000007fffffff
          ... fixed-purpose events:   3
          ... event mask:             0000000700000003
          NMI watchdog: enabled on all CPUs, permanently consumes one hw-PMU counter.
          Booting Node   0, Processors  #1 #2 #3 Ok.
          Brought up 4 CPUs
      
      V2: little changes based on Joe Perches' feedback
      V3: printk cleanup based on Ingo's feedback; checkpatch fix
      V4: keep printk as one long line
      V5: Ingo fix ups
      
      Reported-and-tested-by: default avatarNathan Zimmer <nzimmer@sgi.com>
      Signed-off-by: default avatarDon Zickus <dzickus@redhat.com>
      Cc: nzimmer@sgi.com
      Cc: joe@perches.com
      Link: http://lkml.kernel.org/r/1339594548-17227-1-git-send-email-dzickus@redhat.com
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      a7027046
  5. Jun 13, 2012
  6. Jun 12, 2012
    • Arnaldo Carvalho de Melo's avatar
      perf tools: Fix synthesizing tracepoint names from the perf.data headers · cb9dd49e
      Arnaldo Carvalho de Melo authored
      
      
      We need to use the per event info snapshoted at record time to
      synthesize the events name, so do it just after reading the perf.data
      headers, when we already processed the /sys events data, otherwise we'll
      end up using the local /sys that only by sheer luck will have the same
      tracepoint ID -> real event association.
      
      Example:
      
        # uname -a
        Linux felicio.ghostprotocols.net 3.4.0-rc5+ #1 SMP Sat May 19 15:27:11 BRT 2012 x86_64 x86_64 x86_64 GNU/Linux
        # perf record -e sched:sched_switch usleep 1
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.015 MB perf.data (~648 samples) ]
        # cat /t/events/sched/sched_switch/id
        279
        # perf evlist -v
        sched:sched_switch: sample_freq=1, type: 2, config: 279, size: 80, sample_type: 1159, read_format: 7, disabled: 1, inherit: 1, mmap: 1, comm: 1, enable_on_exec: 1, sample_id_all: 1, exclude_guest: 1
        #
      
      So on the above machine the sched:sched_switch has tracepoint id 279, but on
      the machine were we'll analyse it it has a different id:
      
        $ cat /t/events/sched/sched_switch/id
        56
        $ perf evlist -i /tmp/perf.data
        kmem:mm_balancedirty_writeout
        $ cat /t/events/kmem/mm_balancedirty_writeout/id
        279
      
      With this fix:
      
        $ perf evlist -i /tmp/perf.data
        sched:sched_switch
      
      Reported-by: default avatarDmitry Antipov <dmitry.antipov@linaro.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Namhyung Kim <namhyung@gmail.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/n/tip-auwks8fpuhmrdpiefs55o5oz@git.kernel.org
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      cb9dd49e
  7. Jun 11, 2012
    • Stephane Eranian's avatar
      perf stat: Fix default output file · fc3e4d07
      Stephane Eranian authored
      The following commit:
      
      commit 56f3bae7
      
      
      Author: Jim Cromie <jim.cromie@gmail.com>
      Date:   Wed Sep 7 17:14:00 2011 -0600
      
          perf stat: Add --log-fd <N> option to redirect stderr elsewhere
      
      introduced a bug in the way perf stat outputs the results by default,
      i.e., without the --log-fd or --output option. It would default to
      writing to file descriptor 0, i.e., stdin. Writing to stdin is allowed
      and is equivalent to writing to stdout. However, there is a major
      difference for any script that was already capturing the output of perf
      stat via redirection:
      
          perf stat >/tmp/log .... or perf stat 2>/tmp/log ....
      
      They would not capture anything anymore. They would have to do:
          perf stat 0>/tmp/log ...
      
      This breaks compatibility with existing scripts and does not look very
      natural.
      
      This patch fixes the problem by looking at output_fd only when it was
      modified by user (> 0). It also checks that the value if positive.
      Passing --log-fd 0 is ignored.
      
      I would also argue that defaulting to stderr for the results is not the
      right thing to do, though this patch does not address this specific
      issue.
      
      Signed-off-by: default avatarStephane Eranian <eranian@google.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Jim Cromie <jim.cromie@gmail.com>
      Link: http://lkml.kernel.org/r/20120515111111.GA9870@quad
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      fc3e4d07
    • David Ahern's avatar
      perf tools: Fix endianity swapping for adds_features bitmask · 80c0120a
      David Ahern authored
      
      
      Based on Jiri's latest attempt:
      https://lkml.org/lkml/2012/5/16/61
      
      Basically, adds_features should be byte swapped assuming unsigned
      longs are either 8-bytes (u64) or 4-bytes (u32).
      
          Fixes 32-bit ppc dumping 64-bit x86 feature data:
           ========
           captured on: Sun May 20 19:23:23 2012
           hostname : nxos-vdc-dev3
           os release : 3.4.0-rc7+
           perf version : 3.4.rc4.137.g978da3
           arch : x86_64
           nrcpus online : 16
           nrcpus avail : 16
           cpudesc : Intel(R) Xeon(R) CPU E5540 @ 2.53GHz
           cpuid : GenuineIntel,6,26,5
           total memory : 24680324 kB
          ...
      
      Verified 64-bit x86 can still dump feature data for 32-bit ppc.
      
      Signed-off-by: default avatarDavid Ahern <dsahern@gmail.com>
      Reviewed-by: default avatarJiri Olsa <jolsa@redhat.com>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/4FBBB539.5010805@gmail.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      80c0120a
    • Shuah Khan's avatar
      perf/x86: Convert obsolete simple_strtoul() usage to kstrtoul() · e2b297fc
      Shuah Khan authored
      
      
      Signed-off-by: default avatarShuah Khan <shuahkhan@gmail.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Link: http://lkml.kernel.org/r/1339384421.3025.8.camel@lorien2
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      e2b297fc
    • Ingo Molnar's avatar
      Merge tag 'v3.5-rc2' into perf/core · c3e228d5
      Ingo Molnar authored
      
      
      Merge in Linux 3.5-rc2 - to pick up fixes.
      
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      c3e228d5
  8. Jun 09, 2012
    • Linus Torvalds's avatar
      Linux 3.5-rc2 · cfaf0251
      Linus Torvalds authored
      v3.5-rc2
      cfaf0251
    • David Rientjes's avatar
      mm, oom: fix badness score underflow · 1e11ad8d
      David Rientjes authored
      If the privileges given to root threads (3% of allowable memory) or a
      negative value of /proc/pid/oom_score_adj happen to exceed the amount of
      rss of a thread, its badness score overflows as a result of commit
      a7f638f9
      
       ("mm, oom: normalize oom scores to oom_score_adj scale only
      for userspace").
      
      Fix this by making the type signed and return 1, meaning the thread is
      still eligible for kill, if the value is negative.
      
      Reported-by: default avatarDave Jones <davej@redhat.com>
      Acked-by: default avatarOleg Nesterov <oleg@redhat.com>
      Signed-off-by: default avatarDavid Rientjes <rientjes@google.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      1e11ad8d
    • Linus Torvalds's avatar
      Merge branch 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 72494504
      Linus Torvalds authored
      Pull scheduler fixes from Ingo Molnar.
      
      * 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        sched: Fix the relax_domain_level boot parameter
        sched: Validate assumptions in sched_init_numa()
        sched: Always initialize cpu-power
        sched: Fix domain iteration
        sched/rt: Fix lockdep annotation within find_lock_lowest_rq()
        sched/numa: Load balance between remote nodes
        sched/x86: Calculate booted cores after construction of sibling_mask
      72494504
    • Randy Dunlap's avatar
      sched/fair: fix lots of kernel-doc warnings · cd96891d
      Randy Dunlap authored
      
      
      Fix lots of new kernel-doc warnings in kernel/sched/fair.c:
      
        Warning(kernel/sched/fair.c:3625): No description found for parameter 'env'
        Warning(kernel/sched/fair.c:3625): Excess function parameter 'sd' description in 'update_sg_lb_stats'
        Warning(kernel/sched/fair.c:3735): No description found for parameter 'env'
        Warning(kernel/sched/fair.c:3735): Excess function parameter 'sd' description in 'update_sd_pick_busiest'
        Warning(kernel/sched/fair.c:3735): Excess function parameter 'this_cpu' description in 'update_sd_pick_busiest'
        .. more warnings
      
      Signed-off-by: default avatarRandy Dunlap <rdunlap@xenotime.net>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      cd96891d
    • Linus Torvalds's avatar
      Revert "drm/i915/crt: Do not rely upon the HPD presence pin" · 8f53369b
      Linus Torvalds authored
      This reverts commit 9e612a00
      
      .
      
      It incorrectly finds VGA connectors where none are attached, apparently
      not noticing that nothing replied to the EDID queries, and happily using
      the default EDID modes that have nothing to do with actual hardware.
      
      That in turn then causes X to fall down to the lowest common
      denominator, which is usually the default 1024x768 mode that is in the
      default EDID and pretty much anything supports).
      
      I'd suggest that if not relying on the HDP pin, the code should at least
      check whether it gets valid EDID data back, rather than just assume
      there's something on the VGA connector.
      
      Cc: Dave Airlie <airlied@linux.ie>
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      8f53369b
    • Linus Torvalds's avatar
      Merge tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4 · 77249539
      Linus Torvalds authored
      Pull ext4 bug fixes from Theodore Ts'o:
       "This update contains two bug fixes, both destined for the stable tree.
        Perhaps the most important is one which fixes ext4 when used with file
        systems originally formatted for use with ext3, but then later
        converted to take advantage of ext4."
      
      * tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4:
        ext4: don't set i_flags in EXT4_IOC_SETFLAGS
        ext4: fix the free blocks calculation for ext3 file systems w/ uninit_bg
      77249539
    • Linus Torvalds's avatar
      Merge branch 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc · 3e9ca022
      Linus Torvalds authored
      Pull powerpc fixes from Paul Mackerras:
       "Two small fixes for powerpc:
         - a fix for a regression since 3.2 that causes 4-second (or longer)
           pauses
         - a fix for a potential oops when loading kernel modules on 32-bit
           embedded systems."
      
      * 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc:
        powerpc: Fix kernel panic during kernel module load
        powerpc/time: Sanity check of decrementer expiration is necessary
      3e9ca022
    • Linus Torvalds's avatar
      Merge tag 'upstream-3.5-rc2' of git://git.infradead.org/linux-ubifs · e7264308
      Linus Torvalds authored
      Pull UBI/UBIFS fixes from Artem Bityutskiy:
       "Fix UBI and UBIFS - they refuse to work without debugfs.  This was
        broken by the 3.5-rc1 UBI/UBIFS changes when we removed the debugging
        Kconfig switches.
      
        Also, correct locking in 'ubi_wl_flush()' - it was extended to support
        flushing a specific LEB in 3.5-rc1, and the locking was sub-optimal."
      
      * tag 'upstream-3.5-rc2' of git://git.infradead.org/linux-ubifs:
        UBI: correct ubi_wl_flush locking
        UBIFS: fix debugfs-less systems support
        UBI: fix debugfs-less systems support
      e7264308