diff options
author | Anton Blanchard <anton@samba.org> | 2006-02-12 22:48:35 -0500 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2006-02-23 19:36:31 -0500 |
commit | cb2c9b2741346eb23b177187a51ff5abf08295bd (patch) | |
tree | 31433b46f96a00e22ca7e8402fd0bfe1fea3408d /arch/powerpc/kernel | |
parent | 47f78a49206b7f9b0d283ba46a2a5a6ee1796472 (diff) |
[PATCH] powerpc: Fix runlatch performance issues
The runlatch SPR can take a lot of time to write. My original runlatch
code would set it on every exception entry even though most of the time
this was not required. It would also continually set it in the idle
loop, which is an issue on an SMT capable processor.
Now we cache the runlatch value in a threadinfo bit, and only check for
it in decrementer and hardware interrupt exceptions as well as the idle
loop. Boot on POWER3, POWER5 and iseries, and compile tested on pmac32.
Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/kernel')
-rw-r--r-- | arch/powerpc/kernel/head_64.S | 12 | ||||
-rw-r--r-- | arch/powerpc/kernel/process.c | 32 |
2 files changed, 34 insertions, 10 deletions
diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S index 2b03a09fe5e9..bb845eed0e98 100644 --- a/arch/powerpc/kernel/head_64.S +++ b/arch/powerpc/kernel/head_64.S | |||
@@ -319,7 +319,6 @@ exception_marker: | |||
319 | label##_pSeries: \ | 319 | label##_pSeries: \ |
320 | HMT_MEDIUM; \ | 320 | HMT_MEDIUM; \ |
321 | mtspr SPRN_SPRG1,r13; /* save r13 */ \ | 321 | mtspr SPRN_SPRG1,r13; /* save r13 */ \ |
322 | RUNLATCH_ON(r13); \ | ||
323 | EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, label##_common) | 322 | EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, label##_common) |
324 | 323 | ||
325 | #define STD_EXCEPTION_ISERIES(n, label, area) \ | 324 | #define STD_EXCEPTION_ISERIES(n, label, area) \ |
@@ -327,7 +326,6 @@ label##_pSeries: \ | |||
327 | label##_iSeries: \ | 326 | label##_iSeries: \ |
328 | HMT_MEDIUM; \ | 327 | HMT_MEDIUM; \ |
329 | mtspr SPRN_SPRG1,r13; /* save r13 */ \ | 328 | mtspr SPRN_SPRG1,r13; /* save r13 */ \ |
330 | RUNLATCH_ON(r13); \ | ||
331 | EXCEPTION_PROLOG_ISERIES_1(area); \ | 329 | EXCEPTION_PROLOG_ISERIES_1(area); \ |
332 | EXCEPTION_PROLOG_ISERIES_2; \ | 330 | EXCEPTION_PROLOG_ISERIES_2; \ |
333 | b label##_common | 331 | b label##_common |
@@ -337,7 +335,6 @@ label##_iSeries: \ | |||
337 | label##_iSeries: \ | 335 | label##_iSeries: \ |
338 | HMT_MEDIUM; \ | 336 | HMT_MEDIUM; \ |
339 | mtspr SPRN_SPRG1,r13; /* save r13 */ \ | 337 | mtspr SPRN_SPRG1,r13; /* save r13 */ \ |
340 | RUNLATCH_ON(r13); \ | ||
341 | EXCEPTION_PROLOG_ISERIES_1(PACA_EXGEN); \ | 338 | EXCEPTION_PROLOG_ISERIES_1(PACA_EXGEN); \ |
342 | lbz r10,PACAPROCENABLED(r13); \ | 339 | lbz r10,PACAPROCENABLED(r13); \ |
343 | cmpwi 0,r10,0; \ | 340 | cmpwi 0,r10,0; \ |
@@ -390,6 +387,7 @@ label##_common: \ | |||
390 | label##_common: \ | 387 | label##_common: \ |
391 | EXCEPTION_PROLOG_COMMON(trap, PACA_EXGEN); \ | 388 | EXCEPTION_PROLOG_COMMON(trap, PACA_EXGEN); \ |
392 | DISABLE_INTS; \ | 389 | DISABLE_INTS; \ |
390 | bl .ppc64_runlatch_on; \ | ||
393 | addi r3,r1,STACK_FRAME_OVERHEAD; \ | 391 | addi r3,r1,STACK_FRAME_OVERHEAD; \ |
394 | bl hdlr; \ | 392 | bl hdlr; \ |
395 | b .ret_from_except_lite | 393 | b .ret_from_except_lite |
@@ -407,7 +405,6 @@ __start_interrupts: | |||
407 | _machine_check_pSeries: | 405 | _machine_check_pSeries: |
408 | HMT_MEDIUM | 406 | HMT_MEDIUM |
409 | mtspr SPRN_SPRG1,r13 /* save r13 */ | 407 | mtspr SPRN_SPRG1,r13 /* save r13 */ |
410 | RUNLATCH_ON(r13) | ||
411 | EXCEPTION_PROLOG_PSERIES(PACA_EXMC, machine_check_common) | 408 | EXCEPTION_PROLOG_PSERIES(PACA_EXMC, machine_check_common) |
412 | 409 | ||
413 | . = 0x300 | 410 | . = 0x300 |
@@ -434,7 +431,6 @@ END_FTR_SECTION_IFCLR(CPU_FTR_SLB) | |||
434 | data_access_slb_pSeries: | 431 | data_access_slb_pSeries: |
435 | HMT_MEDIUM | 432 | HMT_MEDIUM |
436 | mtspr SPRN_SPRG1,r13 | 433 | mtspr SPRN_SPRG1,r13 |
437 | RUNLATCH_ON(r13) | ||
438 | mfspr r13,SPRN_SPRG3 /* get paca address into r13 */ | 434 | mfspr r13,SPRN_SPRG3 /* get paca address into r13 */ |
439 | std r3,PACA_EXSLB+EX_R3(r13) | 435 | std r3,PACA_EXSLB+EX_R3(r13) |
440 | mfspr r3,SPRN_DAR | 436 | mfspr r3,SPRN_DAR |
@@ -460,7 +456,6 @@ data_access_slb_pSeries: | |||
460 | instruction_access_slb_pSeries: | 456 | instruction_access_slb_pSeries: |
461 | HMT_MEDIUM | 457 | HMT_MEDIUM |
462 | mtspr SPRN_SPRG1,r13 | 458 | mtspr SPRN_SPRG1,r13 |
463 | RUNLATCH_ON(r13) | ||
464 | mfspr r13,SPRN_SPRG3 /* get paca address into r13 */ | 459 | mfspr r13,SPRN_SPRG3 /* get paca address into r13 */ |
465 | std r3,PACA_EXSLB+EX_R3(r13) | 460 | std r3,PACA_EXSLB+EX_R3(r13) |
466 | mfspr r3,SPRN_SRR0 /* SRR0 is faulting address */ | 461 | mfspr r3,SPRN_SRR0 /* SRR0 is faulting address */ |
@@ -491,7 +486,6 @@ instruction_access_slb_pSeries: | |||
491 | .globl system_call_pSeries | 486 | .globl system_call_pSeries |
492 | system_call_pSeries: | 487 | system_call_pSeries: |
493 | HMT_MEDIUM | 488 | HMT_MEDIUM |
494 | RUNLATCH_ON(r9) | ||
495 | mr r9,r13 | 489 | mr r9,r13 |
496 | mfmsr r10 | 490 | mfmsr r10 |
497 | mfspr r13,SPRN_SPRG3 | 491 | mfspr r13,SPRN_SPRG3 |
@@ -575,7 +569,6 @@ slb_miss_user_pseries: | |||
575 | system_reset_fwnmi: | 569 | system_reset_fwnmi: |
576 | HMT_MEDIUM | 570 | HMT_MEDIUM |
577 | mtspr SPRN_SPRG1,r13 /* save r13 */ | 571 | mtspr SPRN_SPRG1,r13 /* save r13 */ |
578 | RUNLATCH_ON(r13) | ||
579 | EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, system_reset_common) | 572 | EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, system_reset_common) |
580 | 573 | ||
581 | .globl machine_check_fwnmi | 574 | .globl machine_check_fwnmi |
@@ -583,7 +576,6 @@ system_reset_fwnmi: | |||
583 | machine_check_fwnmi: | 576 | machine_check_fwnmi: |
584 | HMT_MEDIUM | 577 | HMT_MEDIUM |
585 | mtspr SPRN_SPRG1,r13 /* save r13 */ | 578 | mtspr SPRN_SPRG1,r13 /* save r13 */ |
586 | RUNLATCH_ON(r13) | ||
587 | EXCEPTION_PROLOG_PSERIES(PACA_EXMC, machine_check_common) | 579 | EXCEPTION_PROLOG_PSERIES(PACA_EXMC, machine_check_common) |
588 | 580 | ||
589 | #ifdef CONFIG_PPC_ISERIES | 581 | #ifdef CONFIG_PPC_ISERIES |
@@ -894,7 +886,6 @@ unrecov_fer: | |||
894 | .align 7 | 886 | .align 7 |
895 | .globl data_access_common | 887 | .globl data_access_common |
896 | data_access_common: | 888 | data_access_common: |
897 | RUNLATCH_ON(r10) /* It wont fit in the 0x300 handler */ | ||
898 | mfspr r10,SPRN_DAR | 889 | mfspr r10,SPRN_DAR |
899 | std r10,PACA_EXGEN+EX_DAR(r13) | 890 | std r10,PACA_EXGEN+EX_DAR(r13) |
900 | mfspr r10,SPRN_DSISR | 891 | mfspr r10,SPRN_DSISR |
@@ -1042,6 +1033,7 @@ hardware_interrupt_common: | |||
1042 | EXCEPTION_PROLOG_COMMON(0x500, PACA_EXGEN) | 1033 | EXCEPTION_PROLOG_COMMON(0x500, PACA_EXGEN) |
1043 | hardware_interrupt_entry: | 1034 | hardware_interrupt_entry: |
1044 | DISABLE_INTS | 1035 | DISABLE_INTS |
1036 | bl .ppc64_runlatch_on | ||
1045 | addi r3,r1,STACK_FRAME_OVERHEAD | 1037 | addi r3,r1,STACK_FRAME_OVERHEAD |
1046 | bl .do_IRQ | 1038 | bl .do_IRQ |
1047 | b .ret_from_except_lite | 1039 | b .ret_from_except_lite |
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c index 57703994a063..c225cf154bfe 100644 --- a/arch/powerpc/kernel/process.c +++ b/arch/powerpc/kernel/process.c | |||
@@ -888,3 +888,35 @@ void dump_stack(void) | |||
888 | show_stack(current, NULL); | 888 | show_stack(current, NULL); |
889 | } | 889 | } |
890 | EXPORT_SYMBOL(dump_stack); | 890 | EXPORT_SYMBOL(dump_stack); |
891 | |||
892 | #ifdef CONFIG_PPC64 | ||
893 | void ppc64_runlatch_on(void) | ||
894 | { | ||
895 | unsigned long ctrl; | ||
896 | |||
897 | if (cpu_has_feature(CPU_FTR_CTRL) && !test_thread_flag(TIF_RUNLATCH)) { | ||
898 | HMT_medium(); | ||
899 | |||
900 | ctrl = mfspr(SPRN_CTRLF); | ||
901 | ctrl |= CTRL_RUNLATCH; | ||
902 | mtspr(SPRN_CTRLT, ctrl); | ||
903 | |||
904 | set_thread_flag(TIF_RUNLATCH); | ||
905 | } | ||
906 | } | ||
907 | |||
908 | void ppc64_runlatch_off(void) | ||
909 | { | ||
910 | unsigned long ctrl; | ||
911 | |||
912 | if (cpu_has_feature(CPU_FTR_CTRL) && test_thread_flag(TIF_RUNLATCH)) { | ||
913 | HMT_medium(); | ||
914 | |||
915 | clear_thread_flag(TIF_RUNLATCH); | ||
916 | |||
917 | ctrl = mfspr(SPRN_CTRLF); | ||
918 | ctrl &= ~CTRL_RUNLATCH; | ||
919 | mtspr(SPRN_CTRLT, ctrl); | ||
920 | } | ||
921 | } | ||
922 | #endif | ||