From owner-freebsd-current@FreeBSD.ORG Wed Nov 30 15:46:43 2011 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 708E41065680; Wed, 30 Nov 2011 15:46:43 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 49BE28FC17; Wed, 30 Nov 2011 15:46:42 +0000 (UTC) Received: from alf.home (alf.kiev.zoral.com.ua [10.1.1.177]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id pAUFkblQ010783 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 30 Nov 2011 17:46:37 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from alf.home (kostik@localhost [127.0.0.1]) by alf.home (8.14.5/8.14.5) with ESMTP id pAUFkbsm078718; Wed, 30 Nov 2011 17:46:37 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by alf.home (8.14.5/8.14.5/Submit) id pAUFka0f078717; Wed, 30 Nov 2011 17:46:36 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: alf.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 30 Nov 2011 17:46:36 +0200 From: Kostik Belousov To: John Baldwin Message-ID: <20111130154636.GX50300@deviant.kiev.zoral.com.ua> References: <20111130124320.GA1449@azathoth.lan> <201111301005.11938.jhb@freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="jwac3nLilAlTsrBW" Content-Disposition: inline In-Reply-To: <201111301005.11938.jhb@freebsd.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-3.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: Baptiste Daroussin , freebsd-current@freebsd.org Subject: Re: [patch] turning devctl into a "multiple openable" device X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Nov 2011 15:46:43 -0000 --jwac3nLilAlTsrBW Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Nov 30, 2011 at 10:05:11AM -0500, John Baldwin wrote: > On Wednesday, November 30, 2011 7:43:20 am Baptiste Daroussin wrote: > > Hi all, > >=20 > > With the help of cognet, I wrote a patch to turn devctl into a multiple= openable > > device, that mean that it will allow to open /dev/devctl in multiple pr= ograms, > > for example hald and everythings that want to receive notification from= the > > device won't need to depend on haveing devd running. > >=20 > > here is the patch:=20 > > http://people.freebsd.org/~bapt/devctl_multi_open.diff >=20 > Shouldn't devctl_queue_data_f() use the requested malloc() flags instead = of > hardcoding M_NOWAIT? This is an obvious fallback of holding mutex around the call to per_devctl_queue_data_f(), which caused the author a trouble to use M_WAITOK. Having n readers causes the patch to queue each message n times, that looks like a waste. I wonder why the waiting_threads stuff is needed at all. The cv could be woken up unconditionally everytime. What is the reason for the cv_wait call in cdevpriv data destructor ? You cannot have a thread doing e.g. read on the file descriptor while destructor is run. >=20 > Also, I know that it was an intentional design decisison by Warner to have > the multiplexing of devctl data done in userland via devd rather than in = the > kernel. (I think he envisioned devd providing a UNIX domain socket or so= me > such for other daemons to use to listen to events.) Have you asked him a= bout > this change? And I fully agree that doing multiplexing in user mode is the right approac= h. Not least because you could apply some advanced access control and provide filtering for the consumers. --jwac3nLilAlTsrBW Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iEYEARECAAYFAk7WT9wACgkQC3+MBN1Mb4g5zwCg3MjdQJIZB4pmbmruWX2OEZnc tHcAmQH6vh5NvQ3TGOTDZASNPdkDq73l =TCaE -----END PGP SIGNATURE----- --jwac3nLilAlTsrBW--