Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 338879
b: refs/heads/master
c: 43c032f
h: refs/heads/master
i:
  338877: 53209af
  338875: 36e5886
  338871: 1640c77
  338863: 2de3614
  338847: 1d246aa
  338815: 8e200f4
v: v3
  • Loading branch information
Jiri Olsa authored and Ingo Molnar committed Oct 24, 2012
1 parent 36f8b45 commit e7b0dad
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8300daa26755c9a194776778bd822acf1fa2dbf6
refs/heads/master: 43c032febde48aabcf6d59f47cdcb7b5debbdc63
40 changes: 40 additions & 0 deletions trunk/arch/x86/kernel/cpu/perf_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -1392,6 +1392,46 @@ static struct attribute_group x86_pmu_events_group = {
.attrs = events_attr,
};

ssize_t x86_event_sysfs_show(char *page, u64 config)
{
u64 event = (config & ARCH_PERFMON_EVENTSEL_EVENT);
u64 umask = (config & ARCH_PERFMON_EVENTSEL_UMASK) >> 8;
u64 cmask = (config & ARCH_PERFMON_EVENTSEL_CMASK) >> 24;
bool edge = (config & ARCH_PERFMON_EVENTSEL_EDGE);
bool pc = (config & ARCH_PERFMON_EVENTSEL_PIN_CONTROL);
bool any = (config & ARCH_PERFMON_EVENTSEL_ANY);
bool inv = (config & ARCH_PERFMON_EVENTSEL_INV);
ssize_t ret;

/*
* We have whole page size to spend and just little data
* to write, so we can safely use sprintf.
*/
ret = sprintf(page, "event=0x%02llx", event);

if (umask)
ret += sprintf(page + ret, ",umask=0x%02llx", umask);

if (edge)
ret += sprintf(page + ret, ",edge");

if (pc)
ret += sprintf(page + ret, ",pc");

if (any)
ret += sprintf(page + ret, ",any");

if (inv)
ret += sprintf(page + ret, ",inv");

if (cmask)
ret += sprintf(page + ret, ",cmask=0x%02llx", cmask);

ret += sprintf(page + ret, "\n");

return ret;
}

static int __init init_hw_perf_events(void)
{
struct x86_pmu_quirk *quirk;
Expand Down
2 changes: 2 additions & 0 deletions trunk/arch/x86/kernel/cpu/perf_event.h
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,8 @@ static inline void set_linear_ip(struct pt_regs *regs, unsigned long ip)
regs->ip = ip;
}

ssize_t x86_event_sysfs_show(char *page, u64 config);

#ifdef CONFIG_CPU_SUP_AMD

int amd_pmu_init(void);
Expand Down
2 changes: 2 additions & 0 deletions trunk/arch/x86/kernel/cpu/perf_event_intel.c
Original file line number Diff line number Diff line change
Expand Up @@ -1628,6 +1628,7 @@ static __initconst const struct x86_pmu core_pmu = {
.event_constraints = intel_core_event_constraints,
.guest_get_msrs = core_guest_get_msrs,
.format_attrs = intel_arch_formats_attr,
.events_sysfs_show = x86_event_sysfs_show,
};

struct intel_shared_regs *allocate_shared_regs(int cpu)
Expand Down Expand Up @@ -1766,6 +1767,7 @@ static __initconst const struct x86_pmu intel_pmu = {
.pebs_aliases = intel_pebs_aliases_core2,

.format_attrs = intel_arch3_formats_attr,
.events_sysfs_show = x86_event_sysfs_show,

.cpu_prepare = intel_pmu_cpu_prepare,
.cpu_starting = intel_pmu_cpu_starting,
Expand Down

0 comments on commit e7b0dad

Please sign in to comment.