From owner-freebsd-arch@FreeBSD.ORG Fri Dec 17 04:50:26 2004 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2BB2D16A4F5; Fri, 17 Dec 2004 04:50:26 +0000 (GMT) Received: from server1.astraldream.net (astraldream.net [69.20.5.160]) by mx1.FreeBSD.org (Postfix) with ESMTP id 84C0443D3F; Fri, 17 Dec 2004 04:50:25 +0000 (GMT) (envelope-from ssouhlal@FreeBSD.org) Received: from [192.168.0.98] (pool-138-88-246-116.res.east.verizon.net [138.88.246.116]) (authenticated (0 bits)) by server1.astraldream.net (8.11.6/8.11.6) with ESMTP id iBH4oEW12433 (using TLSv1/SSLv3 with cipher RC4-SHA (128 bits) verified NO); Thu, 16 Dec 2004 23:50:23 -0500 In-Reply-To: <200412131232.55051.max@love2party.net> References: <94AE3F5A-4CD6-11D9-8BD6-000A95C4D7BC@FreeBSD.org> <200412130913.20215.max@love2party.net> <200412131232.55051.max@love2party.net> Mime-Version: 1.0 (Apple Message framework v619) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <21F934EB-4FE7-11D9-B1F7-000A95C4D7BC@FreeBSD.org> Content-Transfer-Encoding: 7bit From: Suleiman Souhlal Date: Thu, 16 Dec 2004 23:50:11 -0500 To: Max Laier X-Mailer: Apple Mail (2.619) cc: freebsd-current@FreeBSD.org cc: freebsd-arch@FreeBSD.org Subject: Re: sysctl locking X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Dec 2004 04:50:26 -0000 Hello, On Dec 13, 2004, at 6:32 AM, Max Laier wrote: > 1) Extend sysctl_add_oid() to accept an additional mutex argument. > 2) Extend the simple sysctl handler to use this mutex to protect the > actual > write(?read?). We must not hold the mutex during the useland copy > in/out so > we must move to temporary storage. > 3) To maintain the current API and behavior we use &Giant as the > default > fallback argument. This might need some extension for complex > handler (i.e. > no mutex given -> acquire Giant before calling the complex handler). > > What do people think of this? Does it make any sense? Should we be > concerned > at all? Does the extension make sense? Comments? I have implemented this. The diff is at http://people.freebsd.org/~ssouhlal/sysctl-sx-locking-20041214.diff It also needs the patch at http://people.freebsd.org/~ssouhlal/sx_xlocked.diff which introduces a sx_xlocked() function. Unfortunately, we still need to look at every single SYSCTL_PROC, and make either grab Giant, lock correctly, or make sure it doesn't need any locking. :( -- Suleiman Souhlal | ssouhlal@vt.edu The FreeBSD Project | ssouhlal@FreeBSD.org