Subject: FD_LOCK, pthreads and drivers
To: None <tech-kern@netbsd.org>
From: mike varga <mike.varga@cavium.com>
List: tech-kern
Date: 09/13/2001 14:27:02
This is a multi-part message in MIME format.

------=_NextPart_000_00AF_01C13C60.28035AC0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

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=20
replaces the ioctl with another that exclusively
locks the file descriptor with calls to FD_LOCK/
FD_UNLOCK.

Why?

 I went to extremes to make sure that it
would be fully reentrant.
The driver/crypto accelerator now suffers
from slow performance.=20

------=_NextPart_000_00AF_01C13C60.28035AC0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 5.50.4522.1800" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>I noticed that while testing the driver =
I=20
wrote</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>for a crypto device, that only one=20
thread</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>can be executing within the context =
of</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>my driver at a time.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>The problem is that the pthreads =
library=20
</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>replaces the ioctl with another that=20
exclusively</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>locks the file descriptor </FONT><FONT =
face=3DArial=20
size=3D2>with calls to FD_LOCK/</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>FD_UNLOCK.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Why?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;I went to extremes to make sure =
that=20
it</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>would be fully reentrant.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>The driver/crypto accelerator now=20
suffers</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>from slow performance. =
</FONT></DIV></BODY></HTML>

------=_NextPart_000_00AF_01C13C60.28035AC0--