* [PATCH] powerpc/pseries: fix idle sleep early exit state
@ 2008-11-27 14:52 Sebastien Dugue
2008-12-03 9:38 ` Paul Mackerras
0 siblings, 1 reply; 3+ messages in thread
From: Sebastien Dugue @ 2008-11-27 14:52 UTC (permalink / raw)
To: linux-ppc; +Cc: Will Schmidt, Paul Mackerras, Jean Pierre Dion, Gilles Carry
In pseries_dedicated_idle_sleep(), if we need to exit idle during the
snooze period (i.e. need_resched or cpu has been offlined), then we should
re-disable the interrupts and clear TIF_POLLING_NRFLAG before leaving.
Signed-off-by: Sebastien Dugue <sebastien.dugue@bull.net>
Cc: Paul Mackerras <paulus@samba.org>
---
arch/powerpc/platforms/pseries/setup.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index ec34170..8270f04 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -504,8 +504,13 @@ static void pseries_dedicated_idle_sleep(void)
set_thread_flag(TIF_POLLING_NRFLAG);
while (get_tb() < start_snooze) {
- if (need_resched() || cpu_is_offline(cpu))
- goto out;
+ if (need_resched() || cpu_is_offline(cpu)) {
+ HMT_medium();
+ clear_thread_flag(TIF_POLLING_NRFLAG);
+ smp_mb();
+ local_irq_disable();
+ goto out2;
+ }
ppc64_runlatch_off();
HMT_low();
HMT_very_low();
@@ -523,6 +528,7 @@ static void pseries_dedicated_idle_sleep(void)
out:
HMT_medium();
+out2:
out_purr = mfspr(SPRN_PURR);
get_lppaca()->wait_state_cycles += out_purr - in_purr;
get_lppaca()->donate_dedicated_cpu = 0;
--
1.6.0.1.308.gede4c
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] powerpc/pseries: fix idle sleep early exit state
2008-11-27 14:52 [PATCH] powerpc/pseries: fix idle sleep early exit state Sebastien Dugue
@ 2008-12-03 9:38 ` Paul Mackerras
2008-12-03 10:07 ` Sebastien Dugue
0 siblings, 1 reply; 3+ messages in thread
From: Paul Mackerras @ 2008-12-03 9:38 UTC (permalink / raw)
To: Sebastien Dugue; +Cc: linux-ppc, Will Schmidt, Jean Pierre Dion, Gilles Carry
Sebastien Dugue writes:
> In pseries_dedicated_idle_sleep(), if we need to exit idle during the
> snooze period (i.e. need_resched or cpu has been offlined), then we should
> re-disable the interrupts and clear TIF_POLLING_NRFLAG before leaving.
Are you doing this because of a bug you actually observed, or did you
just find this by inspection? I don't believe it's necessary to do
these things (disabling interrupts, clearing TIF_POLLING_NRFLAG)
because the code that calls it immediately reenables interrupts and
sets TIF_POLLING_NRFLAG again. From arch/powerpc/kernel/idle.c (line
73):
if (!need_resched() && !cpu_should_die())
ppc_md.power_save();
local_irq_enable();
set_thread_flag(TIF_POLLING_NRFLAG);
Paul.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] powerpc/pseries: fix idle sleep early exit state
2008-12-03 9:38 ` Paul Mackerras
@ 2008-12-03 10:07 ` Sebastien Dugue
0 siblings, 0 replies; 3+ messages in thread
From: Sebastien Dugue @ 2008-12-03 10:07 UTC (permalink / raw)
To: Paul Mackerras; +Cc: linux-ppc, Will Schmidt, Jean Pierre Dion, Gilles Carry
On Wed, 3 Dec 2008 20:38:54 +1100 Paul Mackerras <paulus@samba.org> wrote:
> Sebastien Dugue writes:
>
> > In pseries_dedicated_idle_sleep(), if we need to exit idle during the
> > snooze period (i.e. need_resched or cpu has been offlined), then we should
> > re-disable the interrupts and clear TIF_POLLING_NRFLAG before leaving.
>
> Are you doing this because of a bug you actually observed, or did you
> just find this by inspection?
By inspection, and just to be consistent with the other way out. But
you're right, it's not really necessary here.
> I don't believe it's necessary to do
> these things (disabling interrupts, clearing TIF_POLLING_NRFLAG)
> because the code that calls it immediately reenables interrupts and
> sets TIF_POLLING_NRFLAG again. From arch/powerpc/kernel/idle.c (line
> 73):
>
> if (!need_resched() && !cpu_should_die())
> ppc_md.power_save();
>
> local_irq_enable();
> set_thread_flag(TIF_POLLING_NRFLAG);
>
> Paul.
>
Thanks,
Sebastien.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-12-03 10:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-27 14:52 [PATCH] powerpc/pseries: fix idle sleep early exit state Sebastien Dugue
2008-12-03 9:38 ` Paul Mackerras
2008-12-03 10:07 ` Sebastien Dugue
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).