projects/linux·commit 5d70f79b

Merge branch 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip

5d70f79b · Linus Torvalds <[email protected]> · 2010-10-21 12:54:49 -07:00

* 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (163 commits)
  tracing: Fix compile issue for trace_sched_wakeup.c
  [S390] hardirq: remove pointless header file includes
  [IA64] Move local_softirq_pending() definition
  perf, powerpc: Fix power_pmu_event_init to not use event->ctx
  ftrace: Remove recursion between recordmcount and scripts/mod/empty
  jump_label: Add COND_STMT(), reducer wrappery
  perf: Optimize sw events
  perf: Use jump_labels to optimize the scheduler hooks
  jump_label: Add atomic_t interface
  jump_label: Use more consistent naming
  perf, hw_breakpoint: Fix crash in hw_breakpoint creation
  perf: Find task before event alloc
  perf: Fix task refcount bugs
  perf: Fix group moving
  irq_work: Add generic hardirq context callbacks
  perf_events: Fix transaction recovery in group_sched_in()
  perf_events: Fix bogus AMD64 generic TLB events
  perf_events: Fix bogus context time tracking
  tracing: Remove parent recording in latency tracer graph options
  tracing: Use one prologue for the preempt irqs off tracer function tracers
  ...
Commit
5d70f79b5ef6ea2de4f72a37b2d96e2601e40a22
Parents
888a6f77 · 750ed158

Merge commit. Changes below are compared with the first parent: 888a6f77.

Changes

158 files changed · +7202 −3408

FileStatusAddDelContent
Documentation/kprobes.txtmodified+5−3View file
Makefilemodified+11−0View file
arch/Kconfigmodified+3−0View file
arch/alpha/Kconfigmodified+1−0View file
arch/alpha/include/asm/perf_event.hmodified+0−5View file
arch/alpha/kernel/perf_event.cmodified+86−42View file
arch/alpha/kernel/time.cmodified+15−15View file
arch/arm/Kconfigmodified+1−0View file
arch/arm/include/asm/perf_event.hmodified+0−12View file
arch/arm/kernel/perf_event.cmodified+102−110View file
arch/arm/oprofile/Makefilemodified+4−0View file
arch/arm/oprofile/common.cmodified+6−305View file
arch/frv/Kconfigmodified+1−0View file
arch/frv/lib/Makefilemodified+1−1View file
arch/frv/lib/perf_event.cdeleted+0−19View before deletion
arch/ia64/include/asm/hardirq.hmodified+5−6View file
arch/parisc/Kconfigmodified+1−0View file
arch/parisc/include/asm/perf_event.hmodified+1−2View file
arch/powerpc/Kconfigmodified+1−0View file
arch/powerpc/include/asm/paca.hmodified+1−1View file
arch/powerpc/kernel/perf_callchain.cmodified+25−61View file
arch/powerpc/kernel/perf_event.cmodified+102−64View file
arch/powerpc/kernel/perf_event_fsl_emb.cmodified+90−58View file
arch/powerpc/kernel/time.cmodified+21−21View file
arch/s390/Kconfigmodified+1−0View file
arch/s390/include/asm/hardirq.hmodified+0−4View file
arch/s390/include/asm/perf_event.hmodified+1−2View file
arch/sh/Kconfigmodified+14−0View file
arch/sh/include/asm/perf_event.hmodified+0−7View file
arch/sh/kernel/perf_callchain.cmodified+4−46View file
arch/sh/kernel/perf_event.cmodified+112−47View file
arch/sh/oprofile/Makefilemodified+4−0View file
arch/sh/oprofile/common.cmodified+23−92View file
arch/sh/oprofile/op_impl.hdeleted+0−33View before deletion
arch/sparc/Kconfigmodified+3−0View file
arch/sparc/include/asm/jump_label.hadded+32−0View file
arch/sparc/include/asm/perf_event.hmodified+0−4View file
arch/sparc/kernel/Makefilemodified+2−0View file
arch/sparc/kernel/jump_label.cadded+47−0View file
arch/sparc/kernel/module.cmodified+6−0View file
arch/sparc/kernel/pcr.cmodified+4−4View file
arch/sparc/kernel/perf_event.cmodified+123−117View file
arch/x86/Kconfigmodified+8−0View file
arch/x86/include/asm/alternative.hmodified+11−0View file
arch/x86/include/asm/entry_arch.hmodified+2−2View file
arch/x86/include/asm/hardirq.hmodified+1−1View file
arch/x86/include/asm/hw_irq.hmodified+1−1View file
arch/x86/include/asm/irq_vectors.hmodified+2−2View file
arch/x86/include/asm/jump_label.hadded+37−0View file
arch/x86/include/asm/perf_event_p4.hmodified+22−30View file
arch/x86/kernel/Makefilemodified+2−1View file
arch/x86/kernel/alternative.cmodified+68−3View file
arch/x86/kernel/cpu/perf_event.cmodified+123−157View file
arch/x86/kernel/cpu/perf_event_amd.cmodified+2−2View file
arch/x86/kernel/cpu/perf_event_intel.cmodified+4−4View file
arch/x86/kernel/cpu/perf_event_intel_ds.cmodified+7−6View file
arch/x86/kernel/cpu/perf_event_p4.cmodified+268−24View file
arch/x86/kernel/entry_64.Smodified+3−3View file
arch/x86/kernel/ftrace.cmodified+1−62View file
arch/x86/kernel/irq.cmodified+4−4View file
arch/x86/kernel/irq_work.cadded+30−0View file
arch/x86/kernel/irqinit.cmodified+3−3View file
arch/x86/kernel/jump_label.cadded+50−0View file
arch/x86/kernel/kprobes.cmodified+5−9View file
arch/x86/kernel/module.cmodified+3−0View file
arch/x86/kernel/setup.cmodified+6−0View file
arch/x86/mm/fault.cmodified+4−0View file
arch/x86/mm/kmemcheck/kmemcheck.cmodified+2−0View file
arch/x86/oprofile/backtrace.cmodified+59−11View file
arch/x86/oprofile/nmi_int.cmodified+1−8View file
drivers/oprofile/oprof.cmodified+8−24View file
drivers/oprofile/oprof.hmodified+1−1View file
drivers/oprofile/oprofile_files.cmodified+5−2View file
drivers/oprofile/oprofile_perf.cadded+328−0View file
drivers/oprofile/oprofilefs.cmodified+20−34View file
include/asm-generic/hardirq.hmodified+1−1View file
include/asm-generic/vmlinux.lds.hmodified+10−0View file
include/linux/dynamic_debug.hmodified+21−18View file
include/linux/ftrace_event.hmodified+4−4View file
include/linux/interrupt.hmodified+7−1View file
include/linux/irq_work.hadded+20−0View file
include/linux/jump_label.hadded+74−0View file
include/linux/jump_label_ref.hadded+44−0View file
include/linux/module.hmodified+4−1View file
include/linux/oprofile.hmodified+7−0View file
include/linux/percpu.hmodified+9−0View file
include/linux/perf_event.hmodified+138−74View file
include/linux/sched.hmodified+8−1View file
include/linux/stop_machine.hmodified+8−2View file
include/linux/tracepoint.hmodified+4−1View file
include/trace/events/irq.hmodified+24−2View file
include/trace/events/napi.hmodified+23−2View file
include/trace/events/net.hadded+82−0View file
include/trace/events/power.hmodified+87−3View file
include/trace/events/skb.hmodified+17−0View file
init/Kconfigmodified+8−0View file
kernel/Makefilemodified+3−1View file
kernel/exit.cmodified+1−3View file
kernel/hw_breakpoint.cmodified+63−12View file
kernel/irq_work.cadded+164−0View file
kernel/jump_label.cadded+429−0View file
kernel/kprobes.cmodified+17−9View file
kernel/module.cmodified+6−0View file
kernel/perf_event.cmodified+1557−1115View file
kernel/sched.cmodified+1−1View file
kernel/test_kprobes.cmodified+9−3View file
kernel/timer.cmodified+5−2View file
kernel/trace/Kconfigmodified+5−0View file
kernel/trace/ftrace.cmodified+82−45View file
kernel/trace/ring_buffer.cmodified+15−6View file
kernel/trace/trace.cmodified+1−1View file
kernel/trace/trace.hmodified+4−0View file
kernel/trace/trace_event_perf.cmodified+16−12View file
kernel/trace/trace_events.cmodified+18−37View file
kernel/trace/trace_functions_graph.cmodified+201−8View file
kernel/trace/trace_irqsoff.cmodified+55−97View file
kernel/trace/trace_sched_wakeup.cmodified+232−24View file
kernel/trace/trace_workqueue.cmodified+5−5View file
kernel/tracepoint.cmodified+12−2View file
kernel/watchdog.cmodified+15−26View file
lib/Kconfig.debugmodified+4−4View file
lib/dynamic_debug.cmodified+3−39View file
net/core/datagram.cmodified+1−0View file
net/core/dev.cmodified+8−0View file
net/core/net-traces.cmodified+1−0View file
net/core/skbuff.cmodified+1−0View file
scripts/Makefilemodified+1−0View file
scripts/Makefile.buildmodified+10−0View file
scripts/Makefile.libmodified+1−10View file
scripts/basic/Makefilemodified+1−1View file
scripts/basic/hash.cdeleted+0−64View before deletion
scripts/gcc-goto.shadded+5−0View file
scripts/recordmcount.cadded+363−0View file
scripts/recordmcount.hadded+366−0View file
tools/perf/Documentation/perf-annotate.txtmodified+9−2View file
tools/perf/Documentation/perf-report.txtmodified+7−0View file
tools/perf/Makefilemodified+24−6View file
tools/perf/builtin-annotate.cmodified+16−10View file
tools/perf/builtin-report.cmodified+12−2View file
tools/perf/feature-tests.makmodified+11−0View file
tools/perf/scripts/python/bin/netdev-times-recordadded+8−0View file
tools/perf/scripts/python/bin/netdev-times-reportadded+5−0View file
tools/perf/scripts/python/netdev-times.pyadded+464−0View file
tools/perf/util/cache.hmodified+2−0View file
tools/perf/util/callchain.cmodified+78−20View file
tools/perf/util/callchain.hmodified+17−10View file
tools/perf/util/hist.cmodified+3−1View file
tools/perf/util/path.cmodified+2−1View file
tools/perf/util/sort.hmodified+1−1View file
tools/perf/util/symbol.cmodified+14−0View file
tools/perf/util/symbol.hmodified+1−0View file
tools/perf/util/ui/browser.cmodified+63−54View file
tools/perf/util/ui/browser.hmodified+7−2View file
tools/perf/util/ui/browsers/annotate.cmodified+17−21View file
tools/perf/util/ui/browsers/hists.cmodified+196−131View file
tools/perf/util/ui/browsers/map.cmodified+13−19View file
tools/perf/util/ui/util.cmodified+1−3View file
tools/perf/util/util.hmodified+0−13View file

Only the first 600 diff lines are shown. Download the complete patch.

Documentation/kprobes.txt

View file
diff --git a/Documentation/kprobes.txt b/Documentation/kprobes.txt
index 1762b81..741fe66 100644
--- a/Documentation/kprobes.txt
+++ b/Documentation/kprobes.txt
@@ -542,9 +542,11 @@ Kprobes does not use mutexes or allocate memory except during
registration and unregistration.
Probe handlers are run with preemption disabled. Depending on the
-architecture, handlers may also run with interrupts disabled. In any
-case, your handler should not yield the CPU (e.g., by attempting to
-acquire a semaphore).
+architecture and optimization state, handlers may also run with
+interrupts disabled (e.g., kretprobe handlers and optimized kprobe
+handlers run without interrupt disabled on x86/x86-64). In any case,
+your handler should not yield the CPU (e.g., by attempting to acquire
+a semaphore).
Since a return probe is implemented by replacing the return
address with the trampoline's address, stack backtraces and calls

Makefile

View file
diff --git a/Makefile b/Makefile
index 860c26a..d3c1071 100644
--- a/Makefile
+++ b/Makefile
@@ -568,6 +568,12 @@ endif
ifdef CONFIG_FUNCTION_TRACER
KBUILD_CFLAGS += -pg
+ifdef CONFIG_DYNAMIC_FTRACE
+ ifdef CONFIG_HAVE_C_RECORDMCOUNT
+ BUILD_C_RECORDMCOUNT := y
+ export BUILD_C_RECORDMCOUNT
+ endif
+endif
endif
# We trigger additional mismatches with less inlining
@@ -591,6 +597,11 @@ KBUILD_CFLAGS += $(call cc-option,-fno-strict-overflow)
# conserve stack if available
KBUILD_CFLAGS += $(call cc-option,-fconserve-stack)
+# check for 'asm goto'
+ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC)), y)
+ KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO
+endif
+
# Add user supplied CPPFLAGS, AFLAGS and CFLAGS as the last assignments
# But warn user when we do so
warn-assign = \

arch/Kconfig

View file
diff --git a/arch/Kconfig b/arch/Kconfig
index fe48fc7..53d7f61 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -158,4 +158,7 @@ config HAVE_PERF_EVENTS_NMI
subsystem. Also has support for calculating CPU cycle events
to determine how many clock cycles in a given period.
+config HAVE_ARCH_JUMP_LABEL
+ bool
+
source "kernel/gcov/Kconfig"

arch/alpha/Kconfig

View file
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index b9647bb..d04ccd7 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -9,6 +9,7 @@ config ALPHA
select HAVE_IDE
select HAVE_OPROFILE
select HAVE_SYSCALL_WRAPPERS
+ select HAVE_IRQ_WORK
select HAVE_PERF_EVENTS
select HAVE_DMA_ATTRS
help

arch/alpha/include/asm/perf_event.h

View file
diff --git a/arch/alpha/include/asm/perf_event.h b/arch/alpha/include/asm/perf_event.h
index 4157cd3..fe792ca 100644
--- a/arch/alpha/include/asm/perf_event.h
+++ b/arch/alpha/include/asm/perf_event.h
@@ -1,11 +1,6 @@
#ifndef __ASM_ALPHA_PERF_EVENT_H
#define __ASM_ALPHA_PERF_EVENT_H
-/* Alpha only supports software events through this interface. */
-extern void set_perf_event_pending(void);
-
-#define PERF_EVENT_INDEX_OFFSET 0
-
#ifdef CONFIG_PERF_EVENTS
extern void init_hw_perf_events(void);
#else

arch/alpha/kernel/perf_event.c

View file
diff --git a/arch/alpha/kernel/perf_event.c b/arch/alpha/kernel/perf_event.c
index 85d8e4f..1cc4968 100644
--- a/arch/alpha/kernel/perf_event.c
+++ b/arch/alpha/kernel/perf_event.c
@@ -307,7 +307,7 @@ again:
new_raw_count) != prev_raw_count)
goto again;
- delta = (new_raw_count - (prev_raw_count & alpha_pmu->pmc_count_mask[idx])) + ovf;
+ delta = (new_raw_count - (prev_raw_count & alpha_pmu->pmc_count_mask[idx])) + ovf;
/* It is possible on very rare occasions that the PMC has overflowed
* but the interrupt is yet to come. Detect and fix this situation.
@@ -402,14 +402,13 @@ static void maybe_change_configuration(struct cpu_hw_events *cpuc)
struct hw_perf_event *hwc = &pe->hw;
int idx = hwc->idx;
- if (cpuc->current_idx[j] != PMC_NO_INDEX) {
- cpuc->idx_mask |= (1<<cpuc->current_idx[j]);
- continue;
+ if (cpuc->current_idx[j] == PMC_NO_INDEX) {
+ alpha_perf_event_set_period(pe, hwc, idx);
+ cpuc->current_idx[j] = idx;
}
- alpha_perf_event_set_period(pe, hwc, idx);
- cpuc->current_idx[j] = idx;
- cpuc->idx_mask |= (1<<cpuc->current_idx[j]);
+ if (!(hwc->state & PERF_HES_STOPPED))
+ cpuc->idx_mask |= (1<<cpuc->current_idx[j]);
}
cpuc->config = cpuc->event[0]->hw.config_base;
}
@@ -420,12 +419,13 @@ static void maybe_change_configuration(struct cpu_hw_events *cpuc)
* - this function is called from outside this module via the pmu struct
* returned from perf event initialisation.
*/
-static int alpha_pmu_enable(struct perf_event *event)
+static int alpha_pmu_add(struct perf_event *event, int flags)
{
struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
+ struct hw_perf_event *hwc = &event->hw;
int n0;
int ret;
- unsigned long flags;
+ unsigned long irq_flags;
/*
* The Sparc code has the IRQ disable first followed by the perf
@@ -435,8 +435,8 @@ static int alpha_pmu_enable(struct perf_event *event)
* nevertheless we disable the PMCs first to enable a potential
* final PMI to occur before we disable interrupts.
*/
- perf_disable();
- local_irq_save(flags);
+ perf_pmu_disable(event->pmu);
+ local_irq_save(irq_flags);
/* Default to error to be returned */
ret = -EAGAIN;
@@ -455,8 +455,12 @@ static int alpha_pmu_enable(struct perf_event *event)
}
}
- local_irq_restore(flags);
- perf_enable();
+ hwc->state = PERF_HES_UPTODATE;
+ if (!(flags & PERF_EF_START))
+ hwc->state |= PERF_HES_STOPPED;
+
+ local_irq_restore(irq_flags);
+ perf_pmu_enable(event->pmu);
return ret;
}
@@ -467,15 +471,15 @@ static int alpha_pmu_enable(struct perf_event *event)
* - this function is called from outside this module via the pmu struct
* returned from perf event initialisation.
*/
-static void alpha_pmu_disable(struct perf_event *event)
+static void alpha_pmu_del(struct perf_event *event, int flags)
{
struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
struct hw_perf_event *hwc = &event->hw;
- unsigned long flags;
+ unsigned long irq_flags;
int j;
- perf_disable();
- local_irq_save(flags);
+ perf_pmu_disable(event->pmu);
+ local_irq_save(irq_flags);
for (j = 0; j < cpuc->n_events; j++) {
if (event == cpuc->event[j]) {
@@ -501,8 +505,8 @@ static void alpha_pmu_disable(struct perf_event *event)
}
}
- local_irq_restore(flags);
- perf_enable();
+ local_irq_restore(irq_flags);
+ perf_pmu_enable(event->pmu);
}
@@ -514,13 +518,44 @@ static void alpha_pmu_read(struct perf_event *event)
}
-static void alpha_pmu_unthrottle(struct perf_event *event)
+static void alpha_pmu_stop(struct perf_event *event, int flags)
+{
+ struct hw_perf_event *hwc = &event->hw;
+ struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
+
+ if (!(hwc->state & PERF_HES_STOPPED)) {
+ cpuc->idx_mask &= ~(1UL<<hwc->idx);
+ hwc->state |= PERF_HES_STOPPED;
+ }
+
+ if ((flags & PERF_EF_UPDATE) && !(hwc->state & PERF_HES_UPTODATE)) {
+ alpha_perf_event_update(event, hwc, hwc->idx, 0);
+ hwc->state |= PERF_HES_UPTODATE;
+ }
+
+ if (cpuc->enabled)
+ wrperfmon(PERFMON_CMD_DISABLE, (1UL<<hwc->idx));
+}
+
+
+static void alpha_pmu_start(struct perf_event *event, int flags)
{
struct hw_perf_event *hwc = &event->hw;
struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
+ if (WARN_ON_ONCE(!(hwc->state & PERF_HES_STOPPED)))
+ return;
+
+ if (flags & PERF_EF_RELOAD) {
+ WARN_ON_ONCE(!(hwc->state & PERF_HES_UPTODATE));
+ alpha_perf_event_set_period(event, hwc, hwc->idx);
+ }
+
+ hwc->state = 0;
+
cpuc->idx_mask |= 1UL<<hwc->idx;
- wrperfmon(PERFMON_CMD_ENABLE, (1UL<<hwc->idx));
+ if (cpuc->enabled)
+ wrperfmon(PERFMON_CMD_ENABLE, (1UL<<hwc->idx));
}
@@ -642,39 +677,36 @@ static int __hw_perf_event_init(struct perf_event *event)
return 0;
}
-static const struct pmu pmu = {
- .enable = alpha_pmu_enable,
- .disable = alpha_pmu_disable,
- .read = alpha_pmu_read,
- .unthrottle = alpha_pmu_unthrottle,
-};
-
-
/*
* Main entry point to initialise a HW performance event.
*/
-const struct pmu *hw_perf_event_init(struct perf_event *event)
+static int alpha_pmu_event_init(struct perf_event *event)
{
int err;
+ switch (event->attr.type) {
+ case PERF_TYPE_RAW:
+ case PERF_TYPE_HARDWARE:
+ case PERF_TYPE_HW_CACHE:
+ break;
+
+ default:
+ return -ENOENT;
+ }
+
if (!alpha_pmu)
- return ERR_PTR(-ENODEV);
+ return -ENODEV;
/* Do the real initialisation work. */
err = __hw_perf_event_init(event);
- if (err)
- return ERR_PTR(err);
-
- return &pmu;
+ return err;
}
-
-
/*
* Main entry point - enable HW performance counters.
*/
-void hw_perf_enable(void)
+static void alpha_pmu_enable(struct pmu *pmu)
{
struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
@@ -700,7 +732,7 @@ void hw_perf_enable(void)
* Main entry point - disable HW performance counters.
*/
-void hw_perf_disable(void)
+static void alpha_pmu_disable(struct pmu *pmu)
{
struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
@@ -713,6 +745,17 @@ void hw_perf_disable(void)
wrperfmon(PERFMON_CMD_DISABLE, cpuc->idx_mask);
}
+static struct pmu pmu = {
+ .pmu_enable = alpha_pmu_enable,
+ .pmu_disable = alpha_pmu_disable,
+ .event_init = alpha_pmu_event_init,
+ .add = alpha_pmu_add,
+ .del = alpha_pmu_del,
+ .start = alpha_pmu_start,
+ .stop = alpha_pmu_stop,
+ .read = alpha_pmu_read,
+};
+
/*
* Main entry point - don't know when this is called but it
@@ -766,7 +809,7 @@ static void alpha_perf_event_irq_handler(unsigned long la_ptr,
wrperfmon(PERFMON_CMD_DISABLE, cpuc->idx_mask);
/* la_ptr is the counter that overflowed. */
- if (unlikely(la_ptr >= perf_max_events)) {
+ if (unlikely(la_ptr >= alpha_pmu->num_pmcs)) {
/* This should never occur! */
irq_err_count++;
pr_warning("PMI: silly index %ld\n", la_ptr);
@@ -807,7 +850,7 @@ static void alpha_perf_event_irq_handler(unsigned long la_ptr,
/* Interrupts coming too quickly; "throttle" the
* counter, i.e., disable it for a little while.
*/
- cpuc->idx_mask &= ~(1UL<<idx);
+ alpha_pmu_stop(event, 0);
}
}
wrperfmon(PERFMON_CMD_ENABLE, cpuc->idx_mask);
@@ -837,6 +880,7 @@ void __init init_hw_perf_events(void)
/* And set up PMU specification */
alpha_pmu = &ev67_pmu;
- perf_max_events = alpha_pmu->num_pmcs;
+
+ perf_pmu_register(&pmu);
}

arch/alpha/kernel/time.c

View file
diff --git a/arch/alpha/kernel/time.c b/arch/alpha/kernel/time.c
index 396af17..0f1d849 100644
--- a/arch/alpha/kernel/time.c
+++ b/arch/alpha/kernel/time.c
@@ -41,7 +41,7 @@
#include <linux/init.h>
#include <linux/bcd.h>
#include <linux/profile.h>
-#include <linux/perf_event.h>
+#include <linux/irq_work.h>
#include <asm/uaccess.h>
#include <asm/io.h>
@@ -83,25 +83,25 @@ static struct {
unsigned long est_cycle_freq;
-#ifdef CONFIG_PERF_EVENTS
+#ifdef CONFIG_IRQ_WORK
-DEFINE_PER_CPU(u8, perf_event_pending);
+DEFINE_PER_CPU(u8, irq_work_pending);
-#define set_perf_event_pending_flag() __get_cpu_var(perf_event_pending) = 1
-#define test_perf_event_pending() __get_cpu_var(perf_event_pending)
-#define clear_perf_event_pending() __get_cpu_var(perf_event_pending) = 0
+#define set_irq_work_pending_flag() __get_cpu_var(irq_work_pending) = 1
+#define test_irq_work_pending() __get_cpu_var(irq_work_pending)
+#define clear_irq_work_pending() __get_cpu_var(irq_work_pending) = 0
-void set_perf_event_pending(void)
+void set_irq_work_pending(void)
{
- set_perf_event_pending_flag();
+ set_irq_work_pending_flag();
}
-#else /* CONFIG_PERF_EVENTS */
+#else /* CONFIG_IRQ_WORK */
-#define test_perf_event_pending() 0
-#define clear_perf_event_pending()
+#define test_irq_work_pending() 0
+#define clear_irq_work_pending()
-#endif /* CONFIG_PERF_EVENTS */
+#endif /* CONFIG_IRQ_WORK */
static inline __u32 rpcc(void)
@@ -191,9 +191,9 @@ irqreturn_t timer_interrupt(int irq, void *dev)
write_sequnlock(&xtime_lock);
- if (test_perf_event_pending()) {
- clear_perf_event_pending();
- perf_event_do_pending();
+ if (test_irq_work_pending()) {
+ clear_irq_work_pending();
+ irq_work_run();
}
#ifndef CONFIG_SMP

arch/arm/Kconfig

View file
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 9c26ba7..9103904 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -23,6 +23,7 @@ config ARM
select HAVE_KERNEL_GZIP
select HAVE_KERNEL_LZO
select HAVE_KERNEL_LZMA
+ select HAVE_IRQ_WORK
select HAVE_PERF_EVENTS
select PERF_USE_VMALLOC
select HAVE_REGS_AND_STACK_ACCESS_API

arch/arm/include/asm/perf_event.h

View file
diff --git a/arch/arm/include/asm/perf_event.h b/arch/arm/include/asm/perf_event.h
index b5799a3..c4aa4e8 100644
--- a/arch/arm/include/asm/perf_event.h
+++ b/arch/arm/include/asm/perf_event.h
@@ -12,18 +12,6 @@
#ifndef __ARM_PERF_EVENT_H__
#define __ARM_PERF_EVENT_H__
-/*
- * NOP: on *most* (read: all supported) ARM platforms, the performance
- * counter interrupts are regular interrupts and not an NMI. This
- * means that when we receive the interrupt we can call
- * perf_event_do_pending() that handles all of the work with
- * interrupts disabled.
- */
-static inline void
-set_perf_event_pending(void)
-{
-}
-
/* ARM performance counters start from 1 (in the cp15 accesses) so use the
* same indexes here for consistency. */
#define PERF_EVENT_INDEX_OFFSET 1

arch/arm/kernel/perf_event.c

View file
diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c
index ecbb028..49643b1 100644
--- a/arch/arm/kernel/perf_event.c
+++ b/arch/arm/kernel/perf_event.c
@@ -123,6 +123,12 @@ armpmu_get_max_events(void)
}
EXPORT_SYMBOL_GPL(armpmu_get_max_events);
+int perf_num_counters(void)
+{
+ return armpmu_get_max_events();
+}
+EXPORT_SYMBOL_GPL(perf_num_counters);
+
#define HW_OP_UNSUPPORTED 0xFFFF
#define C(_x) \
@@ -221,46 +227,56 @@ again:
}
static void
-armpmu_disable(struct perf_event *event)
+armpmu_read(struct perf_event *event)
{
- struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
struct hw_perf_event *hwc = &event->hw;
- int idx = hwc->idx;
-
- WARN_ON(idx < 0);
-
- clear_bit(idx, cpuc->active_mask);
- armpmu->disable(hwc, idx);
-
- barrier();
- armpmu_event_update(event, hwc, idx);
- cpuc->events[idx] = NULL;
- clear_bit(idx, cpuc->used_mask);
+ /* Don't read disabled counters! */
+ if (hwc->idx < 0)
+ return;
- perf_event_update_userpage(event);
+ armpmu_event_update(event, hwc, hwc->idx);
}
static void
-armpmu_read(struct perf_event *event)
+armpmu_stop(struct perf_event *event, int flags)
{
struct hw_perf_event *hwc = &event->hw;
- /* Don't read disabled counters! */
- if (hwc->idx < 0)
+ if (!armpmu)
return;
- armpmu_event_update(event, hwc, hwc->idx);
+ /*
+ * ARM pmu always has to update the counter, so ignore
+ * PERF_EF_UPDATE, see comments in armpmu_start().
+ */
+ if (!(hwc->state & PERF_HES_STOPPED)) {
+ armpmu->disable(hwc, hwc->idx);
+ barrier(); /* why? */
+ armpmu_event_update(event, hwc, hwc->idx);
+ hwc->state |= PERF_HES_STOPPED | PERF_HES_UPTODATE;
+ }
}
static void
-armpmu_unthrottle(struct perf_event *event)
+armpmu_start(struct perf_event *event, int flags)
{
struct hw_perf_event *hwc = &event->hw;
+ if (!armpmu)
+ return;
+
+ /*
+ * ARM pmu always has to reprogram the period, so ignore
+ * PERF_EF_RELOAD, see the comment below.
+ */
+ if (flags & PERF_EF_RELOAD)
+ WARN_ON_ONCE(!(hwc->state & PERF_HES_UPTODATE));
+
+ hwc->state = 0;
/*
* Set the period again. Some counters can't be stopped, so when we
- * were throttled we simply disabled the IRQ source and the counter
+ * were stopped we simply disabled the IRQ source and the counter
* may have been left counting. If we don't do this step then we may
* get an interrupt too soon or *way* too late if the overflow has
* happened since disabling.
@@ -269,14 +285,33 @@ armpmu_unthrottle(struct perf_event *event)
armpmu->enable(hwc, hwc->idx);
}
+static void
+armpmu_del(struct perf_event *event, int flags)
+{
+ struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
+ struct hw_perf_event *hwc = &event->hw;
+ int idx = hwc->idx;
+
+ WARN_ON(idx < 0);
+
+ clear_bit(idx, cpuc->active_mask);
+ armpmu_stop(event, PERF_EF_UPDATE);
+ cpuc->events[idx] = NULL;
+ clear_bit(idx, cpuc->used_mask);
+
+ perf_event_update_userpage(event);
+}
+
static int
-armpmu_enable(struct perf_event *event)
+armpmu_add(struct perf_event *event, int flags)
{
struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
struct hw_perf_event *hwc = &event->hw;
int idx;
int err = 0;
+ perf_pmu_disable(event->pmu);
+
/* If we don't have a space for the counter then finish early. */
idx = armpmu->get_event_idx(cpuc, hwc);
if (idx < 0) {
@@ -293,25 +328,19 @@ armpmu_enable(struct perf_event *event)
cpuc->events[idx] = event;
set_bit(idx, cpuc->active_mask);
- /* Set the period for the event. */
- armpmu_event_set_period(event, hwc, idx);
-
- /* Enable the event. */
- armpmu->enable(hwc, idx);
+ hwc->state = PERF_HES_STOPPED | PERF_HES_UPTODATE;
+ if (flags & PERF_EF_START)
+ armpmu_start(event, PERF_EF_RELOAD);
/* Propagate our changes to the userspace mapping. */
perf_event_update_userpage(event);
out:
+ perf_pmu_enable(event->pmu);
return err;
}
-static struct pmu pmu = {
- .enable = armpmu_enable,
- .disable = armpmu_disable,

This diff is incomplete. Download the complete patch.

arch/arm/oprofile/Makefile

View file

This diff is incomplete. Download the complete patch.

arch/arm/oprofile/common.c

View file

This diff is incomplete. Download the complete patch.

arch/frv/Kconfig

View file

This diff is incomplete. Download the complete patch.

arch/frv/lib/Makefile

View file

This diff is incomplete. Download the complete patch.

arch/frv/lib/perf_event.c

View before deletion

This diff is incomplete. Download the complete patch.

arch/ia64/include/asm/hardirq.h

View file

This diff is incomplete. Download the complete patch.

arch/parisc/Kconfig

View file

This diff is incomplete. Download the complete patch.

arch/parisc/include/asm/perf_event.h

View file

This diff is incomplete. Download the complete patch.

arch/powerpc/Kconfig

View file

This diff is incomplete. Download the complete patch.

arch/powerpc/include/asm/paca.h

View file

This diff is incomplete. Download the complete patch.

arch/powerpc/kernel/perf_callchain.c

View file

This diff is incomplete. Download the complete patch.

arch/powerpc/kernel/perf_event.c

View file

This diff is incomplete. Download the complete patch.

arch/powerpc/kernel/perf_event_fsl_emb.c

View file

This diff is incomplete. Download the complete patch.

arch/powerpc/kernel/time.c

View file

This diff is incomplete. Download the complete patch.

arch/s390/Kconfig

View file

This diff is incomplete. Download the complete patch.

arch/s390/include/asm/hardirq.h

View file

This diff is incomplete. Download the complete patch.

arch/s390/include/asm/perf_event.h

View file

This diff is incomplete. Download the complete patch.

arch/sh/Kconfig

View file

This diff is incomplete. Download the complete patch.

arch/sh/include/asm/perf_event.h

View file

This diff is incomplete. Download the complete patch.

arch/sh/kernel/perf_callchain.c

View file

This diff is incomplete. Download the complete patch.

arch/sh/kernel/perf_event.c

View file

This diff is incomplete. Download the complete patch.

arch/sh/oprofile/Makefile

View file

This diff is incomplete. Download the complete patch.

arch/sh/oprofile/common.c

View file

This diff is incomplete. Download the complete patch.

arch/sh/oprofile/op_impl.h

View before deletion

This diff is incomplete. Download the complete patch.

arch/sparc/Kconfig

View file

This diff is incomplete. Download the complete patch.

arch/sparc/include/asm/jump_label.h

View file

This diff is incomplete. Download the complete patch.

arch/sparc/include/asm/perf_event.h

View file

This diff is incomplete. Download the complete patch.

arch/sparc/kernel/Makefile

View file

This diff is incomplete. Download the complete patch.

arch/sparc/kernel/jump_label.c

View file

This diff is incomplete. Download the complete patch.

arch/sparc/kernel/module.c

View file

This diff is incomplete. Download the complete patch.

arch/sparc/kernel/pcr.c

View file

This diff is incomplete. Download the complete patch.

arch/sparc/kernel/perf_event.c

View file

This diff is incomplete. Download the complete patch.

arch/x86/Kconfig

View file

This diff is incomplete. Download the complete patch.

arch/x86/include/asm/alternative.h

View file

This diff is incomplete. Download the complete patch.

arch/x86/include/asm/entry_arch.h

View file

This diff is incomplete. Download the complete patch.

arch/x86/include/asm/hardirq.h

View file

This diff is incomplete. Download the complete patch.

arch/x86/include/asm/hw_irq.h

View file

This diff is incomplete. Download the complete patch.

arch/x86/include/asm/irq_vectors.h

View file

This diff is incomplete. Download the complete patch.

arch/x86/include/asm/jump_label.h

View file

This diff is incomplete. Download the complete patch.

arch/x86/include/asm/perf_event_p4.h

View file

This diff is incomplete. Download the complete patch.

arch/x86/kernel/Makefile

View file

This diff is incomplete. Download the complete patch.

arch/x86/kernel/alternative.c

View file

This diff is incomplete. Download the complete patch.

arch/x86/kernel/cpu/perf_event.c

View file

This diff is incomplete. Download the complete patch.

arch/x86/kernel/cpu/perf_event_amd.c

View file

This diff is incomplete. Download the complete patch.

arch/x86/kernel/cpu/perf_event_intel.c

View file

This diff is incomplete. Download the complete patch.

arch/x86/kernel/cpu/perf_event_intel_ds.c

View file

This diff is incomplete. Download the complete patch.

arch/x86/kernel/cpu/perf_event_p4.c

View file

This diff is incomplete. Download the complete patch.

arch/x86/kernel/entry_64.S

View file

This diff is incomplete. Download the complete patch.

arch/x86/kernel/ftrace.c

View file

This diff is incomplete. Download the complete patch.

arch/x86/kernel/irq.c

View file

This diff is incomplete. Download the complete patch.

arch/x86/kernel/irq_work.c

View file

This diff is incomplete. Download the complete patch.

arch/x86/kernel/irqinit.c

View file

This diff is incomplete. Download the complete patch.

arch/x86/kernel/jump_label.c

View file

This diff is incomplete. Download the complete patch.

arch/x86/kernel/kprobes.c

View file

This diff is incomplete. Download the complete patch.

arch/x86/kernel/module.c

View file

This diff is incomplete. Download the complete patch.

arch/x86/kernel/setup.c

View file

This diff is incomplete. Download the complete patch.

arch/x86/mm/fault.c

View file

This diff is incomplete. Download the complete patch.

arch/x86/mm/kmemcheck/kmemcheck.c

View file

This diff is incomplete. Download the complete patch.

arch/x86/oprofile/backtrace.c

View file

This diff is incomplete. Download the complete patch.

arch/x86/oprofile/nmi_int.c

View file

This diff is incomplete. Download the complete patch.

drivers/oprofile/oprof.c

View file

This diff is incomplete. Download the complete patch.

drivers/oprofile/oprof.h

View file

This diff is incomplete. Download the complete patch.

drivers/oprofile/oprofile_files.c

View file

This diff is incomplete. Download the complete patch.

drivers/oprofile/oprofile_perf.c

View file

This diff is incomplete. Download the complete patch.

drivers/oprofile/oprofilefs.c

View file

This diff is incomplete. Download the complete patch.

include/asm-generic/hardirq.h

View file

This diff is incomplete. Download the complete patch.

include/asm-generic/vmlinux.lds.h

View file

This diff is incomplete. Download the complete patch.

include/linux/dynamic_debug.h

View file

This diff is incomplete. Download the complete patch.

include/linux/ftrace_event.h

View file

This diff is incomplete. Download the complete patch.

include/linux/interrupt.h

View file

This diff is incomplete. Download the complete patch.

include/linux/irq_work.h

View file

This diff is incomplete. Download the complete patch.

include/linux/jump_label.h

View file

This diff is incomplete. Download the complete patch.

include/linux/jump_label_ref.h

View file

This diff is incomplete. Download the complete patch.

include/linux/module.h

View file

This diff is incomplete. Download the complete patch.

include/linux/oprofile.h

View file

This diff is incomplete. Download the complete patch.

include/linux/percpu.h

View file

This diff is incomplete. Download the complete patch.

include/linux/perf_event.h

View file

This diff is incomplete. Download the complete patch.

include/linux/sched.h

View file

This diff is incomplete. Download the complete patch.

include/linux/stop_machine.h

View file

This diff is incomplete. Download the complete patch.

include/linux/tracepoint.h

View file

This diff is incomplete. Download the complete patch.

include/trace/events/irq.h

View file

This diff is incomplete. Download the complete patch.

include/trace/events/napi.h

View file

This diff is incomplete. Download the complete patch.

include/trace/events/net.h

View file

This diff is incomplete. Download the complete patch.

include/trace/events/power.h

View file

This diff is incomplete. Download the complete patch.

include/trace/events/skb.h

View file

This diff is incomplete. Download the complete patch.

init/Kconfig

View file

This diff is incomplete. Download the complete patch.

kernel/Makefile

View file

This diff is incomplete. Download the complete patch.

kernel/exit.c

View file

This diff is incomplete. Download the complete patch.

kernel/hw_breakpoint.c

View file

This diff is incomplete. Download the complete patch.

kernel/irq_work.c

View file

This diff is incomplete. Download the complete patch.

kernel/jump_label.c

View file

This diff is incomplete. Download the complete patch.

kernel/kprobes.c

View file

This diff is incomplete. Download the complete patch.

kernel/module.c

View file

This diff is incomplete. Download the complete patch.

kernel/perf_event.c

View file

This diff is incomplete. Download the complete patch.

kernel/sched.c

View file

This diff is incomplete. Download the complete patch.

kernel/test_kprobes.c

View file

This diff is incomplete. Download the complete patch.

kernel/timer.c

View file

This diff is incomplete. Download the complete patch.

kernel/trace/Kconfig

View file

This diff is incomplete. Download the complete patch.

kernel/trace/ftrace.c

View file

This diff is incomplete. Download the complete patch.

kernel/trace/ring_buffer.c

View file

This diff is incomplete. Download the complete patch.

kernel/trace/trace.c

View file

This diff is incomplete. Download the complete patch.

kernel/trace/trace.h

View file

This diff is incomplete. Download the complete patch.

kernel/trace/trace_event_perf.c

View file

This diff is incomplete. Download the complete patch.

kernel/trace/trace_events.c

View file

This diff is incomplete. Download the complete patch.

kernel/trace/trace_functions_graph.c

View file

This diff is incomplete. Download the complete patch.

kernel/trace/trace_irqsoff.c

View file

This diff is incomplete. Download the complete patch.

kernel/trace/trace_sched_wakeup.c

View file

This diff is incomplete. Download the complete patch.

kernel/trace/trace_workqueue.c

View file

This diff is incomplete. Download the complete patch.

kernel/tracepoint.c

View file

This diff is incomplete. Download the complete patch.

kernel/watchdog.c

View file

This diff is incomplete. Download the complete patch.

lib/Kconfig.debug

View file

This diff is incomplete. Download the complete patch.

lib/dynamic_debug.c

View file

This diff is incomplete. Download the complete patch.

net/core/datagram.c

View file

This diff is incomplete. Download the complete patch.

net/core/dev.c

View file

This diff is incomplete. Download the complete patch.

net/core/net-traces.c

View file

This diff is incomplete. Download the complete patch.

net/core/skbuff.c

View file

This diff is incomplete. Download the complete patch.

scripts/Makefile

View file

This diff is incomplete. Download the complete patch.

scripts/Makefile.build

View file

This diff is incomplete. Download the complete patch.

scripts/Makefile.lib

View file

This diff is incomplete. Download the complete patch.

scripts/basic/Makefile

View file

This diff is incomplete. Download the complete patch.

scripts/basic/hash.c

View before deletion

This diff is incomplete. Download the complete patch.

scripts/gcc-goto.sh

View file

This diff is incomplete. Download the complete patch.

scripts/recordmcount.c

View file

This diff is incomplete. Download the complete patch.

scripts/recordmcount.h

View file

This diff is incomplete. Download the complete patch.

tools/perf/Documentation/perf-annotate.txt

View file

This diff is incomplete. Download the complete patch.

tools/perf/Documentation/perf-report.txt

View file

This diff is incomplete. Download the complete patch.

tools/perf/Makefile

View file

This diff is incomplete. Download the complete patch.

tools/perf/builtin-annotate.c

View file

This diff is incomplete. Download the complete patch.

tools/perf/builtin-report.c

View file

This diff is incomplete. Download the complete patch.

tools/perf/feature-tests.mak

View file

This diff is incomplete. Download the complete patch.

tools/perf/scripts/python/bin/netdev-times-record

View file

This diff is incomplete. Download the complete patch.

tools/perf/scripts/python/bin/netdev-times-report

View file

This diff is incomplete. Download the complete patch.

tools/perf/scripts/python/netdev-times.py

View file

This diff is incomplete. Download the complete patch.

tools/perf/util/cache.h

View file

This diff is incomplete. Download the complete patch.

tools/perf/util/callchain.c

View file

This diff is incomplete. Download the complete patch.

tools/perf/util/callchain.h

View file

This diff is incomplete. Download the complete patch.

tools/perf/util/hist.c

View file

This diff is incomplete. Download the complete patch.

tools/perf/util/path.c

View file

This diff is incomplete. Download the complete patch.

tools/perf/util/sort.h

View file

This diff is incomplete. Download the complete patch.

tools/perf/util/symbol.c

View file

This diff is incomplete. Download the complete patch.

tools/perf/util/symbol.h

View file

This diff is incomplete. Download the complete patch.

tools/perf/util/ui/browser.c

View file

This diff is incomplete. Download the complete patch.

tools/perf/util/ui/browser.h

View file

This diff is incomplete. Download the complete patch.

tools/perf/util/ui/browsers/annotate.c

View file

This diff is incomplete. Download the complete patch.

tools/perf/util/ui/browsers/hists.c

View file

This diff is incomplete. Download the complete patch.

tools/perf/util/ui/browsers/map.c

View file

This diff is incomplete. Download the complete patch.

tools/perf/util/ui/util.c

View file

This diff is incomplete. Download the complete patch.

tools/perf/util/util.h

View file

This diff is incomplete. Download the complete patch.