Skip to content

Commit

Permalink
Merge branches 'perf/powerpc' and 'perf/bench' into perf/core
Browse files Browse the repository at this point in the history
Merge reason: Both 'perf bench' and the pending PowerPC changes
              are now ready for the next merge window.

Signed-off-by: Ingo Molnar <[email protected]>
  • Loading branch information
Ingo Molnar committed Nov 15, 2009
3 parents 39dc78b + c86e2ea + c5659b7 commit 0ffa798
Show file tree
Hide file tree
Showing 37 changed files with 1,146 additions and 96 deletions.
2 changes: 1 addition & 1 deletion arch/powerpc/Kconfig.debug
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ config DEBUG_STACK_USAGE

config HCALL_STATS
bool "Hypervisor call instrumentation"
depends on PPC_PSERIES && DEBUG_FS
depends on PPC_PSERIES && DEBUG_FS && TRACEPOINTS
help
Adds code to keep track of the number of hypervisor calls made and
the amount of time spent in hypervisor calls. Wall time spent in
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/configs/pseries_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1683,7 +1683,7 @@ CONFIG_HAVE_ARCH_KGDB=y
CONFIG_DEBUG_STACKOVERFLOW=y
# CONFIG_DEBUG_STACK_USAGE is not set
# CONFIG_DEBUG_PAGEALLOC is not set
CONFIG_HCALL_STATS=y
# CONFIG_HCALL_STATS is not set
# CONFIG_CODE_PATCHING_SELFTEST is not set
# CONFIG_FTR_FIXUP_SELFTEST is not set
# CONFIG_MSI_BITMAP_SELFTEST is not set
Expand Down
19 changes: 17 additions & 2 deletions arch/powerpc/include/asm/emulated_ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#define _ASM_POWERPC_EMULATED_OPS_H

#include <asm/atomic.h>
#include <linux/perf_event.h>


#ifdef CONFIG_PPC_EMULATED_STATS
Expand Down Expand Up @@ -57,7 +58,7 @@ extern u32 ppc_warn_emulated;

extern void ppc_warn_emulated_print(const char *type);

#define PPC_WARN_EMULATED(type) \
#define __PPC_WARN_EMULATED(type) \
do { \
atomic_inc(&ppc_emulated.type.val); \
if (ppc_warn_emulated) \
Expand All @@ -66,8 +67,22 @@ extern void ppc_warn_emulated_print(const char *type);

#else /* !CONFIG_PPC_EMULATED_STATS */

#define PPC_WARN_EMULATED(type) do { } while (0)
#define __PPC_WARN_EMULATED(type) do { } while (0)

#endif /* !CONFIG_PPC_EMULATED_STATS */

#define PPC_WARN_EMULATED(type, regs) \
do { \
perf_sw_event(PERF_COUNT_SW_EMULATION_FAULTS, \
1, 0, regs, 0); \
__PPC_WARN_EMULATED(type); \
} while (0)

#define PPC_WARN_ALIGNMENT(type, regs) \
do { \
perf_sw_event(PERF_COUNT_SW_ALIGNMENT_FAULTS, \
1, 0, regs, regs->dar); \
__PPC_WARN_EMULATED(type); \
} while (0)

#endif /* _ASM_POWERPC_EMULATED_OPS_H */
2 changes: 2 additions & 0 deletions arch/powerpc/include/asm/hvcall.h
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,8 @@ struct hcall_stats {
unsigned long num_calls; /* number of calls (on this CPU) */
unsigned long tb_total; /* total wall time (mftb) of calls. */
unsigned long purr_total; /* total cpu time (PURR) of calls. */
unsigned long tb_start;
unsigned long purr_start;
};
#define HCALL_STAT_ARRAY_SIZE ((MAX_HCALL_OPCODE >> 2) + 1)

Expand Down
2 changes: 2 additions & 0 deletions arch/powerpc/include/asm/reg.h
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,8 @@
#define SPRN_MMCR1 798
#define SPRN_MMCRA 0x312
#define MMCRA_SDSYNC 0x80000000UL /* SDAR synced with SIAR */
#define MMCRA_SDAR_DCACHE_MISS 0x40000000UL
#define MMCRA_SDAR_ERAT_MISS 0x20000000UL
#define MMCRA_SIHV 0x10000000UL /* state of MSR HV when SIAR set */
#define MMCRA_SIPR 0x08000000UL /* state of MSR PR when SIAR set */
#define MMCRA_SLOT 0x07000000UL /* SLOT bits (37-39) */
Expand Down
133 changes: 133 additions & 0 deletions arch/powerpc/include/asm/trace.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
#undef TRACE_SYSTEM
#define TRACE_SYSTEM powerpc

#if !defined(_TRACE_POWERPC_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_POWERPC_H

#include <linux/tracepoint.h>

struct pt_regs;

TRACE_EVENT(irq_entry,

TP_PROTO(struct pt_regs *regs),

TP_ARGS(regs),

TP_STRUCT__entry(
__field(struct pt_regs *, regs)
),

TP_fast_assign(
__entry->regs = regs;
),

TP_printk("pt_regs=%p", __entry->regs)
);

TRACE_EVENT(irq_exit,

TP_PROTO(struct pt_regs *regs),

TP_ARGS(regs),

TP_STRUCT__entry(
__field(struct pt_regs *, regs)
),

TP_fast_assign(
__entry->regs = regs;
),

TP_printk("pt_regs=%p", __entry->regs)
);

TRACE_EVENT(timer_interrupt_entry,

TP_PROTO(struct pt_regs *regs),

TP_ARGS(regs),

TP_STRUCT__entry(
__field(struct pt_regs *, regs)
),

TP_fast_assign(
__entry->regs = regs;
),

TP_printk("pt_regs=%p", __entry->regs)
);

TRACE_EVENT(timer_interrupt_exit,

TP_PROTO(struct pt_regs *regs),

TP_ARGS(regs),

TP_STRUCT__entry(
__field(struct pt_regs *, regs)
),

TP_fast_assign(
__entry->regs = regs;
),

TP_printk("pt_regs=%p", __entry->regs)
);

#ifdef CONFIG_PPC_PSERIES
extern void hcall_tracepoint_regfunc(void);
extern void hcall_tracepoint_unregfunc(void);

TRACE_EVENT_FN(hcall_entry,

TP_PROTO(unsigned long opcode, unsigned long *args),

TP_ARGS(opcode, args),

TP_STRUCT__entry(
__field(unsigned long, opcode)
),

TP_fast_assign(
__entry->opcode = opcode;
),

TP_printk("opcode=%lu", __entry->opcode),

hcall_tracepoint_regfunc, hcall_tracepoint_unregfunc
);

TRACE_EVENT_FN(hcall_exit,

TP_PROTO(unsigned long opcode, unsigned long retval,
unsigned long *retbuf),

TP_ARGS(opcode, retval, retbuf),

TP_STRUCT__entry(
__field(unsigned long, opcode)
__field(unsigned long, retval)
),

TP_fast_assign(
__entry->opcode = opcode;
__entry->retval = retval;
),

TP_printk("opcode=%lu retval=%lu", __entry->opcode, __entry->retval),

hcall_tracepoint_regfunc, hcall_tracepoint_unregfunc
);
#endif

#endif /* _TRACE_POWERPC_H */

#undef TRACE_INCLUDE_PATH
#undef TRACE_INCLUDE_FILE

#define TRACE_INCLUDE_PATH asm
#define TRACE_INCLUDE_FILE trace

#include <trace/define_trace.h>
12 changes: 6 additions & 6 deletions arch/powerpc/kernel/align.c
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,7 @@ int fix_alignment(struct pt_regs *regs)

#ifdef CONFIG_SPE
if ((instr >> 26) == 0x4) {
PPC_WARN_EMULATED(spe);
PPC_WARN_ALIGNMENT(spe, regs);
return emulate_spe(regs, reg, instr);
}
#endif
Expand Down Expand Up @@ -786,15 +786,15 @@ int fix_alignment(struct pt_regs *regs)
flags |= SPLT;
nb = 8;
}
PPC_WARN_EMULATED(vsx);
PPC_WARN_ALIGNMENT(vsx, regs);
return emulate_vsx(addr, reg, areg, regs, flags, nb);
}
#endif
/* A size of 0 indicates an instruction we don't support, with
* the exception of DCBZ which is handled as a special case here
*/
if (instr == DCBZ) {
PPC_WARN_EMULATED(dcbz);
PPC_WARN_ALIGNMENT(dcbz, regs);
return emulate_dcbz(regs, addr);
}
if (unlikely(nb == 0))
Expand All @@ -804,7 +804,7 @@ int fix_alignment(struct pt_regs *regs)
* function
*/
if (flags & M) {
PPC_WARN_EMULATED(multiple);
PPC_WARN_ALIGNMENT(multiple, regs);
return emulate_multiple(regs, addr, reg, nb,
flags, instr, swiz);
}
Expand All @@ -825,11 +825,11 @@ int fix_alignment(struct pt_regs *regs)

/* Special case for 16-byte FP loads and stores */
if (nb == 16) {
PPC_WARN_EMULATED(fp_pair);
PPC_WARN_ALIGNMENT(fp_pair, regs);
return emulate_fp_pair(addr, reg, flags);
}

PPC_WARN_EMULATED(unaligned);
PPC_WARN_ALIGNMENT(unaligned, regs);

/* If we are loading, get the data from user space, else
* get it from register values
Expand Down
4 changes: 2 additions & 2 deletions arch/powerpc/kernel/entry_64.S
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ restore:
BEGIN_FW_FTR_SECTION
ld r5,SOFTE(r1)
FW_FTR_SECTION_ELSE
b iseries_check_pending_irqs
b .Liseries_check_pending_irqs
ALT_FW_FTR_SECTION_END_IFCLR(FW_FEATURE_ISERIES)
2:
TRACE_AND_RESTORE_IRQ(r5);
Expand Down Expand Up @@ -623,7 +623,7 @@ ALT_FW_FTR_SECTION_END_IFCLR(FW_FEATURE_ISERIES)

#endif /* CONFIG_PPC_BOOK3E */

iseries_check_pending_irqs:
.Liseries_check_pending_irqs:
#ifdef CONFIG_PPC_ISERIES
ld r5,SOFTE(r1)
cmpdi 0,r5,0
Expand Down
3 changes: 3 additions & 0 deletions arch/powerpc/kernel/exceptions-64s.S
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,15 @@ END_FTR_SECTION_IFSET(CPU_FTR_REAL_LE)
* prolog code of the PerformanceMonitor one. A little
* trickery is thus necessary
*/
performance_monitor_pSeries_1:
. = 0xf00
b performance_monitor_pSeries

altivec_unavailable_pSeries_1:
. = 0xf20
b altivec_unavailable_pSeries

vsx_unavailable_pSeries_1:
. = 0xf40
b vsx_unavailable_pSeries

Expand Down
6 changes: 6 additions & 0 deletions arch/powerpc/kernel/irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@
#include <asm/firmware.h>
#include <asm/lv1call.h>
#endif
#define CREATE_TRACE_POINTS
#include <asm/trace.h>

int __irq_offset_value;
static int ppc_spurious_interrupts;
Expand Down Expand Up @@ -325,6 +327,8 @@ void do_IRQ(struct pt_regs *regs)
struct pt_regs *old_regs = set_irq_regs(regs);
unsigned int irq;

trace_irq_entry(regs);

irq_enter();

check_stack_overflow();
Expand All @@ -348,6 +352,8 @@ void do_IRQ(struct pt_regs *regs)
timer_interrupt(regs);
}
#endif

trace_irq_exit(regs);
}

void __init init_IRQ(void)
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/kernel/perf_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -1165,7 +1165,7 @@ static void record_and_restart(struct perf_event *event, unsigned long val,
*/
if (record) {
struct perf_sample_data data = {
.addr = 0,
.addr = ~0ULL,
.period = event->hw.last_period,
};

Expand Down
4 changes: 0 additions & 4 deletions arch/powerpc/kernel/power5+-pmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,6 @@
#define MMCR1_PMCSEL_SH(n) (MMCR1_PMC1SEL_SH - (n) * 8)
#define MMCR1_PMCSEL_MSK 0x7f

/*
* Bits in MMCRA
*/

/*
* Layout of constraint bits:
* 6666555555555544444444443333333333222222222211111111110000000000
Expand Down
6 changes: 1 addition & 5 deletions arch/powerpc/kernel/power5-pmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,6 @@
#define MMCR1_PMCSEL_SH(n) (MMCR1_PMC1SEL_SH - (n) * 8)
#define MMCR1_PMCSEL_MSK 0x7f

/*
* Bits in MMCRA
*/

/*
* Layout of constraint bits:
* 6666555555555544444444443333333333222222222211111111110000000000
Expand Down Expand Up @@ -390,7 +386,7 @@ static int power5_compute_mmcr(u64 event[], int n_ev,
unsigned int hwc[], unsigned long mmcr[])
{
unsigned long mmcr1 = 0;
unsigned long mmcra = 0;
unsigned long mmcra = MMCRA_SDAR_DCACHE_MISS | MMCRA_SDAR_ERAT_MISS;
unsigned int pmc, unit, byte, psel;
unsigned int ttm, grp;
int i, isbus, bit, grsel;
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/kernel/power6-pmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ static int p6_compute_mmcr(u64 event[], int n_ev,
unsigned int hwc[], unsigned long mmcr[])
{
unsigned long mmcr1 = 0;
unsigned long mmcra = 0;
unsigned long mmcra = MMCRA_SDAR_DCACHE_MISS | MMCRA_SDAR_ERAT_MISS;
int i;
unsigned int pmc, ev, b, u, s, psel;
unsigned int ttmset = 0;
Expand Down
6 changes: 1 addition & 5 deletions arch/powerpc/kernel/power7-pmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,6 @@
#define MMCR1_PMCSEL_SH(n) (MMCR1_PMC1SEL_SH - (n) * 8)
#define MMCR1_PMCSEL_MSK 0xff

/*
* Bits in MMCRA
*/

/*
* Layout of constraint bits:
* 6666555555555544444444443333333333222222222211111111110000000000
Expand Down Expand Up @@ -230,7 +226,7 @@ static int power7_compute_mmcr(u64 event[], int n_ev,
unsigned int hwc[], unsigned long mmcr[])
{
unsigned long mmcr1 = 0;
unsigned long mmcra = 0;
unsigned long mmcra = MMCRA_SDAR_DCACHE_MISS | MMCRA_SDAR_ERAT_MISS;
unsigned int pmc, unit, combine, l2sel, psel;
unsigned int pmc_inuse = 0;
int i;
Expand Down
Loading

0 comments on commit 0ffa798

Please sign in to comment.