From owner-freebsd-drivers@FreeBSD.ORG Mon Jul 2 12:29:29 2007 Return-Path: X-Original-To: freebsd-drivers@freebsd.org Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DCAFF16A46C for ; Mon, 2 Jul 2007 12:29:29 +0000 (UTC) (envelope-from daniel@roe.ch) Received: from calvin.roe.ch (calvin.roe.ch [213.144.141.26]) by mx1.freebsd.org (Postfix) with ESMTP id 9A8E513C469 for ; Mon, 2 Jul 2007 12:29:29 +0000 (UTC) (envelope-from daniel@roe.ch) Received: from d212-53-102-185.cust.tele2.ch ([212.53.102.185] helo=dragon.roe.ch) by calvin.roe.ch (envelope-from ) with ESMTPS (TLSv1:AES256-SHA:256) id 1I5KXc-0000o5-Hv for freebsd-drivers@freebsd.org; Mon, 02 Jul 2007 13:58:04 +0200 Received: from roe by dragon.roe.ch (envelope-from ) with LOCAL id 1I5Kax-0002Gq-00 for freebsd-drivers@freebsd.org; Mon, 02 Jul 2007 14:01:31 +0200 Date: Mon, 2 Jul 2007 14:01:31 +0200 From: Daniel Roethlisberger To: freebsd-drivers@freebsd.org Message-ID: <20070702120131.GB5161@dragon.roe.ch> Mail-Followup-To: freebsd-drivers@freebsd.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.4i DomainKey-Status: (calvin.roe.ch) DomainKey-Result: (calvin.roe.ch) Subject: cdev destroy_dev() and detach races X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jul 2007 12:29:29 -0000 I have been doing some finishing work on my cmx driver [1] and have run into some difficulties involving detach races. This is a pccard driver with a cdev interface, the device is a PCMCIA based smartcard reader. Originally, I thought destroy_dev() would block until all threads have left the cdevsw handlers. Then I found out that it would only do so if d_purge is set in cdevsw. However, there aren't an awful lot of drivers using this. My attempts to use a d_purge handler resulted in crashes within kern/kern_conf.c when having an endless cat loop running while detaching the device. The solution I am using now is that I sleep in detach() until cdev->si_threadcount is 0. This seems to have done the trick, but I still have to do more testing to be sure. How do other driver solve this problem? I haven't found much documentation on this, and I didn't find any suitable driver to use as a guide (ideally a pccard driver with cdev interface, sleeps within read/write handlers, running without Giant). I'd be grateful if somebody could share any insight on this, or point me to the appropriate documentation. (Or any other comments on the cmx driver code, for that matter.) Thanks -Dan [1] http://dragon.roe.ch/~roe/cmx/ -- Daniel Roethlisberger From owner-freebsd-drivers@FreeBSD.ORG Mon Jul 2 12:56:46 2007 Return-Path: X-Original-To: freebsd-drivers@freebsd.org Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 37D1416A41F for ; Mon, 2 Jul 2007 12:56:46 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from relay02.kiev.sovam.com (relay02.kiev.sovam.com [62.64.120.197]) by mx1.freebsd.org (Postfix) with ESMTP id C3FD213C469 for ; Mon, 2 Jul 2007 12:56:45 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from [89.162.146.170] (helo=skuns.kiev.zoral.com.ua) by relay02.kiev.sovam.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.67) (envelope-from ) id 1I5LDV-000NXo-5g for freebsd-drivers@freebsd.org; Mon, 02 Jul 2007 15:41:23 +0300 Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by skuns.kiev.zoral.com.ua (8.14.1/8.14.1) with ESMTP id l62Cf1R1000176 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 2 Jul 2007 15:41:01 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.1/8.14.1) with ESMTP id l62Cf7hl037380 for ; Mon, 2 Jul 2007 15:41:07 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.1/8.14.1/Submit) id l62Cf5DW037375 for freebsd-drivers@freebsd.org; Mon, 2 Jul 2007 15:41:05 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 2 Jul 2007 15:41:04 +0300 From: Kostik Belousov To: freebsd-drivers@freebsd.org Message-ID: <20070702124104.GO2268@deviant.kiev.zoral.com.ua> References: <20070702120131.GB5161@dragon.roe.ch> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="1D2Sd8R3prdjrxgd" Content-Disposition: inline In-Reply-To: <20070702120131.GB5161@dragon.roe.ch> User-Agent: Mutt/1.4.2.2i X-Virus-Scanned: ClamAV version 0.90.2, clamav-milter version 0.90.2 on skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-1.4 required=5.0 tests=ALL_TRUSTED autolearn=failed version=3.1.8 X-Spam-Checker-Version: SpamAssassin 3.1.8 (2007-02-13) on skuns.kiev.zoral.com.ua X-Scanner-Signature: f7f1c38b0b2d7aeba17750d70212ab70 X-DrWeb-checked: yes X-SpamTest-Envelope-From: kostikbel@gmail.com X-SpamTest-Group-ID: 00000000 X-SpamTest-Header: Not Detected X-SpamTest-Info: Profiles 1187 [June 28 2007] X-SpamTest-Info: helo_type=3 X-SpamTest-Method: none X-SpamTest-Rate: 0 X-SpamTest-Status: Not detected X-SpamTest-Status-Extended: not_detected X-SpamTest-Version: SMTP-Filter Version 3.0.0 [0255], KAS30/Release Subject: Re: cdev destroy_dev() and detach races X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jul 2007 12:56:46 -0000 --1D2Sd8R3prdjrxgd Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jul 02, 2007 at 02:01:31PM +0200, Daniel Roethlisberger wrote: > I have been doing some finishing work on my cmx driver [1] and have run > into some difficulties involving detach races. This is a pccard driver > with a cdev interface, the device is a PCMCIA based smartcard reader. >=20 > Originally, I thought destroy_dev() would block until all threads have > left the cdevsw handlers. Then I found out that it would only do so if > d_purge is set in cdevsw. However, there aren't an awful lot of drivers > using this. My attempts to use a d_purge handler resulted in crashes > within kern/kern_conf.c when having an endless cat loop running while > detaching the device. Do you referring to RELENG_6 or CURRENT ? In CURRENT, destroy_devl() does sleep until there is any thread that grabbed thread reference. Look at the rev. 1.199 of kern_conf.c. On the other hand, this was never MFCed, and cause some other troubles that are being worked on. >=20 > The solution I am using now is that I sleep in detach() until > cdev->si_threadcount is 0. This seems to have done the trick, but I > still have to do more testing to be sure. This looks like a workaround. >=20 > How do other driver solve this problem? I haven't found much > documentation on this, and I didn't find any suitable driver to use as a > guide (ideally a pccard driver with cdev interface, sleeps within > read/write handlers, running without Giant). >=20 > I'd be grateful if somebody could share any insight on this, or point me > to the appropriate documentation. (Or any other comments on the cmx > driver code, for that matter.) >=20 > Thanks > -Dan >=20 >=20 > [1] http://dragon.roe.ch/~roe/cmx/ --1D2Sd8R3prdjrxgd Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (FreeBSD) iD8DBQFGiPJgC3+MBN1Mb4gRAg47AKDGrlvQwoPIlP1SUFxy52+OLjFYgwCdE85r g6Pr+/NoOaamXnOTYAXkeDQ= =fPfl -----END PGP SIGNATURE----- --1D2Sd8R3prdjrxgd-- From owner-freebsd-drivers@FreeBSD.ORG Mon Jul 2 13:26:11 2007 Return-Path: X-Original-To: freebsd-drivers@freebsd.org Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AA59916A41F for ; Mon, 2 Jul 2007 13:26:11 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.freebsd.org (Postfix) with ESMTP id 6B98D13C484 for ; Mon, 2 Jul 2007 13:26:11 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (localhost [127.0.0.1]) by spam.des.no (Postfix) with ESMTP id 41BC020A4; Mon, 2 Jul 2007 15:26:07 +0200 (CEST) X-Spam-Tests: AWL X-Spam-Learn: disabled X-Spam-Score: 0.0/3.0 X-Spam-Checker-Version: SpamAssassin 3.2.0 (2007-05-01) on tim.des.no Received: from dwp.des.no (des.no [80.203.243.180]) by smtp.des.no (Postfix) with ESMTP id 3588F208A; Mon, 2 Jul 2007 15:26:07 +0200 (CEST) Received: by dwp.des.no (Postfix, from userid 1001) id 133CE525F; Mon, 2 Jul 2007 15:26:07 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: "James R. Van Artsdalen" References: <46827B9F.1010308@jrv.org> Date: Mon, 02 Jul 2007 15:26:06 +0200 In-Reply-To: <46827B9F.1010308@jrv.org> (James R. Van Artsdalen's message of "Wed\, 27 Jun 2007 10\:00\:47 -0500") Message-ID: <868x9zc4y9.fsf@dwp.des.no> User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: freebsd-drivers@freebsd.org Subject: Re: SATA port multiplier crashes 7.0 i386 & amd64 during boot X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jul 2007 13:26:11 -0000 "James R. Van Artsdalen" writes: > Connecting a Silicon Image porn multiplier with five drives behind it to > a host adapter based on either the Silicon Image 3124 or 3132 chips > causes the 7. 0 kernel to crash during startup. Sorry, what was your question again? My head exploded when I got to the "porn multiplier" part. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-freebsd-drivers@FreeBSD.ORG Mon Jul 2 16:21:00 2007 Return-Path: X-Original-To: freebsd-drivers@freebsd.org Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9D00716A421 for ; Mon, 2 Jul 2007 16:21:00 +0000 (UTC) (envelope-from daniel@roe.ch) Received: from calvin.roe.ch (calvin.roe.ch [213.144.141.26]) by mx1.freebsd.org (Postfix) with ESMTP id 5177B13C48A for ; Mon, 2 Jul 2007 16:21:00 +0000 (UTC) (envelope-from daniel@roe.ch) Received: from d212-53-102-185.cust.tele2.ch ([212.53.102.185] helo=dragon.roe.ch) by calvin.roe.ch (envelope-from ) with ESMTPS (TLSv1:AES256-SHA:256) id 1I5Oah-0000yW-TJ for freebsd-drivers@freebsd.org; Mon, 02 Jul 2007 18:17:32 +0200 Received: from roe by dragon.roe.ch (envelope-from ) with LOCAL id 1I5Oe2-00045N-00 for freebsd-drivers@freebsd.org; Mon, 02 Jul 2007 18:20:58 +0200 Date: Mon, 2 Jul 2007 18:20:58 +0200 From: Daniel Roethlisberger To: freebsd-drivers@freebsd.org Message-ID: <20070702162058.GA12423@dragon.roe.ch> Mail-Followup-To: freebsd-drivers@freebsd.org References: <20070702120131.GB5161@dragon.roe.ch> <20070702124104.GO2268@deviant.kiev.zoral.com.ua> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20070702124104.GO2268@deviant.kiev.zoral.com.ua> User-Agent: Mutt/1.5.4i DomainKey-Status: (calvin.roe.ch) DomainKey-Result: (calvin.roe.ch) Subject: Re: cdev destroy_dev() and detach races X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jul 2007 16:21:00 -0000 Kostik Belousov 2007-07-02: > On Mon, Jul 02, 2007 at 02:01:31PM +0200, Daniel Roethlisberger wrote: > > I have been doing some finishing work on my cmx driver [1] and have run > > into some difficulties involving detach races. This is a pccard driver > > with a cdev interface, the device is a PCMCIA based smartcard reader. > > > > Originally, I thought destroy_dev() would block until all threads have > > left the cdevsw handlers. Then I found out that it would only do so if > > d_purge is set in cdevsw. However, there aren't an awful lot of drivers > > using this. My attempts to use a d_purge handler resulted in crashes > > within kern/kern_conf.c when having an endless cat loop running while > > detaching the device. > Do you referring to RELENG_6 or CURRENT ? In CURRENT, destroy_devl() does > sleep until there is any thread that grabbed thread reference. Look at the > rev. 1.199 of kern_conf.c. On the other hand, this was never MFCed, and > cause some other troubles that are being worked on. RELENG_6, sorry for not mentioning. > > The solution I am using now is that I sleep in detach() until > > cdev->si_threadcount is 0. This seems to have done the trick, but I > > still have to do more testing to be sure. > This looks like a workaround. Why don't all the other drivers in RELENG_6 need some kind of workaround to detach reliably? Did I just look at the wrong drivers? > > How do other driver solve this problem? I haven't found much > > documentation on this, and I didn't find any suitable driver to use as a > > guide (ideally a pccard driver with cdev interface, sleeps within > > read/write handlers, running without Giant). > > > > I'd be grateful if somebody could share any insight on this, or point me > > to the appropriate documentation. (Or any other comments on the cmx > > driver code, for that matter.) > > > > Thanks > > -Dan > > > > > > [1] http://dragon.roe.ch/~roe/cmx/ -Dan -- Daniel Roethlisberger From owner-freebsd-drivers@FreeBSD.ORG Tue Jul 3 09:43:21 2007 Return-Path: X-Original-To: freebsd-drivers@freebsd.org Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B107116A41F for ; Tue, 3 Jul 2007 09:43:21 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from relay01.kiev.sovam.com (relay01.kiev.sovam.com [62.64.120.200]) by mx1.freebsd.org (Postfix) with ESMTP id 4345A13C469 for ; Tue, 3 Jul 2007 09:43:21 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from [89.162.146.170] (helo=skuns.kiev.zoral.com.ua) by relay01.kiev.sovam.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.67) (envelope-from ) id 1I5euh-0003QJ-4K for freebsd-drivers@freebsd.org; Tue, 03 Jul 2007 12:43:19 +0300 Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by skuns.kiev.zoral.com.ua (8.14.1/8.14.1) with ESMTP id l639h2GN029112 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 3 Jul 2007 12:43:02 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.1/8.14.1) with ESMTP id l639h7rL088072 for ; Tue, 3 Jul 2007 12:43:07 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.1/8.14.1/Submit) id l639h7WM088071 for freebsd-drivers@freebsd.org; Tue, 3 Jul 2007 12:43:07 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 3 Jul 2007 12:43:06 +0300 From: Kostik Belousov To: freebsd-drivers@freebsd.org Message-ID: <20070703094306.GD2200@deviant.kiev.zoral.com.ua> References: <20070702120131.GB5161@dragon.roe.ch> <20070702124104.GO2268@deviant.kiev.zoral.com.ua> <20070702162058.GA12423@dragon.roe.ch> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="EP0wieDxd4TSJjHq" Content-Disposition: inline In-Reply-To: <20070702162058.GA12423@dragon.roe.ch> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: ClamAV version 0.90.2, clamav-milter version 0.90.2 on skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-1.4 required=5.0 tests=ALL_TRUSTED autolearn=failed version=3.1.8 X-Spam-Checker-Version: SpamAssassin 3.1.8 (2007-02-13) on skuns.kiev.zoral.com.ua X-Scanner-Signature: e04e44772e0ad72f7751591e8aa1bd99 X-DrWeb-checked: yes X-SpamTest-Envelope-From: kostikbel@gmail.com X-SpamTest-Group-ID: 00000000 X-SpamTest-Header: Not Detected X-SpamTest-Info: Profiles 1187 [June 28 2007] X-SpamTest-Info: helo_type=3 X-SpamTest-Method: none X-SpamTest-Rate: 0 X-SpamTest-Status: Not detected X-SpamTest-Status-Extended: not_detected X-SpamTest-Version: SMTP-Filter Version 3.0.0 [0255], KAS30/Release Subject: Re: cdev destroy_dev() and detach races X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jul 2007 09:43:21 -0000 --EP0wieDxd4TSJjHq Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jul 02, 2007 at 06:20:58PM +0200, Daniel Roethlisberger wrote: > Kostik Belousov 2007-07-02: > > On Mon, Jul 02, 2007 at 02:01:31PM +0200, Daniel Roethlisberger wrote: > > > I have been doing some finishing work on my cmx driver [1] and have r= un > > > into some difficulties involving detach races. This is a pccard driv= er > > > with a cdev interface, the device is a PCMCIA based smartcard reader. > > >=20 > > > Originally, I thought destroy_dev() would block until all threads have > > > left the cdevsw handlers. Then I found out that it would only do so = if > > > d_purge is set in cdevsw. However, there aren't an awful lot of driv= ers > > > using this. My attempts to use a d_purge handler resulted in crashes > > > within kern/kern_conf.c when having an endless cat loop running while > > > detaching the device. > > Do you referring to RELENG_6 or CURRENT ? In CURRENT, destroy_devl() do= es > > sleep until there is any thread that grabbed thread reference. Look at = the > > rev. 1.199 of kern_conf.c. On the other hand, this was never MFCed, and > > cause some other troubles that are being worked on. >=20 > RELENG_6, sorry for not mentioning. >=20 > > > The solution I am using now is that I sleep in detach() until > > > cdev->si_threadcount is 0. This seems to have done the trick, but I > > > still have to do more testing to be sure. > > This looks like a workaround. >=20 > Why don't all the other drivers in RELENG_6 need some kind of workaround > to detach reliably? Did I just look at the wrong drivers? The problem you described is a bug in RELENG_6. The fix changes devfs infrastructure instead of modyfing all the drivers. One of the reason why the fix (rev. 1.199 of kern_conf.c) it is not MFCed is some undesirable consequences, in particular, interaction with drivers calling destroy_dev() from cdev methods. --EP0wieDxd4TSJjHq Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (FreeBSD) iD8DBQFGihoqC3+MBN1Mb4gRAkRSAJ9qgEJTrKbxhwezzlsrhM1W8s8EQQCgvd7L jW6NDILNgW1ERu6Qaql5R9s= =Ret0 -----END PGP SIGNATURE----- --EP0wieDxd4TSJjHq-- From owner-freebsd-drivers@FreeBSD.ORG Tue Jul 3 16:35:17 2007 Return-Path: X-Original-To: freebsd-drivers@freebsd.org Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id F12C116A468 for ; Tue, 3 Jul 2007 16:35:17 +0000 (UTC) (envelope-from daniel@roe.ch) Received: from calvin.roe.ch (calvin.roe.ch [213.144.141.26]) by mx1.freebsd.org (Postfix) with ESMTP id A3A4813C4AE for ; Tue, 3 Jul 2007 16:35:17 +0000 (UTC) (envelope-from daniel@roe.ch) Received: from d212-53-102-185.cust.tele2.ch ([212.53.102.185] helo=dragon.roe.ch) by calvin.roe.ch (envelope-from ) with ESMTPS (TLSv1:AES256-SHA:256) id 1I5lI4-0001xG-7r for freebsd-drivers@freebsd.org; Tue, 03 Jul 2007 18:31:48 +0200 Received: from roe by dragon.roe.ch (envelope-from ) with LOCAL id 1I5lLP-0006l2-00 for freebsd-drivers@freebsd.org; Tue, 03 Jul 2007 18:35:15 +0200 Date: Tue, 3 Jul 2007 18:35:15 +0200 From: Daniel Roethlisberger To: freebsd-drivers@freebsd.org Message-ID: <20070703163515.GA21591@dragon.roe.ch> Mail-Followup-To: freebsd-drivers@freebsd.org References: <20070702120131.GB5161@dragon.roe.ch> <20070702124104.GO2268@deviant.kiev.zoral.com.ua> <20070702162058.GA12423@dragon.roe.ch> <20070703094306.GD2200@deviant.kiev.zoral.com.ua> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20070703094306.GD2200@deviant.kiev.zoral.com.ua> User-Agent: Mutt/1.5.4i DomainKey-Status: (calvin.roe.ch) DomainKey-Result: (calvin.roe.ch) Subject: Re: cdev destroy_dev() and detach races X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jul 2007 16:35:18 -0000 Kostik Belousov 2007-07-03: > On Mon, Jul 02, 2007 at 06:20:58PM +0200, Daniel Roethlisberger wrote: > > Kostik Belousov 2007-07-02: > > > On Mon, Jul 02, 2007 at 02:01:31PM +0200, Daniel Roethlisberger wrote: > > > > I have been doing some finishing work on my cmx driver [1] and have run > > > > into some difficulties involving detach races. This is a pccard driver > > > > with a cdev interface, the device is a PCMCIA based smartcard reader. > > > > > > > > Originally, I thought destroy_dev() would block until all threads have > > > > left the cdevsw handlers. Then I found out that it would only do so if > > > > d_purge is set in cdevsw. However, there aren't an awful lot of drivers > > > > using this. My attempts to use a d_purge handler resulted in crashes > > > > within kern/kern_conf.c when having an endless cat loop running while > > > > detaching the device. > > > Do you referring to RELENG_6 or CURRENT ? In CURRENT, destroy_devl() does > > > sleep until there is any thread that grabbed thread reference. Look at the > > > rev. 1.199 of kern_conf.c. On the other hand, this was never MFCed, and > > > cause some other troubles that are being worked on. > > > > RELENG_6, sorry for not mentioning. > > > > > > The solution I am using now is that I sleep in detach() until > > > > cdev->si_threadcount is 0. This seems to have done the trick, but I > > > > still have to do more testing to be sure. > > > This looks like a workaround. > > > > Why don't all the other drivers in RELENG_6 need some kind of workaround > > to detach reliably? Did I just look at the wrong drivers? > The problem you described is a bug in RELENG_6. The fix changes devfs > infrastructure instead of modyfing all the drivers. Hum, that's not what I meant, sorry for not being clear. I understand the implications of the fix. But since the fix was not MFCed, why aren't there drivers in RELENG_6 crashing on this issue? Why don't I see more workarounds like mine in RELENG_6 drivers? That's what I wondered. Since my driver now works flawlessly, it doesn't really matter. > One of the reason why the fix (rev. 1.199 of kern_conf.c) it is not > MFCed is some undesirable consequences, in particular, interaction > with drivers calling destroy_dev() from cdev methods. -Dan -- Daniel Roethlisberger From owner-freebsd-drivers@FreeBSD.ORG Thu Jul 5 12:45:39 2007 Return-Path: X-Original-To: freebsd-drivers@freebsd.org Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1310216A468 for ; Thu, 5 Jul 2007 12:45:39 +0000 (UTC) (envelope-from sharadc@niksun.com) Received: from in.niksun.com (210.18.76.166.sify.net [210.18.76.166]) by mx1.freebsd.org (Postfix) with ESMTP id AD11913C4BF for ; Thu, 5 Jul 2007 12:45:38 +0000 (UTC) (envelope-from sharadc@niksun.com) Received: from sharadc.niksun.com (unknown [10.60.5.27]) by in.niksun.com (Postfix) with ESMTP id 4B6F25D84 for ; Thu, 5 Jul 2007 17:49:00 +0530 (IST) From: Sharad Chandra Organization: Niksun India To: freebsd-drivers@freebsd.org Date: Thu, 5 Jul 2007 17:43:31 +0530 User-Agent: KMail/1.8.2 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200707051743.31967.sharadc@niksun.com> Subject: Sound Driver. X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jul 2007 12:45:39 -0000 Hi Guys, I have freebsd 6.0 box. but could not start sound. pciconf -l -v shows none1@pci0:30:2: class=0x040100 card=0x100417aa chip=0x27de8086 rev=0x01 hdr=0x00 vendor = 'Intel Corporation' device = '82801GB I/O Controller Hub AC'97 Audio' class = multimedia subclass = audio After i kldload snd_driver, cat /dev/sndstat does not show any thing [root@/usr/src/sys/dev/sound/pci]# cat /dev/sndstat FreeBSD Audio Driver (newpcm) Installed devices: and this appears in the dmesg => pci0: at device 30.2 (no driver attached) and also see this from /var/log/messages once i load driver. Jul 5 17:36:54 sharadc kernel: sio1: port may not be enabled Jul 5 17:36:54 sharadc kernel: sio1: configured irq 3 not in bitmap of probed irqs 0 Can any one give me a clue how to handle this.. above is max info that i can provde. Thank you in advance Sharad Chandra From owner-freebsd-drivers@FreeBSD.ORG Thu Jul 5 13:32:33 2007 Return-Path: X-Original-To: freebsd-drivers@freebsd.org Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D787616A46E for ; Thu, 5 Jul 2007 13:32:33 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 86F9813C45D for ; Thu, 5 Jul 2007 13:32:33 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.13.8/8.13.4) with ESMTP id l65DV4dh062355; Thu, 5 Jul 2007 07:31:04 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Thu, 05 Jul 2007 07:31:45 -0600 (MDT) Message-Id: <20070705.073145.1152728806.imp@bsdimp.com> To: sharadc@niksun.com From: "M. Warner Losh" In-Reply-To: <200707051743.31967.sharadc@niksun.com> References: <200707051743.31967.sharadc@niksun.com> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0 (harmony.bsdimp.com [127.0.0.1]); Thu, 05 Jul 2007 07:31:05 -0600 (MDT) Cc: freebsd-drivers@freebsd.org Subject: Re: Sound Driver. X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jul 2007 13:32:33 -0000 In message: <200707051743.31967.sharadc@niksun.com> Sharad Chandra writes: : Hi Guys, : : I have freebsd 6.0 box. but could not start sound. : pciconf -l -v shows : none1@pci0:30:2: class=0x040100 card=0x100417aa chip=0x27de8086 : rev=0x01 hdr=0x00 : vendor = 'Intel Corporation' : device = '82801GB I/O Controller Hub AC'97 Audio' : class = multimedia : subclass = audio : : After i kldload snd_driver, cat /dev/sndstat does not show any thing : [root@/usr/src/sys/dev/sound/pci]# cat /dev/sndstat : FreeBSD Audio Driver (newpcm) : Installed devices: : : and this appears in the dmesg => : pci0: at device 30.2 (no driver attached) : : and also see this from /var/log/messages once i load driver. : Jul 5 17:36:54 sharadc kernel: sio1: port may not be enabled : Jul 5 17:36:54 sharadc kernel: sio1: configured irq 3 not in bitmap of probed : irqs 0 : : Can any one give me a clue how to handle this.. above is max info that i can : provde. You might have better advise on the multimedia@ list. Warner From owner-freebsd-drivers@FreeBSD.ORG Thu Jul 5 14:02:52 2007 Return-Path: X-Original-To: freebsd-drivers@freebsd.org Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5003F16A421 for ; Thu, 5 Jul 2007 14:02:52 +0000 (UTC) (envelope-from sebastien.bourdeauducq@gmail.com) Received: from py-out-1112.google.com (py-out-1112.google.com [64.233.166.182]) by mx1.freebsd.org (Postfix) with ESMTP id 108D713C448 for ; Thu, 5 Jul 2007 14:02:51 +0000 (UTC) (envelope-from sebastien.bourdeauducq@gmail.com) Received: by py-out-1112.google.com with SMTP id u77so4906447pyb for ; Thu, 05 Jul 2007 07:02:50 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=lnJ2+FXgAuLmjkqTIu+BsbIcIEZThY7iuV1mpyAXhN+vS91RbLzibfaIiz6bS+ivEuzjJH75ZqaFTfgSwvBbOeoYlXUuww87HjNDwCJLkZOAqgs8GQQ2mgFxVqdhhR5ytLjekndWJC6Ng1a3p1JyKXJ+eh0ahgvf+6jqh5ACk0A= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=n3ZKY8TQcZ6ezn4Ke+qWki0BAZ1iAIwF2i5dST43brQrl4AZkLT7VwGYT3FM/M2TWhgI9xXUmLJjjrbBC0OfS2HbJLXyu6eV1TCk14HiGL6UZUVJ/u112jjzeCVEvnT/SH4ejw8+u7L1dII2bRdEjNIlHnwN62Zqi+pCzapLbdc= Received: by 10.35.71.1 with SMTP id y1mr11634014pyk.1183642577266; Thu, 05 Jul 2007 06:36:17 -0700 (PDT) Received: by 10.35.27.3 with HTTP; Thu, 5 Jul 2007 06:36:17 -0700 (PDT) Message-ID: <3a947d1d0707050636y69098a7cl6571378c40971771@mail.gmail.com> Date: Thu, 5 Jul 2007 15:36:17 +0200 From: "Sebastien Bourdeauducq" To: "Sharad Chandra" In-Reply-To: <200707051743.31967.sharadc@niksun.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <200707051743.31967.sharadc@niksun.com> Cc: freebsd-drivers@freebsd.org Subject: Re: Sound Driver. X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jul 2007 14:02:52 -0000 Hi, You need to load the hardware driver for your card, snd_driver is just for the sound architecture. Try kldload snd_ich. The messages about sio are unrelated. sio is RS232. 2007/7/5, Sharad Chandra : > Hi Guys, > > I have freebsd 6.0 box. but could not start sound. > pciconf -l -v shows > none1@pci0:30:2: class=0x040100 card=0x100417aa chip=0x27de8086 > rev=0x01 hdr=0x00 > vendor = 'Intel Corporation' > device = '82801GB I/O Controller Hub AC'97 Audio' > class = multimedia > subclass = audio > > After i kldload snd_driver, cat /dev/sndstat does not show any thing > [root@/usr/src/sys/dev/sound/pci]# cat /dev/sndstat > FreeBSD Audio Driver (newpcm) > Installed devices: > > and this appears in the dmesg => > pci0: at device 30.2 (no driver attached) > > and also see this from /var/log/messages once i load driver. > Jul 5 17:36:54 sharadc kernel: sio1: port may not be enabled > Jul 5 17:36:54 sharadc kernel: sio1: configured irq 3 not in bitmap of probed > irqs 0 > > Can any one give me a clue how to handle this.. above is max info that i can > provde. > Thank you in advance > Sharad Chandra > _______________________________________________ > freebsd-drivers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-drivers > To unsubscribe, send any mail to "freebsd-drivers-unsubscribe@freebsd.org" >