aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorMichael Ellerman <mpe@ellerman.id.au>2015-11-24 22:25:16 -0500
committerMichael Ellerman <mpe@ellerman.id.au>2015-12-17 06:40:57 -0500
commitd6265aeaf815801ad53a95f11cea8ea752862176 (patch)
treeccfd814e423b21069d19e0c6f8bdc3c8b8843693 /arch
parentcd5cdeb6c8a42fb87644b0eb5d240f6ce6172402 (diff)
powerpc/kernel: Drop HMT_MEDIUM_PPR_DISCARD
HMT_MEDIUM_PPR_DISCARD is a macro which is present at the start of most of our first level exception handlers. It conditionally executes a HMT_MEDIUM instruction, which sets the processor priority to medium. On on modern systems, ie. Power7 and later, it is nop'ed out at boot. All it does is make the exception vectors more cramped, and consume 4 bytes of icache. On old systems it has the effect of boosting the processor priority at the start of exception processing. If we were previously in the idle loop for example, we may be at low or very low priority. This is desirable as we want to process the exception as fast as possible. However looking closely at the generated code, we see that in all cases we execute another HMT_MEDIUM just four instructions later. With code patching applied, the final code on an old (Power6) system will look like, eg: c000000000000300 <data_access_pSeries>: c000000000000300: 7c 42 13 78 mr r2,r2 <- c000000000000304: 7d b2 43 a6 mtsprg 2,r13 c000000000000308: 7d b1 42 a6 mfsprg r13,1 c00000000000030c: f9 2d 00 80 std r9,128(r13) c000000000000310: 60 00 00 00 nop c000000000000314: 7c 42 13 78 mr r2,r2 <- So I suggest that the added code complexity of HMT_MEDIUM_PPR_DISCARD is not justified by the benefit of boosting the processor priority for the duration of four instructions, and therefore we drop it. Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/include/asm/exception-64s.h15
-rw-r--r--arch/powerpc/kernel/exceptions-64s.S9
2 files changed, 0 insertions, 24 deletions
diff --git a/arch/powerpc/include/asm/exception-64s.h b/arch/powerpc/include/asm/exception-64s.h
index 9ee10781121f..60b2bbda212d 100644
--- a/arch/powerpc/include/asm/exception-64s.h
+++ b/arch/powerpc/include/asm/exception-64s.h
@@ -130,15 +130,6 @@ BEGIN_FTR_SECTION_NESTED(941) \
130END_FTR_SECTION_NESTED(CPU_FTR_HAS_PPR,CPU_FTR_HAS_PPR,941) 130END_FTR_SECTION_NESTED(CPU_FTR_HAS_PPR,CPU_FTR_HAS_PPR,941)
131 131
132/* 132/*
133 * Increase the priority on systems where PPR save/restore is not
134 * implemented/ supported.
135 */
136#define HMT_MEDIUM_PPR_DISCARD \
137BEGIN_FTR_SECTION_NESTED(942) \
138 HMT_MEDIUM; \
139END_FTR_SECTION_NESTED(CPU_FTR_HAS_PPR,0,942) /*non P7*/
140
141/*
142 * Get an SPR into a register if the CPU has the given feature 133 * Get an SPR into a register if the CPU has the given feature
143 */ 134 */
144#define OPT_GET_SPR(ra, spr, ftr) \ 135#define OPT_GET_SPR(ra, spr, ftr) \
@@ -346,7 +337,6 @@ do_kvm_##n: \
346 . = loc; \ 337 . = loc; \
347 .globl label##_pSeries; \ 338 .globl label##_pSeries; \
348label##_pSeries: \ 339label##_pSeries: \
349 HMT_MEDIUM_PPR_DISCARD; \
350 SET_SCRATCH0(r13); /* save r13 */ \ 340 SET_SCRATCH0(r13); /* save r13 */ \
351 EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, label##_common, \ 341 EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, label##_common, \
352 EXC_STD, KVMTEST, vec) 342 EXC_STD, KVMTEST, vec)
@@ -362,7 +352,6 @@ label##_pSeries: \
362 . = loc; \ 352 . = loc; \
363 .globl label##_hv; \ 353 .globl label##_hv; \
364label##_hv: \ 354label##_hv: \
365 HMT_MEDIUM_PPR_DISCARD; \
366 SET_SCRATCH0(r13); /* save r13 */ \ 355 SET_SCRATCH0(r13); /* save r13 */ \
367 EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, label##_common, \ 356 EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, label##_common, \
368 EXC_HV, KVMTEST, vec) 357 EXC_HV, KVMTEST, vec)
@@ -378,7 +367,6 @@ label##_hv: \
378 . = loc; \ 367 . = loc; \
379 .globl label##_relon_pSeries; \ 368 .globl label##_relon_pSeries; \
380label##_relon_pSeries: \ 369label##_relon_pSeries: \
381 HMT_MEDIUM_PPR_DISCARD; \
382 /* No guest interrupts come through here */ \ 370 /* No guest interrupts come through here */ \
383 SET_SCRATCH0(r13); /* save r13 */ \ 371 SET_SCRATCH0(r13); /* save r13 */ \
384 EXCEPTION_RELON_PROLOG_PSERIES(PACA_EXGEN, label##_common, \ 372 EXCEPTION_RELON_PROLOG_PSERIES(PACA_EXGEN, label##_common, \
@@ -394,7 +382,6 @@ label##_relon_pSeries: \
394 . = loc; \ 382 . = loc; \
395 .globl label##_relon_hv; \ 383 .globl label##_relon_hv; \
396label##_relon_hv: \ 384label##_relon_hv: \
397 HMT_MEDIUM_PPR_DISCARD; \
398 /* No guest interrupts come through here */ \ 385 /* No guest interrupts come through here */ \
399 SET_SCRATCH0(r13); /* save r13 */ \ 386 SET_SCRATCH0(r13); /* save r13 */ \
400 EXCEPTION_RELON_PROLOG_PSERIES(PACA_EXGEN, label##_common, \ 387 EXCEPTION_RELON_PROLOG_PSERIES(PACA_EXGEN, label##_common, \
@@ -448,7 +435,6 @@ label##_relon_hv: \
448 . = loc; \ 435 . = loc; \
449 .globl label##_pSeries; \ 436 .globl label##_pSeries; \
450label##_pSeries: \ 437label##_pSeries: \
451 HMT_MEDIUM_PPR_DISCARD; \
452 _MASKABLE_EXCEPTION_PSERIES(vec, label, \ 438 _MASKABLE_EXCEPTION_PSERIES(vec, label, \
453 EXC_STD, SOFTEN_TEST_PR) 439 EXC_STD, SOFTEN_TEST_PR)
454 440
@@ -466,7 +452,6 @@ label##_hv: \
466 EXCEPTION_PROLOG_PSERIES_1(label##_common, EXC_HV); 452 EXCEPTION_PROLOG_PSERIES_1(label##_common, EXC_HV);
467 453
468#define __MASKABLE_RELON_EXCEPTION_PSERIES(vec, label, h, extra) \ 454#define __MASKABLE_RELON_EXCEPTION_PSERIES(vec, label, h, extra) \
469 HMT_MEDIUM_PPR_DISCARD; \
470 SET_SCRATCH0(r13); /* save r13 */ \ 455 SET_SCRATCH0(r13); /* save r13 */ \
471 EXCEPTION_PROLOG_0(PACA_EXGEN); \ 456 EXCEPTION_PROLOG_0(PACA_EXGEN); \
472 __EXCEPTION_PROLOG_1(PACA_EXGEN, extra, vec); \ 457 __EXCEPTION_PROLOG_1(PACA_EXGEN, extra, vec); \
diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S
index 3419cbf2ad59..0757f23d35aa 100644
--- a/arch/powerpc/kernel/exceptions-64s.S
+++ b/arch/powerpc/kernel/exceptions-64s.S
@@ -96,7 +96,6 @@ __start_interrupts:
96 96
97 .globl system_reset_pSeries; 97 .globl system_reset_pSeries;
98system_reset_pSeries: 98system_reset_pSeries:
99 HMT_MEDIUM_PPR_DISCARD
100 SET_SCRATCH0(r13) 99 SET_SCRATCH0(r13)
101#ifdef CONFIG_PPC_P7_NAP 100#ifdef CONFIG_PPC_P7_NAP
102BEGIN_FTR_SECTION 101BEGIN_FTR_SECTION
@@ -164,7 +163,6 @@ machine_check_pSeries_1:
164 * some code path might still want to branch into the original 163 * some code path might still want to branch into the original
165 * vector 164 * vector
166 */ 165 */
167 HMT_MEDIUM_PPR_DISCARD
168 SET_SCRATCH0(r13) /* save r13 */ 166 SET_SCRATCH0(r13) /* save r13 */
169#ifdef CONFIG_PPC_P7_NAP 167#ifdef CONFIG_PPC_P7_NAP
170BEGIN_FTR_SECTION 168BEGIN_FTR_SECTION
@@ -199,7 +197,6 @@ ALT_FTR_SECTION_END_IFSET(CPU_FTR_HVMODE)
199 . = 0x300 197 . = 0x300
200 .globl data_access_pSeries 198 .globl data_access_pSeries
201data_access_pSeries: 199data_access_pSeries:
202 HMT_MEDIUM_PPR_DISCARD
203 SET_SCRATCH0(r13) 200 SET_SCRATCH0(r13)
204 EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, data_access_common, EXC_STD, 201 EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, data_access_common, EXC_STD,
205 KVMTEST, 0x300) 202 KVMTEST, 0x300)
@@ -207,7 +204,6 @@ data_access_pSeries:
207 . = 0x380 204 . = 0x380
208 .globl data_access_slb_pSeries 205 .globl data_access_slb_pSeries
209data_access_slb_pSeries: 206data_access_slb_pSeries:
210 HMT_MEDIUM_PPR_DISCARD
211 SET_SCRATCH0(r13) 207 SET_SCRATCH0(r13)
212 EXCEPTION_PROLOG_0(PACA_EXSLB) 208 EXCEPTION_PROLOG_0(PACA_EXSLB)
213 EXCEPTION_PROLOG_1(PACA_EXSLB, KVMTEST, 0x380) 209 EXCEPTION_PROLOG_1(PACA_EXSLB, KVMTEST, 0x380)
@@ -239,7 +235,6 @@ data_access_slb_pSeries:
239 . = 0x480 235 . = 0x480
240 .globl instruction_access_slb_pSeries 236 .globl instruction_access_slb_pSeries
241instruction_access_slb_pSeries: 237instruction_access_slb_pSeries:
242 HMT_MEDIUM_PPR_DISCARD
243 SET_SCRATCH0(r13) 238 SET_SCRATCH0(r13)
244 EXCEPTION_PROLOG_0(PACA_EXSLB) 239 EXCEPTION_PROLOG_0(PACA_EXSLB)
245 EXCEPTION_PROLOG_1(PACA_EXSLB, KVMTEST, 0x480) 240 EXCEPTION_PROLOG_1(PACA_EXSLB, KVMTEST, 0x480)
@@ -269,7 +264,6 @@ instruction_access_slb_pSeries:
269 .globl hardware_interrupt_hv; 264 .globl hardware_interrupt_hv;
270hardware_interrupt_pSeries: 265hardware_interrupt_pSeries:
271hardware_interrupt_hv: 266hardware_interrupt_hv:
272 HMT_MEDIUM_PPR_DISCARD
273 BEGIN_FTR_SECTION 267 BEGIN_FTR_SECTION
274 _MASKABLE_EXCEPTION_PSERIES(0x502, hardware_interrupt, 268 _MASKABLE_EXCEPTION_PSERIES(0x502, hardware_interrupt,
275 EXC_HV, SOFTEN_TEST_HV) 269 EXC_HV, SOFTEN_TEST_HV)
@@ -413,7 +407,6 @@ hv_facility_unavailable_trampoline:
413 . = 0x1500 407 . = 0x1500
414 .global denorm_exception_hv 408 .global denorm_exception_hv
415denorm_exception_hv: 409denorm_exception_hv:
416 HMT_MEDIUM_PPR_DISCARD
417 mtspr SPRN_SPRG_HSCRATCH0,r13 410 mtspr SPRN_SPRG_HSCRATCH0,r13
418 EXCEPTION_PROLOG_0(PACA_EXGEN) 411 EXCEPTION_PROLOG_0(PACA_EXGEN)
419 EXCEPTION_PROLOG_1(PACA_EXGEN, NOTEST, 0x1500) 412 EXCEPTION_PROLOG_1(PACA_EXGEN, NOTEST, 0x1500)
@@ -527,7 +520,6 @@ END_FTR_SECTION_IFSET(CPU_FTR_HVMODE)
527machine_check_pSeries: 520machine_check_pSeries:
528 .globl machine_check_fwnmi 521 .globl machine_check_fwnmi
529machine_check_fwnmi: 522machine_check_fwnmi:
530 HMT_MEDIUM_PPR_DISCARD
531 SET_SCRATCH0(r13) /* save r13 */ 523 SET_SCRATCH0(r13) /* save r13 */
532 EXCEPTION_PROLOG_0(PACA_EXMC) 524 EXCEPTION_PROLOG_0(PACA_EXMC)
533machine_check_pSeries_0: 525machine_check_pSeries_0:
@@ -711,7 +703,6 @@ ALT_FTR_SECTION_END_IFSET(CPU_FTR_HVMODE)
711 .globl system_reset_fwnmi 703 .globl system_reset_fwnmi
712 .align 7 704 .align 7
713system_reset_fwnmi: 705system_reset_fwnmi:
714 HMT_MEDIUM_PPR_DISCARD
715 SET_SCRATCH0(r13) /* save r13 */ 706 SET_SCRATCH0(r13) /* save r13 */
716 EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, system_reset_common, EXC_STD, 707 EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, system_reset_common, EXC_STD,
717 NOTEST, 0x100) 708 NOTEST, 0x100)