linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc/xive: Prevent page fault issues in the machine crash handler
@ 2019-10-31  6:31 Cédric Le Goater
  2019-10-31  8:43 ` Greg Kurz
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Cédric Le Goater @ 2019-10-31  6:31 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc-dev, Greg Kurz, Cédric Le Goater

When the machine crash handler is invoked, all interrupts are masked
but interrupts which have not been started yet do not have an ESB page
mapped in the Linux address space. This crashes the 'crash kexec'
sequence on sPAPR guests.

To fix, force the mapping of the ESB page when an interrupt is being
mapped in the Linux IRQ number space. This is done by setting the
initial state of the interrupt to OFF which is not necessarily the
case on PowerNV.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
 arch/powerpc/sysdev/xive/common.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/arch/powerpc/sysdev/xive/common.c b/arch/powerpc/sysdev/xive/common.c
index df832b09e3e9..f5fadbd2533a 100644
--- a/arch/powerpc/sysdev/xive/common.c
+++ b/arch/powerpc/sysdev/xive/common.c
@@ -1035,6 +1035,15 @@ static int xive_irq_alloc_data(unsigned int virq, irq_hw_number_t hw)
 	xd->target = XIVE_INVALID_TARGET;
 	irq_set_handler_data(virq, xd);
 
+	/*
+	 * Turn OFF by default the interrupt being mapped. A side
+	 * effect of this check is the mapping the ESB page of the
+	 * interrupt in the Linux address space. This prevents page
+	 * fault issues in the crash handler which masks all
+	 * interrupts.
+	 */
+	xive_esb_read(xd, XIVE_ESB_SET_PQ_01);
+
 	return 0;
 }
 
-- 
2.21.0


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

* Re: [PATCH] powerpc/xive: Prevent page fault issues in the machine crash handler
  2019-10-31  6:31 [PATCH] powerpc/xive: Prevent page fault issues in the machine crash handler Cédric Le Goater
@ 2019-10-31  8:43 ` Greg Kurz
  2019-11-12 12:44 ` Michael Ellerman
  2019-11-14  9:08 ` Michael Ellerman
  2 siblings, 0 replies; 5+ messages in thread
From: Greg Kurz @ 2019-10-31  8:43 UTC (permalink / raw)
  To: Cédric Le Goater; +Cc: linuxppc-dev

On Thu, 31 Oct 2019 07:31:00 +0100
Cédric Le Goater <clg@kaod.org> wrote:

> When the machine crash handler is invoked, all interrupts are masked
> but interrupts which have not been started yet do not have an ESB page
> mapped in the Linux address space. This crashes the 'crash kexec'
> sequence on sPAPR guests.
> 
> To fix, force the mapping of the ESB page when an interrupt is being
> mapped in the Linux IRQ number space. This is done by setting the
> initial state of the interrupt to OFF which is not necessarily the
> case on PowerNV.
> 
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> ---

Reviewed-by: Greg Kurz <groug@kaod.org>

>  arch/powerpc/sysdev/xive/common.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/arch/powerpc/sysdev/xive/common.c b/arch/powerpc/sysdev/xive/common.c
> index df832b09e3e9..f5fadbd2533a 100644
> --- a/arch/powerpc/sysdev/xive/common.c
> +++ b/arch/powerpc/sysdev/xive/common.c
> @@ -1035,6 +1035,15 @@ static int xive_irq_alloc_data(unsigned int virq, irq_hw_number_t hw)
>  	xd->target = XIVE_INVALID_TARGET;
>  	irq_set_handler_data(virq, xd);
>  
> +	/*
> +	 * Turn OFF by default the interrupt being mapped. A side
> +	 * effect of this check is the mapping the ESB page of the
> +	 * interrupt in the Linux address space. This prevents page
> +	 * fault issues in the crash handler which masks all
> +	 * interrupts.
> +	 */
> +	xive_esb_read(xd, XIVE_ESB_SET_PQ_01);
> +
>  	return 0;
>  }
>  


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

* Re: [PATCH] powerpc/xive: Prevent page fault issues in the machine crash handler
  2019-10-31  6:31 [PATCH] powerpc/xive: Prevent page fault issues in the machine crash handler Cédric Le Goater
  2019-10-31  8:43 ` Greg Kurz
@ 2019-11-12 12:44 ` Michael Ellerman
  2019-11-12 12:48   ` Cédric Le Goater
  2019-11-14  9:08 ` Michael Ellerman
  2 siblings, 1 reply; 5+ messages in thread
From: Michael Ellerman @ 2019-11-12 12:44 UTC (permalink / raw)
  To: Cédric Le Goater; +Cc: linuxppc-dev, Greg Kurz, Cédric Le Goater

Cédric Le Goater <clg@kaod.org> writes:
> When the machine crash handler is invoked, all interrupts are masked
> but interrupts which have not been started yet do not have an ESB page
> mapped in the Linux address space. This crashes the 'crash kexec'
> sequence on sPAPR guests.

This sounds like it needs a Fixes/stable tag?

I used these:

  Fixes: 243e25112d06 ("powerpc/xive: Native exploitation of the XIVE interrupt controller")
  Cc: stable@vger.kernel.org # v4.12+

Please tell me if you think that's wrong.

cheers


> diff --git a/arch/powerpc/sysdev/xive/common.c b/arch/powerpc/sysdev/xive/common.c
> index df832b09e3e9..f5fadbd2533a 100644
> --- a/arch/powerpc/sysdev/xive/common.c
> +++ b/arch/powerpc/sysdev/xive/common.c
> @@ -1035,6 +1035,15 @@ static int xive_irq_alloc_data(unsigned int virq, irq_hw_number_t hw)
>  	xd->target = XIVE_INVALID_TARGET;
>  	irq_set_handler_data(virq, xd);
>  
> +	/*
> +	 * Turn OFF by default the interrupt being mapped. A side
> +	 * effect of this check is the mapping the ESB page of the
> +	 * interrupt in the Linux address space. This prevents page
> +	 * fault issues in the crash handler which masks all
> +	 * interrupts.
> +	 */
> +	xive_esb_read(xd, XIVE_ESB_SET_PQ_01);
> +
>  	return 0;
>  }
>  
> -- 
> 2.21.0

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

* Re: [PATCH] powerpc/xive: Prevent page fault issues in the machine crash handler
  2019-11-12 12:44 ` Michael Ellerman
@ 2019-11-12 12:48   ` Cédric Le Goater
  0 siblings, 0 replies; 5+ messages in thread
From: Cédric Le Goater @ 2019-11-12 12:48 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc-dev, Greg Kurz

On 12/11/2019 13:44, Michael Ellerman wrote:
> Cédric Le Goater <clg@kaod.org> writes:
>> When the machine crash handler is invoked, all interrupts are masked
>> but interrupts which have not been started yet do not have an ESB page
>> mapped in the Linux address space. This crashes the 'crash kexec'
>> sequence on sPAPR guests.
> 
> This sounds like it needs a Fixes/stable tag?

yes.

> I used these:
> 
>   Fixes: 243e25112d06 ("powerpc/xive: Native exploitation of the XIVE interrupt controller")
>   Cc: stable@vger.kernel.org # v4.12+
>
> Please tell me if you think that's wrong.

Looks OK to me. 

Thanks,

C. 


 
> cheers
> 
> 
>> diff --git a/arch/powerpc/sysdev/xive/common.c b/arch/powerpc/sysdev/xive/common.c
>> index df832b09e3e9..f5fadbd2533a 100644
>> --- a/arch/powerpc/sysdev/xive/common.c
>> +++ b/arch/powerpc/sysdev/xive/common.c
>> @@ -1035,6 +1035,15 @@ static int xive_irq_alloc_data(unsigned int virq, irq_hw_number_t hw)
>>  	xd->target = XIVE_INVALID_TARGET;
>>  	irq_set_handler_data(virq, xd);
>>  
>> +	/*
>> +	 * Turn OFF by default the interrupt being mapped. A side
>> +	 * effect of this check is the mapping the ESB page of the
>> +	 * interrupt in the Linux address space. This prevents page
>> +	 * fault issues in the crash handler which masks all
>> +	 * interrupts.
>> +	 */
>> +	xive_esb_read(xd, XIVE_ESB_SET_PQ_01);
>> +
>>  	return 0;
>>  }
>>  
>> -- 
>> 2.21.0


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

* Re: [PATCH] powerpc/xive: Prevent page fault issues in the machine crash handler
  2019-10-31  6:31 [PATCH] powerpc/xive: Prevent page fault issues in the machine crash handler Cédric Le Goater
  2019-10-31  8:43 ` Greg Kurz
  2019-11-12 12:44 ` Michael Ellerman
@ 2019-11-14  9:08 ` Michael Ellerman
  2 siblings, 0 replies; 5+ messages in thread
From: Michael Ellerman @ 2019-11-14  9:08 UTC (permalink / raw)
  To: Cédric Le Goater; +Cc: linuxppc-dev, Greg Kurz, Cédric Le Goater

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 721 bytes --]

On Thu, 2019-10-31 at 06:31:00 UTC, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= wrote:
> When the machine crash handler is invoked, all interrupts are masked
> but interrupts which have not been started yet do not have an ESB page
> mapped in the Linux address space. This crashes the 'crash kexec'
> sequence on sPAPR guests.
> 
> To fix, force the mapping of the ESB page when an interrupt is being
> mapped in the Linux IRQ number space. This is done by setting the
> initial state of the interrupt to OFF which is not necessarily the
> case on PowerNV.
> 
> Signed-off-by: Cédric Le Goater <clg@kaod.org>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/1ca3dec2b2dff9d286ce6cd64108bda0e98f9710

cheers

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

end of thread, other threads:[~2019-11-14 10:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-31  6:31 [PATCH] powerpc/xive: Prevent page fault issues in the machine crash handler Cédric Le Goater
2019-10-31  8:43 ` Greg Kurz
2019-11-12 12:44 ` Michael Ellerman
2019-11-12 12:48   ` Cédric Le Goater
2019-11-14  9:08 ` 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).