Commit 0d48696f authored by Peter Zijlstra's avatar Peter Zijlstra Committed by Ingo Molnar

perf_counter: Rename perf_counter_hw_event => perf_counter_attr

The structure isn't hw only and when I read event, I think about those
things that fall out the other end. Rename the thing.
Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: John Kacur <jkacur@redhat.com>
Cc: Stephane Eranian <eranian@googlemail.com>
LKML-Reference: <new-submission>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 08247e31
...@@ -262,13 +262,13 @@ static int check_excludes(struct perf_counter **ctrs, unsigned int cflags[], ...@@ -262,13 +262,13 @@ static int check_excludes(struct perf_counter **ctrs, unsigned int cflags[],
} }
counter = ctrs[i]; counter = ctrs[i];
if (first) { if (first) {
eu = counter->hw_event.exclude_user; eu = counter->attr.exclude_user;
ek = counter->hw_event.exclude_kernel; ek = counter->attr.exclude_kernel;
eh = counter->hw_event.exclude_hv; eh = counter->attr.exclude_hv;
first = 0; first = 0;
} else if (counter->hw_event.exclude_user != eu || } else if (counter->attr.exclude_user != eu ||
counter->hw_event.exclude_kernel != ek || counter->attr.exclude_kernel != ek ||
counter->hw_event.exclude_hv != eh) { counter->attr.exclude_hv != eh) {
return -EAGAIN; return -EAGAIN;
} }
} }
...@@ -483,16 +483,16 @@ void hw_perf_enable(void) ...@@ -483,16 +483,16 @@ void hw_perf_enable(void)
/* /*
* Add in MMCR0 freeze bits corresponding to the * Add in MMCR0 freeze bits corresponding to the
* hw_event.exclude_* bits for the first counter. * attr.exclude_* bits for the first counter.
* We have already checked that all counters have the * We have already checked that all counters have the
* same values for these bits as the first counter. * same values for these bits as the first counter.
*/ */
counter = cpuhw->counter[0]; counter = cpuhw->counter[0];
if (counter->hw_event.exclude_user) if (counter->attr.exclude_user)
cpuhw->mmcr[0] |= MMCR0_FCP; cpuhw->mmcr[0] |= MMCR0_FCP;
if (counter->hw_event.exclude_kernel) if (counter->attr.exclude_kernel)
cpuhw->mmcr[0] |= freeze_counters_kernel; cpuhw->mmcr[0] |= freeze_counters_kernel;
if (counter->hw_event.exclude_hv) if (counter->attr.exclude_hv)
cpuhw->mmcr[0] |= MMCR0_FCHV; cpuhw->mmcr[0] |= MMCR0_FCHV;
/* /*
...@@ -786,10 +786,10 @@ static int can_go_on_limited_pmc(struct perf_counter *counter, u64 ev, ...@@ -786,10 +786,10 @@ static int can_go_on_limited_pmc(struct perf_counter *counter, u64 ev,
int n; int n;
u64 alt[MAX_EVENT_ALTERNATIVES]; u64 alt[MAX_EVENT_ALTERNATIVES];
if (counter->hw_event.exclude_user if (counter->attr.exclude_user
|| counter->hw_event.exclude_kernel || counter->attr.exclude_kernel
|| counter->hw_event.exclude_hv || counter->attr.exclude_hv
|| counter->hw_event.sample_period) || counter->attr.sample_period)
return 0; return 0;
if (ppmu->limited_pmc_event(ev)) if (ppmu->limited_pmc_event(ev))
...@@ -855,13 +855,13 @@ const struct pmu *hw_perf_counter_init(struct perf_counter *counter) ...@@ -855,13 +855,13 @@ const struct pmu *hw_perf_counter_init(struct perf_counter *counter)
if (!ppmu) if (!ppmu)
return ERR_PTR(-ENXIO); return ERR_PTR(-ENXIO);
if (!perf_event_raw(&counter->hw_event)) { if (!perf_event_raw(&counter->attr)) {
ev = perf_event_id(&counter->hw_event); ev = perf_event_id(&counter->attr);
if (ev >= ppmu->n_generic || ppmu->generic_events[ev] == 0) if (ev >= ppmu->n_generic || ppmu->generic_events[ev] == 0)
return ERR_PTR(-EOPNOTSUPP); return ERR_PTR(-EOPNOTSUPP);
ev = ppmu->generic_events[ev]; ev = ppmu->generic_events[ev];
} else { } else {
ev = perf_event_config(&counter->hw_event); ev = perf_event_config(&counter->attr);
} }
counter->hw.config_base = ev; counter->hw.config_base = ev;
counter->hw.idx = 0; counter->hw.idx = 0;
...@@ -872,7 +872,7 @@ const struct pmu *hw_perf_counter_init(struct perf_counter *counter) ...@@ -872,7 +872,7 @@ const struct pmu *hw_perf_counter_init(struct perf_counter *counter)
* the user set it to. * the user set it to.
*/ */
if (!firmware_has_feature(FW_FEATURE_LPAR)) if (!firmware_has_feature(FW_FEATURE_LPAR))
counter->hw_event.exclude_hv = 0; counter->attr.exclude_hv = 0;
/* /*
* If this is a per-task counter, then we can use * If this is a per-task counter, then we can use
...@@ -990,7 +990,7 @@ static void record_and_restart(struct perf_counter *counter, long val, ...@@ -990,7 +990,7 @@ static void record_and_restart(struct perf_counter *counter, long val,
*/ */
if (record) { if (record) {
addr = 0; addr = 0;
if (counter->hw_event.record_type & PERF_RECORD_ADDR) { if (counter->attr.record_type & PERF_RECORD_ADDR) {
/* /*
* The user wants a data address recorded. * The user wants a data address recorded.
* If we're not doing instruction sampling, * If we're not doing instruction sampling,
......
...@@ -247,11 +247,11 @@ static inline int x86_pmu_initialized(void) ...@@ -247,11 +247,11 @@ static inline int x86_pmu_initialized(void)
} }
/* /*
* Setup the hardware configuration for a given hw_event_type * Setup the hardware configuration for a given attr_type
*/ */
static int __hw_perf_counter_init(struct perf_counter *counter) static int __hw_perf_counter_init(struct perf_counter *counter)
{ {
struct perf_counter_hw_event *hw_event = &counter->hw_event; struct perf_counter_attr *attr = &counter->attr;
struct hw_perf_counter *hwc = &counter->hw; struct hw_perf_counter *hwc = &counter->hw;
int err; int err;
...@@ -279,9 +279,9 @@ static int __hw_perf_counter_init(struct perf_counter *counter) ...@@ -279,9 +279,9 @@ static int __hw_perf_counter_init(struct perf_counter *counter)
/* /*
* Count user and OS events unless requested not to. * Count user and OS events unless requested not to.
*/ */
if (!hw_event->exclude_user) if (!attr->exclude_user)
hwc->config |= ARCH_PERFMON_EVENTSEL_USR; hwc->config |= ARCH_PERFMON_EVENTSEL_USR;
if (!hw_event->exclude_kernel) if (!attr->exclude_kernel)
hwc->config |= ARCH_PERFMON_EVENTSEL_OS; hwc->config |= ARCH_PERFMON_EVENTSEL_OS;
if (!hwc->sample_period) if (!hwc->sample_period)
...@@ -292,15 +292,15 @@ static int __hw_perf_counter_init(struct perf_counter *counter) ...@@ -292,15 +292,15 @@ static int __hw_perf_counter_init(struct perf_counter *counter)
/* /*
* Raw event type provide the config in the event structure * Raw event type provide the config in the event structure
*/ */
if (perf_event_raw(hw_event)) { if (perf_event_raw(attr)) {
hwc->config |= x86_pmu.raw_event(perf_event_config(hw_event)); hwc->config |= x86_pmu.raw_event(perf_event_config(attr));
} else { } else {
if (perf_event_id(hw_event) >= x86_pmu.max_events) if (perf_event_id(attr) >= x86_pmu.max_events)
return -EINVAL; return -EINVAL;
/* /*
* The generic map: * The generic map:
*/ */
hwc->config |= x86_pmu.event_map(perf_event_id(hw_event)); hwc->config |= x86_pmu.event_map(perf_event_id(attr));
} }
counter->destroy = hw_perf_counter_destroy; counter->destroy = hw_perf_counter_destroy;
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
*/ */
/* /*
* hw_event.type * attr.type
*/ */
enum perf_event_types { enum perf_event_types {
PERF_TYPE_HARDWARE = 0, PERF_TYPE_HARDWARE = 0,
...@@ -37,10 +37,10 @@ enum perf_event_types { ...@@ -37,10 +37,10 @@ enum perf_event_types {
}; };
/* /*
* Generalized performance counter event types, used by the hw_event.event_id * Generalized performance counter event types, used by the attr.event_id
* parameter of the sys_perf_counter_open() syscall: * parameter of the sys_perf_counter_open() syscall:
*/ */
enum hw_event_ids { enum attr_ids {
/* /*
* Common hardware events, generalized by the kernel: * Common hardware events, generalized by the kernel:
*/ */
...@@ -94,7 +94,7 @@ enum sw_event_ids { ...@@ -94,7 +94,7 @@ enum sw_event_ids {
#define PERF_COUNTER_EVENT_MASK __PERF_COUNTER_MASK(EVENT) #define PERF_COUNTER_EVENT_MASK __PERF_COUNTER_MASK(EVENT)
/* /*
* Bits that can be set in hw_event.sample_type to request information * Bits that can be set in attr.sample_type to request information
* in the overflow packets. * in the overflow packets.
*/ */
enum perf_counter_sample_format { enum perf_counter_sample_format {
...@@ -109,7 +109,7 @@ enum perf_counter_sample_format { ...@@ -109,7 +109,7 @@ enum perf_counter_sample_format {
}; };
/* /*
* Bits that can be set in hw_event.read_format to request that * Bits that can be set in attr.read_format to request that
* reads on the counter should return the indicated quantities, * reads on the counter should return the indicated quantities,
* in increasing order of bit value, after the counter value. * in increasing order of bit value, after the counter value.
*/ */
...@@ -122,7 +122,7 @@ enum perf_counter_read_format { ...@@ -122,7 +122,7 @@ enum perf_counter_read_format {
/* /*
* Hardware event to monitor via a performance monitoring counter: * Hardware event to monitor via a performance monitoring counter:
*/ */
struct perf_counter_hw_event { struct perf_counter_attr {
/* /*
* The MSB of the config word signifies if the rest contains cpu * The MSB of the config word signifies if the rest contains cpu
* specific (raw) counter configuration data, if unset, the next * specific (raw) counter configuration data, if unset, the next
...@@ -323,25 +323,25 @@ enum perf_event_type { ...@@ -323,25 +323,25 @@ enum perf_event_type {
struct task_struct; struct task_struct;
static inline u64 perf_event_raw(struct perf_counter_hw_event *hw_event) static inline u64 perf_event_raw(struct perf_counter_attr *attr)
{ {
return hw_event->config & PERF_COUNTER_RAW_MASK; return attr->config & PERF_COUNTER_RAW_MASK;
} }
static inline u64 perf_event_config(struct perf_counter_hw_event *hw_event) static inline u64 perf_event_config(struct perf_counter_attr *attr)
{ {
return hw_event->config & PERF_COUNTER_CONFIG_MASK; return attr->config & PERF_COUNTER_CONFIG_MASK;
} }
static inline u64 perf_event_type(struct perf_counter_hw_event *hw_event) static inline u64 perf_event_type(struct perf_counter_attr *attr)
{ {
return (hw_event->config & PERF_COUNTER_TYPE_MASK) >> return (attr->config & PERF_COUNTER_TYPE_MASK) >>
PERF_COUNTER_TYPE_SHIFT; PERF_COUNTER_TYPE_SHIFT;
} }
static inline u64 perf_event_id(struct perf_counter_hw_event *hw_event) static inline u64 perf_event_id(struct perf_counter_attr *attr)
{ {
return hw_event->config & PERF_COUNTER_EVENT_MASK; return attr->config & PERF_COUNTER_EVENT_MASK;
} }
/** /**
...@@ -457,7 +457,7 @@ struct perf_counter { ...@@ -457,7 +457,7 @@ struct perf_counter {
u64 tstamp_running; u64 tstamp_running;
u64 tstamp_stopped; u64 tstamp_stopped;
struct perf_counter_hw_event hw_event; struct perf_counter_attr attr;
struct hw_perf_counter hw; struct hw_perf_counter hw;
struct perf_counter_context *ctx; struct perf_counter_context *ctx;
...@@ -605,8 +605,8 @@ extern int perf_counter_overflow(struct perf_counter *counter, ...@@ -605,8 +605,8 @@ extern int perf_counter_overflow(struct perf_counter *counter,
*/ */
static inline int is_software_counter(struct perf_counter *counter) static inline int is_software_counter(struct perf_counter *counter)
{ {
return !perf_event_raw(&counter->hw_event) && return !perf_event_raw(&counter->attr) &&
perf_event_type(&counter->hw_event) != PERF_TYPE_HARDWARE; perf_event_type(&counter->attr) != PERF_TYPE_HARDWARE;
} }
extern void perf_swcounter_event(u32, u64, int, struct pt_regs *, u64); extern void perf_swcounter_event(u32, u64, int, struct pt_regs *, u64);
......
...@@ -55,7 +55,7 @@ struct compat_timeval; ...@@ -55,7 +55,7 @@ struct compat_timeval;
struct robust_list_head; struct robust_list_head;
struct getcpu_cache; struct getcpu_cache;
struct old_linux_dirent; struct old_linux_dirent;
struct perf_counter_hw_event; struct perf_counter_attr;
#include <linux/types.h> #include <linux/types.h>
#include <linux/aio_abi.h> #include <linux/aio_abi.h>
...@@ -758,6 +758,6 @@ int kernel_execve(const char *filename, char *const argv[], char *const envp[]); ...@@ -758,6 +758,6 @@ int kernel_execve(const char *filename, char *const argv[], char *const envp[]);
asmlinkage long sys_perf_counter_open( asmlinkage long sys_perf_counter_open(
const struct perf_counter_hw_event __user *hw_event_uptr, const struct perf_counter_attr __user *attr_uptr,
pid_t pid, int cpu, int group_fd, unsigned long flags); pid_t pid, int cpu, int group_fd, unsigned long flags);
#endif #endif
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment