All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cpuidle:powernv: Add the CPUIDLE_FLAG_POLLING for snooze
@ 2018-07-03  5:24 Gautham R. Shenoy
  2018-07-03 14:06 ` Vaidyanathan Srinivasan
  0 siblings, 1 reply; 5+ messages in thread
From: Gautham R. Shenoy @ 2018-07-03  5:24 UTC (permalink / raw)
  To: akshay.adiga, Vaidyanathan Srinivasan, Nicholas Piggin,
	Michael Ellerman, Rafael J. Wysocki, Daniel Lezcano
  Cc: linux-kernel, linux-pm, Gautham R. Shenoy

From: "Gautham R. Shenoy" <ego@linux.vnet.ibm.com>

In the situations where snooze is the only cpuidle state due to
firmware not exposing any platform idle states, the idle CPUs will
remain in snooze for a long time with interrupts disabled causing the
Hard-lockup detector to complain.

watchdog: CPU 51 detected hard LOCKUP on other CPUs 59
watchdog: CPU 51 TB:535296107736, last SMP heartbeat TB:527472229239 (15281ms ago)
watchdog: CPU 59 Hard LOCKUP
watchdog: CPU 59 TB:535296252849, last heartbeat TB:526554725466 (17073ms ago)

Fix this by adding CPUIDLE_FLAG_POLLING flag to the state, so that the
cpuidle governor will do the right thing, such as not stopping the
tick if it is going to put the idle cpu to snooze.

Reported-by: Akshay Adiga <akshay.adiga@linux.vnet.ibm.com>
Cc: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>
---
 drivers/cpuidle/cpuidle-powernv.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/cpuidle/cpuidle-powernv.c b/drivers/cpuidle/cpuidle-powernv.c
index d29e4f0..b73041b 100644
--- a/drivers/cpuidle/cpuidle-powernv.c
+++ b/drivers/cpuidle/cpuidle-powernv.c
@@ -156,6 +156,7 @@ static int stop_loop(struct cpuidle_device *dev,
 	{ /* Snooze */
 		.name = "snooze",
 		.desc = "snooze",
+		.flags = CPUIDLE_FLAG_POLLING,
 		.exit_latency = 0,
 		.target_residency = 0,
 		.enter = snooze_loop },
-- 
1.9.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] cpuidle:powernv: Add the CPUIDLE_FLAG_POLLING for snooze
  2018-07-03  5:24 [PATCH] cpuidle:powernv: Add the CPUIDLE_FLAG_POLLING for snooze Gautham R. Shenoy
@ 2018-07-03 14:06 ` Vaidyanathan Srinivasan
  2018-07-03 15:03   ` Gautham R Shenoy
  0 siblings, 1 reply; 5+ messages in thread
From: Vaidyanathan Srinivasan @ 2018-07-03 14:06 UTC (permalink / raw)
  To: Gautham R. Shenoy
  Cc: akshay.adiga, Nicholas Piggin, Michael Ellerman,
	Rafael J. Wysocki, Daniel Lezcano, linux-kernel, linux-pm

* Gautham R Shenoy <ego@linux.vnet.ibm.com> [2018-07-03 10:54:16]:

> From: "Gautham R. Shenoy" <ego@linux.vnet.ibm.com>
> 
> In the situations where snooze is the only cpuidle state due to
> firmware not exposing any platform idle states, the idle CPUs will
> remain in snooze for a long time with interrupts disabled causing the
> Hard-lockup detector to complain.

snooze_loop() will spin in SMT low priority with interrupt enabled. We
have local_irq_enable() before we get into the snooze loop.
Since this is a polling state, we should wakeup without an interrupt
and hence we set TIF_POLLING_NRFLAG as well.

 
> watchdog: CPU 51 detected hard LOCKUP on other CPUs 59
> watchdog: CPU 51 TB:535296107736, last SMP heartbeat TB:527472229239 (15281ms ago)
> watchdog: CPU 59 Hard LOCKUP
> watchdog: CPU 59 TB:535296252849, last heartbeat TB:526554725466 (17073ms ago)

hmm.. not sure why watchdog will complain, maybe something more is
going on.
 
> Fix this by adding CPUIDLE_FLAG_POLLING flag to the state, so that the
> cpuidle governor will do the right thing, such as not stopping the
> tick if it is going to put the idle cpu to snooze.
> 
> Reported-by: Akshay Adiga <akshay.adiga@linux.vnet.ibm.com>
> Cc: Nicholas Piggin <npiggin@gmail.com>
> Signed-off-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>
> ---
>  drivers/cpuidle/cpuidle-powernv.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/cpuidle/cpuidle-powernv.c b/drivers/cpuidle/cpuidle-powernv.c
> index d29e4f0..b73041b 100644
> --- a/drivers/cpuidle/cpuidle-powernv.c
> +++ b/drivers/cpuidle/cpuidle-powernv.c
> @@ -156,6 +156,7 @@ static int stop_loop(struct cpuidle_device *dev,
>  	{ /* Snooze */
>  		.name = "snooze",
>  		.desc = "snooze",
> +		.flags = CPUIDLE_FLAG_POLLING,
>  		.exit_latency = 0,
>  		.target_residency = 0,
>  		.enter = snooze_loop },

Adding the CPUIDLE_FLAG_POLLING is good and enables more optimization.
But the reason that we spin with interrupt disabled does not seem
right.

--Vaidy


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] cpuidle:powernv: Add the CPUIDLE_FLAG_POLLING for snooze
  2018-07-03 14:06 ` Vaidyanathan Srinivasan
@ 2018-07-03 15:03   ` Gautham R Shenoy
  2018-07-05  6:00       ` Michael Ellerman
  0 siblings, 1 reply; 5+ messages in thread
From: Gautham R Shenoy @ 2018-07-03 15:03 UTC (permalink / raw)
  To: Vaidyanathan Srinivasan
  Cc: Gautham R. Shenoy, akshay.adiga, Nicholas Piggin,
	Michael Ellerman, Rafael J. Wysocki, Daniel Lezcano,
	linux-kernel, linux-pm

On Tue, Jul 03, 2018 at 07:36:16PM +0530, Vaidyanathan Srinivasan wrote:
> * Gautham R Shenoy <ego@linux.vnet.ibm.com> [2018-07-03 10:54:16]:
> 
> > From: "Gautham R. Shenoy" <ego@linux.vnet.ibm.com>
> > 
> > In the situations where snooze is the only cpuidle state due to
> > firmware not exposing any platform idle states, the idle CPUs will
> > remain in snooze for a long time with interrupts disabled causing the
> > Hard-lockup detector to complain.
> 
> snooze_loop() will spin in SMT low priority with interrupt enabled. We
> have local_irq_enable() before we get into the snooze loop.
> Since this is a polling state, we should wakeup without an interrupt
> and hence we set TIF_POLLING_NRFLAG as well.
>

You are right. We have a local_irq_enable() inside the snooze_loop.


> 
> > watchdog: CPU 51 detected hard LOCKUP on other CPUs 59
> > watchdog: CPU 51 TB:535296107736, last SMP heartbeat TB:527472229239 (15281ms ago)
> > watchdog: CPU 59 Hard LOCKUP
> > watchdog: CPU 59 TB:535296252849, last heartbeat TB:526554725466 (17073ms ago)
> 
> hmm.. not sure why watchdog will complain, maybe something more is
> going on.

Will look into this Vaidy.

> 
> > Fix this by adding CPUIDLE_FLAG_POLLING flag to the state, so that the
> > cpuidle governor will do the right thing, such as not stopping the
> > tick if it is going to put the idle cpu to snooze.
> > 
> > Reported-by: Akshay Adiga <akshay.adiga@linux.vnet.ibm.com>
> > Cc: Nicholas Piggin <npiggin@gmail.com>
> > Signed-off-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>
> > ---
> >  drivers/cpuidle/cpuidle-powernv.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/drivers/cpuidle/cpuidle-powernv.c b/drivers/cpuidle/cpuidle-powernv.c
> > index d29e4f0..b73041b 100644
> > --- a/drivers/cpuidle/cpuidle-powernv.c
> > +++ b/drivers/cpuidle/cpuidle-powernv.c
> > @@ -156,6 +156,7 @@ static int stop_loop(struct cpuidle_device *dev,
> >  	{ /* Snooze */
> >  		.name = "snooze",
> >  		.desc = "snooze",
> > +		.flags = CPUIDLE_FLAG_POLLING,
> >  		.exit_latency = 0,
> >  		.target_residency = 0,
> >  		.enter = snooze_loop },
> 
> Adding the CPUIDLE_FLAG_POLLING is good and enables more optimization.
> But the reason that we spin with interrupt disabled does not seem
> right.


Fair point. 
> 
> --Vaidy
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] cpuidle:powernv: Add the CPUIDLE_FLAG_POLLING for snooze
  2018-07-03 15:03   ` Gautham R Shenoy
@ 2018-07-05  6:00       ` Michael Ellerman
  0 siblings, 0 replies; 5+ messages in thread
From: Michael Ellerman @ 2018-07-05  6:00 UTC (permalink / raw)
  To: Gautham R Shenoy, Vaidyanathan Srinivasan
  Cc: Gautham R. Shenoy, akshay.adiga, Nicholas Piggin,
	Rafael J. Wysocki, Daniel Lezcano, linux-kernel, linux-pm

Gautham R Shenoy <ego@linux.vnet.ibm.com> writes:
> On Tue, Jul 03, 2018 at 07:36:16PM +0530, Vaidyanathan Srinivasan wrote:
>> * Gautham R Shenoy <ego@linux.vnet.ibm.com> [2018-07-03 10:54:16]:
>> 
>> > From: "Gautham R. Shenoy" <ego@linux.vnet.ibm.com>
>> > 
>> > In the situations where snooze is the only cpuidle state due to
>> > firmware not exposing any platform idle states, the idle CPUs will
>> > remain in snooze for a long time with interrupts disabled causing the
>> > Hard-lockup detector to complain.
>> 
>> snooze_loop() will spin in SMT low priority with interrupt enabled. We
>> have local_irq_enable() before we get into the snooze loop.
>> Since this is a polling state, we should wakeup without an interrupt
>> and hence we set TIF_POLLING_NRFLAG as well.
>>
>
> You are right. We have a local_irq_enable() inside the snooze_loop.
>> 
>> > watchdog: CPU 51 detected hard LOCKUP on other CPUs 59
>> > watchdog: CPU 51 TB:535296107736, last SMP heartbeat TB:527472229239 (15281ms ago)
>> > watchdog: CPU 59 Hard LOCKUP
>> > watchdog: CPU 59 TB:535296252849, last heartbeat TB:526554725466 (17073ms ago)
>> 
>> hmm.. not sure why watchdog will complain, maybe something more is
>> going on.
>
> Will look into this Vaidy.

I'll wait for a v2.

cheers

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] cpuidle:powernv: Add the CPUIDLE_FLAG_POLLING for snooze
@ 2018-07-05  6:00       ` Michael Ellerman
  0 siblings, 0 replies; 5+ messages in thread
From: Michael Ellerman @ 2018-07-05  6:00 UTC (permalink / raw)
  To: Vaidyanathan Srinivasan
  Cc: Gautham R. Shenoy, akshay.adiga, Nicholas Piggin,
	Rafael J. Wysocki, Daniel Lezcano, linux-kernel, linux-pm

Gautham R Shenoy <ego@linux.vnet.ibm.com> writes:
> On Tue, Jul 03, 2018 at 07:36:16PM +0530, Vaidyanathan Srinivasan wrote:
>> * Gautham R Shenoy <ego@linux.vnet.ibm.com> [2018-07-03 10:54:16]:
>> 
>> > From: "Gautham R. Shenoy" <ego@linux.vnet.ibm.com>
>> > 
>> > In the situations where snooze is the only cpuidle state due to
>> > firmware not exposing any platform idle states, the idle CPUs will
>> > remain in snooze for a long time with interrupts disabled causing the
>> > Hard-lockup detector to complain.
>> 
>> snooze_loop() will spin in SMT low priority with interrupt enabled. We
>> have local_irq_enable() before we get into the snooze loop.
>> Since this is a polling state, we should wakeup without an interrupt
>> and hence we set TIF_POLLING_NRFLAG as well.
>>
>
> You are right. We have a local_irq_enable() inside the snooze_loop.
>> 
>> > watchdog: CPU 51 detected hard LOCKUP on other CPUs 59
>> > watchdog: CPU 51 TB:535296107736, last SMP heartbeat TB:527472229239 (15281ms ago)
>> > watchdog: CPU 59 Hard LOCKUP
>> > watchdog: CPU 59 TB:535296252849, last heartbeat TB:526554725466 (17073ms ago)
>> 
>> hmm.. not sure why watchdog will complain, maybe something more is
>> going on.
>
> Will look into this Vaidy.

I'll wait for a v2.

cheers

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-07-05  6:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-03  5:24 [PATCH] cpuidle:powernv: Add the CPUIDLE_FLAG_POLLING for snooze Gautham R. Shenoy
2018-07-03 14:06 ` Vaidyanathan Srinivasan
2018-07-03 15:03   ` Gautham R Shenoy
2018-07-05  6:00     ` Michael Ellerman
2018-07-05  6:00       ` Michael Ellerman

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.