Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Sep 2001 20:54:53 -0400 (EDT)
From:      Daniel Eischen <eischen@vigrid.com>
To:        Alfred Perlstein <bright@mu.org>
Cc:        mike varga <mike.varga@cavium.com>, freebsd-arch@FreeBSD.ORG
Subject:   Re: FD_LOCK, pthreads and drivers
Message-ID:  <Pine.SUN.3.91.1010913204528.2886A-100000@pcnet1.pcnet.com>
In-Reply-To: <20010913183028.P968@elvis.mu.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 13 Sep 2001, Alfred Perlstein wrote:
> * mike varga <mike.varga@cavium.com> [010913 17:41] wrote:
> > I noticed that while testing the driver I wrote
> > for a crypto device, that only one thread
> > can be executing within the context of
> > my driver at a time.
> > 
> > The problem is that the pthreads library 
> > replaces the ioctl with another that exclusively
> > locks the file descriptor with calls to FD_LOCK/
> > FD_UNLOCK.

This isn't true for -current.  I removed automatic locking of
file descriptors many months ago.

> > Why?

Indeed, it should be up to the application to provide protection
for I/O operations on the same file descriptor :-)  Or at least
the threads library should stay out of the way and let the application
and kernel decide...

> >  I went to extremes to make sure that it
> > would be fully reentrant.
> > The driver/crypto accelerator now suffers
> > from slow performance. 
> 
> Under the native FreeBSD threading model there is only one
> process context.  You'll want to use the linuxthreads port
> to do this.

You can have multiple I/O requests within libc_r, but they
are all converted to non-blocking requests and the thread
scheduler periodically polls for I/O completion.  If your
device driver doesn't support non-blocking operations, then
our threads library isn't going to help you much even in
-current where FD locking is disabled.

-- 
Dan Eischen

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




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