* [PATCH]: load_mmu for SMP systems
@ 2003-04-25 18:24 Kip Walker
2003-04-25 18:28 ` Kip Walker
2003-04-28 0:56 ` Ralf Baechle
0 siblings, 2 replies; 4+ messages in thread
From: Kip Walker @ 2003-04-25 18:24 UTC (permalink / raw)
To: linux-mips; +Cc: Ralf Baechle
[-- Attachment #1: Type: text/plain, Size: 481 bytes --]
In SMP systems, each CPU needs to set up "current_cpu_data.tlbsize".
Some CPUs do this initialization in cpu_probe, which is called both by
init_arch and start_secondary. However, some CPUs do this in their TLB
setup code, which is called via load_mmu. The SMP boot code doesn't
currently call load_mmu() for the secondary CPUs. Here's a simple fix
for the 2.4 tree.
TLB flush routines that have loops running up to tlbsize will lose if
it's not set properly on all CPUs!
Kip
[-- Attachment #2: loadmmu.diff --]
[-- Type: text/plain, Size: 936 bytes --]
Index: arch/mips/kernel/smp.c
===================================================================
RCS file: /home/cvs/linux/arch/mips/kernel/smp.c,v
retrieving revision 1.10.2.24
diff -u -r1.10.2.24 smp.c
--- arch/mips/kernel/smp.c 23 Apr 2003 20:10:49 -0000 1.10.2.24
+++ arch/mips/kernel/smp.c 25 Apr 2003 18:19:55 -0000
@@ -99,6 +99,7 @@
unsigned int cpu = smp_processor_id();
cpu_probe();
+ load_mmu();
prom_init_secondary();
per_cpu_trap_init();
Index: arch/mips64/kernel/smp.c
===================================================================
RCS file: /home/cvs/linux/arch/mips64/kernel/smp.c,v
retrieving revision 1.26.2.22
diff -u -r1.26.2.22 smp.c
--- arch/mips64/kernel/smp.c 23 Apr 2003 20:10:49 -0000 1.26.2.22
+++ arch/mips64/kernel/smp.c 25 Apr 2003 18:19:55 -0000
@@ -103,6 +103,7 @@
unsigned int cpu = smp_processor_id();
cpu_probe();
+ load_mmu();
prom_init_secondary();
per_cpu_trap_init();
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH]: load_mmu for SMP systems
2003-04-25 18:24 [PATCH]: load_mmu for SMP systems Kip Walker
@ 2003-04-25 18:28 ` Kip Walker
2003-04-28 0:56 ` Ralf Baechle
1 sibling, 0 replies; 4+ messages in thread
From: Kip Walker @ 2003-04-25 18:28 UTC (permalink / raw)
To: linux-mips; +Cc: Ralf Baechle
[-- Attachment #1: Type: text/plain, Size: 568 bytes --]
OK, I'll add some declarations make it tidier.
Kip
Kip Walker wrote:
>
> In SMP systems, each CPU needs to set up "current_cpu_data.tlbsize".
> Some CPUs do this initialization in cpu_probe, which is called both by
> init_arch and start_secondary. However, some CPUs do this in their TLB
> setup code, which is called via load_mmu. The SMP boot code doesn't
> currently call load_mmu() for the secondary CPUs. Here's a simple fix
> for the 2.4 tree.
>
> TLB flush routines that have loops running up to tlbsize will lose if
> it's not set properly on all CPUs!
[-- Attachment #2: loadmmu.diff --]
[-- Type: text/plain, Size: 1507 bytes --]
Index: arch/mips/kernel/smp.c
===================================================================
RCS file: /home/cvs/linux/arch/mips/kernel/smp.c,v
retrieving revision 1.10.2.24
diff -u -r1.10.2.24 smp.c
--- arch/mips/kernel/smp.c 23 Apr 2003 20:10:49 -0000 1.10.2.24
+++ arch/mips/kernel/smp.c 25 Apr 2003 18:27:05 -0000
@@ -39,6 +39,9 @@
#include <asm/mmu_context.h>
#include <asm/smp.h>
+extern void load_mmu(void);
+extern void per_cpu_trap_init(void);
+
/* The 'big kernel lock' */
spinlock_t kernel_flag __cacheline_aligned_in_smp = SPIN_LOCK_UNLOCKED;
int smp_threads_ready; /* Not used */
@@ -99,6 +102,7 @@
unsigned int cpu = smp_processor_id();
cpu_probe();
+ load_mmu();
prom_init_secondary();
per_cpu_trap_init();
Index: arch/mips64/kernel/smp.c
===================================================================
RCS file: /home/cvs/linux/arch/mips64/kernel/smp.c,v
retrieving revision 1.26.2.22
diff -u -r1.26.2.22 smp.c
--- arch/mips64/kernel/smp.c 23 Apr 2003 20:10:49 -0000 1.26.2.22
+++ arch/mips64/kernel/smp.c 25 Apr 2003 18:27:05 -0000
@@ -39,6 +39,9 @@
#include <asm/mmu_context.h>
#include <asm/smp.h>
+extern void load_mmu(void);
+extern void per_cpu_trap_init(void);
+
/* The 'big kernel lock' */
spinlock_t kernel_flag __cacheline_aligned_in_smp = SPIN_LOCK_UNLOCKED;
int smp_threads_ready; /* Not used */
@@ -103,6 +106,7 @@
unsigned int cpu = smp_processor_id();
cpu_probe();
+ load_mmu();
prom_init_secondary();
per_cpu_trap_init();
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH]: load_mmu for SMP systems
2003-04-25 18:24 [PATCH]: load_mmu for SMP systems Kip Walker
2003-04-25 18:28 ` Kip Walker
@ 2003-04-28 0:56 ` Ralf Baechle
2003-04-28 14:43 ` Kip Walker
1 sibling, 1 reply; 4+ messages in thread
From: Ralf Baechle @ 2003-04-28 0:56 UTC (permalink / raw)
To: Kip Walker; +Cc: linux-mips
On Fri, Apr 25, 2003 at 11:24:20AM -0700, Kip Walker wrote:
> In SMP systems, each CPU needs to set up "current_cpu_data.tlbsize".
> Some CPUs do this initialization in cpu_probe, which is called both by
> init_arch and start_secondary. However, some CPUs do this in their TLB
> setup code, which is called via load_mmu. The SMP boot code doesn't
> currently call load_mmu() for the secondary CPUs. Here's a simple fix
> for the 2.4 tree.
I instead changed cpu-probe to set tlbsize properly. Nothing wrong with
your patch, it just fits better into my Grand Plan (TM) :-)
> TLB flush routines that have loops running up to tlbsize will lose if
> it's not set properly on all CPUs!
Yeah, they're going to be sort of slow. There must be a reason for all
those GHz processors ;-)
Ralf
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH]: load_mmu for SMP systems
2003-04-28 0:56 ` Ralf Baechle
@ 2003-04-28 14:43 ` Kip Walker
0 siblings, 0 replies; 4+ messages in thread
From: Kip Walker @ 2003-04-28 14:43 UTC (permalink / raw)
To: Ralf Baechle; +Cc: linux-mips
Ralf Baechle wrote:
>
> > TLB flush routines that have loops running up to tlbsize will lose if
> > it's not set properly on all CPUs!
>
> Yeah, they're going to be sort of slow. There must be a reason for all
> those GHz processors ;-)
Um, it was worse than that if (for example) a complete TLB flush has a
"for (i=0; i<0; i++)" loop around it. My board was experiencing
occasional userland segfaults thanks to bogus TLB flushing.
Kip
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2003-04-28 14:43 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-04-25 18:24 [PATCH]: load_mmu for SMP systems Kip Walker
2003-04-25 18:28 ` Kip Walker
2003-04-28 0:56 ` Ralf Baechle
2003-04-28 14:43 ` Kip Walker
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox