Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src Add kcpuset(9). Ok rmind@.



details:   https://anonhg.NetBSD.org/src/rev/b9a1b9e5d584
branches:  trunk
changeset: 770150:b9a1b9e5d584
user:      jruoho <jruoho%NetBSD.org@localhost>
date:      Thu Oct 06 05:23:39 2011 +0000

description:
Add kcpuset(9). Ok rmind@.

diffstat:

 distrib/sets/lists/comp/mi |   56 ++++++++++-
 share/man/man9/Makefile    |   21 +++-
 share/man/man9/kcpuset.9   |  230 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 304 insertions(+), 3 deletions(-)

diffs (truncated from 360 to 300 lines):

diff -r 89d48b332346 -r b9a1b9e5d584 distrib/sets/lists/comp/mi
--- a/distrib/sets/lists/comp/mi        Thu Oct 06 03:19:32 2011 +0000
+++ b/distrib/sets/lists/comp/mi        Thu Oct 06 05:23:39 2011 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: mi,v 1.1687 2011/10/03 13:12:15 roy Exp $
+#      $NetBSD: mi,v 1.1688 2011/10/06 05:23:39 jruoho Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -10076,6 +10076,24 @@
 ./usr/share/man/cat9/kauth.0                   comp-sys-catman         .cat
 ./usr/share/man/cat9/kcont.0                   comp-obsolete           obsolete
 ./usr/share/man/cat9/kcopy.0                   comp-sys-catman         .cat
+./usr/share/man/cat9/kcpuset.0                 comp-sys-catman         .cat
+./usr/share/man/cat9/kcpuset_create.0          comp-sys-catman         .cat
+./usr/share/man/cat9/kcpuset_destroy.0         comp-sys-catman         .cat
+./usr/share/man/cat9/kcpuset_copy.0            comp-sys-catman         .cat
+./usr/share/man/cat9/kcpuset_use.0             comp-sys-catman         .cat
+./usr/share/man/cat9/kcpuset_unuse.0           comp-sys-catman         .cat
+./usr/share/man/cat9/kcpuset_copyin.0          comp-sys-catman         .cat
+./usr/share/man/cat9/kcpuset_copyout.0         comp-sys-catman         .cat
+./usr/share/man/cat9/kcpuset_zero.0            comp-sys-catman         .cat
+./usr/share/man/cat9/kcpuset_fill.0            comp-sys-catman         .cat
+./usr/share/man/cat9/kcpuset_set.0             comp-sys-catman         .cat
+./usr/share/man/cat9/kcpuset_clear.0           comp-sys-catman         .cat
+./usr/share/man/cat9/kcpuset_isset.0           comp-sys-catman         .cat
+./usr/share/man/cat9/kcpuset_iszero.0          comp-sys-catman         .cat
+./usr/share/man/cat9/kcpuset_match.0           comp-sys-catman         .cat
+./usr/share/man/cat9/kcpuset_merge.0           comp-sys-catman         .cat
+./usr/share/man/cat9/kcpuset_atomic_set.0      comp-sys-catman         .cat
+./usr/share/man/cat9/kcpuset_atomic_clear.0    comp-sys-catman         .cat
 ./usr/share/man/cat9/kernacc.0                 comp-obsolete           obsolete
 ./usr/share/man/cat9/kfilter_register.0                comp-sys-catman         .cat
 ./usr/share/man/cat9/kfilter_unregister.0      comp-sys-catman         .cat
@@ -16152,6 +16170,24 @@
 ./usr/share/man/html9/itimerfix.html           comp-sys-htmlman        html
 ./usr/share/man/html9/kauth.html               comp-sys-htmlman        html
 ./usr/share/man/html9/kcopy.html               comp-sys-htmlman        html
+./usr/share/man/html9/kcpuset.html             comp-sys-htmlman        html
+./usr/share/man/html9/kcpuset_create.html      comp-sys-htmlman        html
+./usr/share/man/html9/kcpuset_destroy.html     comp-sys-htmlman        html
+./usr/share/man/html9/kcpuset_copy.html                comp-sys-htmlman        html
+./usr/share/man/html9/kcpuset_use.html         comp-sys-htmlman        html
+./usr/share/man/html9/kcpuset_unuse.html       comp-sys-htmlman        html
+./usr/share/man/html9/kcpuset_copyin.html      comp-sys-htmlman        html
+./usr/share/man/html9/kcpuset_copyout.html     comp-sys-htmlman        html
+./usr/share/man/html9/kcpuset_zero.html                comp-sys-htmlman        html
+./usr/share/man/html9/kcpuset_fill.html                comp-sys-htmlman        html
+./usr/share/man/html9/kcpuset_set.html         comp-sys-htmlman        html
+./usr/share/man/html9/kcpuset_clear.html       comp-sys-htmlman        html
+./usr/share/man/html9/kcpuset_isset.html       comp-sys-htmlman        html
+./usr/share/man/html9/kcpuset_iszero.html      comp-sys-htmlman        html
+./usr/share/man/html9/kcpuset_match.html       comp-sys-htmlman        html
+./usr/share/man/html9/kcpuset_merge.html       comp-sys-htmlman        html
+./usr/share/man/html9/kcpuset_atomic_set.html  comp-sys-htmlman        html
+./usr/share/man/html9/kcpuset_atomic_clear.html        comp-sys-htmlman        html
 ./usr/share/man/html9/kfilter_register.html    comp-sys-htmlman        html
 ./usr/share/man/html9/kfilter_unregister.html  comp-sys-htmlman        html
 ./usr/share/man/html9/killproc.html            comp-sys-htmlman        html
@@ -22383,6 +22419,24 @@
 ./usr/share/man/man9/kauth.9                   comp-sys-man            .man
 ./usr/share/man/man9/kcont.9                   comp-obsolete           obsolete
 ./usr/share/man/man9/kcopy.9                   comp-sys-man            .man
+./usr/share/man/man9/kcpuset.9                 comp-sys-man            .man
+./usr/share/man/man9/kcpuset_create.9          comp-sys-man            .man
+./usr/share/man/man9/kcpuset_destroy.9         comp-sys-man            .man
+./usr/share/man/man9/kcpuset_copy.9            comp-sys-man            .man
+./usr/share/man/man9/kcpuset_use.9             comp-sys-man            .man
+./usr/share/man/man9/kcpuset_unuse.9           comp-sys-man            .man
+./usr/share/man/man9/kcpuset_copyin.9          comp-sys-man            .man
+./usr/share/man/man9/kcpuset_copyout.9         comp-sys-man            .man
+./usr/share/man/man9/kcpuset_zero.9            comp-sys-man            .man
+./usr/share/man/man9/kcpuset_fill.9            comp-sys-man            .man
+./usr/share/man/man9/kcpuset_set.9             comp-sys-man            .man
+./usr/share/man/man9/kcpuset_clear.9           comp-sys-man            .man
+./usr/share/man/man9/kcpuset_isset.9           comp-sys-man            .man
+./usr/share/man/man9/kcpuset_iszero.9          comp-sys-man            .man
+./usr/share/man/man9/kcpuset_match.9           comp-sys-man            .man
+./usr/share/man/man9/kcpuset_merge.9           comp-sys-man            .man
+./usr/share/man/man9/kcpuset_atomic_set.9      comp-sys-man            .man
+./usr/share/man/man9/kcpuset_atomic_clear.9    comp-sys-man            .man
 ./usr/share/man/man9/kernacc.9                 comp-obsolete           obsolete
 ./usr/share/man/man9/kfilter_register.9                comp-sys-man            .man
 ./usr/share/man/man9/kfilter_unregister.9      comp-sys-man            .man
diff -r 89d48b332346 -r b9a1b9e5d584 share/man/man9/Makefile
--- a/share/man/man9/Makefile   Thu Oct 06 03:19:32 2011 +0000
+++ b/share/man/man9/Makefile   Thu Oct 06 05:23:39 2011 +0000
@@ -1,4 +1,4 @@
-#       $NetBSD: Makefile,v 1.353 2011/09/30 15:47:20 njoly Exp $
+#       $NetBSD: Makefile,v 1.354 2011/10/06 05:23:41 jruoho Exp $
 
 #      Makefile for section 9 (kernel function and variable) manual pages.
 
@@ -26,7 +26,7 @@
        ieee80211_radiotap.9 iic.9 imax.9 \
        in_getifa.9 \
        in4_cksum.9 inittodr.9 intro.9 ioasic.9 ioctl.9 ipkdb.9 isa.9 \
-       isapnp.9 itimerfix.9 kauth.9 kcopy.9 kmem.9 \
+       isapnp.9 itimerfix.9 kauth.9 kcopy.9 kcpuset.9 kmem.9 \
        kpause.9 \
        kfilter_register.9 knote.9 \
        kprintf.9 kthread.9 linedisc.9 lock.9 log.9 ltsleep.9 \
@@ -375,6 +375,23 @@
        isapnp.9 isapnp_unconfig.9
 MLINKS+=knote.9 KNOTE.9 \
        kfilter_register.9 kfilter_unregister.9
+MLINKS+=kcpuset.9 kcpuset_create.9 \
+       kcpuset.9 kcpuset_destroy.9 \
+       kcpuset.9 kcpuset_copy.9 \
+       kcpuset.9 kcpuset_use.9 \
+       kcpuset.9 kcpuset_unuse.9 \
+       kcpuset.9 kcpuset_copyin.9 \
+       kcpuset.9 kcpuset_copyout.9 \
+       kcpuset.9 kcpuset_zero.9 \
+       kcpuset.9 kcpuset_fill.9 \
+       kcpuset.9 kcpuset_set.9 \
+       kcpuset.9 kcpuset_clear.9 \
+       kcpuset.9 kcpuset_isset.9 \
+       kcpuset.9 kcpuset_iszero.9 \
+       kcpuset.9 kcpuset_match.9 \
+       kcpuset.9 kcpuset_merge.9 \
+       kcpuset.9 kcpuset_atomic_set.9 \
+       kcpuset.9 kcpuset_atomic_clear.9
 MLINKS+=kmem.9 kmem_alloc.9 \
        kmem.9 kmem_free.9 \
        kmem.9 kmem_zalloc.9 \
diff -r 89d48b332346 -r b9a1b9e5d584 share/man/man9/kcpuset.9
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/share/man/man9/kcpuset.9  Thu Oct 06 05:23:39 2011 +0000
@@ -0,0 +1,230 @@
+.\" $NetBSD: kcpuset.9,v 1.1 2011/10/06 05:23:41 jruoho Exp $ */
+.\"
+.\" Copyright (c) 2011 Jukka Ruohonen <jruohonen.iki.fi>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\"
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice, this list of conditions and the following disclaimer in the
+.\"    documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.Dd October 6, 2011
+.Dt KCPUSET 9
+.Os
+.Sh NAME
+.Nm kcpuset ,
+.Nm kcpuset_create ,
+.Nm kcpuset_destroy ,
+.Nm kcpuset_copy ,
+.Nm kcpuset_use ,
+.Nm kcpuset_unuse ,
+.Nm kcpuset_copyin ,
+.Nm kcpuset_copyout ,
+.Nm kcpuset_zero ,
+.Nm kcpuset_fill ,
+.Nm kcpuset_set ,
+.Nm kcpuset_clear ,
+.Nm kcpuset_isset ,
+.Nm kcpuset_iszero ,
+.Nm kcpuset_match ,
+.Nm kcpuset_merge ,
+.Nm kcpuset_atomic_set ,
+.Nm kcpuset_atomic_clear
+.Nd dynamic kernel CPU sets
+.Sh SYNOPSIS
+.In sys/kcpuset.h
+.Ft void
+.Fn kcpuset_create "kcpuset_t **retkcp" "bool zero"
+.Ft void
+.Fn kcpuset_destroy "kcpuset_t *kcp"
+.Ft void
+.Fn kcpuset_copy "kcpuset_t *dkcp" "kcpuset_t *skcp"
+.Ft void
+.Fn kcpuset_use "kcpuset_t *kcp"
+.Ft void
+.Fn kcpuset_unuse "kcpuset_t *kcp" "kcpuset_t **lst"
+.Ft int
+.Fn kcpuset_copyin "const cpuset_t *ucp" "kcpuset_t *kcp" "size_t len"
+.Ft int
+.Fn kcpuset_copyout "kcpuset_t *kcp" "cpuset_t *ucp" "size_t len"
+.Ft void
+.Fn kcpuset_zero "kcpuset_t *kcp"
+.Ft void
+.Fn kcpuset_fill "kcpuset_t *kcp"
+.Ft void
+.Fn kcpuset_set "kcpuset_t *kcp" "cpuid_t cpu"
+.Ft void
+.Fn kcpuset_clear "kcpuset_t *kcp" "cpuid_t cpu"
+.Ft int
+.Fn kcpuset_isset "kcpuset_t * kcp" "cpuid_t cpu"
+.Ft bool
+.Fn kcpuset_iszero "kcpuset_t *kcp"
+.Ft bool
+.Fn kcpuset_match "const kcpuset_t *kcp1" "const kcpuset_t *kcp2"
+.Ft void
+.Fn kcpuset_merge "kcpuset_t *kcp1" "kcpuset_t *kcp2"
+.Ft void
+.Fn kcpuset_atomic_set "kcpuset_t *kcp" "cpuid_t cpu"
+.Ft void
+.Fn kcpuset_atomic_clear "kcpuset_t *kcp" "cpuid_t cpu"
+.Sh DESCRIPTION
+The machine-independent
+.Nm
+subsystem provides support for dynamic processor sets.
+Conceptually
+.Nm
+can be understood to be the kernel equivalent of the user space
+.Xr cpuset 3
+interface.
+.Sh FUNCTIONS
+.Bl -tag -width compact
+.It Fn kcpuset_create "retkcp" "zero"
+The
+.Fn kcpuset_create
+function creates a dynamic
+.Tn CPU
+set and stores the result to
+.Fa retkcp .
+If the boolean
+.Fa zero
+is not false, the allocated set is also initialized to zero.
+.It Fn kcpuset_destroy "kcp"
+Destroys the
+.Tn CPU
+set
+.Fa kcp
+and schedules any linked CPU sets for deferred destruction.
+.It Fn kcpuset_copy "dkcp" "skcp"
+Copies the
+.Tn CPU
+set pointed by
+.Fa skcp
+to
+.Fa dkcp .
+.It Fn kcpuset_use "kcp"
+Marks
+.Fa kcp
+as being in use by increasing the reference count of the object.
+Note that initially
+.Fn kcpuset_create
+sets the reference count to 1.
+.It Fn kcpuset_unuse "kcp" "lst"
+Decreases the internal reference count of
+.Fa kcp ,
+and on the last reference (when the count reaches zero), destroys
+.Fa kcp .
+If
+.Fa lst
+is not
+.Dv NULL ,
+then instead of destroying,
+.Fa kcp
+will be added to the
+.Fa lst
+list for a deferred destruction.
+.It Fn kcpuset_copyin "ucp" "kcp" "len"
+Copies the
+.Fa len
+bytes long user-space
+.Tn CPU
+set
+.Fa ucp
+to the kernel
+.Tn CPU
+set
+.Fa kcp .
+.It Fn kcpuset_copyout "kcp" "ucp" "len"
+Copies the kernel
+.Tn CPU
+set
+.Fa kcp
+to the user-space
+.Tn CPU
+set
+.Fa ucp .
+.It Fn kcpuset_zero "kcp"
+Clears the set
+.Fa kcp .
+.It Fn kcpuset_fill "kcp"
+Fills the whole set
+.Fa kcp
+with ones.
+.It Fn kcpuset_set "kcp" "cpu"
+Adds



Home | Main Index | Thread Index | Old Index