linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc/pseries: correctly track irq state in default idle
@ 2019-09-10 22:52 Nathan Lynch
  2019-09-19 10:25 ` Michael Ellerman
  0 siblings, 1 reply; 2+ messages in thread
From: Nathan Lynch @ 2019-09-10 22:52 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: ego, npiggin

prep_irq_for_idle() is intended to be called before entering
H_CEDE (and it is used by the pseries cpuidle driver). However the
default pseries idle routine does not call it, leading to mismanaged
lazy irq state when the cpuidle driver isn't in use. Manifestations of
this include:

* Dropped IPIs in the time immediately after a cpu comes
  online (before it has installed the cpuidle handler), making the
  online operation block indefinitely waiting for the new cpu to
  respond.

* Hitting this WARN_ON in arch_local_irq_restore():
	/*
	 * We should already be hard disabled here. We had bugs
	 * where that wasn't the case so let's dbl check it and
	 * warn if we are wrong. Only do that when IRQ tracing
	 * is enabled as mfmsr() can be costly.
	 */
	if (WARN_ON_ONCE(mfmsr() & MSR_EE))
		__hard_irq_disable();

Call prep_irq_for_idle() from pseries_lpar_idle() and honor its
result.

Fixes: 363edbe2614a ("powerpc: Default arch idle could cede processor on pseries")
Signed-off-by: Nathan Lynch <nathanl@linux.ibm.com>
---
 arch/powerpc/platforms/pseries/setup.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index b955d54628ff..f8adcd0e4589 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -321,6 +321,9 @@ static void pseries_lpar_idle(void)
 	 * low power mode by ceding processor to hypervisor
 	 */
 
+	if (!prep_irq_for_idle())
+		return;
+
 	/* Indicate to hypervisor that we are idle. */
 	get_lppaca()->idle = 1;
 
-- 
2.20.1


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

* Re: [PATCH] powerpc/pseries: correctly track irq state in default idle
  2019-09-10 22:52 [PATCH] powerpc/pseries: correctly track irq state in default idle Nathan Lynch
@ 2019-09-19 10:25 ` Michael Ellerman
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Ellerman @ 2019-09-19 10:25 UTC (permalink / raw)
  To: Nathan Lynch, linuxppc-dev; +Cc: ego, npiggin

On Tue, 2019-09-10 at 22:52:44 UTC, Nathan Lynch wrote:
> prep_irq_for_idle() is intended to be called before entering
> H_CEDE (and it is used by the pseries cpuidle driver). However the
> default pseries idle routine does not call it, leading to mismanaged
> lazy irq state when the cpuidle driver isn't in use. Manifestations of
> this include:
> 
> * Dropped IPIs in the time immediately after a cpu comes
>   online (before it has installed the cpuidle handler), making the
>   online operation block indefinitely waiting for the new cpu to
>   respond.
> 
> * Hitting this WARN_ON in arch_local_irq_restore():
> 	/*
> 	 * We should already be hard disabled here. We had bugs
> 	 * where that wasn't the case so let's dbl check it and
> 	 * warn if we are wrong. Only do that when IRQ tracing
> 	 * is enabled as mfmsr() can be costly.
> 	 */
> 	if (WARN_ON_ONCE(mfmsr() & MSR_EE))
> 		__hard_irq_disable();
> 
> Call prep_irq_for_idle() from pseries_lpar_idle() and honor its
> result.
> 
> Fixes: 363edbe2614a ("powerpc: Default arch idle could cede processor on pseries")
> Signed-off-by: Nathan Lynch <nathanl@linux.ibm.com>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/92c94dfb69e350471473fd3075c74bc68150879e

cheers

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

end of thread, other threads:[~2019-09-19 10:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-10 22:52 [PATCH] powerpc/pseries: correctly track irq state in default idle Nathan Lynch
2019-09-19 10:25 ` Michael Ellerman

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).