Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 26 Sep 2001 11:43:22 -0700
From:      "mike varga" <mike.varga@cavium.com>
To:        "Daniel Eischen" <eischen@vigrid.com>
Cc:        <freebsd-arch@freebsd.org>
Subject:   Re: FD_LOCK, pthreads and drivers
Message-ID:  <007f01c146bb$1f105fc0$4a10a8c0@stcla1.sfba.home.com>
References:  <Pine.SUN.3.91.1010913204528.2886A-100000@pcnet1.pcnet.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Will the next release of FreeBSD have the
FD_LOCKs removed from the default
installation?

If so, when is that availible?

----- Original Message ----- 
From: "Daniel Eischen" <eischen@vigrid.com>
To: "Alfred Perlstein" <bright@mu.org>
Cc: "mike varga" <mike.varga@cavium.com>; <freebsd-arch@FreeBSD.ORG>
Sent: Thursday, September 13, 2001 5:54 PM
Subject: Re: FD_LOCK, pthreads and drivers


> 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
> 


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?007f01c146bb$1f105fc0$4a10a8c0>