Commit 3fc5ee92 authored by Nicholas Piggin's avatar Nicholas Piggin Committed by Michael Ellerman

cpuidle: powerpc: cpuidle set polling before enabling irqs

local_irq_enable can cause interrupts to be taken which could
take significant amount of processing time. The idle process
should set its polling flag before this, so another process that
wakes it during this time will not have to send an IPI.

Expand the TIF_POLLING_NRFLAG coverage to as large as possible.
Reviewed-by: default avatarGautham R. Shenoy <ego@linux.vnet.ibm.com>
Signed-off-by: default avatarNicholas Piggin <npiggin@gmail.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent 68fa6478
...@@ -51,9 +51,10 @@ static int snooze_loop(struct cpuidle_device *dev, ...@@ -51,9 +51,10 @@ static int snooze_loop(struct cpuidle_device *dev,
{ {
u64 snooze_exit_time; u64 snooze_exit_time;
local_irq_enable();
set_thread_flag(TIF_POLLING_NRFLAG); set_thread_flag(TIF_POLLING_NRFLAG);
local_irq_enable();
snooze_exit_time = get_tb() + snooze_timeout; snooze_exit_time = get_tb() + snooze_timeout;
ppc64_runlatch_off(); ppc64_runlatch_off();
HMT_very_low(); HMT_very_low();
...@@ -66,6 +67,7 @@ static int snooze_loop(struct cpuidle_device *dev, ...@@ -66,6 +67,7 @@ static int snooze_loop(struct cpuidle_device *dev,
ppc64_runlatch_on(); ppc64_runlatch_on();
clear_thread_flag(TIF_POLLING_NRFLAG); clear_thread_flag(TIF_POLLING_NRFLAG);
smp_mb(); smp_mb();
return index; return index;
} }
......
...@@ -62,9 +62,10 @@ static int snooze_loop(struct cpuidle_device *dev, ...@@ -62,9 +62,10 @@ static int snooze_loop(struct cpuidle_device *dev,
unsigned long in_purr; unsigned long in_purr;
u64 snooze_exit_time; u64 snooze_exit_time;
set_thread_flag(TIF_POLLING_NRFLAG);
idle_loop_prolog(&in_purr); idle_loop_prolog(&in_purr);
local_irq_enable(); local_irq_enable();
set_thread_flag(TIF_POLLING_NRFLAG);
snooze_exit_time = get_tb() + snooze_timeout; snooze_exit_time = get_tb() + snooze_timeout;
while (!need_resched()) { while (!need_resched()) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment