Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 28 Jul 2002 23:42:22 -0400 (EDT)
From:      John Baldwin <jhb@FreeBSD.org>
To:        Don Lewis <truckman@FreeBSD.org>
Cc:        cvs-all@FreeBSD.org, cvs-committers@FreeBSD.org
Subject:   RE: cvs commit: src/sys/kern kern_sysctl.c
Message-ID:  <XFMail.20020728234222.jhb@FreeBSD.org>
In-Reply-To: <200207282106.g6SL6FWT093267@freefall.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

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 <jhb@FreeBSD.org>  <><  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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.20020728234222.jhb>