2009-03-19 19:46:35

by Peter Zijlstra

[permalink] [raw]
Subject: [PATCH 10/10] perf_counter: powerpc: clean up perc_counter_interrupt

From: Paul Mackerras <[email protected]>

> Nice cleanup, and thanks for updating powerpc too. With this, I think
> we'll need to update the powerpc perf_counter_interrupt a bit: we
> might as well use get_perf_counter_pending() instead of the wakeup
> variable now. I'll send an extra patch once I have done some testing.

This seems to work OK.

Signed-off-by: Paul Mackerras <[email protected]>
Signed-off-by: Peter Zijlstra <[email protected]>
---
arch/powerpc/kernel/perf_counter.c | 19 +++++++------------
1 file changed, 7 insertions(+), 12 deletions(-)

Index: linux-2.6/arch/powerpc/kernel/perf_counter.c
===================================================================
--- linux-2.6.orig/arch/powerpc/kernel/perf_counter.c
+++ linux-2.6/arch/powerpc/kernel/perf_counter.c
@@ -723,8 +723,6 @@ static void perf_counter_interrupt(struc
/* counter has overflowed */
found = 1;
record_and_restart(counter, val, regs);
- if (counter->wakeup_pending)
- need_wakeup = 1;
}
}

@@ -754,17 +752,14 @@ static void perf_counter_interrupt(struc
/*
* If we need a wakeup, check whether interrupts were soft-enabled
* when we took the interrupt. If they were, we can wake stuff up
- * immediately; otherwise we'll have to set a flag and do the
- * wakeup when interrupts get soft-enabled.
+ * immediately; otherwise we'll have do the wakeup when interrupts
+ * get soft-enabled.
*/
- if (need_wakeup) {
- if (regs->softe) {
- irq_enter();
- perf_counter_do_pending();
- irq_exit();
- } else {
- set_perf_counter_pending();
- }
+ if (get_perf_counter_pending() && regs->softe) {
+ irq_enter();
+ clear_perf_counter_pending();
+ perf_counter_do_pending();
+ irq_exit();
}
}


--


2009-03-19 22:17:41

by Paul Mackerras

[permalink] [raw]
Subject: Re: [PATCH 10/10] perf_counter: powerpc: clean up perc_counter_interrupt

Peter Zijlstra writes:

> From: Paul Mackerras <[email protected]>
>
> > Nice cleanup, and thanks for updating powerpc too. With this, I think
> > we'll need to update the powerpc perf_counter_interrupt a bit: we
> > might as well use get_perf_counter_pending() instead of the wakeup
> > variable now. I'll send an extra patch once I have done some testing.
>
> This seems to work OK.
>
> Signed-off-by: Paul Mackerras <[email protected]>
> Signed-off-by: Peter Zijlstra <[email protected]>

Let's have a better patch description (my fault for not providing a
decent one in the first place):

perf_counter: powerpc: clean up perf_counter_interrupt

From: Paul Mackerras <[email protected]>

This updates the powerpc perf_counter_interrupt following on from the
"perf_counter: unify irq output code" patch. Since we now use the
generic perf_counter_output code, which sets the perf_counter_pending
flag directly, we no longer need the need_wakeup variable. This
removes need_wakeup and makes perf_counter_interrupt use
get_perf_counter_pending() instead.

Signed-off-by: Paul Mackerras <[email protected]>

2009-03-20 08:54:50

by Ingo Molnar

[permalink] [raw]
Subject: Re: [PATCH 10/10] perf_counter: powerpc: clean up perc_counter_interrupt


* Paul Mackerras <[email protected]> wrote:

> Peter Zijlstra writes:
>
> > From: Paul Mackerras <[email protected]>
> >
> > > Nice cleanup, and thanks for updating powerpc too. With this, I think
> > > we'll need to update the powerpc perf_counter_interrupt a bit: we
> > > might as well use get_perf_counter_pending() instead of the wakeup
> > > variable now. I'll send an extra patch once I have done some testing.
> >
> > This seems to work OK.
> >
> > Signed-off-by: Paul Mackerras <[email protected]>
> > Signed-off-by: Peter Zijlstra <[email protected]>
>
> Let's have a better patch description (my fault for not providing a
> decent one in the first place):

thanks - picked up your changelog.

Ingo

2009-03-20 10:28:35

by Paul Mackerras

[permalink] [raw]
Subject: [tip:perfcounters/core] perf_counter: powerpc: clean up perc_counter_interrupt

Commit-ID: 8b3229288a401f45b95c9b0aa9a551b82947a101
Gitweb: http://git.kernel.org/tip/8b3229288a401f45b95c9b0aa9a551b82947a101
Author: Paul Mackerras <[email protected]>
AuthorDate: Thu, 19 Mar 2009 20:26:20 +0100
Committer: Ingo Molnar <[email protected]>
CommitDate: Fri, 20 Mar 2009 11:15:14 +0100

perf_counter: powerpc: clean up perc_counter_interrupt

Impact: cleanup

This updates the powerpc perf_counter_interrupt following on from the
"perf_counter: unify irq output code" patch. Since we now use the
generic perf_counter_output code, which sets the perf_counter_pending
flag directly, we no longer need the need_wakeup variable.

This removes need_wakeup and makes perf_counter_interrupt use
get_perf_counter_pending() instead.

Signed-off-by: Paul Mackerras <[email protected]>
Signed-off-by: Peter Zijlstra <[email protected]>
Cc: Steven Rostedt <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>


---
arch/powerpc/kernel/perf_counter.c | 19 +++++++------------
1 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/arch/powerpc/kernel/perf_counter.c b/arch/powerpc/kernel/perf_counter.c
index 88b72eb..830ca9c 100644
--- a/arch/powerpc/kernel/perf_counter.c
+++ b/arch/powerpc/kernel/perf_counter.c
@@ -723,8 +723,6 @@ static void perf_counter_interrupt(struct pt_regs *regs)
/* counter has overflowed */
found = 1;
record_and_restart(counter, val, regs);
- if (counter->wakeup_pending)
- need_wakeup = 1;
}
}

@@ -754,17 +752,14 @@ static void perf_counter_interrupt(struct pt_regs *regs)
/*
* If we need a wakeup, check whether interrupts were soft-enabled
* when we took the interrupt. If they were, we can wake stuff up
- * immediately; otherwise we'll have to set a flag and do the
- * wakeup when interrupts get soft-enabled.
+ * immediately; otherwise we'll have do the wakeup when interrupts
+ * get soft-enabled.
*/
- if (need_wakeup) {
- if (regs->softe) {
- irq_enter();
- perf_counter_do_pending();
- irq_exit();
- } else {
- set_perf_counter_pending();
- }
+ if (get_perf_counter_pending() && regs->softe) {
+ irq_enter();
+ clear_perf_counter_pending();
+ perf_counter_do_pending();
+ irq_exit();
}
}