From owner-cvs-all Sun Jul 28 20:42:25 2002 Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0D82637B400 for ; Sun, 28 Jul 2002 20:42:18 -0700 (PDT) Received: from mail.speakeasy.net (mail11.speakeasy.net [216.254.0.211]) by mx1.FreeBSD.org (Postfix) with ESMTP id 19DAD43E4A for ; Sun, 28 Jul 2002 20:42:17 -0700 (PDT) (envelope-from jhb@FreeBSD.org) Received: (qmail 22550 invoked from network); 29 Jul 2002 03:42:15 -0000 Received: from unknown (HELO server.baldwin.cx) ([216.27.160.63]) (envelope-sender ) by mail11.speakeasy.net (qmail-ldap-1.03) with DES-CBC3-SHA encrypted SMTP for ; 29 Jul 2002 03:42:15 -0000 Received: from laptop.baldwin.cx (laptop.baldwin.cx [192.168.0.4]) by server.baldwin.cx (8.12.5/8.12.5) with ESMTP id g6T3gEuR049031; Sun, 28 Jul 2002 23:42:14 -0400 (EDT) (envelope-from jhb@FreeBSD.org) Message-ID: X-Mailer: XFMail 1.5.2 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <200207282106.g6SL6FWT093267@freefall.freebsd.org> Date: Sun, 28 Jul 2002 23:42:22 -0400 (EDT) From: John Baldwin To: Don Lewis Subject: RE: cvs commit: src/sys/kern kern_sysctl.c Cc: cvs-all@FreeBSD.org, cvs-committers@FreeBSD.org Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On 28-Jul-2002 Don Lewis wrote: > truckman 2002/07/28 14:06:15 PDT > > Modified files: > sys/kern kern_sysctl.c > Log: > Make a temporary copy of the output data in the generic sysctl handlers > so that the data is less likely to be inconsistent if SYSCTL_OUT() blocks. > If the data is large, wire the output buffer instead. > > This is somewhat less than optimal, since the handler could skip the copy > if it knew that the data was static. > > If the data is dynamic, we are still not guaranteed to get a consistent > copy since another processor could change the data while the copy is in > progress because the data is not locked. This problem could be solved if > the generic handlers had the ability to grab the proper lock before the > copy and release it afterwards. > > This may duplicate work done in other sysctl handlers in the kernel which > also copy the data, possibly while a lock is held, before calling they call > a generic handler to output the data. These handlers should probably call > SYSCTL_OUT() directly. Actually, we need to rework the generic sysctl alogrithm in general to do copyin first of any new data values, lock, make changes and copy output to temporary variables, unlock, then do copyout. I talked about this in the SMPng document I posted several months ago but I guess few people read it. -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message