Fix reboot hang on LPARs
Subsystems (2)
From: Michael Holzheu <[email protected]>
[S390] Fix reboot hang on LPARs
Reboot hangs on LPARs without diag308 support. The reason for this is, that before the reboot is done, the channel subsystem is shut down. During the reset on each possible subchannel a "store subchannel" is done. This operation can end in a program check interruption, if the specified subchannel set is not implemented by the hardware. During the reset, currently we do not have a program check handler, which leads to the described kernel bug. We install now a new program check handler for the reboot code to fix this problem.
---
arch/s390/kernel/ipl.c | 10 +++++++++- arch/s390/kernel/reset.S | 42 ++++++++++++++++++++++++++++++++++++++++++ drivers/s390/cio/cio.c | 25 +++++++++++++++++++++++-- include/asm-s390/reset.h | 1 + 4 files changed, 75 insertions(+), 3 deletions(-)
arch/s390/kernel/ipl.c +9 -1
@@ -1037,13 +1037,15 @@ static void do_reset_calls(void) }extern void reset_mcck_handler (void ); +extern void reset_pgm_handler (void );void s390_reset_system (void ) {struct _lowcore *lc; -/* Stack for interrupt/machine check handler */ lc = (struct _lowcore *)(unsigned long )store_prefix (); + +/* Stack for interrupt/machine check handler */ lc->panic_stack = S390_lowcore.panic_stack;/* Disable prefixing */
@@ -1056,5 +1058,11 @@ void s390_reset_system(void) S390_lowcore.mcck_new_psw.mask =PSW_KERNEL_BITS & ~PSW_MASK_MCHECK ; S390_lowcore.mcck_new_psw.addr =PSW_ADDR_AMODE | (unsigned long ) &reset_mcck_handler; + +/* Set new program check handler */ + S390_lowcore.program_new_psw.mask =PSW_KERNEL_BITS & ~PSW_MASK_MCHECK ; + S390_lowcore.program_new_psw.addr = +PSW_ADDR_AMODE | (unsigned long ) &reset_pgm_handler; +do_reset_calls (); }
arch/s390/kernel/reset.S +42 -0
58 lines not on this page · raw message
drivers/s390/cio/cio.c +23 -2
@@ -871,11 +871,32 @@ __clear_subchannel_easy(struct subchannereturn -EBUSY ; } +static int pgm_check_occured; + +static void cio_reset_pgm_check_handler (void ) +{ + pgm_check_occured =1 ; +} + +static int stsch_reset (struct subchannel_id schid,volatile struct schib *addr) +{ +int rc; + + pgm_check_occured =0 ; + s390_reset_pgm_handler = cio_reset_pgm_check_handler; + rc =stsch (schid, addr); + s390_reset_pgm_handler =NULL ; +if (pgm_check_occured) +return -EIO ; +else +return rc; +} +static int __shutdown_subchannel_easy (struct subchannel_id schid,void *data) {struct schib schib; -if (stsch_err (schid, &schib)) +if (stsch_reset (schid, &schib))return -ENXIO ;if (!schib.pmcw.ena)return 0 ;
@@ -972,7 +993,7 @@ static int __reipl_subchannel_match(strustruct schib schib;struct sch_match_id *match_id = data; -if (stsch_err (schid, &schib)) +if (stsch_reset (schid, &schib))return -ENXIO ; if (schib.pmcw.dnv && (schib.pmcw.dev == match_id->devid.devno) &&
include/asm-s390/reset.h +1 -0
@@ -19,5 +19,6 @@ extern void register_reset_call(struct rextern void unregister_reset_call (struct reset_call *reset);extern void s390_reset_system (void );extern void (*s390_reset_mcck_handler)(void ); +extern void (*s390_reset_pgm_handler)(void );#endif /* _ASM_S390_RESET_H */
Quoted 10 lines
drivers/s390/cio/cio.c +10
-0+static int pgm_check_occured; + +static void cio_reset_pgm_check_handler (void ) +{ + pgm_check_occured =1 ; +} + +static int stsch_reset (struct subchannel_id schid,volatile struct schib *addr) +{ +int rc;
drivers/s390/cio/cio.c __clear_subchannel_easy(struct subchanne · line 893
Quoted 10 lines
drivers/s390/cio/cio.c +10
-0+ + pgm_check_occured =0 ; + s390_reset_pgm_handler = cio_reset_pgm_check_handler; + rc =stsch (schid, addr); + s390_reset_pgm_handler =NULL ; +if (pgm_check_occured) +return -EIO ; +else +return rc; +}
This is broken. pgm_check_occured must be volatile, otherwise the -EIO path in stsch_reset might get optimized away.
Quoted 2 lines · Heiko Carstens
This is broken.
pgm_check_occuredmust be volatile, otherwise the-EIOpath instsch_resetmight get optimized away.
That is true, good spotting. Only adding a "volatile" in not the right solution. The point here is that the stsch inline assembly can write to pgm_check_occured. We better tell the compiler, e.g. by adding a "memory" clobber or better a "+m" (pgm_check_occured). For the later we'd have to copy the inline assembly though.
Signature · 8 lines
blue skies, Martin. Martin Schwidefsky Linux for zSeries Development & Services IBM Deutschland Entwicklung GmbH "Reality continues to ruin my life." - Calvin.