Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 147610
b: refs/heads/master
c: 0d48696
h: refs/heads/master
v: v3
  • Loading branch information
Peter Zijlstra authored and Ingo Molnar committed Jun 2, 2009
1 parent 2b216e5 commit 12f3c84
Show file tree
Hide file tree
Showing 6 changed files with 105 additions and 105 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: 08247e31ca79b8f02cce47b7e8120797a8726606
refs/heads/master: 0d48696f87e3618b0d35bd3e4e9d7c188d51e7de
38 changes: 19 additions & 19 deletions trunk/arch/powerpc/kernel/perf_counter.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,13 +262,13 @@ static int check_excludes(struct perf_counter **ctrs, unsigned int cflags[],
}
counter = ctrs[i];
if (first) {
eu = counter->hw_event.exclude_user;
ek = counter->hw_event.exclude_kernel;
eh = counter->hw_event.exclude_hv;
eu = counter->attr.exclude_user;
ek = counter->attr.exclude_kernel;
eh = counter->attr.exclude_hv;
first = 0;
} else if (counter->hw_event.exclude_user != eu ||
counter->hw_event.exclude_kernel != ek ||
counter->hw_event.exclude_hv != eh) {
} else if (counter->attr.exclude_user != eu ||
counter->attr.exclude_kernel != ek ||
counter->attr.exclude_hv != eh) {
return -EAGAIN;
}
}
Expand Down Expand Up @@ -483,16 +483,16 @@ void hw_perf_enable(void)

/*
* 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
* same values for these bits as the first counter.
*/
counter = cpuhw->counter[0];
if (counter->hw_event.exclude_user)
if (counter->attr.exclude_user)
cpuhw->mmcr[0] |= MMCR0_FCP;
if (counter->hw_event.exclude_kernel)
if (counter->attr.exclude_kernel)
cpuhw->mmcr[0] |= freeze_counters_kernel;
if (counter->hw_event.exclude_hv)
if (counter->attr.exclude_hv)
cpuhw->mmcr[0] |= MMCR0_FCHV;

/*
Expand Down Expand Up @@ -786,10 +786,10 @@ static int can_go_on_limited_pmc(struct perf_counter *counter, u64 ev,
int n;
u64 alt[MAX_EVENT_ALTERNATIVES];

if (counter->hw_event.exclude_user
|| counter->hw_event.exclude_kernel
|| counter->hw_event.exclude_hv
|| counter->hw_event.sample_period)
if (counter->attr.exclude_user
|| counter->attr.exclude_kernel
|| counter->attr.exclude_hv
|| counter->attr.sample_period)
return 0;

if (ppmu->limited_pmc_event(ev))
Expand Down Expand Up @@ -855,13 +855,13 @@ const struct pmu *hw_perf_counter_init(struct perf_counter *counter)

if (!ppmu)
return ERR_PTR(-ENXIO);
if (!perf_event_raw(&counter->hw_event)) {
ev = perf_event_id(&counter->hw_event);
if (!perf_event_raw(&counter->attr)) {
ev = perf_event_id(&counter->attr);
if (ev >= ppmu->n_generic || ppmu->generic_events[ev] == 0)
return ERR_PTR(-EOPNOTSUPP);
ev = ppmu->generic_events[ev];
} else {
ev = perf_event_config(&counter->hw_event);
ev = perf_event_config(&counter->attr);
}
counter->hw.config_base = ev;
counter->hw.idx = 0;
Expand All @@ -872,7 +872,7 @@ const struct pmu *hw_perf_counter_init(struct perf_counter *counter)
* the user set it to.
*/
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
Expand Down Expand Up @@ -990,7 +990,7 @@ static void record_and_restart(struct perf_counter *counter, long val,
*/
if (record) {
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.
* If we're not doing instruction sampling,
Expand Down
16 changes: 8 additions & 8 deletions trunk/arch/x86/kernel/cpu/perf_counter.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
struct perf_counter_hw_event *hw_event = &counter->hw_event;
struct perf_counter_attr *attr = &counter->attr;
struct hw_perf_counter *hwc = &counter->hw;
int err;

Expand Down Expand Up @@ -279,9 +279,9 @@ static int __hw_perf_counter_init(struct perf_counter *counter)
/*
* Count user and OS events unless requested not to.
*/
if (!hw_event->exclude_user)
if (!attr->exclude_user)
hwc->config |= ARCH_PERFMON_EVENTSEL_USR;
if (!hw_event->exclude_kernel)
if (!attr->exclude_kernel)
hwc->config |= ARCH_PERFMON_EVENTSEL_OS;

if (!hwc->sample_period)
Expand All @@ -292,15 +292,15 @@ static int __hw_perf_counter_init(struct perf_counter *counter)
/*
* Raw event type provide the config in the event structure
*/
if (perf_event_raw(hw_event)) {
hwc->config |= x86_pmu.raw_event(perf_event_config(hw_event));
if (perf_event_raw(attr)) {
hwc->config |= x86_pmu.raw_event(perf_event_config(attr));
} else {
if (perf_event_id(hw_event) >= x86_pmu.max_events)
if (perf_event_id(attr) >= x86_pmu.max_events)
return -EINVAL;
/*
* 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;
Expand Down
34 changes: 17 additions & 17 deletions trunk/include/linux/perf_counter.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*/

/*
* hw_event.type
* attr.type
*/
enum perf_event_types {
PERF_TYPE_HARDWARE = 0,
Expand All @@ -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:
*/
enum hw_event_ids {
enum attr_ids {
/*
* Common hardware events, generalized by the kernel:
*/
Expand Down Expand Up @@ -94,7 +94,7 @@ enum sw_event_ids {
#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.
*/
enum perf_counter_sample_format {
Expand All @@ -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,
* in increasing order of bit value, after the counter value.
*/
Expand All @@ -122,7 +122,7 @@ enum perf_counter_read_format {
/*
* 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
* specific (raw) counter configuration data, if unset, the next
Expand Down Expand Up @@ -323,25 +323,25 @@ enum perf_event_type {

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;
}

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;
}

/**
Expand Down Expand Up @@ -457,7 +457,7 @@ struct perf_counter {
u64 tstamp_running;
u64 tstamp_stopped;

struct perf_counter_hw_event hw_event;
struct perf_counter_attr attr;
struct hw_perf_counter hw;

struct perf_counter_context *ctx;
Expand Down Expand Up @@ -605,8 +605,8 @@ extern int perf_counter_overflow(struct perf_counter *counter,
*/
static inline int is_software_counter(struct perf_counter *counter)
{
return !perf_event_raw(&counter->hw_event) &&
perf_event_type(&counter->hw_event) != PERF_TYPE_HARDWARE;
return !perf_event_raw(&counter->attr) &&
perf_event_type(&counter->attr) != PERF_TYPE_HARDWARE;
}

extern void perf_swcounter_event(u32, u64, int, struct pt_regs *, u64);
Expand Down
4 changes: 2 additions & 2 deletions trunk/include/linux/syscalls.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ struct compat_timeval;
struct robust_list_head;
struct getcpu_cache;
struct old_linux_dirent;
struct perf_counter_hw_event;
struct perf_counter_attr;

#include <linux/types.h>
#include <linux/aio_abi.h>
Expand Down Expand Up @@ -758,6 +758,6 @@ int kernel_execve(const char *filename, char *const argv[], char *const envp[]);


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);
#endif
Loading

0 comments on commit 12f3c84

Please sign in to comment.