mtx_lock_do_what_i_mean()

Marcel Moolenaar xcllnt at mac.com
Mon Aug 24 21:05:18 UTC 2009


On Aug 24, 2009, at 10:40 AM, Ed Schouten wrote:

> Hi all,
>
> As some of you may already know, I'm writing a console driver for
> FreeBSD in my Perforce branch (newcons). What I don't like about  
> console
> devices, but cannot be avoided, is that certain pieces of code need to
> be protected by spinning mutex, instead of default mutexes. This is
> because things like the terminal emulator need to be protected from
> concurrent access, which is likely to happen when printf() by the  
> kernel
> and a write() on a TTY by a userspace process happen at the same time.

I would approach the problem differently: decouple printf() in the
kernel from anything to which we have a TTY attached. Instead, look
at printf() as a means to write to the message buffer only. Echoing
things that go into the message buffer to the console becomes 1)
optional (yay!), and 2) something you can do by going through the TTY
layer (use a kthread or use a process [syslog]).

Just a thought,

-- 
Marcel Moolenaar
xcllnt at mac.com





More information about the freebsd-arch mailing list