Bug 128036 - [sio] [patch] serial console mostly ignores typein to restart after shutdown
Summary: [sio] [patch] serial console mostly ignores typein to restart after shutdown
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: unspecified
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-10-13 02:00 UTC by Arthur Hartwig
Modified: 2018-01-03 05:13 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Arthur Hartwig 2008-10-13 02:00:01 UTC
System with serial console.

If the system is shutdown by "shutdown -h ..." the following prompt is displayed on the console:

"The operating system has halted.
Please press any key to reboot."

Often a single keypress is not recognised; multiple keypresses are often required for the system to reboot.

Fix: 

In sys/dev/sio.c, function siocnclose() change

    outb(iobase + com_mcr, sp->mcr | MCR_DTR | MCR_RTS);
    outb(iobase + com_ier, sp->ier);
to
    outb(iobase + com_mcr, sp->mcr | MCR_DTR | MCR_RTS);
    if (rebooting == 0) {
        /*
         * Only restore the interrupt enables if not rebooting. If 
	 * rebooting leave interrupts disabled, else a key press might be 
	 * swallowed by the interrupt handler and not seen by the shutdown code.
	 */
        outb(iobase + com_ier, sp->ier);
    }

The problem is that the shutdown code looking for a keypress on the console (loop in sys/kern/kern_shutdown.c function shutdown_halt) runs with console interrupts enabled. If the keypress generates a console interrupt then the keypress is swallowed by the console interrupt handler and not seen by the code polling for a keypress.
How-To-Repeat: On system with serial console, issue 

# shutdown -h now 

command
Comment 1 Eitan Adler freebsd_committer freebsd_triage 2012-11-14 23:34:55 UTC
Responsible Changed
From-To: freebsd-bugs->eadler

I'll take it.
Comment 2 Eitan Adler freebsd_committer freebsd_triage 2012-11-16 04:07:52 UTC
Responsible Changed
From-To: eadler->freebsd-bugs

according to bde@ this patch is incorrect. In particular the bug actually lies in a higher level driver and needs to be fixed there. I can't track this down at the moment.
Comment 3 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 08:01:45 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped