Date: Thu, 13 Sep 2001 15:28:35 -0700 From: "mike varga" <mike.varga@cavium.com> To: <freebsd-arch@freebsd.org> Subject: FD_LOCK, pthreads and drivers Message-ID: <010e01c13ca3$6e12b4a0$4a10a8c0@stcla1.sfba.home.com>
next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format. ------=_NextPart_000_010B_01C13C68.C14A6C70 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_010B_01C13C68.C14A6C70 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> <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> </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> </DIV> <DIV><FONT face=3DArial size=3D2>Why?</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2> 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.=20 </FONT></DIV></FONT></DIV></BODY></HTML> ------=_NextPart_000_010B_01C13C68.C14A6C70-- 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?010e01c13ca3$6e12b4a0$4a10a8c0>