kern/128036: Serial console mostly ignores typein to restart after shutdown

Arthur Hartwig arthur.hartwig at nokia.com
Mon Oct 13 01:00:02 UTC 2008


>Number:         128036
>Category:       kern
>Synopsis:       Serial console mostly ignores typein to restart after shutdown
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Oct 13 01:00:01 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Arthur Hartwig
>Release:        6.3
>Organization:
Nokia
>Environment:
>Description:
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.
>How-To-Repeat:
On system with serial console, issue 

# shutdown -h now 

command
>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.

 

>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list