Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 147284
b: refs/heads/master
c: 7b732a7
h: refs/heads/master
v: v3
  • Loading branch information
Peter Zijlstra authored and Ingo Molnar committed Apr 6, 2009
1 parent 7fe73c4 commit 7e9ac24
Show file tree
Hide file tree
Showing 4 changed files with 264 additions and 247 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: b09d2501ed3d294619cbfbcf828ad39324d0e548
refs/heads/master: 7b732a75047738e4f85438ed2f9cd34bf5f2a19a
9 changes: 3 additions & 6 deletions trunk/arch/powerpc/kernel/perf_counter.c
Original file line number Diff line number Diff line change
Expand Up @@ -417,8 +417,7 @@ void hw_perf_restore(u64 disable)
atomic64_set(&counter->hw.prev_count, val);
counter->hw.idx = hwc_index[i] + 1;
write_pmc(counter->hw.idx, val);
if (counter->user_page)
perf_counter_update_userpage(counter);
perf_counter_update_userpage(counter);
}
mb();
cpuhw->mmcr[0] |= MMCR0_PMXE | MMCR0_FCECE;
Expand Down Expand Up @@ -574,8 +573,7 @@ static void power_perf_disable(struct perf_counter *counter)
ppmu->disable_pmc(counter->hw.idx - 1, cpuhw->mmcr);
write_pmc(counter->hw.idx, 0);
counter->hw.idx = 0;
if (counter->user_page)
perf_counter_update_userpage(counter);
perf_counter_update_userpage(counter);
break;
}
}
Expand Down Expand Up @@ -702,8 +700,7 @@ static void record_and_restart(struct perf_counter *counter, long val,
write_pmc(counter->hw.idx, val);
atomic64_set(&counter->hw.prev_count, val);
atomic64_set(&counter->hw.period_left, left);
if (counter->user_page)
perf_counter_update_userpage(counter);
perf_counter_update_userpage(counter);

/*
* Finally record data if requested.
Expand Down
36 changes: 15 additions & 21 deletions trunk/include/linux/perf_counter.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ struct perf_counter_mmap_page {
__u32 lock; /* seqlock for synchronization */
__u32 index; /* hardware counter identifier */
__s64 offset; /* add to hardware counter value */

__u32 data_head; /* head in the data section */
};

#ifdef __KERNEL__
Expand Down Expand Up @@ -218,21 +220,6 @@ struct hw_perf_counter {
#endif
};

/*
* Hardcoded buffer length limit for now, for IRQ-fed events:
*/
#define PERF_DATA_BUFLEN 2048

/**
* struct perf_data - performance counter IRQ data sampling ...
*/
struct perf_data {
int len;
int rd_idx;
int overrun;
u8 data[PERF_DATA_BUFLEN];
};

struct perf_counter;

/**
Expand All @@ -256,6 +243,14 @@ enum perf_counter_active_state {

struct file;

struct perf_mmap_data {
struct rcu_head rcu_head;
int nr_pages;
atomic_t head;
struct perf_counter_mmap_page *user_page;
void *data_pages[0];
};

/**
* struct perf_counter - performance counter kernel representation:
*/
Expand Down Expand Up @@ -289,16 +284,15 @@ struct perf_counter {
int oncpu;
int cpu;

/* pointer to page shared with userspace via mmap */
unsigned long user_page;
/* mmap bits */
struct mutex mmap_mutex;
atomic_t mmap_count;
struct perf_mmap_data *data;

/* read() / irq related data */
/* poll related */
wait_queue_head_t waitq;
/* optional: for NMIs */
int wakeup_pending;
struct perf_data *irqdata;
struct perf_data *usrdata;
struct perf_data data[2];

void (*destroy)(struct perf_counter *);
struct rcu_head rcu_head;
Expand Down
Loading

0 comments on commit 7e9ac24

Please sign in to comment.