Linux MIPS Architecture development
 help / color / mirror / Atom feed
* [PATCH 3.2 09/24] MIPS: Fix kernel lockup or crash after CPU offline/online
       [not found] <lsq.1425420688.806916072@decadent.org.uk>
  2015-03-03 22:11 ` [PATCH 3.2 12/24] MIPS: Fix C0_Pagegrain[IEC] support Ben Hutchings
  2015-03-03 22:11 ` [PATCH 3.2 03/24] MIPS: IRQ: Fix disable_irq on CPU IRQs Ben Hutchings
@ 2015-03-03 22:11 ` Ben Hutchings
  2 siblings, 0 replies; 5+ messages in thread
From: Ben Hutchings @ 2015-03-03 22:11 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, linux-mips, Hemmo Nieminen, David Daney, Ralf Baechle,
	Aaro Koskinen

3.2.68-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Hemmo Nieminen <hemmo.nieminen@iki.fi>

commit c7754e75100ed5e3068ac5085747f2bfc386c8d6 upstream.

As printk() invocation can cause e.g. a TLB miss, printk() cannot be
called before the exception handlers have been properly initialized.
This can happen e.g. when netconsole has been loaded as a kernel module
and the TLB table has been cleared when a CPU was offline.

Call cpu_report() in start_secondary() only after the exception handlers
have been initialized to fix this.

Without the patch the kernel will randomly either lockup or crash
after a CPU is onlined and the console driver is a module.

Signed-off-by: Hemmo Nieminen <hemmo.nieminen@iki.fi>
Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Cc: David Daney <david.daney@cavium.com>
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/8953/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
[bwh: Backported to 3.2: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 arch/mips/kernel/smp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/mips/kernel/smp.c
+++ b/arch/mips/kernel/smp.c
@@ -105,10 +105,10 @@ asmlinkage __cpuinit void start_secondar
 	if ((read_c0_tcbind() & TCBIND_CURTC) == 0)
 #endif /* CONFIG_MIPS_MT_SMTC */
 	cpu_probe();
-	cpu_report();
 	per_cpu_trap_init();
 	mips_clockevent_init();
 	mp_ops->init_secondary();
+	cpu_report();
 
 	/*
 	 * XXX parity protection should be folded in here when it's converted

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

* [PATCH 3.2 12/24] MIPS: Fix C0_Pagegrain[IEC] support.
       [not found] <lsq.1425420688.806916072@decadent.org.uk>
@ 2015-03-03 22:11 ` Ben Hutchings
  2015-03-03 23:24   ` David Daney
  2015-03-03 22:11 ` [PATCH 3.2 03/24] MIPS: IRQ: Fix disable_irq on CPU IRQs Ben Hutchings
  2015-03-03 22:11 ` [PATCH 3.2 09/24] MIPS: Fix kernel lockup or crash after CPU offline/online Ben Hutchings
  2 siblings, 1 reply; 5+ messages in thread
From: Ben Hutchings @ 2015-03-03 22:11 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, linux-mips, Leonid Yegoshin, David Daney, Ralf Baechle

3.2.68-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: David Daney <david.daney@cavium.com>

commit 9ead8632bbf454cfc709b6205dc9cd8582fb0d64 upstream.

The following commits:

  5890f70f15c52d (MIPS: Use dedicated exception handler if CPU supports RI/XI exceptions)
  6575b1d4173eae (MIPS: kernel: cpu-probe: Detect unique RI/XI exceptions)

break the kernel for *all* existing MIPS CPUs that implement the
CP0_PageGrain[IEC] bit.  They cause the TLB exception handlers to be
generated without the legacy execute-inhibit handling, but never set
the CP0_PageGrain[IEC] bit to activate the use of dedicated exception
vectors for execute-inhibit exceptions.  The result is that upon
detection of an execute-inhibit violation, we loop forever in the TLB
exception handlers instead of sending SIGSEGV to the task.

If we are generating TLB exception handlers expecting separate
vectors, we must also enable the CP0_PageGrain[IEC] feature.

The bug was introduced in kernel version 3.17.

Signed-off-by: David Daney <david.daney@cavium.com>
Cc: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: http://patchwork.linux-mips.org/patch/8880/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 arch/mips/mm/tlb-r4k.c | 2 ++
 1 file changed, 2 insertions(+)

--- a/arch/mips/mm/tlb-r4k.c
+++ b/arch/mips/mm/tlb-r4k.c
@@ -447,6 +447,8 @@ void __cpuinit tlb_init(void)
 #ifdef CONFIG_64BIT
 		pg |= PG_ELPA;
 #endif
+		if (cpu_has_rixiex)
+			pg |= PG_IEC;
 		write_c0_pagegrain(pg);
 	}
 

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

* [PATCH 3.2 03/24] MIPS: IRQ: Fix disable_irq on CPU IRQs
       [not found] <lsq.1425420688.806916072@decadent.org.uk>
  2015-03-03 22:11 ` [PATCH 3.2 12/24] MIPS: Fix C0_Pagegrain[IEC] support Ben Hutchings
@ 2015-03-03 22:11 ` Ben Hutchings
  2015-03-03 22:11 ` [PATCH 3.2 09/24] MIPS: Fix kernel lockup or crash after CPU offline/online Ben Hutchings
  2 siblings, 0 replies; 5+ messages in thread
From: Ben Hutchings @ 2015-03-03 22:11 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Felix Fietkau, Ralf Baechle, linux-mips

3.2.68-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Felix Fietkau <nbd@openwrt.org>

commit a3e6c1eff54878506b2dddcc202df9cc8180facb upstream.

If the irq_chip does not define .irq_disable, any call to disable_irq
will defer disabling the IRQ until it fires while marked as disabled.
This assumes that the handler function checks for this condition, which
handle_percpu_irq does not. In this case, calling disable_irq leads to
an IRQ storm, if the interrupt fires while disabled.

This optimization is only useful when disabling the IRQ is slow, which
is not true for the MIPS CPU IRQ.

Disable this optimization by implementing .irq_disable and .irq_enable

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/8949/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 arch/mips/kernel/irq_cpu.c | 4 ++++
 1 file changed, 4 insertions(+)

--- a/arch/mips/kernel/irq_cpu.c
+++ b/arch/mips/kernel/irq_cpu.c
@@ -56,6 +56,8 @@ static struct irq_chip mips_cpu_irq_cont
 	.irq_mask_ack	= mask_mips_irq,
 	.irq_unmask	= unmask_mips_irq,
 	.irq_eoi	= unmask_mips_irq,
+	.irq_disable	= mask_mips_irq,
+	.irq_enable	= unmask_mips_irq,
 };
 
 /*
@@ -92,6 +94,8 @@ static struct irq_chip mips_mt_cpu_irq_c
 	.irq_mask_ack	= mips_mt_cpu_irq_ack,
 	.irq_unmask	= unmask_mips_irq,
 	.irq_eoi	= unmask_mips_irq,
+	.irq_disable	= mask_mips_irq,
+	.irq_enable	= unmask_mips_irq,
 };
 
 void __init mips_cpu_irq_init(void)

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

* Re: [PATCH 3.2 12/24] MIPS: Fix C0_Pagegrain[IEC] support.
  2015-03-03 22:11 ` [PATCH 3.2 12/24] MIPS: Fix C0_Pagegrain[IEC] support Ben Hutchings
@ 2015-03-03 23:24   ` David Daney
  2015-03-04  0:25     ` Ben Hutchings
  0 siblings, 1 reply; 5+ messages in thread
From: David Daney @ 2015-03-03 23:24 UTC (permalink / raw)
  To: Ben Hutchings
  Cc: linux-kernel, stable, akpm, linux-mips, Leonid Yegoshin,
	David Daney, Ralf Baechle

On 03/03/2015 02:11 PM, Ben Hutchings wrote:
> 3.2.68-rc1 review patch.  If anyone has any objections, please let me know.
>

I object!

Because ...

> ------------------
>
> From: David Daney <david.daney@cavium.com>
>
> commit 9ead8632bbf454cfc709b6205dc9cd8582fb0d64 upstream.
>
> The following commits:
>
>    5890f70f15c52d (MIPS: Use dedicated exception handler if CPU supports RI/XI exceptions)
>    6575b1d4173eae (MIPS: kernel: cpu-probe: Detect unique RI/XI exceptions)
>
> break the kernel for *all* existing MIPS CPUs that implement the
> CP0_PageGrain[IEC] bit.  They cause the TLB exception handlers to be
> generated without the legacy execute-inhibit handling, but never set
> the CP0_PageGrain[IEC] bit to activate the use of dedicated exception
> vectors for execute-inhibit exceptions.  The result is that upon
> detection of an execute-inhibit violation, we loop forever in the TLB
> exception handlers instead of sending SIGSEGV to the task.
>
> If we are generating TLB exception handlers expecting separate
> vectors, we must also enable the CP0_PageGrain[IEC] feature.
>
> The bug was introduced in kernel version 3.17.

... I don't think the patch should be applied to versions prior to 3.17

David Daney

>
> Signed-off-by: David Daney <david.daney@cavium.com>
> Cc: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
> Cc: linux-mips@linux-mips.org
> Patchwork: http://patchwork.linux-mips.org/patch/8880/
> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
> ---
>   arch/mips/mm/tlb-r4k.c | 2 ++
>   1 file changed, 2 insertions(+)
>
> --- a/arch/mips/mm/tlb-r4k.c
> +++ b/arch/mips/mm/tlb-r4k.c
> @@ -447,6 +447,8 @@ void __cpuinit tlb_init(void)
>   #ifdef CONFIG_64BIT
>   		pg |= PG_ELPA;
>   #endif
> +		if (cpu_has_rixiex)
> +			pg |= PG_IEC;
>   		write_c0_pagegrain(pg);
>   	}
>
>
>
>
>

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

* Re: [PATCH 3.2 12/24] MIPS: Fix C0_Pagegrain[IEC] support.
  2015-03-03 23:24   ` David Daney
@ 2015-03-04  0:25     ` Ben Hutchings
  0 siblings, 0 replies; 5+ messages in thread
From: Ben Hutchings @ 2015-03-04  0:25 UTC (permalink / raw)
  To: David Daney
  Cc: linux-kernel, stable, akpm, linux-mips, Leonid Yegoshin,
	David Daney, Ralf Baechle

[-- Attachment #1: Type: text/plain, Size: 1609 bytes --]

On Tue, 2015-03-03 at 15:24 -0800, David Daney wrote:
> On 03/03/2015 02:11 PM, Ben Hutchings wrote:
> > 3.2.68-rc1 review patch.  If anyone has any objections, please let me know.
> >
> 
> I object!
> 
> Because ...
> 
> > ------------------
> >
> > From: David Daney <david.daney@cavium.com>
> >
> > commit 9ead8632bbf454cfc709b6205dc9cd8582fb0d64 upstream.
> >
> > The following commits:
> >
> >    5890f70f15c52d (MIPS: Use dedicated exception handler if CPU supports RI/XI exceptions)
> >    6575b1d4173eae (MIPS: kernel: cpu-probe: Detect unique RI/XI exceptions)
> >
> > break the kernel for *all* existing MIPS CPUs that implement the
> > CP0_PageGrain[IEC] bit.  They cause the TLB exception handlers to be
> > generated without the legacy execute-inhibit handling, but never set
> > the CP0_PageGrain[IEC] bit to activate the use of dedicated exception
> > vectors for execute-inhibit exceptions.  The result is that upon
> > detection of an execute-inhibit violation, we loop forever in the TLB
> > exception handlers instead of sending SIGSEGV to the task.
> >
> > If we are generating TLB exception handlers expecting separate
> > vectors, we must also enable the CP0_PageGrain[IEC] feature.
> >
> > The bug was introduced in kernel version 3.17.
> 
> ... I don't think the patch should be applied to versions prior to 3.17
[...]

Sorry about that - I dropped this one just before sending, but didn't
regenerate the mailbox.

Ben.

-- 
Ben Hutchings
Horngren's Observation:
                   Among economists, the real world is often a special case.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 811 bytes --]

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

end of thread, other threads:[~2015-03-04  0:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <lsq.1425420688.806916072@decadent.org.uk>
2015-03-03 22:11 ` [PATCH 3.2 12/24] MIPS: Fix C0_Pagegrain[IEC] support Ben Hutchings
2015-03-03 23:24   ` David Daney
2015-03-04  0:25     ` Ben Hutchings
2015-03-03 22:11 ` [PATCH 3.2 03/24] MIPS: IRQ: Fix disable_irq on CPU IRQs Ben Hutchings
2015-03-03 22:11 ` [PATCH 3.2 09/24] MIPS: Fix kernel lockup or crash after CPU offline/online Ben Hutchings

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox