* [PATCH] alpha: convert perf_event to use local_t
@ 2010-08-12 9:49 Michael Cree
2010-08-12 13:50 ` Matt Turner
0 siblings, 1 reply; 3+ messages in thread
From: Michael Cree @ 2010-08-12 9:49 UTC (permalink / raw)
To: linux-kernel
Cc: Michael Cree, Richard Henderson, Ivan Kokshaysky, Matt Turner,
Ingo Molnar, Peter Zijlstra, Andrew Morton, linux-alpha
Updates the Alpha perf_event code to match the changes
recently made to the core perf_event code in commit
e78505958cf123048fb48cb56b79cebb8edd15fb.
Signed-off-by: Michael Cree <mcree@orcon.net.nz>
---
arch/alpha/kernel/perf_event.c | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/arch/alpha/kernel/perf_event.c b/arch/alpha/kernel/perf_event.c
index 51c39fa..85d8e4f 100644
--- a/arch/alpha/kernel/perf_event.c
+++ b/arch/alpha/kernel/perf_event.c
@@ -241,20 +241,20 @@ static inline unsigned long alpha_read_pmc(int idx)
static int alpha_perf_event_set_period(struct perf_event *event,
struct hw_perf_event *hwc, int idx)
{
- long left = atomic64_read(&hwc->period_left);
+ long left = local64_read(&hwc->period_left);
long period = hwc->sample_period;
int ret = 0;
if (unlikely(left <= -period)) {
left = period;
- atomic64_set(&hwc->period_left, left);
+ local64_set(&hwc->period_left, left);
hwc->last_period = period;
ret = 1;
}
if (unlikely(left <= 0)) {
left += period;
- atomic64_set(&hwc->period_left, left);
+ local64_set(&hwc->period_left, left);
hwc->last_period = period;
ret = 1;
}
@@ -269,7 +269,7 @@ static int alpha_perf_event_set_period(struct perf_event *event,
if (left > (long)alpha_pmu->pmc_max_period[idx])
left = alpha_pmu->pmc_max_period[idx];
- atomic64_set(&hwc->prev_count, (unsigned long)(-left));
+ local64_set(&hwc->prev_count, (unsigned long)(-left));
alpha_write_pmc(idx, (unsigned long)(-left));
@@ -300,10 +300,10 @@ static unsigned long alpha_perf_event_update(struct perf_event *event,
long delta;
again:
- prev_raw_count = atomic64_read(&hwc->prev_count);
+ prev_raw_count = local64_read(&hwc->prev_count);
new_raw_count = alpha_read_pmc(idx);
- if (atomic64_cmpxchg(&hwc->prev_count, prev_raw_count,
+ if (local64_cmpxchg(&hwc->prev_count, prev_raw_count,
new_raw_count) != prev_raw_count)
goto again;
@@ -316,8 +316,8 @@ again:
delta += alpha_pmu->pmc_max_period[idx] + 1;
}
- atomic64_add(delta, &event->count);
- atomic64_sub(delta, &hwc->period_left);
+ local64_add(delta, &event->count);
+ local64_sub(delta, &hwc->period_left);
return new_raw_count;
}
@@ -636,7 +636,7 @@ static int __hw_perf_event_init(struct perf_event *event)
if (!hwc->sample_period) {
hwc->sample_period = alpha_pmu->pmc_max_period[0];
hwc->last_period = hwc->sample_period;
- atomic64_set(&hwc->period_left, hwc->sample_period);
+ local64_set(&hwc->period_left, hwc->sample_period);
}
return 0;
--
1.7.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] alpha: convert perf_event to use local_t
2010-08-12 9:49 [PATCH] alpha: convert perf_event to use local_t Michael Cree
@ 2010-08-12 13:50 ` Matt Turner
0 siblings, 0 replies; 3+ messages in thread
From: Matt Turner @ 2010-08-12 13:50 UTC (permalink / raw)
To: Michael Cree
Cc: linux-kernel, Richard Henderson, Ivan Kokshaysky, Ingo Molnar,
Peter Zijlstra, Andrew Morton, linux-alpha
On Thu, Aug 12, 2010 at 5:49 AM, Michael Cree <mcree@orcon.net.nz> wrote:
> Updates the Alpha perf_event code to match the changes
> recently made to the core perf_event code in commit
> e78505958cf123048fb48cb56b79cebb8edd15fb.
>
> Signed-off-by: Michael Cree <mcree@orcon.net.nz>
> ---
> arch/alpha/kernel/perf_event.c | 18 +++++++++---------
> 1 files changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/arch/alpha/kernel/perf_event.c b/arch/alpha/kernel/perf_event.c
> index 51c39fa..85d8e4f 100644
> --- a/arch/alpha/kernel/perf_event.c
> +++ b/arch/alpha/kernel/perf_event.c
> @@ -241,20 +241,20 @@ static inline unsigned long alpha_read_pmc(int idx)
> static int alpha_perf_event_set_period(struct perf_event *event,
> struct hw_perf_event *hwc, int idx)
> {
> - long left = atomic64_read(&hwc->period_left);
> + long left = local64_read(&hwc->period_left);
> long period = hwc->sample_period;
> int ret = 0;
>
> if (unlikely(left <= -period)) {
> left = period;
> - atomic64_set(&hwc->period_left, left);
> + local64_set(&hwc->period_left, left);
> hwc->last_period = period;
> ret = 1;
> }
>
> if (unlikely(left <= 0)) {
> left += period;
> - atomic64_set(&hwc->period_left, left);
> + local64_set(&hwc->period_left, left);
> hwc->last_period = period;
> ret = 1;
> }
> @@ -269,7 +269,7 @@ static int alpha_perf_event_set_period(struct perf_event *event,
> if (left > (long)alpha_pmu->pmc_max_period[idx])
> left = alpha_pmu->pmc_max_period[idx];
>
> - atomic64_set(&hwc->prev_count, (unsigned long)(-left));
> + local64_set(&hwc->prev_count, (unsigned long)(-left));
>
> alpha_write_pmc(idx, (unsigned long)(-left));
>
> @@ -300,10 +300,10 @@ static unsigned long alpha_perf_event_update(struct perf_event *event,
> long delta;
>
> again:
> - prev_raw_count = atomic64_read(&hwc->prev_count);
> + prev_raw_count = local64_read(&hwc->prev_count);
> new_raw_count = alpha_read_pmc(idx);
>
> - if (atomic64_cmpxchg(&hwc->prev_count, prev_raw_count,
> + if (local64_cmpxchg(&hwc->prev_count, prev_raw_count,
> new_raw_count) != prev_raw_count)
> goto again;
>
> @@ -316,8 +316,8 @@ again:
> delta += alpha_pmu->pmc_max_period[idx] + 1;
> }
>
> - atomic64_add(delta, &event->count);
> - atomic64_sub(delta, &hwc->period_left);
> + local64_add(delta, &event->count);
> + local64_sub(delta, &hwc->period_left);
>
> return new_raw_count;
> }
> @@ -636,7 +636,7 @@ static int __hw_perf_event_init(struct perf_event *event)
> if (!hwc->sample_period) {
> hwc->sample_period = alpha_pmu->pmc_max_period[0];
> hwc->last_period = hwc->sample_period;
> - atomic64_set(&hwc->period_left, hwc->sample_period);
> + local64_set(&hwc->period_left, hwc->sample_period);
> }
>
> return 0;
> --
> 1.7.1
>
>
Thanks Michael. I'll apply this when I get back from vacation.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] alpha: convert perf_event to use local_t
@ 2010-08-12 13:50 ` Matt Turner
0 siblings, 0 replies; 3+ messages in thread
From: Matt Turner @ 2010-08-12 13:50 UTC (permalink / raw)
To: Michael Cree
Cc: linux-kernel, Richard Henderson, Ivan Kokshaysky, Ingo Molnar,
Peter Zijlstra, Andrew Morton, linux-alpha
On Thu, Aug 12, 2010 at 5:49 AM, Michael Cree <mcree@orcon.net.nz> wrote:
> Updates the Alpha perf_event code to match the changes
> recently made to the core perf_event code in commit
> e78505958cf123048fb48cb56b79cebb8edd15fb.
>
> Signed-off-by: Michael Cree <mcree@orcon.net.nz>
> ---
> arch/alpha/kernel/perf_event.c | 18 +++++++++---------
> 1 files changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/arch/alpha/kernel/perf_event.c b/arch/alpha/kernel/perf_event.c
> index 51c39fa..85d8e4f 100644
> --- a/arch/alpha/kernel/perf_event.c
> +++ b/arch/alpha/kernel/perf_event.c
> @@ -241,20 +241,20 @@ static inline unsigned long alpha_read_pmc(int idx)
> static int alpha_perf_event_set_period(struct perf_event *event,
> struct hw_perf_event *hwc, int idx)
> {
> - long left = atomic64_read(&hwc->period_left);
> + long left = local64_read(&hwc->period_left);
> long period = hwc->sample_period;
> int ret = 0;
>
> if (unlikely(left <= -period)) {
> left = period;
> - atomic64_set(&hwc->period_left, left);
> + local64_set(&hwc->period_left, left);
> hwc->last_period = period;
> ret = 1;
> }
>
> if (unlikely(left <= 0)) {
> left += period;
> - atomic64_set(&hwc->period_left, left);
> + local64_set(&hwc->period_left, left);
> hwc->last_period = period;
> ret = 1;
> }
> @@ -269,7 +269,7 @@ static int alpha_perf_event_set_period(struct perf_event *event,
> if (left > (long)alpha_pmu->pmc_max_period[idx])
> left = alpha_pmu->pmc_max_period[idx];
>
> - atomic64_set(&hwc->prev_count, (unsigned long)(-left));
> + local64_set(&hwc->prev_count, (unsigned long)(-left));
>
> alpha_write_pmc(idx, (unsigned long)(-left));
>
> @@ -300,10 +300,10 @@ static unsigned long alpha_perf_event_update(struct perf_event *event,
> long delta;
>
> again:
> - prev_raw_count = atomic64_read(&hwc->prev_count);
> + prev_raw_count = local64_read(&hwc->prev_count);
> new_raw_count = alpha_read_pmc(idx);
>
> - if (atomic64_cmpxchg(&hwc->prev_count, prev_raw_count,
> + if (local64_cmpxchg(&hwc->prev_count, prev_raw_count,
> new_raw_count) != prev_raw_count)
> goto again;
>
> @@ -316,8 +316,8 @@ again:
> delta += alpha_pmu->pmc_max_period[idx] + 1;
> }
>
> - atomic64_add(delta, &event->count);
> - atomic64_sub(delta, &hwc->period_left);
> + local64_add(delta, &event->count);
> + local64_sub(delta, &hwc->period_left);
>
> return new_raw_count;
> }
> @@ -636,7 +636,7 @@ static int __hw_perf_event_init(struct perf_event *event)
> if (!hwc->sample_period) {
> hwc->sample_period = alpha_pmu->pmc_max_period[0];
> hwc->last_period = hwc->sample_period;
> - atomic64_set(&hwc->period_left, hwc->sample_period);
> + local64_set(&hwc->period_left, hwc->sample_period);
> }
>
> return 0;
> --
> 1.7.1
>
>
Thanks Michael. I'll apply this when I get back from vacation.
--
To unsubscribe from this list: send the line "unsubscribe linux-alpha" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-08-12 13:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-12 9:49 [PATCH] alpha: convert perf_event to use local_t Michael Cree
2010-08-12 13:50 ` Matt Turner
2010-08-12 13:50 ` Matt Turner
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.