Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 5 Jun 1997 23:31:25 -0700 (MST)
From:      Richard Straka <straka@inficad.com>
To:        Bruce Evans <bde@zeta.org.au>
Cc:        current@freebsd.org
Subject:   Re: sio driver performance
Message-ID:  <Pine.BSI.3.95.970605225737.10408A-100000@user2.inficad.com>
In-Reply-To: <Pine.BSI.3.96.970605214012.29114A-100000@user1.inficad.com>

next in thread | previous in thread | raw e-mail | index | archive | help

I want to use FreeBSD (2.2.1-RELEASE) on a 486DX-33 to collect some serial
data from some remote test equipment. As a precursor test, I have
connected this box to another FreeBSD box and have been sending serial
data back and forth.

I have set both boxes serial ports as follows

	temp.c_lflag &= ~(ECHO | ICANON | IEXTEN | ISIG);
	temp.c_iflag &= ~(BRKINT | ICRNL | INPCK | ISTRIP | IXON);
	temp.c_cflag &= ~(CRTSCTS | CSIZE | PARENB);
	temp.c_cflag |= CS8;
	temp.c_oflag &= ~(OPOST);
	temp.c_cc[VMIN] = 1;
	temp.c_cc[VTIME] = 0;
	cfsetispeed(&temp,(speed_t)115200);
	cfsetospeed(&temp,(speed_t)115200);

I have a small loop on one of the boxes which wakes up on a 100Hz alarm
and send 16 bytes out the serial port. On the other box, I have a loop
which continuously tries to read 16 bytes from the serial port.

I have noticed that the communications work great until I interrupt the
process on the box which is tranmitting the data.  At that point, the box
which was receiving suddenly elevates to 100% CPU usage (mostly system) as
if in a polling loop. When I attempt to reestablish the process which is
sending the data, I get "tty-level buffer overflows" on the receiving box,
the read never unblocks and the CPU utilization stays at 100%. I have to
kill the receiving process and restart it to reestablish communication.

Also when the receive process is started, before the transmit process is
started on the other box, the read seems to periodically return -1.
Shouldn't the read indefinitely block if c_cc[VMIN]=1 and c_cc[VTIME]=0?

The "tty-level buffer overflows" only occurs after the transmit process is
started, then halted, then restarted. This could be a real problem for my
remote test equipment as the serial lines may be inadvertently
disconnected and reconnected from time to time.

Any help with this would be greatly appreciated.

 Richard Straka 
 straka@inficad.com





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSI.3.95.970605225737.10408A-100000>