Skip to content

Commit 98587c2

Browse files
author
Martin Schwidefsky
committed
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>
1 parent ec7bf47 commit 98587c2

9 files changed

Lines changed: 13 additions & 18 deletions

File tree

‎arch/s390/boot/als.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ static void facility_mismatch(void)
9999
print_machine_type();
100100
print_missing_facilities();
101101
sclp_early_printk("See Principles of Operations for facility bits\n");
102-
disabled_wait(0x8badcccc);
102+
disabled_wait();
103103
}
104104

105105
void verify_facilities(void)

‎arch/s390/boot/startup.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ void error(char *x)
5757
sclp_early_printk(x);
5858
sclp_early_printk("\n\n -- System halted");
5959

60-
disabled_wait(0xdeadbeef);
60+
disabled_wait();
6161
}
6262

6363
#ifdef CONFIG_KERNEL_UNCOMPRESSED

‎arch/s390/include/asm/processor.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,12 +315,12 @@ void enabled_wait(void);
315315
/*
316316
* Function to drop a processor into disabled wait state
317317
*/
318-
static inline void __noreturn disabled_wait(unsigned long code)
318+
static inline void __noreturn disabled_wait(void)
319319
{
320320
psw_t psw;
321321

322322
psw.mask = PSW_MASK_BASE | PSW_MASK_WAIT | PSW_MASK_BA | PSW_MASK_EA;
323-
psw.addr = code;
323+
psw.addr = _THIS_IP_;
324324
__load_psw(psw);
325325
while (1);
326326
}

‎arch/s390/kernel/early.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ static void early_pgm_check_handler(void)
141141
addr = S390_lowcore.program_old_psw.addr;
142142
fixup = s390_search_extables(addr);
143143
if (!fixup)
144-
disabled_wait(0);
144+
disabled_wait();
145145
/* Disable low address protection before storing into lowcore. */
146146
__ctl_store(cr0, 0, 0);
147147
cr0_new = cr0 & ~(1UL << 28);
@@ -298,7 +298,7 @@ static void __init check_image_bootable(void)
298298
sclp_early_printk("Linux kernel boot failure: An attempt to boot a vmlinux ELF image failed.\n");
299299
sclp_early_printk("This image does not contain all parts necessary for starting up. Use\n");
300300
sclp_early_printk("bzImage or arch/s390/boot/compressed/vmlinux instead.\n");
301-
disabled_wait(0xbadb007);
301+
disabled_wait();
302302
}
303303

304304
void __init startup_init(void)

‎arch/s390/kernel/early_nobss.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ static void __init reset_tod_clock(void)
2525
return;
2626
/* TOD clock not running. Set the clock to Unix Epoch. */
2727
if (set_tod_clock(TOD_UNIX_EPOCH) != 0 || store_tod_clock(&time) != 0)
28-
disabled_wait(0);
28+
disabled_wait();
2929

3030
memset(tod_clock_base, 0, 16);
3131
*(__u64 *) &tod_clock_base[1] = TOD_UNIX_EPOCH;

‎arch/s390/kernel/ipl.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -920,7 +920,7 @@ static void __reipl_run(void *unused)
920920
case IPL_TYPE_FCP_DUMP:
921921
break;
922922
}
923-
disabled_wait((unsigned long) __builtin_return_address(0));
923+
disabled_wait();
924924
}
925925

926926
static void reipl_run(struct shutdown_trigger *trigger)
@@ -1375,7 +1375,7 @@ static void stop_run(struct shutdown_trigger *trigger)
13751375
{
13761376
if (strcmp(trigger->name, ON_PANIC_STR) == 0 ||
13771377
strcmp(trigger->name, ON_RESTART_STR) == 0)
1378-
disabled_wait((unsigned long) __builtin_return_address(0));
1378+
disabled_wait();
13791379
smp_stop_cpu();
13801380
}
13811381

‎arch/s390/kernel/machine_kexec.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ static void __do_machine_kdump(void *image)
9696
start_kdump(1);
9797

9898
/* Die if start_kdump returns */
99-
disabled_wait((unsigned long) __builtin_return_address(0));
99+
disabled_wait();
100100
}
101101

102102
/*
@@ -284,7 +284,7 @@ static void __do_machine_kexec(void *data)
284284
(*data_mover)(&image->head, image->start);
285285

286286
/* Die if kexec returns */
287-
disabled_wait((unsigned long) __builtin_return_address(0));
287+
disabled_wait();
288288
}
289289

290290
/*

‎arch/s390/kernel/nmi.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ void nmi_free_per_cpu(struct lowcore *lc)
125125
static notrace void s390_handle_damage(void)
126126
{
127127
smp_emergency_stop();
128-
disabled_wait((unsigned long) __builtin_return_address(0));
128+
disabled_wait();
129129
while (1);
130130
}
131131
NOKPROBE_SYMBOL(s390_handle_damage);

‎kernel/panic.c‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -318,12 +318,7 @@ void panic(const char *fmt, ...)
318318
}
319319
#endif
320320
#if defined(CONFIG_S390)
321-
{
322-
unsigned long caller;
323-
324-
caller = (unsigned long)__builtin_return_address(0);
325-
disabled_wait(caller);
326-
}
321+
disabled_wait();
327322
#endif
328323
pr_emerg("---[ end Kernel panic - not syncing: %s ]---\n", buf);
329324
local_irq_enable();

0 commit comments

Comments
 (0)