Discussion:
[master] Prevent init from telling us its story if the shutdown was planned.
Ales Kozumplik
2010-01-21 15:26:06 UTC
Permalink
dcantrell'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.
---
loader/init.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/loader/init.c b/loader/init.c
index 443b53f..0d3db00 100644
--- a/loader/init.c
+++ b/loader/init.c
@@ -786,6 +786,7 @@ int main(int argc, char **argv) {
doReboot = 1;
}

+ expected_exit = 1;
shutDown(doKill, doReboot?REBOOT:HALT);

return 0;
--
1.6.2.5
Ales Kozumplik
2010-01-21 15:33:15 UTC
Permalink
Post by Ales Kozumplik
dcantrell'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?
Steffen Maier
2010-01-21 16:23:56 UTC
Permalink
Post by Ales Kozumplik
Post by Ales Kozumplik
dcantrell'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)

Considering that David's patch has caused at least two follow-up fixes
including one build break, I'd really like more people to look at the
problem so we can come up together with a less intrusive fix.

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
Ales Kozumplik
2010-01-21 17:14:29 UTC
Permalink
Post by Steffen Maier
Post by Ales Kozumplik
Post by Ales Kozumplik
dcantrell'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)
Hi Steffen,

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
loop could be one option, possibly with conditional code for S390 --
what do you think David?

BTW Steffen, how does one halt the Linux kernel?

Thanks,
Ales
David Cantrell
2010-01-21 18:50:21 UTC
Permalink
Post by Ales Kozumplik
Post by Steffen Maier
Post by Ales Kozumplik
Post by Ales Kozumplik
dcantrell'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)
Hi Steffen,
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 loop could
be one option, possibly with conditional code for S390 -- what do you think
David?
BTW Steffen, how does one halt the Linux kernel?
No opposition here.

- --
David Cantrell <***@redhat.com>
Red Hat / Honolulu, HI
Steffen Maier
2010-01-22 16:22:53 UTC
Permalink
Post by Ales Kozumplik
Post by Steffen Maier
Post by Ales Kozumplik
Post by Ales Kozumplik
dcantrell'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 Kozumplik
loop could be one option, possibly with conditional code for S390 --
what do you think David?
Sounds good to me.
Post by Ales Kozumplik
BTW 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 Kozumplik
static 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);
}
Post by Ales Kozumplik
}
(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

Loading...