Skip to content

Commit d7c3ebc

Browse files
svens-s390Vasily Gorbik
authored andcommitted
s390/nmi: Remove duplicate get_lowcore() calls
Assign the output from get_lowcore() to a local variable, so the code is easier to read. Acked-by: Heiko Carstens <[email protected]> Signed-off-by: Sven Schnelle <[email protected]> Signed-off-by: Vasily Gorbik <[email protected]>
1 parent bbf7860 commit d7c3ebc

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

arch/s390/kernel/nmi.c

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ static __always_inline char *u64_to_hex(char *dest, u64 val)
117117

118118
static notrace void s390_handle_damage(void)
119119
{
120+
struct lowcore *lc = get_lowcore();
120121
union ctlreg0 cr0, cr0_new;
121122
char message[100];
122123
psw_t psw_save;
@@ -125,7 +126,7 @@ static notrace void s390_handle_damage(void)
125126
smp_emergency_stop();
126127
diag_amode31_ops.diag308_reset();
127128
ptr = nmi_puts(message, "System stopped due to unrecoverable machine check, code: 0x");
128-
u64_to_hex(ptr, get_lowcore()->mcck_interruption_code);
129+
u64_to_hex(ptr, lc->mcck_interruption_code);
129130

130131
/*
131132
* Disable low address protection and make machine check new PSW a
@@ -135,17 +136,17 @@ static notrace void s390_handle_damage(void)
135136
cr0_new = cr0;
136137
cr0_new.lap = 0;
137138
local_ctl_load(0, &cr0_new.reg);
138-
psw_save = get_lowcore()->mcck_new_psw;
139-
psw_bits(get_lowcore()->mcck_new_psw).io = 0;
140-
psw_bits(get_lowcore()->mcck_new_psw).ext = 0;
141-
psw_bits(get_lowcore()->mcck_new_psw).wait = 1;
139+
psw_save = lc->mcck_new_psw;
140+
psw_bits(lc->mcck_new_psw).io = 0;
141+
psw_bits(lc->mcck_new_psw).ext = 0;
142+
psw_bits(lc->mcck_new_psw).wait = 1;
142143
sclp_emergency_printk(message);
143144

144145
/*
145146
* Restore machine check new PSW and control register 0 to original
146147
* values. This makes possible system dump analysis easier.
147148
*/
148-
get_lowcore()->mcck_new_psw = psw_save;
149+
lc->mcck_new_psw = psw_save;
149150
local_ctl_load(0, &cr0.reg);
150151
disabled_wait();
151152
while (1);
@@ -301,6 +302,7 @@ void notrace s390_do_machine_check(struct pt_regs *regs)
301302
static int ipd_count;
302303
static DEFINE_SPINLOCK(ipd_lock);
303304
static unsigned long long last_ipd;
305+
struct lowcore *lc = get_lowcore();
304306
struct mcck_struct *mcck;
305307
unsigned long long tmp;
306308
irqentry_state_t irq_state;
@@ -313,7 +315,7 @@ void notrace s390_do_machine_check(struct pt_regs *regs)
313315
if (user_mode(regs))
314316
update_timer_mcck();
315317
inc_irq_stat(NMI_NMI);
316-
mci.val = get_lowcore()->mcck_interruption_code;
318+
mci.val = lc->mcck_interruption_code;
317319
mcck = this_cpu_ptr(&cpu_mcck);
318320

319321
/*
@@ -381,9 +383,9 @@ void notrace s390_do_machine_check(struct pt_regs *regs)
381383
}
382384
if (mci.ed && mci.ec) {
383385
/* External damage */
384-
if (get_lowcore()->external_damage_code & (1U << ED_STP_SYNC))
386+
if (lc->external_damage_code & (1U << ED_STP_SYNC))
385387
mcck->stp_queue |= stp_sync_check();
386-
if (get_lowcore()->external_damage_code & (1U << ED_STP_ISLAND))
388+
if (lc->external_damage_code & (1U << ED_STP_ISLAND))
387389
mcck->stp_queue |= stp_island_check();
388390
mcck_pending = 1;
389391
}

0 commit comments

Comments
 (0)