Re: strange behaviour with /sbin/init and serial console

2008-10-31 Thread Jeremy Chadwick
On Fri, Oct 31, 2008 at 01:28:02PM -0600, Scott Long wrote:
> Ed Schouten wrote:
>> Hello Theirry,
>>
>> * Thierry Herbelot <[EMAIL PROTECTED]> wrote:
>>> with the following patch on /sbin/init, I have two different 
>>> behaviours depending on the console type (on a i386/32 PC) :
>>> - on a video console, I see the expected two messages,
>>> - on a serial console, the messages are not displayed (init silently 
>>> finishes its job and gets to start /etc/rc and everything)
>>>
>>> I assume that the writev system call is implemented in  
>>> src/sys/kern/tty_cons.c::cnwrite(), but I could not parse the code to 
>>> find an explanation.
>>>
>>> any taker ?
>>>
>>> TfH
>>>
>>> PS : this is initially for a RELENG_6 machine, but the code is quite 
>>> similar under RELENG_7 or Current
>>
>> Any data written to /dev/console is not multiplexed to all console
>> devices, but only the first active device in the list. The reason behind
>> this, is because it adds a real lot of complexity to the console code,
>> especially related to polling and reading on /dev/console.
>>
>> This weekend I'm going to commit a replacement implementation of
>> /dev/console, which also has this restriction.
>>
>
> The multiplexed console feature is one thing that linux got right.  In a
> corporate setting, you really need both a serial console and a video
> console in order to effectively manage the machines, as you want to be
> able to access them both remotely and locally.

I know this comment isn't much help, but, I am in full agreement with
Scott.  FreeBSD's lack of *true* multi (or even dual) console during all
stages is a big disappointment to server administrators.  The common
reaction is: "What do you mean I can only get some messages on serial or
some messages on VGA?!  That's retarded!"

I believe DragonFly has addressed this (offering a true dual console
mechanism), and if I remember correctly, Matt Dillon discussed the code
changes in great detail, citing a large amount of re-engineering
required to accomplish it.

> While it might be hard to build multiplexing into the console driver,
> do you think it would be possible to layer a multiplexer on top of it,
> similar to how the kbdmux driver works?

Let's make sure that we don't implement it identically though, as there
are many of us who have major problems with kbdmux (reports of LORs, and
even more reports of incredibly slow keyboard input when a USB keyboard
is used; workarounds are either disabling atkbd/atkbdc entirely, or
disabling kbdmux entirely.  In my case, I found the latter to be
preferable).  :-)

-- 
| Jeremy Chadwickjdc at parodius.com |
| Parodius Networking   http://www.parodius.com/ |
| UNIX Systems Administrator  Mountain View, CA, USA |
| Making life hard for others since 1977.  PGP: 4BD6C0CB |

___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: strange behaviour with /sbin/init and serial console

2008-10-31 Thread Scott Long

Ed Schouten wrote:

Hello Theirry,

* Thierry Herbelot <[EMAIL PROTECTED]> wrote:
with the following patch on /sbin/init, I have two different behaviours 
depending on the console type (on a i386/32 PC) :

- on a video console, I see the expected two messages,
- on a serial console, the messages are not displayed (init silently finishes 
its job and gets to start /etc/rc and everything)


I assume that the writev system call is implemented in 
src/sys/kern/tty_cons.c::cnwrite(), but I could not parse the code to find an 
explanation.


any taker ?

TfH

PS : this is initially for a RELENG_6 machine, but the code is quite similar 
under RELENG_7 or Current


Any data written to /dev/console is not multiplexed to all console
devices, but only the first active device in the list. The reason behind
this, is because it adds a real lot of complexity to the console code,
especially related to polling and reading on /dev/console.

This weekend I'm going to commit a replacement implementation of
/dev/console, which also has this restriction.



The multiplexed console feature is one thing that linux got right.  In a
corporate setting, you really need both a serial console and a video
console in order to effectively manage the machines, as you want to be
able to access them both remotely and locally.  While it might be hard
to build multiplexing into the console driver, do you think it would be
possible to layer a multiplexer on top of it, similar to how the kbdmux
driver works?

Scott
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: strange behaviour with /sbin/init and serial console

2008-10-31 Thread Ed Schouten
* Scott Long <[EMAIL PROTECTED]> wrote:
> The multiplexed console feature is one thing that linux got right.  In a
> corporate setting, you really need both a serial console and a video
> console in order to effectively manage the machines, as you want to be
> able to access them both remotely and locally.  While it might be hard
> to build multiplexing into the console driver, do you think it would be
> possible to layer a multiplexer on top of it, similar to how the kbdmux
> driver works?

I'm not sure at which level we should implement this. I mainly wrote the
new /dev/console implementation, because it is a lot more simple than
the existing one and removes ugly hacks from the TTY code (like
recursive locking, etc).

Maybe if I can find some more time I'll look into it more closely, but
my todo list is very long right now. ;-)

-- 
 Ed Schouten <[EMAIL PROTECTED]>
 WWW: http://80386.nl/


pgpvX4JmlJp7z.pgp
Description: PGP signature


Re: strange behaviour with /sbin/init and serial console

2008-10-31 Thread Ed Schouten
Hello Theirry,

* Thierry Herbelot <[EMAIL PROTECTED]> wrote:
> with the following patch on /sbin/init, I have two different behaviours 
> depending on the console type (on a i386/32 PC) :
> - on a video console, I see the expected two messages,
> - on a serial console, the messages are not displayed (init silently finishes 
> its job and gets to start /etc/rc and everything)
> 
> I assume that the writev system call is implemented in 
> src/sys/kern/tty_cons.c::cnwrite(), but I could not parse the code to find an 
> explanation.
> 
>   any taker ?
> 
>   TfH
> 
> PS : this is initially for a RELENG_6 machine, but the code is quite similar 
> under RELENG_7 or Current

Any data written to /dev/console is not multiplexed to all console
devices, but only the first active device in the list. The reason behind
this, is because it adds a real lot of complexity to the console code,
especially related to polling and reading on /dev/console.

This weekend I'm going to commit a replacement implementation of
/dev/console, which also has this restriction.

-- 
 Ed Schouten <[EMAIL PROTECTED]>
 WWW: http://80386.nl/


pgpF88ru0nCzf.pgp
Description: PGP signature


Re: strange behaviour with /sbin/init and serial console

2008-10-31 Thread Thierry Herbelot
Le Friday 31 October 2008, Jeremy Chadwick a écrit :
> On Fri, Oct 31, 2008 at 05:46:23PM +0100, Thierry Herbelot wrote:
> > with the following patch on /sbin/init, I have two different behaviours
> > depending on the console type (on a i386/32 PC) :
> > - on a video console, I see the expected two messages,
> > - on a serial console, the messages are not displayed (init silently
> > finishes its job and gets to start /etc/rc and everything)
>
> I thought this was normal behaviour on FreeBSD, but it's very likely I'm
> misunderstanding.  The charts in Section 27.6.4 describe what "level" of
> logging is shown where and at what stage, depending upon which boot
> flags and device settings you use:
>
> http://www.freebsd.org/doc/en/books/handbook/serialconsole-setup.html

Hello,

I had not taken the time to read this link as thouroughly as should  have 
been.

nevertheless, I think the config is right, as the serial console is selected 
with "-h" in /boot.config (from memory, the machine is at work ...) and all 
*other* expected messages from the kernel ("dmesg") and the rc scripts are 
correctly displayed on respectively the serial and video console.

what struck me is that, from all the startup messages, just the messages 
from /sbin/init are displayed only on the video console

TfH
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: strange behaviour with /sbin/init and serial console

2008-10-31 Thread Jeremy Chadwick
On Fri, Oct 31, 2008 at 05:46:23PM +0100, Thierry Herbelot wrote:
> with the following patch on /sbin/init, I have two different behaviours 
> depending on the console type (on a i386/32 PC) :
> - on a video console, I see the expected two messages,
> - on a serial console, the messages are not displayed (init silently finishes 
> its job and gets to start /etc/rc and everything)

I thought this was normal behaviour on FreeBSD, but it's very likely I'm
misunderstanding.  The charts in Section 27.6.4 describe what "level" of
logging is shown where and at what stage, depending upon which boot
flags and device settings you use:

http://www.freebsd.org/doc/en/books/handbook/serialconsole-setup.html

-- 
| Jeremy Chadwickjdc at parodius.com |
| Parodius Networking   http://www.parodius.com/ |
| UNIX Systems Administrator  Mountain View, CA, USA |
| Making life hard for others since 1977.  PGP: 4BD6C0CB |

___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


strange behaviour with /sbin/init and serial console

2008-10-31 Thread Thierry Herbelot
Hello,

with the following patch on /sbin/init, I have two different behaviours 
depending on the console type (on a i386/32 PC) :
- on a video console, I see the expected two messages,
- on a serial console, the messages are not displayed (init silently finishes 
its job and gets to start /etc/rc and everything)

I assume that the writev system call is implemented in 
src/sys/kern/tty_cons.c::cnwrite(), but I could not parse the code to find an 
explanation.

any taker ?

TfH

PS : this is initially for a RELENG_6 machine, but the code is quite similar 
under RELENG_7 or Current

--- usr/src/sbin/init/init.c.ori2008-10-31 14:20:48.294794898 +0100
+++ usr/src/sbin/init/init.c2008-10-31 14:12:16.168062031 +0100
@@ -44,6 +44,8 @@
   "$FreeBSD: src/sbin/init/init.c,v 1.60.2.2 2006/07/08 15:34:27 kib Exp $";
 #endif /* not lint */

+#include 
+
 #include 
 #include 
 #include 
@@ -239,6 +241,23 @@
 */
openlog("init", LOG_CONS|LOG_ODELAY, LOG_AUTH);

+   warning("warning after openlog");
+{
+int fd;
+  if ((fd = open("/dev/console", O_WRONLY|O_NONBLOCK, 0)) >= 0) {
+   struct iovec iov[2];
+   struct iovec *v = iov;
+
+   v->iov_base = (void *)"iov direct write test";
+   v->iov_len = 21;
+   ++v;
+   v->iov_base = (void *)"\r\n";
+   v->iov_len = 2;
+   (void)writev(fd, iov, 2);
+   (void)close(fd);
+   }
+
+}
/*
 * Create an initial session.
 */
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"