linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] irqchip/bcm-6345-l1: fix SMP support
@ 2021-02-22 20:13 Álvaro Fernández Rojas
  2021-02-22 21:00 ` Florian Fainelli
  0 siblings, 1 reply; 3+ messages in thread
From: Álvaro Fernández Rojas @ 2021-02-22 20:13 UTC (permalink / raw)
  To: jonas.gorski, Florian Fainelli, Thomas Gleixner, Marc Zyngier,
	bcm-kernel-feedback-list, linux-mips, linux-kernel
  Cc: Álvaro Fernández Rojas

Some BCM6358 devices start with Core #1 instead of Core #0.
Apart from that, SMP is restricted to 1 CPU since BCM6358 has a shared TLB,
which makes it impossible for the current SMP support to start both CPUs.

The problem is that smp_processor_id() returns 0 and then cpu_logical_map()
converts that to 1, which accesses an uninitialized position of intc->cpus[],
resulting in a kernel panic.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
---
 drivers/irqchip/irq-bcm6345-l1.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/irqchip/irq-bcm6345-l1.c b/drivers/irqchip/irq-bcm6345-l1.c
index e3483789f4df..b2173ce4743d 100644
--- a/drivers/irqchip/irq-bcm6345-l1.c
+++ b/drivers/irqchip/irq-bcm6345-l1.c
@@ -121,7 +121,7 @@ static void bcm6345_l1_irq_handle(struct irq_desc *desc)
 	unsigned int idx;
 
 #ifdef CONFIG_SMP
-	cpu = intc->cpus[cpu_logical_map(smp_processor_id())];
+	cpu = intc->cpus[smp_processor_id()];
 #else
 	cpu = intc->cpus[0];
 #endif
-- 
2.20.1


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

* Re: [PATCH] irqchip/bcm-6345-l1: fix SMP support
  2021-02-22 20:13 [PATCH] irqchip/bcm-6345-l1: fix SMP support Álvaro Fernández Rojas
@ 2021-02-22 21:00 ` Florian Fainelli
  2021-02-23 12:30   ` Álvaro Fernández Rojas
  0 siblings, 1 reply; 3+ messages in thread
From: Florian Fainelli @ 2021-02-22 21:00 UTC (permalink / raw)
  To: Álvaro Fernández Rojas, jonas.gorski, Florian Fainelli,
	Thomas Gleixner, Marc Zyngier, bcm-kernel-feedback-list,
	linux-mips, linux-kernel



On 2/22/2021 12:13 PM, Álvaro Fernández Rojas wrote:
> Some BCM6358 devices start with Core #1 instead of Core #0.
> Apart from that, SMP is restricted to 1 CPU since BCM6358 has a shared TLB,
> which makes it impossible for the current SMP support to start both CPUs.
> 
> The problem is that smp_processor_id() returns 0 and then cpu_logical_map()
> converts that to 1, which accesses an uninitialized position of intc->cpus[],
> resulting in a kernel panic.

Sounds like you nee to correct the way the cpu_logical_map[] is
populated then?
-- 
Florian

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

* Re: [PATCH] irqchip/bcm-6345-l1: fix SMP support
  2021-02-22 21:00 ` Florian Fainelli
@ 2021-02-23 12:30   ` Álvaro Fernández Rojas
  0 siblings, 0 replies; 3+ messages in thread
From: Álvaro Fernández Rojas @ 2021-02-23 12:30 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: Jonas Gorski, Thomas Gleixner, Marc Zyngier,
	bcm-kernel-feedback-list, linux-mips, linux-kernel

Hi Florian,

Yes, you’re right, there seems to be a bug, because cpu_number_map() and cpu_logical_map() are returning the same when BCM6358 starts with CMT 1:
[    4.662896] bcm6345_l1_irq_handle: smp_id=0 cpu_logical=1 cpu_number=1

Let’s see if I can fix it…

Best regards,
Álvaro.

> El 22 feb 2021, a las 22:00, Florian Fainelli <f.fainelli@gmail.com> escribió:
> 
> 
> 
> On 2/22/2021 12:13 PM, Álvaro Fernández Rojas wrote:
>> Some BCM6358 devices start with Core #1 instead of Core #0.
>> Apart from that, SMP is restricted to 1 CPU since BCM6358 has a shared TLB,
>> which makes it impossible for the current SMP support to start both CPUs.
>> 
>> The problem is that smp_processor_id() returns 0 and then cpu_logical_map()
>> converts that to 1, which accesses an uninitialized position of intc->cpus[],
>> resulting in a kernel panic.
> 
> Sounds like you nee to correct the way the cpu_logical_map[] is
> populated then?
> -- 
> Florian


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

end of thread, other threads:[~2021-02-23 12:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-22 20:13 [PATCH] irqchip/bcm-6345-l1: fix SMP support Álvaro Fernández Rojas
2021-02-22 21:00 ` Florian Fainelli
2021-02-23 12:30   ` Álvaro Fernández Rojas

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