diff options
author | David S. Miller <davem@sunset.davemloft.net> | 2007-05-26 04:14:43 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-05-29 05:49:49 -0400 |
commit | 22adb358e816ce6aa0afb231ae9d826b0bddc8b0 (patch) | |
tree | 6f9886bf5b4e5c916c72d8d5733211813873c5fc /arch/sparc64/kernel | |
parent | 5cbc30737398b49f62ae8603129ce43ac7db1a41 (diff) |
[SPARC64]: Eliminate NR_CPUS limitations.
Cheetah systems can have cpuids as large as 1023, although physical
systems don't have that many cpus.
Only three limitations existed in the kernel preventing arbitrary
NR_CPUS values:
1) dcache dirty cpu state stored in page->flags on
D-cache aliasing platforms. With some build time
calculations and some build-time BUG checks on
page->flags layout, this one was easily solved.
2) The cheetah XCALL delivery code could only handle
a cpumask with up to 32 cpus set. Some simple looping
logic clears that up too.
3) thread_info->cpu was a u8, easily changed to a u16.
There are a few spots in the kernel that still put NR_CPUS
sized arrays on the kernel stack, but that's not a sparc64
specific problem.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc64/kernel')
-rw-r--r-- | arch/sparc64/kernel/head.S | 2 | ||||
-rw-r--r-- | arch/sparc64/kernel/smp.c | 19 |
2 files changed, 19 insertions, 2 deletions
diff --git a/arch/sparc64/kernel/head.S b/arch/sparc64/kernel/head.S index baea10a98196..5c11529742d4 100644 --- a/arch/sparc64/kernel/head.S +++ b/arch/sparc64/kernel/head.S | |||
@@ -523,7 +523,7 @@ tlb_fixup_done: | |||
523 | #else | 523 | #else |
524 | mov 0, %o0 | 524 | mov 0, %o0 |
525 | #endif | 525 | #endif |
526 | stb %o0, [%g6 + TI_CPU] | 526 | sth %o0, [%g6 + TI_CPU] |
527 | 527 | ||
528 | /* Off we go.... */ | 528 | /* Off we go.... */ |
529 | call start_kernel | 529 | call start_kernel |
diff --git a/arch/sparc64/kernel/smp.c b/arch/sparc64/kernel/smp.c index f7fa873c800d..c550bba3490a 100644 --- a/arch/sparc64/kernel/smp.c +++ b/arch/sparc64/kernel/smp.c | |||
@@ -400,7 +400,7 @@ static __inline__ void spitfire_xcall_deliver(u64 data0, u64 data1, u64 data2, c | |||
400 | static void cheetah_xcall_deliver(u64 data0, u64 data1, u64 data2, cpumask_t mask) | 400 | static void cheetah_xcall_deliver(u64 data0, u64 data1, u64 data2, cpumask_t mask) |
401 | { | 401 | { |
402 | u64 pstate, ver; | 402 | u64 pstate, ver; |
403 | int nack_busy_id, is_jbus; | 403 | int nack_busy_id, is_jbus, need_more; |
404 | 404 | ||
405 | if (cpus_empty(mask)) | 405 | if (cpus_empty(mask)) |
406 | return; | 406 | return; |
@@ -416,6 +416,7 @@ static void cheetah_xcall_deliver(u64 data0, u64 data1, u64 data2, cpumask_t mas | |||
416 | __asm__ __volatile__("rdpr %%pstate, %0" : "=r" (pstate)); | 416 | __asm__ __volatile__("rdpr %%pstate, %0" : "=r" (pstate)); |
417 | 417 | ||
418 | retry: | 418 | retry: |
419 | need_more = 0; | ||
419 | __asm__ __volatile__("wrpr %0, %1, %%pstate\n\t" | 420 | __asm__ __volatile__("wrpr %0, %1, %%pstate\n\t" |
420 | : : "r" (pstate), "i" (PSTATE_IE)); | 421 | : : "r" (pstate), "i" (PSTATE_IE)); |
421 | 422 | ||
@@ -444,6 +445,10 @@ retry: | |||
444 | : /* no outputs */ | 445 | : /* no outputs */ |
445 | : "r" (target), "i" (ASI_INTR_W)); | 446 | : "r" (target), "i" (ASI_INTR_W)); |
446 | nack_busy_id++; | 447 | nack_busy_id++; |
448 | if (nack_busy_id == 32) { | ||
449 | need_more = 1; | ||
450 | break; | ||
451 | } | ||
447 | } | 452 | } |
448 | } | 453 | } |
449 | 454 | ||
@@ -460,6 +465,16 @@ retry: | |||
460 | if (dispatch_stat == 0UL) { | 465 | if (dispatch_stat == 0UL) { |
461 | __asm__ __volatile__("wrpr %0, 0x0, %%pstate" | 466 | __asm__ __volatile__("wrpr %0, 0x0, %%pstate" |
462 | : : "r" (pstate)); | 467 | : : "r" (pstate)); |
468 | if (unlikely(need_more)) { | ||
469 | int i, cnt = 0; | ||
470 | for_each_cpu_mask(i, mask) { | ||
471 | cpu_clear(i, mask); | ||
472 | cnt++; | ||
473 | if (cnt == 32) | ||
474 | break; | ||
475 | } | ||
476 | goto retry; | ||
477 | } | ||
463 | return; | 478 | return; |
464 | } | 479 | } |
465 | if (!--stuck) | 480 | if (!--stuck) |
@@ -497,6 +512,8 @@ retry: | |||
497 | if ((dispatch_stat & check_mask) == 0) | 512 | if ((dispatch_stat & check_mask) == 0) |
498 | cpu_clear(i, mask); | 513 | cpu_clear(i, mask); |
499 | this_busy_nack += 2; | 514 | this_busy_nack += 2; |
515 | if (this_busy_nack == 64) | ||
516 | break; | ||
500 | } | 517 | } |
501 | 518 | ||
502 | goto retry; | 519 | goto retry; |