diff mbox

[09/13] powerpc/64s: cpuidle set polling before enabling irqs

Message ID 20170613130557.26315-10-npiggin@gmail.com (mailing list archive)
State Superseded
Headers show

Commit Message

Nicholas Piggin June 13, 2017, 1:05 p.m. UTC
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: Gautham R. Shenoy <ego@linux.vnet.ibm.com>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 drivers/cpuidle/cpuidle-powernv.c | 4 +++-
 drivers/cpuidle/cpuidle-pseries.c | 3 ++-
 2 files changed, 5 insertions(+), 2 deletions(-)

Comments

Michael Ellerman June 14, 2017, 11:40 a.m. UTC | #1
Nicholas Piggin <npiggin@gmail.com> writes:

> 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: Gautham R. Shenoy <ego@linux.vnet.ibm.com>
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> ---
>  drivers/cpuidle/cpuidle-powernv.c | 4 +++-
>  drivers/cpuidle/cpuidle-pseries.c | 3 ++-
>  2 files changed, 5 insertions(+), 2 deletions(-)

I don't think the cpuidle folks are really interested in these changes,
but we should Cc them to be polite.

Can you resend patches 9, 10, 11 with a subject like:

  "cpuidle: powernv: Set polling ..."

And Cc the cpuidle folks:

$ ./scripts/get_maintainer.pl -f drivers/cpuidle
rjw@rjwysocki.net
daniel.lezcano@linaro.org
linux-pm@vger.kernel.org
linux-kernel@vger.kernel.org

cheers
Nicholas Piggin June 14, 2017, 11:50 a.m. UTC | #2
On Wed, 14 Jun 2017 21:40:52 +1000
Michael Ellerman <mpe@ellerman.id.au> wrote:

> Nicholas Piggin <npiggin@gmail.com> writes:
> 
> > 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: Gautham R. Shenoy <ego@linux.vnet.ibm.com>
> > Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> > ---
> >  drivers/cpuidle/cpuidle-powernv.c | 4 +++-
> >  drivers/cpuidle/cpuidle-pseries.c | 3 ++-
> >  2 files changed, 5 insertions(+), 2 deletions(-)  
> 
> I don't think the cpuidle folks are really interested in these changes,
> but we should Cc them to be polite.
> 
> Can you resend patches 9, 10, 11 with a subject like:
> 
>   "cpuidle: powernv: Set polling ..."
> 
> And Cc the cpuidle folks:
> 
> $ ./scripts/get_maintainer.pl -f drivers/cpuidle
> rjw@rjwysocki.net
> daniel.lezcano@linaro.org
> linux-pm@vger.kernel.org
> linux-kernel@vger.kernel.org

Yeah I can do that. I'll send them as thier own series. They don't
depend on any of the patches in this series, so I should have done
that in the first place.

Thanks,
Nick
Michael Ellerman June 14, 2017, 1:05 p.m. UTC | #3
Nicholas Piggin <npiggin@gmail.com> writes:

> On Wed, 14 Jun 2017 21:40:52 +1000
> Michael Ellerman <mpe@ellerman.id.au> wrote:
>
>> Nicholas Piggin <npiggin@gmail.com> writes:
>> 
>> > 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: Gautham R. Shenoy <ego@linux.vnet.ibm.com>
>> > Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
>> > ---
>> >  drivers/cpuidle/cpuidle-powernv.c | 4 +++-
>> >  drivers/cpuidle/cpuidle-pseries.c | 3 ++-
>> >  2 files changed, 5 insertions(+), 2 deletions(-)  
>> 
>> I don't think the cpuidle folks are really interested in these changes,
>> but we should Cc them to be polite.
>> 
>> Can you resend patches 9, 10, 11 with a subject like:
>> 
>>   "cpuidle: powernv: Set polling ..."
>> 
>> And Cc the cpuidle folks:
>> 
>> $ ./scripts/get_maintainer.pl -f drivers/cpuidle
>> rjw@rjwysocki.net
>> daniel.lezcano@linaro.org
>> linux-pm@vger.kernel.org
>> linux-kernel@vger.kernel.org
>
> Yeah I can do that. I'll send them as thier own series. They don't
> depend on any of the patches in this series, so I should have done
> that in the first place.

Great thanks.

cheers
diff mbox

Patch

diff --git a/drivers/cpuidle/cpuidle-powernv.c b/drivers/cpuidle/cpuidle-powernv.c
index 79152676f62b..50b3c2e0306f 100644
--- a/drivers/cpuidle/cpuidle-powernv.c
+++ b/drivers/cpuidle/cpuidle-powernv.c
@@ -51,9 +51,10 @@  static int snooze_loop(struct cpuidle_device *dev,
 {
 	u64 snooze_exit_time;
 
-	local_irq_enable();
 	set_thread_flag(TIF_POLLING_NRFLAG);
 
+	local_irq_enable();
+
 	snooze_exit_time = get_tb() + snooze_timeout;
 	ppc64_runlatch_off();
 	HMT_very_low();
@@ -66,6 +67,7 @@  static int snooze_loop(struct cpuidle_device *dev,
 	ppc64_runlatch_on();
 	clear_thread_flag(TIF_POLLING_NRFLAG);
 	smp_mb();
+
 	return index;
 }
 
diff --git a/drivers/cpuidle/cpuidle-pseries.c b/drivers/cpuidle/cpuidle-pseries.c
index 166ccd711ec9..7b12bb2ea70f 100644
--- a/drivers/cpuidle/cpuidle-pseries.c
+++ b/drivers/cpuidle/cpuidle-pseries.c
@@ -62,9 +62,10 @@  static int snooze_loop(struct cpuidle_device *dev,
 	unsigned long in_purr;
 	u64 snooze_exit_time;
 
+	set_thread_flag(TIF_POLLING_NRFLAG);
+
 	idle_loop_prolog(&in_purr);
 	local_irq_enable();
-	set_thread_flag(TIF_POLLING_NRFLAG);
 	snooze_exit_time = get_tb() + snooze_timeout;
 
 	while (!need_resched()) {