Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 304899
b: refs/heads/master
c: c4f400e
h: refs/heads/master
i:
  304897: 5dd0d9c
  304895: a375f8b
v: v3
  • Loading branch information
Ingo Molnar committed May 9, 2012
1 parent 4a7a006 commit 9a34f75
Show file tree
Hide file tree
Showing 25 changed files with 786 additions and 154 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 68179686ac67cb08f08b1ef28b860d5ed899f242
refs/heads/master: c4f400e837713f677de94390c57e7dc7567e0286
3 changes: 1 addition & 2 deletions trunk/arch/alpha/kernel/perf_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,6 @@ static void alpha_perf_event_irq_handler(unsigned long la_ptr,

idx = la_ptr;

perf_sample_data_init(&data, 0);
for (j = 0; j < cpuc->n_events; j++) {
if (cpuc->current_idx[j] == idx)
break;
Expand All @@ -848,7 +847,7 @@ static void alpha_perf_event_irq_handler(unsigned long la_ptr,

hwc = &event->hw;
alpha_perf_event_update(event, hwc, idx, alpha_pmu->pmc_max_period[idx]+1);
data.period = event->hw.last_period;
perf_sample_data_init(&data, 0, hwc->last_period);

if (alpha_perf_event_set_period(event, hwc, idx)) {
if (perf_event_overflow(event, &data, regs)) {
Expand Down
4 changes: 1 addition & 3 deletions trunk/arch/arm/kernel/perf_event_v6.c
Original file line number Diff line number Diff line change
Expand Up @@ -489,8 +489,6 @@ armv6pmu_handle_irq(int irq_num,
*/
armv6_pmcr_write(pmcr);

perf_sample_data_init(&data, 0);

cpuc = &__get_cpu_var(cpu_hw_events);
for (idx = 0; idx < cpu_pmu->num_events; ++idx) {
struct perf_event *event = cpuc->events[idx];
Expand All @@ -509,7 +507,7 @@ armv6pmu_handle_irq(int irq_num,

hwc = &event->hw;
armpmu_event_update(event, hwc, idx);
data.period = event->hw.last_period;
perf_sample_data_init(&data, 0, hwc->last_period);
if (!armpmu_event_set_period(event, hwc, idx))
continue;

Expand Down
4 changes: 1 addition & 3 deletions trunk/arch/arm/kernel/perf_event_v7.c
Original file line number Diff line number Diff line change
Expand Up @@ -1077,8 +1077,6 @@ static irqreturn_t armv7pmu_handle_irq(int irq_num, void *dev)
*/
regs = get_irq_regs();

perf_sample_data_init(&data, 0);

cpuc = &__get_cpu_var(cpu_hw_events);
for (idx = 0; idx < cpu_pmu->num_events; ++idx) {
struct perf_event *event = cpuc->events[idx];
Expand All @@ -1097,7 +1095,7 @@ static irqreturn_t armv7pmu_handle_irq(int irq_num, void *dev)

hwc = &event->hw;
armpmu_event_update(event, hwc, idx);
data.period = event->hw.last_period;
perf_sample_data_init(&data, 0, hwc->last_period);
if (!armpmu_event_set_period(event, hwc, idx))
continue;

Expand Down
8 changes: 2 additions & 6 deletions trunk/arch/arm/kernel/perf_event_xscale.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,6 @@ xscale1pmu_handle_irq(int irq_num, void *dev)

regs = get_irq_regs();

perf_sample_data_init(&data, 0);

cpuc = &__get_cpu_var(cpu_hw_events);
for (idx = 0; idx < cpu_pmu->num_events; ++idx) {
struct perf_event *event = cpuc->events[idx];
Expand All @@ -263,7 +261,7 @@ xscale1pmu_handle_irq(int irq_num, void *dev)

hwc = &event->hw;
armpmu_event_update(event, hwc, idx);
data.period = event->hw.last_period;
perf_sample_data_init(&data, 0, hwc->last_period);
if (!armpmu_event_set_period(event, hwc, idx))
continue;

Expand Down Expand Up @@ -588,8 +586,6 @@ xscale2pmu_handle_irq(int irq_num, void *dev)

regs = get_irq_regs();

perf_sample_data_init(&data, 0);

cpuc = &__get_cpu_var(cpu_hw_events);
for (idx = 0; idx < cpu_pmu->num_events; ++idx) {
struct perf_event *event = cpuc->events[idx];
Expand All @@ -603,7 +599,7 @@ xscale2pmu_handle_irq(int irq_num, void *dev)

hwc = &event->hw;
armpmu_event_update(event, hwc, idx);
data.period = event->hw.last_period;
perf_sample_data_init(&data, 0, hwc->last_period);
if (!armpmu_event_set_period(event, hwc, idx))
continue;

Expand Down
2 changes: 1 addition & 1 deletion trunk/arch/mips/kernel/perf_event_mipsxx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1325,7 +1325,7 @@ static int mipsxx_pmu_handle_shared_irq(void)

regs = get_irq_regs();

perf_sample_data_init(&data, 0);
perf_sample_data_init(&data, 0, 0);

switch (counters) {
#define HANDLE_COUNTER(n) \
Expand Down
3 changes: 1 addition & 2 deletions trunk/arch/powerpc/perf/core-book3s.c
Original file line number Diff line number Diff line change
Expand Up @@ -1299,8 +1299,7 @@ static void record_and_restart(struct perf_event *event, unsigned long val,
if (record) {
struct perf_sample_data data;

perf_sample_data_init(&data, ~0ULL);
data.period = event->hw.last_period;
perf_sample_data_init(&data, ~0ULL, event->hw.last_period);

if (event->attr.sample_type & PERF_SAMPLE_ADDR)
perf_get_data_addr(regs, &data.addr);
Expand Down
3 changes: 1 addition & 2 deletions trunk/arch/powerpc/perf/core-fsl-emb.c
Original file line number Diff line number Diff line change
Expand Up @@ -613,8 +613,7 @@ static void record_and_restart(struct perf_event *event, unsigned long val,
if (record) {
struct perf_sample_data data;

perf_sample_data_init(&data, 0);
data.period = event->hw.last_period;
perf_sample_data_init(&data, 0, event->hw.last_period);

if (perf_event_overflow(event, &data, regs))
fsl_emb_pmu_stop(event, 0);
Expand Down
4 changes: 1 addition & 3 deletions trunk/arch/sparc/kernel/perf_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -1296,8 +1296,6 @@ static int __kprobes perf_event_nmi_handler(struct notifier_block *self,

regs = args->regs;

perf_sample_data_init(&data, 0);

cpuc = &__get_cpu_var(cpu_hw_events);

/* If the PMU has the TOE IRQ enable bits, we need to do a
Expand All @@ -1321,7 +1319,7 @@ static int __kprobes perf_event_nmi_handler(struct notifier_block *self,
if (val & (1ULL << 31))
continue;

data.period = event->hw.last_period;
perf_sample_data_init(&data, 0, hwc->last_period);
if (!sparc_perf_event_set_period(event, hwc, idx))
continue;

Expand Down
5 changes: 5 additions & 0 deletions trunk/arch/x86/include/asm/msr-index.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,20 @@
#define MSR_AMD64_IBSFETCHCTL 0xc0011030
#define MSR_AMD64_IBSFETCHLINAD 0xc0011031
#define MSR_AMD64_IBSFETCHPHYSAD 0xc0011032
#define MSR_AMD64_IBSFETCH_REG_COUNT 3
#define MSR_AMD64_IBSFETCH_REG_MASK ((1UL<<MSR_AMD64_IBSFETCH_REG_COUNT)-1)
#define MSR_AMD64_IBSOPCTL 0xc0011033
#define MSR_AMD64_IBSOPRIP 0xc0011034
#define MSR_AMD64_IBSOPDATA 0xc0011035
#define MSR_AMD64_IBSOPDATA2 0xc0011036
#define MSR_AMD64_IBSOPDATA3 0xc0011037
#define MSR_AMD64_IBSDCLINAD 0xc0011038
#define MSR_AMD64_IBSDCPHYSAD 0xc0011039
#define MSR_AMD64_IBSOP_REG_COUNT 7
#define MSR_AMD64_IBSOP_REG_MASK ((1UL<<MSR_AMD64_IBSOP_REG_COUNT)-1)
#define MSR_AMD64_IBSCTL 0xc001103a
#define MSR_AMD64_IBSBRTARGET 0xc001103b
#define MSR_AMD64_IBS_REG_COUNT_MAX 8 /* includes MSR_AMD64_IBSBRTARGET */

/* Fam 15h MSRs */
#define MSR_F15H_PERF_CTL 0xc0010200
Expand Down
8 changes: 6 additions & 2 deletions trunk/arch/x86/include/asm/perf_event.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ struct x86_pmu_capability {
#define IBS_CAPS_OPCNT (1U<<4)
#define IBS_CAPS_BRNTRGT (1U<<5)
#define IBS_CAPS_OPCNTEXT (1U<<6)
#define IBS_CAPS_RIPINVALIDCHK (1U<<7)

#define IBS_CAPS_DEFAULT (IBS_CAPS_AVAIL \
| IBS_CAPS_FETCHSAM \
Expand All @@ -170,19 +171,22 @@ struct x86_pmu_capability {
#define IBSCTL_LVT_OFFSET_VALID (1ULL<<8)
#define IBSCTL_LVT_OFFSET_MASK 0x0F

/* IbsFetchCtl bits/masks */
/* ibs fetch bits/masks */
#define IBS_FETCH_RAND_EN (1ULL<<57)
#define IBS_FETCH_VAL (1ULL<<49)
#define IBS_FETCH_ENABLE (1ULL<<48)
#define IBS_FETCH_CNT 0xFFFF0000ULL
#define IBS_FETCH_MAX_CNT 0x0000FFFFULL

/* IbsOpCtl bits */
/* ibs op bits/masks */
/* lower 4 bits of the current count are ignored: */
#define IBS_OP_CUR_CNT (0xFFFF0ULL<<32)
#define IBS_OP_CNT_CTL (1ULL<<19)
#define IBS_OP_VAL (1ULL<<18)
#define IBS_OP_ENABLE (1ULL<<17)
#define IBS_OP_MAX_CNT 0x0000FFFFULL
#define IBS_OP_MAX_CNT_EXT 0x007FFFFFULL /* not a register bit mask */
#define IBS_RIP_INVALID (1ULL<<38)

extern u32 get_ibs_caps(void);

Expand Down
4 changes: 1 addition & 3 deletions trunk/arch/x86/kernel/cpu/perf_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -1183,8 +1183,6 @@ int x86_pmu_handle_irq(struct pt_regs *regs)
int idx, handled = 0;
u64 val;

perf_sample_data_init(&data, 0);

cpuc = &__get_cpu_var(cpu_hw_events);

/*
Expand Down Expand Up @@ -1219,7 +1217,7 @@ int x86_pmu_handle_irq(struct pt_regs *regs)
* event overflow
*/
handled++;
data.period = event->hw.last_period;
perf_sample_data_init(&data, 0, event->hw.last_period);

if (!x86_perf_event_set_period(event))
continue;
Expand Down
7 changes: 6 additions & 1 deletion trunk/arch/x86/kernel/cpu/perf_event_amd.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,13 @@ static u64 amd_pmu_event_map(int hw_event)

static int amd_pmu_hw_config(struct perf_event *event)
{
int ret = x86_pmu_hw_config(event);
int ret;

/* pass precise event sampling to ibs: */
if (event->attr.precise_ip && get_ibs_caps())
return -ENOENT;

ret = x86_pmu_hw_config(event);
if (ret)
return ret;

Expand Down
Loading

0 comments on commit 9a34f75

Please sign in to comment.