diff options
author | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2019-04-30 06:33:45 -0400 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2019-05-02 07:54:11 -0400 |
commit | 98587c2d894c34c9af5cd84ca169e1cd493aa692 (patch) | |
tree | cced9b62cec4042ed7567fa3f834e861d4b73487 | |
parent | ec7bf4789d95a0053bac0dfa36fbefd8cc584eea (diff) |
s390: simplify disabled_wait
The disabled_wait() function uses its argument as the PSW address when
it stops the CPU with a wait PSW that is disabled for interrupts.
The different callers sometimes use a specific number like 0xdeadbeef
to indicate a specific failure, the early boot code uses 0 and some
other calls sites use __builtin_return_address(0).
At the time a dump is created the current PSW and the registers of a
CPU are written to lowcore to make them avaiable to the dump analysis
tool. For a CPU stopped with disabled_wait the PSW and the registers
do not really make sense together, the PSW address does not point to
the function the registers belong to.
Simplify disabled_wait() by using _THIS_IP_ for the PSW address and
drop the argument to the function.
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
-rw-r--r-- | arch/s390/boot/als.c | 2 | ||||
-rw-r--r-- | arch/s390/boot/startup.c | 2 | ||||
-rw-r--r-- | arch/s390/include/asm/processor.h | 4 | ||||
-rw-r--r-- | arch/s390/kernel/early.c | 4 | ||||
-rw-r--r-- | arch/s390/kernel/early_nobss.c | 2 | ||||
-rw-r--r-- | arch/s390/kernel/ipl.c | 4 | ||||
-rw-r--r-- | arch/s390/kernel/machine_kexec.c | 4 | ||||
-rw-r--r-- | arch/s390/kernel/nmi.c | 2 | ||||
-rw-r--r-- | kernel/panic.c | 7 |
9 files changed, 13 insertions, 18 deletions
diff --git a/arch/s390/boot/als.c b/arch/s390/boot/als.c index f902215e9cd9..ff6801d401c4 100644 --- a/arch/s390/boot/als.c +++ b/arch/s390/boot/als.c | |||
@@ -99,7 +99,7 @@ static void facility_mismatch(void) | |||
99 | print_machine_type(); | 99 | print_machine_type(); |
100 | print_missing_facilities(); | 100 | print_missing_facilities(); |
101 | sclp_early_printk("See Principles of Operations for facility bits\n"); | 101 | sclp_early_printk("See Principles of Operations for facility bits\n"); |
102 | disabled_wait(0x8badcccc); | 102 | disabled_wait(); |
103 | } | 103 | } |
104 | 104 | ||
105 | void verify_facilities(void) | 105 | void verify_facilities(void) |
diff --git a/arch/s390/boot/startup.c b/arch/s390/boot/startup.c index 4401e992bda1..7b0d05414618 100644 --- a/arch/s390/boot/startup.c +++ b/arch/s390/boot/startup.c | |||
@@ -57,7 +57,7 @@ void error(char *x) | |||
57 | sclp_early_printk(x); | 57 | sclp_early_printk(x); |
58 | sclp_early_printk("\n\n -- System halted"); | 58 | sclp_early_printk("\n\n -- System halted"); |
59 | 59 | ||
60 | disabled_wait(0xdeadbeef); | 60 | disabled_wait(); |
61 | } | 61 | } |
62 | 62 | ||
63 | #ifdef CONFIG_KERNEL_UNCOMPRESSED | 63 | #ifdef CONFIG_KERNEL_UNCOMPRESSED |
diff --git a/arch/s390/include/asm/processor.h b/arch/s390/include/asm/processor.h index 9f2ff4a54aff..b0fcbc37b637 100644 --- a/arch/s390/include/asm/processor.h +++ b/arch/s390/include/asm/processor.h | |||
@@ -315,12 +315,12 @@ void enabled_wait(void); | |||
315 | /* | 315 | /* |
316 | * Function to drop a processor into disabled wait state | 316 | * Function to drop a processor into disabled wait state |
317 | */ | 317 | */ |
318 | static inline void __noreturn disabled_wait(unsigned long code) | 318 | static inline void __noreturn disabled_wait(void) |
319 | { | 319 | { |
320 | psw_t psw; | 320 | psw_t psw; |
321 | 321 | ||
322 | psw.mask = PSW_MASK_BASE | PSW_MASK_WAIT | PSW_MASK_BA | PSW_MASK_EA; | 322 | psw.mask = PSW_MASK_BASE | PSW_MASK_WAIT | PSW_MASK_BA | PSW_MASK_EA; |
323 | psw.addr = code; | 323 | psw.addr = _THIS_IP_; |
324 | __load_psw(psw); | 324 | __load_psw(psw); |
325 | while (1); | 325 | while (1); |
326 | } | 326 | } |
diff --git a/arch/s390/kernel/early.c b/arch/s390/kernel/early.c index 33f704c16bd3..629f173f60cd 100644 --- a/arch/s390/kernel/early.c +++ b/arch/s390/kernel/early.c | |||
@@ -141,7 +141,7 @@ static void early_pgm_check_handler(void) | |||
141 | addr = S390_lowcore.program_old_psw.addr; | 141 | addr = S390_lowcore.program_old_psw.addr; |
142 | fixup = s390_search_extables(addr); | 142 | fixup = s390_search_extables(addr); |
143 | if (!fixup) | 143 | if (!fixup) |
144 | disabled_wait(0); | 144 | disabled_wait(); |
145 | /* Disable low address protection before storing into lowcore. */ | 145 | /* Disable low address protection before storing into lowcore. */ |
146 | __ctl_store(cr0, 0, 0); | 146 | __ctl_store(cr0, 0, 0); |
147 | cr0_new = cr0 & ~(1UL << 28); | 147 | cr0_new = cr0 & ~(1UL << 28); |
@@ -298,7 +298,7 @@ static void __init check_image_bootable(void) | |||
298 | sclp_early_printk("Linux kernel boot failure: An attempt to boot a vmlinux ELF image failed.\n"); | 298 | sclp_early_printk("Linux kernel boot failure: An attempt to boot a vmlinux ELF image failed.\n"); |
299 | sclp_early_printk("This image does not contain all parts necessary for starting up. Use\n"); | 299 | sclp_early_printk("This image does not contain all parts necessary for starting up. Use\n"); |
300 | sclp_early_printk("bzImage or arch/s390/boot/compressed/vmlinux instead.\n"); | 300 | sclp_early_printk("bzImage or arch/s390/boot/compressed/vmlinux instead.\n"); |
301 | disabled_wait(0xbadb007); | 301 | disabled_wait(); |
302 | } | 302 | } |
303 | 303 | ||
304 | void __init startup_init(void) | 304 | void __init startup_init(void) |
diff --git a/arch/s390/kernel/early_nobss.c b/arch/s390/kernel/early_nobss.c index 8d73f7fae16e..52a3ef959341 100644 --- a/arch/s390/kernel/early_nobss.c +++ b/arch/s390/kernel/early_nobss.c | |||
@@ -25,7 +25,7 @@ static void __init reset_tod_clock(void) | |||
25 | return; | 25 | return; |
26 | /* TOD clock not running. Set the clock to Unix Epoch. */ | 26 | /* TOD clock not running. Set the clock to Unix Epoch. */ |
27 | if (set_tod_clock(TOD_UNIX_EPOCH) != 0 || store_tod_clock(&time) != 0) | 27 | if (set_tod_clock(TOD_UNIX_EPOCH) != 0 || store_tod_clock(&time) != 0) |
28 | disabled_wait(0); | 28 | disabled_wait(); |
29 | 29 | ||
30 | memset(tod_clock_base, 0, 16); | 30 | memset(tod_clock_base, 0, 16); |
31 | *(__u64 *) &tod_clock_base[1] = TOD_UNIX_EPOCH; | 31 | *(__u64 *) &tod_clock_base[1] = TOD_UNIX_EPOCH; |
diff --git a/arch/s390/kernel/ipl.c b/arch/s390/kernel/ipl.c index aa8fe768640e..d836af3ccc38 100644 --- a/arch/s390/kernel/ipl.c +++ b/arch/s390/kernel/ipl.c | |||
@@ -920,7 +920,7 @@ static void __reipl_run(void *unused) | |||
920 | case IPL_TYPE_FCP_DUMP: | 920 | case IPL_TYPE_FCP_DUMP: |
921 | break; | 921 | break; |
922 | } | 922 | } |
923 | disabled_wait((unsigned long) __builtin_return_address(0)); | 923 | disabled_wait(); |
924 | } | 924 | } |
925 | 925 | ||
926 | static void reipl_run(struct shutdown_trigger *trigger) | 926 | static void reipl_run(struct shutdown_trigger *trigger) |
@@ -1375,7 +1375,7 @@ static void stop_run(struct shutdown_trigger *trigger) | |||
1375 | { | 1375 | { |
1376 | if (strcmp(trigger->name, ON_PANIC_STR) == 0 || | 1376 | if (strcmp(trigger->name, ON_PANIC_STR) == 0 || |
1377 | strcmp(trigger->name, ON_RESTART_STR) == 0) | 1377 | strcmp(trigger->name, ON_RESTART_STR) == 0) |
1378 | disabled_wait((unsigned long) __builtin_return_address(0)); | 1378 | disabled_wait(); |
1379 | smp_stop_cpu(); | 1379 | smp_stop_cpu(); |
1380 | } | 1380 | } |
1381 | 1381 | ||
diff --git a/arch/s390/kernel/machine_kexec.c b/arch/s390/kernel/machine_kexec.c index 2f3a742a71a5..8a1ae140c5e2 100644 --- a/arch/s390/kernel/machine_kexec.c +++ b/arch/s390/kernel/machine_kexec.c | |||
@@ -96,7 +96,7 @@ static void __do_machine_kdump(void *image) | |||
96 | start_kdump(1); | 96 | start_kdump(1); |
97 | 97 | ||
98 | /* Die if start_kdump returns */ | 98 | /* Die if start_kdump returns */ |
99 | disabled_wait((unsigned long) __builtin_return_address(0)); | 99 | disabled_wait(); |
100 | } | 100 | } |
101 | 101 | ||
102 | /* | 102 | /* |
@@ -284,7 +284,7 @@ static void __do_machine_kexec(void *data) | |||
284 | (*data_mover)(&image->head, image->start); | 284 | (*data_mover)(&image->head, image->start); |
285 | 285 | ||
286 | /* Die if kexec returns */ | 286 | /* Die if kexec returns */ |
287 | disabled_wait((unsigned long) __builtin_return_address(0)); | 287 | disabled_wait(); |
288 | } | 288 | } |
289 | 289 | ||
290 | /* | 290 | /* |
diff --git a/arch/s390/kernel/nmi.c b/arch/s390/kernel/nmi.c index 8c867b43c8eb..0a487fae763e 100644 --- a/arch/s390/kernel/nmi.c +++ b/arch/s390/kernel/nmi.c | |||
@@ -125,7 +125,7 @@ void nmi_free_per_cpu(struct lowcore *lc) | |||
125 | static notrace void s390_handle_damage(void) | 125 | static notrace void s390_handle_damage(void) |
126 | { | 126 | { |
127 | smp_emergency_stop(); | 127 | smp_emergency_stop(); |
128 | disabled_wait((unsigned long) __builtin_return_address(0)); | 128 | disabled_wait(); |
129 | while (1); | 129 | while (1); |
130 | } | 130 | } |
131 | NOKPROBE_SYMBOL(s390_handle_damage); | 131 | NOKPROBE_SYMBOL(s390_handle_damage); |
diff --git a/kernel/panic.c b/kernel/panic.c index 0ae0d7332f12..c1fcaad337b7 100644 --- a/kernel/panic.c +++ b/kernel/panic.c | |||
@@ -318,12 +318,7 @@ void panic(const char *fmt, ...) | |||
318 | } | 318 | } |
319 | #endif | 319 | #endif |
320 | #if defined(CONFIG_S390) | 320 | #if defined(CONFIG_S390) |
321 | { | 321 | disabled_wait(); |
322 | unsigned long caller; | ||
323 | |||
324 | caller = (unsigned long)__builtin_return_address(0); | ||
325 | disabled_wait(caller); | ||
326 | } | ||
327 | #endif | 322 | #endif |
328 | pr_emerg("---[ end Kernel panic - not syncing: %s ]---\n", buf); | 323 | pr_emerg("---[ end Kernel panic - not syncing: %s ]---\n", buf); |
329 | local_irq_enable(); | 324 | local_irq_enable(); |