Post by Ales KozumplikPost by Steffen MaierPost by Ales KozumplikPost by Ales Kozumplikdcantrell's recent change to the shutdown mechanism exposed a situation when
shutdown is correctly handled but the init's exit handler still gets called and
dumps its callstack, that's not desirable because (in case of an exception in
python code for example) part of the useful information on the screen is
scrolled out of view.
---
Note that there still will be kernel panic displayed and the machine
won't react on ctrl-alt-del (VMWare). An endless sleepy loop could be a
way out perhaps?
Right, the loop is what used to be there. I kind of liked it but it
requires a separation of the two cases: loader returning with error vs.
s390 needing init to halt. If nobody has any real need for waiting at
this point any longer, we could alternatively call performReboot for all
cases of rebootAction, even for HALT.
(See also
https://www.redhat.com/archives/anaconda-devel-list/2010-January/msg00317.html)
I'm not an shutdown expert, but we don't want to call performReboot in
the HALT case, that would make it the same as POWEROFF: not good because
we wouldn't be able to see the final output (in the frequent case of
loader SIGSEGV for example), as you mentioned in the second thread. The
From the old times, I thought a halt without poweroff is possible. At
least that was the case before APM and ACPI came into play. Calling
"halt" or "shutdown -H" should explicitly enforce a halt without
poweroff (whereas a "shutdown -h" could also poweroff is supported by
the system).
Post by Ales Kozumplikloop could be one option, possibly with conditional code for S390 --
what do you think David?
Sounds good to me.
Post by Ales KozumplikBTW Steffen, how does one halt the Linux kernel?
According to "man 2 reboot", this would halt as opposed to poweroff a
system:
LINUX_REBOOT_CMD_HALT
(RB_HALT_SYSTEM, 0xcdef0123; since 1.1.76). The message ‘System
halted.’ is printed, and the system is halted. Control is given
to the ROM monitor, if there is one. If not preceded by a
sync(2), data will be lost.
I haven't tested this but I suppose the performReboot could be extended
as follows and then called dependently for s390 (compile time ifdef or
maybe even cleaner: a new -H option for the standalone shutdown binary
and passing this flag by means of a compile unit global static variable
to shutDown so we don't have to change its interface and thus callers in
init.c. For the latter approach we would change "shutdown" to "shutdown
-H" in linuxrc.s390 to explicitly trigger a non-interactive halt.)
Post by Ales Kozumplikstatic void performReboot(reboot_action rebootAction) {
if (rebootAction == POWEROFF) {
printf("powering off system\n");
sleep(2);
reboot(RB_POWER_OFF);
} else if (rebootAction == REBOOT) {
printf("rebooting system\n");
sleep(2);
#if USE_MINILIBC
reboot(0xfee1dead, 672274793, 0x1234567);
#else
reboot(RB_AUTOBOOT);
#endif
}
else if (rebootAction == HALT) {
printf("halting system\n");
sleep(2);
reboot(RB_HALT_SYSTEM);
}
(From a style point of view, a switch case construct would be nicer than
the else if cascade.)
Steffen
Linux on System z Development
IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Martin Jetter
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294