lkml.org 
[lkml]   [2002]   [Dec]   [8]   [last100]   RSS-feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
Complete thread (EXPERIMENTAL)
/
DateSun, 8 Dec 2002 10:18:38 +0000
FromRussell King <>
SubjectRe: Reference counting in console uarts
Digg This
On Sun, Dec 08, 2002 at 02:43:36AM -0500, Pete Zaitcev wrote:
I boot my 2.5 boxes using "console=ttyS0,9600" argument, and I noticed that something is not right with reference counting in this case. It seems that when the console is open by kernel initially, this is not accounted
as an open, and uart_startup is not called. This is ok, because the serial console is set up separately. However, later every script or a program run by init causes a startup and shutdown, literally dozens of them. These oscillations only stop when daemons are started and keep console open.

That is correct. We are unable to call uart_startup when the serial console is initialised because it may need to allocate memory (as request_irq does) and the memory allocators may not have been initialised.

There are two ways around this problem:

1. initialise the port into a state where it can send characters in the console write method.

2. don't do the actual hardware shutdown in your shutdown() method (but do the normal software shutdown - ie, free irqs etc)
8250 ports in effect implement the first - they don't really care about their setup to send characters. We just disable all interrupts from the chip and then perform polled IO to the port.

In essence, you need your console write method to be able to send charcters whether or not the port has been initialised or shutdown by the conventional tty driver methods.

-- 
Russell King (rmk@arm.linux.org.uk)                The developer of ARM Linux
             http://www.arm.linux.org.uk/personal/aboutme.html
\
ISP Services
Valid XHTML 1.0!\ /
Valid CSS! Last update: 2005-03-22 12:31    [W:0.157 / U:0.010 seconds]
©2003-2005 Jasper Spaans