From owner-freebsd-arch@FreeBSD.ORG Sun Jan 16 01:10:33 2011 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5BA19106564A; Sun, 16 Jan 2011 01:10:33 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50]) by mx1.freebsd.org (Postfix) with ESMTP id BD2A78FC08; Sun, 16 Jan 2011 01:10:32 +0000 (UTC) Received: by wwf26 with SMTP id 26so4195901wwf.31 for ; Sat, 15 Jan 2011 17:10:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=2ee/h2P9NdKAwxIVUvaI7SS1i879NYuVjUI8lhAdwbY=; b=GnhbcbNNFEq4OsCR2F1z9WztzaoaiNHQUXJBFxoYRpKHftgNqoXtk8hI9T21gjpE9j Ji0tK/7U3DgARdnkKzatUA2RZN6x8E8Rsiqky0YVTwOX6vJqZ9X7sDXzqdaYQcWH/vSe aCE9WLwSaYI0RheZy5z5ryYCgGwW4oCgmeQH4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=fhiBjd+gh9Un2ceN3G4GUhPRtsOyFR+3J3TExyUZLv7+QusCJWGgEFtIvi/lnkw6HV u+yAENmc5WlehVTq+XeZ/cZN7qYa2daFZTszzD6+U5XhJ2Vq7AghHbrJkqGueKGtArc3 HYtBVinPiHQXHB0b1jdlnmPnzMx5Mn55MfyNE= MIME-Version: 1.0 Received: by 10.216.30.137 with SMTP id k9mr2026912wea.31.1295140231581; Sat, 15 Jan 2011 17:10:31 -0800 (PST) Sender: yanegomi@gmail.com Received: by 10.216.254.226 with HTTP; Sat, 15 Jan 2011 17:10:31 -0800 (PST) In-Reply-To: References: Date: Sat, 15 Jan 2011 17:10:31 -0800 X-Google-Sender-Auth: HJ5AnRqLuxC40OuBzhyEwPk7WM8 Message-ID: From: Garrett Cooper To: mdf@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: FreeBSD Arch Subject: Re: Automagic SYSCTLs X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Jan 2011 01:10:33 -0000 On Sat, Jan 15, 2011 at 4:12 PM, wrote: > I started out with a plan to import a patch from Isilon that adds > type-safety to the existing SYSCTLs for scalar variables in the > kernel. =A0After the discussion on the svn mailing list here > (http://lists.freebsd.org/pipermail/svn-src-head/2011-January/024097.html= ) > I now have a prototype patch for SYSCTL_ADD_SCALAR that could replace > most uses of SYSCTL_ADD_{INT, UINT, LONG, ULONG, QUAD} and is suitable > for the SYSCTL_ADD_FOO that are used on 16 and 8 bit members (without > type checking) today. > > The gist is that the handler knows the sizeof the variable in the > kernel and uses this to copy out. =A0For the case of a long, there's > some goop for SCTL_MASK32. =A0For the case of 8 and 16 bit variables, > they are still copied in and out as 32-bit quantities. > > Let me know if this seems like the right or wrong direction in which > to move. =A0I haven't tackled the static sysctls as the code I have does > some run-time evaluation because the code is easier to write that way. > =A0One possibility is to change the sysctl_oid struct or at least add a > SIGNED flag; this would also have the advantage of making it possible > to clean up the CTLTYPE_[U]INT issue where there is no real difference > between the two CTLTYPEs. > > http://people.freebsd.org/~mdf/bsd-sysctl-scalar.diff Looks interesting, but what are the performance implications of the new log= ic? Thanks, -Garrett