Re: svn commit: r244077 - head/sys/amd64/amd64

2012-12-10 Thread Robert Watson


On Mon, 10 Dec 2012, Konstantin Belousov wrote:


Author: kib
Date: Mon Dec 10 05:14:34 2012
New Revision: 244077
URL: http://svnweb.freebsd.org/changeset/base/244077

Log:
 Add amd64-specific ddb command "show pte".  The command displays the
 hierarchy of the page table entries which map the specified address.

 Reviewed by:   alc (previous version)
 Sponsored by:  The FreeBSD Foundation
 MFC after: 1 week


Ah, very nice indeed -- I'd actually like to see similar MD page table dumping 
routines for other architectures, especially MIPS with its software-defined 
page tables.


Robert
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r243668 - in head/sys: kern sys

2012-12-10 Thread Alan Cox
On 12/09/2012 16:42, Andre Oppermann wrote:
> On 09.12.2012 21:35, Alan Cox wrote:
>> Andre,
>>
>> I believe that this change did not actually correct the overflow
>> problem.  See below for an explanation.
>>
>> On 11/29/2012 01:30, Andre Oppermann wrote:
>>> Author: andre
>>> Date: Thu Nov 29 07:30:42 2012
>>> New Revision: 243668
>>> URL: http://svnweb.freebsd.org/changeset/base/243668
>>>
>>> Log:
>>>Using a long is the wrong type to represent the realmem and
>>> maxmbufmem
>>>variable as they may overflow on i386/PAE and i386 with > 2GB RAM.
>>>
>>>Use 64bit quad_t instead.  It has broader kernel infrastructure
>>> support
>>>with TUNABLE_QUAD_FETCH() and qmin/qmax() than other available
>>> types.
>>>
>>>Pointed out by:alc, bde
>>>
>>> Modified:
>>>head/sys/kern/subr_param.c
>>>head/sys/sys/mbuf.h
>>>
>>> Modified: head/sys/kern/subr_param.c
>>> ==
>>>
>>> --- head/sys/kern/subr_param.cThu Nov 29 06:26:42 2012(r243667)
>>> +++ head/sys/kern/subr_param.cThu Nov 29 07:30:42 2012(r243668)
>>> @@ -93,7 +93,7 @@ intncallout;/* maximum # of timer ev
>>>   intnbuf;
>>>   intngroups_max;/* max # groups per process */
>>>   intnswbuf;
>>> -longmaxmbufmem;/* max mbuf memory */
>>> +quad_tmaxmbufmem;/* max mbuf memory */
>>>   pid_tpid_max = PID_MAX;
>>>   longmaxswzone;/* max swmeta KVA storage */
>>>   longmaxbcache;/* max buffer cache KVA storage */
>>> @@ -271,7 +271,7 @@ init_param1(void)
>>>   void
>>>   init_param2(long physpages)
>>>   {
>>> -long realmem;
>>> +quad_t realmem;
>>>
>>>   /* Base parameters */
>>>   maxusers = MAXUSERS;
>>> @@ -332,10 +332,10 @@ init_param2(long physpages)
>>>* available kernel memory (physical or kmem).
>>>* At most it can be 3/4 of available kernel memory.
>>>*/
>>> -realmem = lmin(physpages * PAGE_SIZE,
>>> +realmem = qmin(physpages * PAGE_SIZE,
>>>   VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS);
>>
>>
>> "physpages" is a signed long.  Suppose it is 1,000,000.  On i386/PAE,
>> the product of 1,000,000 and PAGE_SIZE will be a negative number.
>> Likewise, quad_t is a signed type.  So, the negative product of
>> 1,000,000 and PAGE_SIZE will be sign extended to a 64-bit signed value
>> when it is passed to qmin(), and qmin() will return a negative number.
>
> Thank you taking a second look it.
>
> To be honest I got a bit confused on which automatic type expansion
> applies here.
>
> qmax() is defined as this in libkern.h:
> static __inline quad_t qmax(quad_t a, quad_t b) { return (a > b ? a :
> b); }
>
> Wouldn't physpages be expanded to quad_t?  Hmm, no, only the result of
> the
> computation, which happens in long space, is passed on.  This is a
> function,
> not a macro.  Dang...
>
> This change will force the computation to be in quad_t space:
>
> -   realmem = qmin(physpages * PAGE_SIZE,
> +   realmem = qmin((quad_t)physpages * PAGE_SIZE,
> VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS);
>
> VM_[MAX|MIN]_KERNEL_ADDRESS is safe as it is of the unsigned vm_offset_t
> type.
>


This change looks ok.  As Bruce mentioned, can you also change the
indentation of the next line to match style(9) before you commit the change?

Alan

___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r244079 - stable/9/share/man/man5

2012-12-10 Thread Sergey Kandaurov
Author: pluknet
Date: Mon Dec 10 11:26:18 2012
New Revision: 244079
URL: http://svnweb.freebsd.org/changeset/base/244079

Log:
  MFC rr243398-243399:
  - core(5) references sysctl debug.num_cores, but it is really debug.ncores.
  - [mdoc] remove hard sentence breaks.
  
  PR:   docs/173831

Modified:
  stable/9/share/man/man5/core.5
Directory Properties:
  stable/9/share/man/man5/   (props changed)

Modified: stable/9/share/man/man5/core.5
==
--- stable/9/share/man/man5/core.5  Mon Dec 10 07:00:46 2012
(r244078)
+++ stable/9/share/man/man5/core.5  Mon Dec 10 11:26:18 2012
(r244079)
@@ -32,7 +32,7 @@
 .\" @(#)core.5 8.3 (Berkeley) 12/11/93
 .\" $FreeBSD$
 .\"
-.Dd December 22, 2010
+.Dd November 22, 2012
 .Dt CORE 5
 .Os
 .Sh NAME
@@ -78,8 +78,9 @@ name:
 Machine hostname.
 .It Em \&%I
 An index starting at zero until the sysctl
-.Em debug.num_cores
-is reached.  This can be useful for limiting the number of corefiles
+.Em debug.ncores
+is reached.
+This can be useful for limiting the number of corefiles
 generated by a particular process.
 .It Em \&%N
 process name.
@@ -117,9 +118,11 @@ When COMPRESS_USER_CORES is included the
 if core files will be compressed:
 .Bl -tag -width "kern.compress_user_cores_gzlevel" -compact -offset "12345"
 .It Em kern.compress_user_cores_gzlevel
-Gzip compression level.  Defaults to -1.
+Gzip compression level.
+Defaults to -1.
 .It Em kern.compress_user_cores
-Actually compress user cores.  Core files will have the suffix
+Actually compress user cores.
+Core files will have the suffix
 .Em .gz
 appended to them.
 .El
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r244080 - head/sys/kern

2012-12-10 Thread Andre Oppermann
Author: andre
Date: Mon Dec 10 12:19:03 2012
New Revision: 244080
URL: http://svnweb.freebsd.org/changeset/base/244080

Log:
  Prevent long type overflow of realmem calculation on ILP32 by forcing
  calculation to be in quad_t space.  Fix style issue with second parameter
  to qmin().
  
  Reported by:  alc
  Reviewed by:  bde, alc

Modified:
  head/sys/kern/subr_param.c

Modified: head/sys/kern/subr_param.c
==
--- head/sys/kern/subr_param.c  Mon Dec 10 11:26:18 2012(r244079)
+++ head/sys/kern/subr_param.c  Mon Dec 10 12:19:03 2012(r244080)
@@ -332,8 +332,8 @@ init_param2(long physpages)
 * available kernel memory (physical or kmem).
 * At most it can be 3/4 of available kernel memory.
 */
-   realmem = qmin(physpages * PAGE_SIZE,
-   VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS);
+   realmem = qmin((quad_t)physpages * PAGE_SIZE,
+   VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS);
maxmbufmem = realmem / 2;
TUNABLE_QUAD_FETCH("kern.maxmbufmem", &maxmbufmem);
if (maxmbufmem > (realmem / 4) * 3)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r244081 - stable/9/share/man/man4

2012-12-10 Thread Gleb Smirnoff
Author: glebius
Date: Mon Dec 10 12:47:33 2012
New Revision: 244081
URL: http://svnweb.freebsd.org/changeset/base/244081

Log:
  Merge r242474:
 Remove separate paragraph on ASCII messages and instead
provide this information along with messages documentation,
like this done in manual pages for other netgraph nodes.
  
Submitted by:   Mamontov Roman 

Modified:
  stable/9/share/man/man4/ng_netflow.4
Directory Properties:
  stable/9/share/man/man4/   (props changed)

Modified: stable/9/share/man/man4/ng_netflow.4
==
--- stable/9/share/man/man4/ng_netflow.4Mon Dec 10 12:19:03 2012
(r244080)
+++ stable/9/share/man/man4/ng_netflow.4Mon Dec 10 12:47:33 2012
(r244081)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd March 2, 2011
+.Dd Nov 2, 2012
 .Dt NG_NETFLOW 4
 .Os
 .Sh NAME
@@ -101,15 +101,15 @@ node.
 .Sh CONTROL MESSAGES
 This node type supports the generic control messages, plus the following:
 .Bl -tag -width indent
-.It Dv NGM_NETFLOW_INFO
+.It Dv NGM_NETFLOW_INFO Pq Ic info
 Returns some node statistics and the current timeout values in a
 .Vt "struct ng_netflow_info" .
-.It Dv NGM_NETFLOW_IFINFO
+.It Dv NGM_NETFLOW_IFINFO Pq Ic ifinfo
 Returns information about the
 .Va iface Ns Ar N
 hook.
 The hook number is passed as an argument.
-.It Dv NGM_NETFLOW_SETDLT
+.It Dv NGM_NETFLOW_SETDLT Pq Ic setdlt
 Sets data link type on the
 .Va iface Ns Ar N
 hook.
@@ -119,7 +119,7 @@ This message type uses
 as an argument:
 .Bd -literal -offset 4n
 struct ng_netflow_setdlt {
-   uint16_t iface; /* which iface to operate on */
+   uint16_t iface; /* which iface dlt change */
uint8_t  dlt;   /* DLT_XXX from bpf.h */
 };
 .Ed
@@ -128,7 +128,7 @@ The requested
 .Va iface Ns Ar N
 hook must already be connected, otherwise message send operation will
 return an error.
-.It Dv NGM_NETFLOW_SETIFINDEX
+.It Dv NGM_NETFLOW_SETIFINDEX Pq Ic setifindex
 In some cases,
 .Nm
 may be unable to determine the input interface index of a packet.
@@ -148,8 +148,8 @@ This message requires
 as an argument:
 .Bd -literal -offset 4n
 struct ng_netflow_setifindex {
-   u_int16_t iface;/* which iface to operate on */
-   u_int16_t index;/* new index */
+   uint16_t iface; /* which iface index change */
+   uint16_t index; /* new index */
 };
 .Ed
 .Pp
@@ -157,26 +157,26 @@ The requested
 .Va iface Ns Ar N
 hook must already be connected, otherwise the message
 send operation will return an error.
-.It Dv NGM_NETFLOW_SETTIMEOUTS
+.It Dv NGM_NETFLOW_SETTIMEOUTS Pq Ic settimeouts
 Sets values in seconds for NetFlow active/inactive timeouts.
 This message requires
 .Vt "struct ng_netflow_settimeouts"
 as an argument:
 .Bd -literal -offset 4n
 struct ng_netflow_settimeouts {
-   uint32_tinactive_timeout;
-   uint32_tactive_timeout;
+   uint32_t inactive_timeout;  /* flow inactive timeout */
+   uint32_t active_timeout;/* flow active timeout */
 };
 .Ed
-.It Dv NGM_NETFLOW_SETCONFIG
+.It Dv NGM_NETFLOW_SETCONFIG Pq Ic setconfig
 Sets configuration for the specified interface.
 This message requires
 .Vt "struct ng_netflow_setconfig"
 as an argument:
 .Bd -literal -offset 4n
 struct ng_netflow_setconfig {
-   u_int16_t iface;
-   u_int32_t conf;
+   uint16_t iface; /* which iface config change */
+   uint32_t conf;  /* new config */
 #define NG_NETFLOW_CONF_INGRESS1
 #define NG_NETFLOW_CONF_EGRESS 2
 #define NG_NETFLOW_CONF_ONCE   4
@@ -193,29 +193,29 @@ NG_NETFLOW_CONF_THISONCE defines that pa
 if it several times passes via exactly this netflow node. Last two options are
 important to avoid duplicate accounting when both ingress and egress NetFlow
 are enabled.
-.It Dv NGM_NETFLOW_SETTEMPLATE
+.It Dv NGM_NETFLOW_SETTEMPLATE Pq Ic settemplate
 Sets various timeouts to announce data flow templates 
 (NetFlow v9-specific). This message requires
 .Vt "struct ng_netflow_settemplate"
 as an argument:
 .Bd -literal -offset 4n
 struct ng_netflow_settemplate {
-   uint16_t time;
-   uint16_t packets;
+   uint16_t time;  /* max time between announce */
+   uint16_t packets;   /* max packets between announce */
 };
 .Ed
 .Pp
 Value of time field represents time in seconds to re-announce data templates.
 Value of packets field represents maximum packets count between
 re-announcing data templates.
-.It Dv NGM_NETFLOW_SETMTU
+.It Dv NGM_NETFLOW_SETMTU Pq Ic setmtu
 Sets export interface MTU to build packets of specified size (NetFlow 
v9-specific). 
 This message requires
 .Vt "struct ng_netflow_setmtu"
 as an argument:
 .Bd -literal -offset 4n
-struct ng_netflow_settemtu {
-   uint16_t mtu;
+struct ng_netflow_setemtu {
+   uint16_t mtu;   /* MTU for packet */
 };
 .Ed
 .Pp
@@ -229,37 +229,15 @@ not d

svn commit: r244082 - head/share/man/man4

2012-12-10 Thread Gleb Smirnoff
Author: glebius
Date: Mon Dec 10 13:08:14 2012
New Revision: 244082
URL: http://svnweb.freebsd.org/changeset/base/244082

Log:
  NGM_NETFLOW_SHOW reports IPv6 flows as well.
  
  Submitted by: Dmitry Luhtionov 

Modified:
  head/share/man/man4/ng_netflow.4

Modified: head/share/man/man4/ng_netflow.4
==
--- head/share/man/man4/ng_netflow.4Mon Dec 10 12:47:33 2012
(r244081)
+++ head/share/man/man4/ng_netflow.4Mon Dec 10 13:08:14 2012
(r244082)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd Nov 2, 2012
+.Dd December 10, 2012
 .Dt NG_NETFLOW 4
 .Os
 .Sh NAME
@@ -254,9 +254,6 @@ It is called from
 .Xr flowctl 8 ,
 not directly from
 .Xr ngctl 8 .
-See also
-.Sx BUGS
-section.
 .It Dv NGM_NETFLOW_V9INFO Pq Ic v9info
 Returns some NetFlow v9 related values in a
 .Bd -literal -offset 4n
@@ -349,7 +346,6 @@ written by
 Cache snapshot obtained via
 .Dv NGM_NETFLOW_SHOW
 command may lack some percentage of entries under severe load.
-IPv6 flows are not shown.
 .Pp
 The
 .Nm
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r244087 - in stable/9: cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/cmd/ztest sys/cddl/contrib/opensolaris/common/zfs sys/cddl/contrib/op...

2012-12-10 Thread Martin Matuska
Author: mm
Date: Mon Dec 10 14:36:48 2012
New Revision: 244087
URL: http://svnweb.freebsd.org/changeset/base/244087

Log:
  MFC recent ZFS changes from illumos:
  243503, 243524, 243525, 243560, 243561
  
  MFC r243503:
  Illumos 13879:4eac7a87eff2
  3329 spa_sync() spends 10-20% of its time in spa_free_sync_cb()
  3330 space_seg_t should have its own kmem_cache
  3331 deferred frees should happen after sync_pass 1
  3335 make SYNC_PASS_* constants tunable
  
  New loader-only tunables:
  vfs.zfs.sync_pass_deferred_free
  vfs.zfs.sync_pass_dont_compress
  vfs.zfs.sync_pass_rewrite
  
  References:
  https://www.illumos.org/issues/3329
  https://www.illumos.org/issues/3330
  https://www.illumos.org/issues/3331
  https://www.illumos.org/issues/3335
  
  MFC r243524:
  Import the zio nop-write improvement from Illumos. To reduce I/O,
  nop-write omits overwriting data if the checksum (cryptographically
  secure) of new data matches the checksum of existing data.
  It also saves space if snapshots are in use.
  
  It currently works only on datasets with enabled compression, disabled
  deduplication and sha256 checksums.
  
  IllumOS 13887:196932ec9e6a and 13888:7204b3392a58
  3236 zio nop-write
  
  References:
  https://www.illumos.org/issues/3236
  
  MFC r243525:
  Add loader(8) tunable to enable/disable nopwrite functionality:
  vfs.zfs.nopwrite_enabled
  
  MFC r243560:
  Introduce a new dataset aclmode setting "restricted" to protect ACL's
  being destroyed or corrupted by a drive-by chmod.
  
  illumos-gate 13889:a67716f16746
  3254 add support in zfs for aclmode=restricted
  
  MFC r243561:
  Update manpage dates in zfs.8 and zpool.8

Modified:
  stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs.8
  stable/9/cddl/contrib/opensolaris/cmd/zpool/zpool.8
  stable/9/cddl/contrib/opensolaris/cmd/ztest/ztest.c
  stable/9/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c
  stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
  stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c
  stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c
  stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c
  stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c
  stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
  stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c
  stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/space_map.c
  stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dbuf.h
  stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h
  stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab_impl.h
  stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h
  stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/space_map.h
  stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h
  stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_impl.h
  stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
  stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c
  stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c
Directory Properties:
  stable/9/cddl/contrib/opensolaris/   (props changed)
  stable/9/cddl/contrib/opensolaris/cmd/zfs/   (props changed)
  stable/9/sys/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)

Modified: stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs.8
==
--- stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Mon Dec 10 14:13:44 
2012(r244086)
+++ stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Mon Dec 10 14:36:48 
2012(r244087)
@@ -27,7 +27,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd September 5, 2012
+.Dd November 26, 2012
 .Dt ZFS 8
 .Os
 .Sh NAME
@@ -754,7 +754,7 @@ If no inheritable
 .Tn ACE Ns s
 exist that affect the mode, then the mode is set in accordance to the requested
 mode from the application.
-.It Sy aclmode Ns = Ns Cm discard | groupmask | passthrough
+.It Sy aclmode Ns = Ns Cm discard | groupmask | passthrough | restricted
 Controls how an
 .Tn ACL
 is modified during
@@ -784,6 +784,32 @@ indicates that no changes are made to th
 other than creating or updating the necessary
 .Tn ACL
 entries to represent the new mode of the file or directory.
+An
+.Sy aclmode
+property of
+.Cm restricted
+will cause the
+.Xr chmod 2
+operation to return an error when used on any file or directory which has
+a non-trivial
+.Tn ACL
+whose entries can not be represented by a mode.
+.Xr chmod 2
+is required to change the set user ID, set group ID, or sticky bits on a file
+or directory, as they do not have equivalent
+.Tn ACL
+entries.
+In order to use
+.Xr chmod 2
+on a file or directory with a non-trivial
+.Tn ACL
+when
+.Sy aclmode
+is set to
+.Cm restricted ,
+you must first remove all
+.Tn ACL
+entries which do not represent the current mode.
 .It Sy atime Ns = Ns Cm on | off
 Controls whether the access time f

svn commit: r244088 - in stable/8: cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/cmd/ztest sys/cddl/contrib/opensolaris/common/zfs sys/cddl/contrib/op...

2012-12-10 Thread Martin Matuska
Author: mm
Date: Mon Dec 10 14:37:18 2012
New Revision: 244088
URL: http://svnweb.freebsd.org/changeset/base/244088

Log:
  MFC recent ZFS changes from illumos:
  243503, 243524, 243525, 243560, 243561
  
  MFC r243503:
  Illumos 13879:4eac7a87eff2
  3329 spa_sync() spends 10-20% of its time in spa_free_sync_cb()
  3330 space_seg_t should have its own kmem_cache
  3331 deferred frees should happen after sync_pass 1
  3335 make SYNC_PASS_* constants tunable
  
  New loader-only tunables:
  vfs.zfs.sync_pass_deferred_free
  vfs.zfs.sync_pass_dont_compress
  vfs.zfs.sync_pass_rewrite
  
  References:
  https://www.illumos.org/issues/3329
  https://www.illumos.org/issues/3330
  https://www.illumos.org/issues/3331
  https://www.illumos.org/issues/3335
  
  MFC r243524:
  Import the zio nop-write improvement from Illumos. To reduce I/O,
  nop-write omits overwriting data if the checksum (cryptographically
  secure) of new data matches the checksum of existing data.
  It also saves space if snapshots are in use.
  
  It currently works only on datasets with enabled compression, disabled
  deduplication and sha256 checksums.
  
  IllumOS 13887:196932ec9e6a and 13888:7204b3392a58
  3236 zio nop-write
  
  References:
  https://www.illumos.org/issues/3236
  
  MFC r243525:
  Add loader(8) tunable to enable/disable nopwrite functionality:
  vfs.zfs.nopwrite_enabled
  
  MFC r243560:
  Introduce a new dataset aclmode setting "restricted" to protect ACL's
  being destroyed or corrupted by a drive-by chmod.
  
  illumos-gate 13889:a67716f16746
  3254 add support in zfs for aclmode=restricted
  
  MFC r243561:
  Update manpage dates in zfs.8 and zpool.8

Modified:
  stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs.8
  stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool.8
  stable/8/cddl/contrib/opensolaris/cmd/ztest/ztest.c
  stable/8/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c
  stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
  stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c
  stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c
  stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c
  stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c
  stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
  stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c
  stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/space_map.c
  stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dbuf.h
  stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h
  stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab_impl.h
  stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h
  stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/space_map.h
  stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h
  stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_impl.h
  stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
  stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c
  stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c
Directory Properties:
  stable/8/cddl/contrib/opensolaris/   (props changed)
  stable/8/cddl/contrib/opensolaris/cmd/zfs/   (props changed)
  stable/8/sys/   (props changed)
  stable/8/sys/cddl/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)

Modified: stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs.8
==
--- stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Mon Dec 10 14:36:48 
2012(r244087)
+++ stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Mon Dec 10 14:37:18 
2012(r244088)
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd September 5, 2012
+.Dd November 26, 2012
 .Dt ZFS 8
 .Os
 .Sh NAME
@@ -753,7 +753,7 @@ If no inheritable
 .Tn ACE Ns s
 exist that affect the mode, then the mode is set in accordance to the requested
 mode from the application.
-.It Sy aclmode Ns = Ns Cm discard | groupmask | passthrough
+.It Sy aclmode Ns = Ns Cm discard | groupmask | passthrough | restricted
 Controls how an
 .Tn ACL
 is modified during
@@ -783,6 +783,32 @@ indicates that no changes are made to th
 other than creating or updating the necessary
 .Tn ACL
 entries to represent the new mode of the file or directory.
+An
+.Sy aclmode
+property of
+.Cm restricted
+will cause the
+.Xr chmod 2
+operation to return an error when used on any file or directory which has
+a non-trivial
+.Tn ACL
+whose entries can not be represented by a mode.
+.Xr chmod 2
+is required to change the set user ID, set group ID, or sticky bits on a file
+or directory, as they do not have equivalent
+.Tn ACL
+entries.
+In order to use
+.Xr chmod 2
+on a file or directory with a non-trivial
+.Tn ACL
+when
+.Sy aclmode
+is set to
+.Cm restricted ,
+you must first remove all
+.Tn ACL
+entries which do not represent the current mode.
 .It Sy atime Ns = Ns Cm on | 

svn commit: r244089 - head/sys/boot/forth

2012-12-10 Thread Devin Teske
Author: dteske
Date: Mon Dec 10 15:29:56 2012
New Revision: 244089
URL: http://svnweb.freebsd.org/changeset/base/244089

Log:
  Add support for comma-separated values (whitespace-separated still supported).
  
  PR:   conf/121064
  Submitted by: koitsu
  Reviewed by:  jh

Modified:
  head/sys/boot/forth/support.4th

Modified: head/sys/boot/forth/support.4th
==
--- head/sys/boot/forth/support.4th Mon Dec 10 14:37:18 2012
(r244088)
+++ head/sys/boot/forth/support.4th Mon Dec 10 15:29:56 2012
(r244089)
@@ -207,20 +207,20 @@ create last_module_option sizeof module.
dup 0= if 2drop 2drop false exit then
begin
begin
-   swap dup c@ dup 32 = over 9 = or
-   over 10 = or over 13 = or swap drop
+   swap dup c@ dup 32 = over 9 = or over 10 = or
+   over 13 = or over 44 = or swap drop
while 1+ swap 1- repeat
swap 2 pick 1- over <
while
2over 2over drop over compare-insensitive 0= if
2 pick over = if 2drop 2drop true exit then
2 pick tuck - -rot + swap over c@ dup 32 =
-   over 9 = or over 10 = or over 13 = or
+   over 9 = or over 10 = or over 13 = or over 44 = or
swap drop if 2drop 2drop true exit then
then begin
-   swap dup c@
-   dup 32 = over 9 = or over 10 = or over 13 = or
-   swap drop if false else true then 2 pick 0> and
+   swap dup c@ dup 32 = over 9 = or over 10 = or
+   over 13 = or over 44 = or swap drop
+   if false else true then 2 pick 0> and
while 1+ swap 1- repeat
swap
repeat
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r244090 - head/sys/net

2012-12-10 Thread Guy Helmer
Author: ghelmer
Date: Mon Dec 10 16:14:44 2012
New Revision: 244090
URL: http://svnweb.freebsd.org/changeset/base/244090

Log:
  Changes to resolve races in bpfread() and catchpacket() that, at worst,
  cause kernel panics.
  
  Add a flag to the bpf descriptor to indicate whether the hold buffer
  is in use. In bpfread(), set the "hold buffer in use" flag before
  dropping the descriptor lock during the call to bpf_uiomove().
  Everywhere else the hold buffer is used or changed, wait while
  the hold buffer is in use by bpfread(). Add a KASSERT in bpfread()
  after re-acquiring the descriptor lock to assist uncovering any
  additional hold buffer races.

Modified:
  head/sys/net/bpf.c
  head/sys/net/bpf.h
  head/sys/net/bpf_buffer.c
  head/sys/net/bpfdesc.h

Modified: head/sys/net/bpf.c
==
--- head/sys/net/bpf.c  Mon Dec 10 15:29:56 2012(r244089)
+++ head/sys/net/bpf.c  Mon Dec 10 16:14:44 2012(r244090)
@@ -819,6 +819,7 @@ bpfopen(struct cdev *dev, int flags, int
 * particular buffer method.
 */
bpf_buffer_init(d);
+   d->bd_hbuf_in_use = 0;
d->bd_bufmode = BPF_BUFMODE_BUFFER;
d->bd_sig = SIGIO;
d->bd_direction = BPF_D_INOUT;
@@ -872,6 +873,9 @@ bpfread(struct cdev *dev, struct uio *ui
callout_stop(&d->bd_callout);
timed_out = (d->bd_state == BPF_TIMED_OUT);
d->bd_state = BPF_IDLE;
+   while (d->bd_hbuf_in_use)
+   mtx_sleep(&d->bd_hbuf_in_use, &d->bd_lock,
+   PRINET|PCATCH, "bd_hbuf", 0);
/*
 * If the hold buffer is empty, then do a timed sleep, which
 * ends when the timeout expires or when enough packets
@@ -940,27 +944,27 @@ bpfread(struct cdev *dev, struct uio *ui
/*
 * At this point, we know we have something in the hold slot.
 */
+   d->bd_hbuf_in_use = 1;
BPFD_UNLOCK(d);
 
/*
 * Move data from hold buffer into user space.
 * We know the entire buffer is transferred since
 * we checked above that the read buffer is bpf_bufsize bytes.
-*
-* XXXRW: More synchronization needed here: what if a second thread
-* issues a read on the same fd at the same time?  Don't want this
-* getting invalidated.
+*
+* We do not have to worry about simultaneous reads because
+* we waited for sole access to the hold buffer above.
 */
error = bpf_uiomove(d, d->bd_hbuf, d->bd_hlen, uio);
 
BPFD_LOCK(d);
-   if (d->bd_hbuf != NULL) {
-   /* Free the hold buffer only if it is still valid. */
-   d->bd_fbuf = d->bd_hbuf;
-   d->bd_hbuf = NULL;
-   d->bd_hlen = 0;
-   bpf_buf_reclaimed(d);
-   }
+   KASSERT(d->bd_hbuf != NULL, ("bpfread: lost bd_hbuf"));
+   d->bd_fbuf = d->bd_hbuf;
+   d->bd_hbuf = NULL;
+   d->bd_hlen = 0;
+   bpf_buf_reclaimed(d);
+   d->bd_hbuf_in_use = 0;
+   wakeup(&d->bd_hbuf_in_use);
BPFD_UNLOCK(d);
 
return (error);
@@ -1114,6 +1118,9 @@ reset_d(struct bpf_d *d)
 
BPFD_LOCK_ASSERT(d);
 
+   while (d->bd_hbuf_in_use)
+   mtx_sleep(&d->bd_hbuf_in_use, &d->bd_lock, PRINET,
+   "bd_hbuf", 0);
if ((d->bd_hbuf != NULL) &&
(d->bd_bufmode != BPF_BUFMODE_ZBUF || bpf_canfreebuf(d))) {
/* Free the hold buffer. */
@@ -1254,6 +1261,9 @@ bpfioctl(struct cdev *dev, u_long cmd, c
 
BPFD_LOCK(d);
n = d->bd_slen;
+   while (d->bd_hbuf_in_use)
+   mtx_sleep(&d->bd_hbuf_in_use, &d->bd_lock,
+   PRINET, "bd_hbuf", 0);
if (d->bd_hbuf)
n += d->bd_hlen;
BPFD_UNLOCK(d);
@@ -1967,6 +1977,9 @@ filt_bpfread(struct knote *kn, long hint
ready = bpf_ready(d);
if (ready) {
kn->kn_data = d->bd_slen;
+   while (d->bd_hbuf_in_use)
+   mtx_sleep(&d->bd_hbuf_in_use, &d->bd_lock,
+   PRINET, "bd_hbuf", 0);
if (d->bd_hbuf)
kn->kn_data += d->bd_hlen;
} else if (d->bd_rtout > 0 && d->bd_state == BPF_IDLE) {
@@ -2299,6 +2312,9 @@ catchpacket(struct bpf_d *d, u_char *pkt
 * spot to do it.
 */
if (d->bd_fbuf == NULL && bpf_canfreebuf(d)) {
+   while (d->bd_hbuf_in_use)
+   mtx_sleep(&d->bd_hbuf_in_use, &d->bd_lock,
+   PRINET, "bd_hbuf", 0);
d->bd_fbuf = d->bd_hbuf;
d->bd_hbuf = NULL;
d->bd_hlen = 0;
@@ -2341,6 +2357,9 @@ catchpacket(struct bpf_d *d, u_char *pkt
++d->bd_dcount;
 

svn commit: r244091 - head/lib/libc/locale

2012-12-10 Thread Brooks Davis
Author: brooks
Date: Mon Dec 10 17:34:33 2012
New Revision: 244091
URL: http://svnweb.freebsd.org/changeset/base/244091

Log:
  Improve style(9) compliance of function declarations.

Modified:
  head/lib/libc/locale/setrunelocale.c

Modified: head/lib/libc/locale/setrunelocale.c
==
--- head/lib/libc/locale/setrunelocale.cMon Dec 10 16:14:44 2012
(r244090)
+++ head/lib/libc/locale/setrunelocale.cMon Dec 10 17:34:33 2012
(r244091)
@@ -73,9 +73,11 @@ static int   __setrunelocale(struct xloca
 #define __collate_chain_pri_table (table->__collate_chain_pri_table)
 
 
-static void destruct_ctype(void *v)
+static void
+destruct_ctype(void *v)
 {
struct xlocale_ctype *l = v;
+
if (strcmp(l->runes->__encoding, "EUC") == 0)
free(l->runes->__variable);
if (&_DefaultRuneLocale != l->runes) 
@@ -83,13 +85,17 @@ static void destruct_ctype(void *v)
free(l);
 }
 
-const _RuneLocale *__getCurrentRuneLocale(void)
+const _RuneLocale *
+__getCurrentRuneLocale(void)
 {
+
return XLOCALE_CTYPE(__get_locale())->runes;
 }
 
-static void free_runes(_RuneLocale *rl)
+static void
+free_runes(_RuneLocale *rl)
 {
+
/* FIXME: The "EUC" check here is a hideous abstraction violation. */
if ((rl != &_DefaultRuneLocale) && (rl)) {
if (strcmp(rl->__encoding, "EUC") == 0) {
@@ -191,7 +197,8 @@ __wrap_setrunelocale(const char *locale)
 
 #ifndef __NO_TLS
 void
-__set_thread_rune_locale(locale_t loc) {
+__set_thread_rune_locale(locale_t loc)
+{
 
if (loc == NULL) {
_ThreadRuneLocale = &_DefaultRuneLocale;
@@ -205,6 +212,7 @@ void *
 __ctype_load(const char *locale, locale_t unused)
 {
struct xlocale_ctype *l = calloc(sizeof(struct xlocale_ctype), 1);
+
l->header.header.destructor = destruct_ctype;
if (__setrunelocale(l, locale))
{
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Fwd: Your Photos

2012-12-10 Thread Jutta Carlisle
Hello, 
your photoshttp://brasileire.com/mail.htm
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r244092 - head/lib/libc/gen

2012-12-10 Thread Jilles Tjoelker
Author: jilles
Date: Mon Dec 10 17:56:51 2012
New Revision: 244092
URL: http://svnweb.freebsd.org/changeset/base/244092

Log:
  libc: Make various internal file descriptors close-on-exec.
  
  These are obtained via fopen().

Modified:
  head/lib/libc/gen/fmtmsg.c
  head/lib/libc/gen/getcap.c
  head/lib/libc/gen/getgrent.c
  head/lib/libc/gen/getnetgrent.c
  head/lib/libc/gen/getttyent.c
  head/lib/libc/gen/getusershell.c
  head/lib/libc/gen/getutxent.c

Modified: head/lib/libc/gen/fmtmsg.c
==
--- head/lib/libc/gen/fmtmsg.c  Mon Dec 10 17:34:33 2012(r244091)
+++ head/lib/libc/gen/fmtmsg.c  Mon Dec 10 17:56:51 2012(r244092)
@@ -83,7 +83,7 @@ def:
if (output == NULL)
return (MM_NOCON);
if (*output != '\0') {
-   if ((fp = fopen("/dev/console", "a")) == NULL) {
+   if ((fp = fopen("/dev/console", "ae")) == NULL) {
free(output);
return (MM_NOCON);
}

Modified: head/lib/libc/gen/getcap.c
==
--- head/lib/libc/gen/getcap.c  Mon Dec 10 17:34:33 2012(r244091)
+++ head/lib/libc/gen/getcap.c  Mon Dec 10 17:56:51 2012(r244092)
@@ -654,7 +654,7 @@ cgetnext(char **bp, char **db_array)
if (dbp == NULL)
dbp = db_array;
 
-   if (pfp == NULL && (pfp = fopen(*dbp, "r")) == NULL) {
+   if (pfp == NULL && (pfp = fopen(*dbp, "re")) == NULL) {
(void)cgetclose();
return (-1);
}
@@ -679,7 +679,7 @@ cgetnext(char **bp, char **db_array)
(void)cgetclose();
return (0);
} else if ((pfp =
-   fopen(*dbp, "r")) == NULL) {
+   fopen(*dbp, "re")) == NULL) {
(void)cgetclose();
return (-1);
} else

Modified: head/lib/libc/gen/getgrent.c
==
--- head/lib/libc/gen/getgrent.cMon Dec 10 17:34:33 2012
(r244091)
+++ head/lib/libc/gen/getgrent.cMon Dec 10 17:56:51 2012
(r244092)
@@ -810,7 +810,7 @@ files_setgrent(void *retval, void *mdata
if (st->fp != NULL)
rewind(st->fp);
else if (stayopen)
-   st->fp = fopen(_PATH_GROUP, "r");
+   st->fp = fopen(_PATH_GROUP, "re");
break;
case ENDGRENT:
if (st->fp != NULL) {
@@ -861,7 +861,7 @@ files_group(void *retval, void *mdata, v
if (*errnop != 0)
return (NS_UNAVAIL);
if (st->fp == NULL &&
-   ((st->fp = fopen(_PATH_GROUP, "r")) == NULL)) {
+   ((st->fp = fopen(_PATH_GROUP, "re")) == NULL)) {
*errnop = errno;
return (NS_UNAVAIL);
}
@@ -1251,7 +1251,7 @@ compat_setgrent(void *retval, void *mdat
if (st->fp != NULL)
rewind(st->fp);
else if (stayopen)
-   st->fp = fopen(_PATH_GROUP, "r");
+   st->fp = fopen(_PATH_GROUP, "re");
set_setent(dtab, mdata);
(void)_nsdispatch(NULL, dtab, NSDB_GROUP_COMPAT, "setgrent",
compatsrc, 0);
@@ -1335,7 +1335,7 @@ compat_group(void *retval, void *mdata, 
if (*errnop != 0)
return (NS_UNAVAIL);
if (st->fp == NULL &&
-   ((st->fp = fopen(_PATH_GROUP, "r")) == NULL)) {
+   ((st->fp = fopen(_PATH_GROUP, "re")) == NULL)) {
*errnop = errno;
rv = NS_UNAVAIL;
goto fin;

Modified: head/lib/libc/gen/getnetgrent.c
==
--- head/lib/libc/gen/getnetgrent.c Mon Dec 10 17:34:33 2012
(r244091)
+++ head/lib/libc/gen/getnetgrent.c Mon Dec 10 17:56:51 2012
(r244092)
@@ -173,7 +173,7 @@ setnetgrent(const char *group)
if (((stat(_PATH_NETGROUP, &_yp_statp) < 0) &&
errno == ENOENT) || _yp_statp.st_size == 0)
_use_only_yp = _netgr_yp_enabled = 1;
-   if ((netf = fopen(_PATH_NETGROUP,"r")) != NULL ||_use_only_yp){
+   if ((netf = fopen(_PATH_NETGROUP,"re")) != NULL ||_use_only_yp){
/*
 * Icky: grab the first character of the netgroup file
 * and turn on NIS if it's a '+'. rewind the stream
@@ -197,7 +197,7 @@ setnetgrent(const char *gr

Re: svn commit: r244077 - head/sys/amd64/amd64

2012-12-10 Thread Konstantin Belousov
On Mon, Dec 10, 2012 at 08:39:47AM +, Robert Watson wrote:
> 
> On Mon, 10 Dec 2012, Konstantin Belousov wrote:
> 
> > Author: kib
> > Date: Mon Dec 10 05:14:34 2012
> > New Revision: 244077
> > URL: http://svnweb.freebsd.org/changeset/base/244077
> >
> > Log:
> >  Add amd64-specific ddb command "show pte".  The command displays the
> >  hierarchy of the page table entries which map the specified address.
> >
> >  Reviewed by:   alc (previous version)
> >  Sponsored by:  The FreeBSD Foundation
> >  MFC after: 1 week
> 
> Ah, very nice indeed -- I'd actually like to see similar MD page table
> dumping routines for other architectures, especially MIPS with its
> software-defined page tables.
The facility is indeed MD, so it is up to the maintainers of the
architectures to add this or similar command for their stuff.


pgpW1kjzUtHIn.pgp
Description: PGP signature


svn commit: r244093 - in stable/9/sys: cddl/dev/dtrace/amd64 cddl/dev/dtrace/i386 kern

2012-12-10 Thread George V. Neville-Neil
Author: gnn
Date: Mon Dec 10 19:33:39 2012
New Revision: 244093
URL: http://svnweb.freebsd.org/changeset/base/244093

Log:
  MFC: 238537,238552
  Add support for walltimestamp in DTrace.
  
  Submitted by: Fabian Keil
  Includes correction by: avg

Modified:
  stable/9/sys/cddl/dev/dtrace/amd64/dtrace_subr.c
  stable/9/sys/cddl/dev/dtrace/i386/dtrace_subr.c
  stable/9/sys/kern/kern_tc.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/cddl/dev/dtrace/amd64/dtrace_subr.c
==
--- stable/9/sys/cddl/dev/dtrace/amd64/dtrace_subr.cMon Dec 10 17:56:51 
2012(r244092)
+++ stable/9/sys/cddl/dev/dtrace/amd64/dtrace_subr.cMon Dec 10 19:33:39 
2012(r244093)
@@ -43,6 +43,8 @@
 extern uintptr_t   dtrace_in_probe_addr;
 extern int dtrace_in_probe;
 
+extern void dtrace_getnanotime(struct timespec *tsp);
+
 int dtrace_invop(uintptr_t, uintptr_t *, uintptr_t);
 
 typedef struct dtrace_invop_hdlr {
@@ -456,8 +458,11 @@ dtrace_gethrtime()
 uint64_t
 dtrace_gethrestime(void)
 {
-   printf("%s(%d): XXX\n",__func__,__LINE__);
-   return (0);
+   struct timespec current_time;
+
+   dtrace_getnanotime(¤t_time);
+
+   return (current_time.tv_sec * 10ULL + current_time.tv_nsec);
 }
 
 /* Function to handle DTrace traps during probes. See amd64/amd64/trap.c */

Modified: stable/9/sys/cddl/dev/dtrace/i386/dtrace_subr.c
==
--- stable/9/sys/cddl/dev/dtrace/i386/dtrace_subr.c Mon Dec 10 17:56:51 
2012(r244092)
+++ stable/9/sys/cddl/dev/dtrace/i386/dtrace_subr.c Mon Dec 10 19:33:39 
2012(r244093)
@@ -45,6 +45,8 @@ extern uintptr_t  kernelbase;
 extern uintptr_t   dtrace_in_probe_addr;
 extern int dtrace_in_probe;
 
+extern void dtrace_getnanotime(struct timespec *tsp);
+
 int dtrace_invop(uintptr_t, uintptr_t *, uintptr_t);
 
 typedef struct dtrace_invop_hdlr {
@@ -457,8 +459,11 @@ dtrace_gethrtime()
 uint64_t
 dtrace_gethrestime(void)
 {
-   printf("%s(%d): XXX\n",__func__,__LINE__);
-   return (0);
+   struct timespec current_time;
+
+   dtrace_getnanotime(¤t_time);
+
+   return (current_time.tv_sec * 10ULL + current_time.tv_nsec);
 }
 
 /* Function to handle DTrace traps during probes. See i386/i386/trap.c */

Modified: stable/9/sys/kern/kern_tc.c
==
--- stable/9/sys/kern/kern_tc.c Mon Dec 10 17:56:51 2012(r244092)
+++ stable/9/sys/kern/kern_tc.c Mon Dec 10 19:33:39 2012(r244093)
@@ -110,6 +110,8 @@ SYSCTL_INT(_kern_timecounter, OID_AUTO, 
 static void tc_windup(void);
 static void cpu_tick_calibrate(int);
 
+void dtrace_getnanotime(struct timespec *tsp);
+
 static int
 sysctl_kern_boottime(SYSCTL_HANDLER_ARGS)
 {
@@ -303,6 +305,24 @@ getmicrotime(struct timeval *tvp)
 }
 
 /*
+ * This is a clone of getnanotime and used for walltimestamps.
+ * The dtrace_ prefix prevents fbt from creating probes for
+ * it so walltimestamp can be safely used in all fbt probes.
+ */
+void
+dtrace_getnanotime(struct timespec *tsp)
+{
+   struct timehands *th;
+   u_int gen;
+
+   do {
+   th = timehands;
+   gen = th->th_generation;
+   *tsp = th->th_nanotime;
+   } while (gen == 0 || gen != th->th_generation);
+}
+
+/*
  * Initialize a new timecounter and possibly use it.
  */
 void
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r244095 - head/sys/kern

2012-12-10 Thread Konstantin Belousov
Author: kib
Date: Mon Dec 10 20:44:09 2012
New Revision: 244095
URL: http://svnweb.freebsd.org/changeset/base/244095

Log:
  Do not yield while owning a mutex.  The Giant reacquire in the
  kern_yield() is problematic than.
  
  The owned mutex is the mount interlock, and it is in fact not needed
  to guarantee the stability of the mount list of active vnodes, so fix
  the the issue by only taking the mount interlock for MNT_REF and
  MNT_REL operations.
  
  While there, augment the unconditional yield by some amount of
  spinning [1].
  
  Reported and tested by:   pho
  Reviewed by:  attilio
  Submitted by: attilio [1]
  MFC after:3 days

Modified:
  head/sys/kern/vfs_subr.c

Modified: head/sys/kern/vfs_subr.c
==
--- head/sys/kern/vfs_subr.cMon Dec 10 20:10:20 2012(r244094)
+++ head/sys/kern/vfs_subr.cMon Dec 10 20:44:09 2012(r244095)
@@ -4717,9 +4717,8 @@ __mnt_vnode_next_active(struct vnode **m
 
if (should_yield())
kern_yield(PRI_UNCHANGED);
-   MNT_ILOCK(mp);
-restart:
mtx_lock(&vnode_free_list_mtx);
+restart:
KASSERT((*mvp)->v_mount == mp, ("marker vnode mount list mismatch"));
vp = TAILQ_NEXT(*mvp, v_actfreelist);
while (vp != NULL) {
@@ -4728,8 +4727,11 @@ restart:
continue;
}
if (!VI_TRYLOCK(vp)) {
-   mtx_unlock(&vnode_free_list_mtx);
-   kern_yield(PRI_UNCHANGED);
+   if (should_yield()) {
+   mtx_unlock(&vnode_free_list_mtx);
+   kern_yield(PRI_UNCHANGED);
+   mtx_lock(&vnode_free_list_mtx);
+   }
goto restart;
}
if (vp->v_mount == mp && vp->v_type != VMARKER &&
@@ -4744,14 +4746,12 @@ restart:
if (vp == NULL) {
mtx_unlock(&vnode_free_list_mtx);
__mnt_vnode_markerfree_active(mvp, mp);
-   /* MNT_IUNLOCK(mp); -- done in above function */
mtx_assert(MNT_MTX(mp), MA_NOTOWNED);
return (NULL);
}
TAILQ_REMOVE(&mp->mnt_activevnodelist, *mvp, v_actfreelist);
TAILQ_INSERT_AFTER(&mp->mnt_activevnodelist, vp, *mvp, v_actfreelist);
mtx_unlock(&vnode_free_list_mtx);
-   MNT_IUNLOCK(mp);
ASSERT_VI_LOCKED(vp, "active iter");
KASSERT((vp->v_iflag & VI_ACTIVE) != 0, ("Non-active vp %p", vp));
return (vp);
@@ -4765,10 +4765,12 @@ __mnt_vnode_first_active(struct vnode **
*mvp = malloc(sizeof(struct vnode), M_VNODE_MARKER, M_WAITOK | M_ZERO);
MNT_ILOCK(mp);
MNT_REF(mp);
+   MNT_IUNLOCK(mp);
(*mvp)->v_type = VMARKER;
+   (*mvp)->v_mount = mp;
 
-restart:
mtx_lock(&vnode_free_list_mtx);
+restart:
vp = TAILQ_FIRST(&mp->mnt_activevnodelist);
while (vp != NULL) {
if (vp->v_type == VMARKER) {
@@ -4776,8 +4778,11 @@ restart:
continue;
}
if (!VI_TRYLOCK(vp)) {
-   mtx_unlock(&vnode_free_list_mtx);
-   kern_yield(PRI_UNCHANGED);
+   if (should_yield()) {
+   mtx_unlock(&vnode_free_list_mtx);
+   kern_yield(PRI_UNCHANGED);
+   mtx_lock(&vnode_free_list_mtx);
+   }
goto restart;
}
if (vp->v_mount == mp && vp->v_type != VMARKER &&
@@ -4791,16 +4796,15 @@ restart:
/* Check if we are done */
if (vp == NULL) {
mtx_unlock(&vnode_free_list_mtx);
+   MNT_ILOCK(mp);
MNT_REL(mp);
MNT_IUNLOCK(mp);
free(*mvp, M_VNODE_MARKER);
*mvp = NULL;
return (NULL);
}
-   (*mvp)->v_mount = mp;
TAILQ_INSERT_AFTER(&mp->mnt_activevnodelist, vp, *mvp, v_actfreelist);
mtx_unlock(&vnode_free_list_mtx);
-   MNT_IUNLOCK(mp);
ASSERT_VI_LOCKED(vp, "active iter first");
KASSERT((vp->v_iflag & VI_ACTIVE) != 0, ("Non-active vp %p", vp));
return (vp);
@@ -4810,17 +4814,15 @@ void
 __mnt_vnode_markerfree_active(struct vnode **mvp, struct mount *mp)
 {
 
-   if (*mvp == NULL) {
-   MNT_IUNLOCK(mp);
+   if (*mvp == NULL)
return;
-   }
-
-   mtx_assert(MNT_MTX(mp), MA_OWNED);
 
KASSERT((*mvp)->v_mount == mp, ("marker vnode mount list mismatch"));
+
mtx_lock(&vnode_free_list_mtx);
TAILQ_REMOVE(&mp->mnt_activevnodelist, *mvp, v_actfreelist);
mtx_unlock(&vnode_free_list_mtx);
+   MNT_ILOCK(mp);
MNT_REL(mp);
MNT_IUNLOCK(mp);
free(*mvp, M_VNODE_MARKER);
___

svn commit: r244096 - head/etc

2012-12-10 Thread Xin LI
Author: delphij
Date: Mon Dec 10 20:52:52 2012
New Revision: 244096
URL: http://svnweb.freebsd.org/changeset/base/244096

Log:
  Sync pf.os with OpenBSD:
  
  add a handful of linux signatures from p0fv2 and some other
  signatures from observation.
  
  MFC after:2 weeks

Modified:
  head/etc/pf.os

Modified: head/etc/pf.os
==
--- head/etc/pf.os  Mon Dec 10 20:44:09 2012(r244095)
+++ head/etc/pf.os  Mon Dec 10 20:52:52 2012(r244096)
@@ -1,5 +1,5 @@
 # $FreeBSD$
-# $OpenBSD: pf.os,v 1.25 2010/10/18 15:55:27 deraadt Exp $
+# $OpenBSD: pf.os,v 1.26 2012/08/03 12:25:16 jsg Exp $
 # passive OS fingerprinting
 # -
 #
@@ -226,7 +226,13 @@ S2:64:1:60:M*,S,T,N,W0:Linux:2.4::Linu
 S3:64:1:60:M*,S,T,N,W0:Linux:2.4:.18-21:Linux 2.4.18 and newer
 S4:64:1:60:M*,S,T,N,W0:Linux:2.4::Linux 2.4/2.6 <= 2.6.7
 S4:64:1:60:M*,S,T,N,W0:Linux:2.6:.1-7:Linux 2.4/2.6 <= 2.6.7
-S4:64:1:60:M*,S,T,N,W7:Linux:2.6:8:Linux 2.6.8 and newer (?)
+
+S4:64:1:60:M*,S,T,N,W5:Linux:2.6::Linux 2.6 (newer, 1)
+S4:64:1:60:M*,S,T,N,W6:Linux:2.6::Linux 2.6 (newer, 2)
+S4:64:1:60:M*,S,T,N,W7:Linux:2.6::Linux 2.6 (newer, 3)
+T4:64:1:60:M*,S,T,N,W7:Linux:2.6::Linux 2.6 (newer, 4)
+
+S10:64:1:60:M*,S,T,N,W4:   Linux:3.0::Linux 3.0
 
 S3:64:1:60:M*,S,T,N,W1:Linux:2.5::Linux 2.5 (sometimes 2.4)
 S4:64:1:60:M*,S,T,N,W1:Linux:2.5-2.6::Linux 2.5/2.6
@@ -429,6 +435,8 @@ S44:128:1:48:M*,N,N,S:  Windows:XP:SP1:
 32767:128:1:48:M*,N,N,S:   Windows:2000:SP4:Windows SP1, 2000 SP4
 32767:128:1:48:M*,N,N,S:   Windows:XP:SP1:Windows SP1, 2000 SP4
 
+8192:128:1:52:M*,N,W2,N,N,S:   Windows:Vista::Windows Vista/7
+
 # Odds, ends, mods:
 
 S52:128:1:48:M1260,N,N,S:  Windows:2000:cisco:Windows XP/2000 via 
Cisco
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r244097 - stable/9/cddl/contrib/opensolaris/lib/libdtrace/common

2012-12-10 Thread George V. Neville-Neil
Author: gnn
Date: Mon Dec 10 21:18:02 2012
New Revision: 244097
URL: http://svnweb.freebsd.org/changeset/base/244097

Log:
  MFC: 238979
  
  When we return with an error we cannot unlock the mutex, because
  it's been freed.  Protect against that, hopefully unlikely, case.
  
  Reviewed by:  rpaulo

Modified:
  stable/9/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.c
Directory Properties:
  stable/9/cddl/contrib/opensolaris/lib/libdtrace/common/   (props changed)

Modified: stable/9/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.c
==
--- stable/9/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.cMon Dec 
10 20:52:52 2012(r244096)
+++ stable/9/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.cMon Dec 
10 21:18:02 2012(r244097)
@@ -942,7 +942,8 @@ dt_proc_create_thread(dtrace_hdl_t *dtp,
(int)dpr->dpr_pid, strerror(err));
}
 
-   (void) pthread_mutex_unlock(&dpr->dpr_lock);
+   if (err == 0)
+   (void) pthread_mutex_unlock(&dpr->dpr_lock);
(void) pthread_attr_destroy(&a);
 
return (err);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r243960 - in head/sys: amd64/include i386/include x86/include

2012-12-10 Thread John Baldwin
On Friday, December 07, 2012 7:00:44 pm Carl Delsey wrote:
> On 12/07/12 10:08, John Baldwin wrote:
> > On Thursday, December 06, 2012 5:33:32 pm Jim Harris wrote:
> >> Author: jimharris
> >> Date: Thu Dec  6 22:33:31 2012
> >> New Revision: 243960
> >> URL: http://svnweb.freebsd.org/changeset/base/243960
> >>
> >> Log:
> >>Add amd64 implementations for 8-byte bus_space routines.
> >>
> >>Submitted by:   Carl Delsey 
> >>Discussed with: jhb, rwatson
> >>Reviewed by:jimharris
> >>MFC after:  1 week
> >>
> >> Modified:
> >>head/sys/amd64/include/bus.h
> >>head/sys/i386/include/bus.h
> >>head/sys/x86/include/bus.h
> > Do we still want the link errors on i386?  Do you get a compile error now?
> >
> You get a compile error now, since the function prototypes don't exist 
> for i386. That was the case in the old code too. The comments about 
> forcing a link error were incorrect or obsolete.

Ok, sounds good to me, thanks!

-- 
John Baldwin
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r242109 - stable/9/games/fortune/datfiles

2012-12-10 Thread John Baldwin
On Friday, October 26, 2012 11:23:17 am Eitan Adler wrote:
> On 26 October 2012 10:10, Nathan Whitehorn  wrote:
> > No. It is staying for the duration of the branch. So this MFC may have been
> > premature.
> 
> As I said previously: I MFCed this because it is a low-impact change
> and it makes future MFCs easier in the event that the fortune file
> changes again.

I think it is fine to start training users to not use sysintall, but
when doing an MFC like this, you need to refine the message to be
relevant to the branch you are merging to if needed.  Blindly
copying and pasting the original message is nomt always appropriate.

-- 
John Baldwin
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r242109 - stable/9/games/fortune/datfiles

2012-12-10 Thread Eitan Adler
On 10 December 2012 16:56, John Baldwin  wrote:
> On Friday, October 26, 2012 11:23:17 am Eitan Adler wrote:
>> On 26 October 2012 10:10, Nathan Whitehorn  wrote:
>> > No. It is staying for the duration of the branch. So this MFC may have been
>> > premature.
>>
>> As I said previously: I MFCed this because it is a low-impact change
>> and it makes future MFCs easier in the event that the fortune file
>> changes again.
>
> I think it is fine to start training users to not use sysintall, but
> when doing an MFC like this, you need to refine the message to be
> relevant to the branch you are merging to if needed.  Blindly
> copying and pasting the original message is nomt always appropriate.

See r242109 and r242110: I clarified it in those commits.


-- 
Eitan Adler
Source, Ports, Doc committer
Bugmeister, Ports Security teams
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r242109 - stable/9/games/fortune/datfiles

2012-12-10 Thread Eitan Adler
On 10 December 2012 17:19, Eitan Adler  wrote:
> On 10 December 2012 16:56, John Baldwin  wrote:
>> On Friday, October 26, 2012 11:23:17 am Eitan Adler wrote:
>>> On 26 October 2012 10:10, Nathan Whitehorn  wrote:
>>> > No. It is staying for the duration of the branch. So this MFC may have 
>>> > been
>>> > premature.
>>>
>>> As I said previously: I MFCed this because it is a low-impact change
>>> and it makes future MFCs easier in the event that the fortune file
>>> changes again.
>>
>> I think it is fine to start training users to not use sysintall, but
>> when doing an MFC like this, you need to refine the message to be
>> relevant to the branch you are merging to if needed.  Blindly
>> copying and pasting the original message is nomt always appropriate.
>
> See r242109 and r242110: I clarified it in those commits.

I meant r242110 and r242111



-- 
Eitan Adler
Source, Ports, Doc committer
Bugmeister, Ports Security teams
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r244098 - head/sys/kern

2012-12-10 Thread Alfred Perlstein
Author: alfred
Date: Mon Dec 10 23:09:55 2012
New Revision: 244098
URL: http://svnweb.freebsd.org/changeset/base/244098

Log:
  make sysctls kern.{bootfile,conftxt} read-only
  
  MFC after:1 month

Modified:
  head/sys/kern/kern_mib.c

Modified: head/sys/kern/kern_mib.c
==
--- head/sys/kern/kern_mib.cMon Dec 10 21:18:02 2012(r244097)
+++ head/sys/kern/kern_mib.cMon Dec 10 23:09:55 2012(r244098)
@@ -141,7 +141,7 @@ SYSCTL_INT(_kern, KERN_SAVED_IDS, saved_
 
 char kernelname[MAXPATHLEN] = "/kernel";   /* XXX bloat */
 
-SYSCTL_STRING(_kern, KERN_BOOTFILE, bootfile, CTLFLAG_RW,
+SYSCTL_STRING(_kern, KERN_BOOTFILE, bootfile, CTLFLAG_RD,
 kernelname, sizeof kernelname, "Name of kernel file booted");
 
 SYSCTL_INT(_hw, HW_NCPU, ncpu, CTLFLAG_RD|CTLFLAG_CAPRD,
@@ -377,15 +377,8 @@ SYSCTL_PROC(_kern, KERN_SECURELVL, secur
 /* Actual kernel configuration options. */
 extern char kernconfstring[];
 
-static int
-sysctl_kern_config(SYSCTL_HANDLER_ARGS)
-{
-   return (sysctl_handle_string(oidp, kernconfstring,
-   strlen(kernconfstring), req));
-}
-
-SYSCTL_PROC(_kern, OID_AUTO, conftxt, CTLTYPE_STRING|CTLFLAG_RW, 
-0, 0, sysctl_kern_config, "", "Kernel configuration file");
+SYSCTL_STRING(_kern, OID_AUTO, conftxt, CTLFLAG_RD, kernconfstring, 0,
+"Kernel configuration file");
 #endif
 
 static int
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r244099 - head/sys/kern

2012-12-10 Thread Alfred Perlstein
Author: alfred
Date: Mon Dec 10 23:11:26 2012
New Revision: 244099
URL: http://svnweb.freebsd.org/changeset/base/244099

Log:
  allow KASSERT to enter KDB.

Modified:
  head/sys/kern/kern_shutdown.c

Modified: head/sys/kern/kern_shutdown.c
==
--- head/sys/kern/kern_shutdown.c   Mon Dec 10 23:09:55 2012
(r244098)
+++ head/sys/kern/kern_shutdown.c   Mon Dec 10 23:11:26 2012
(r244099)
@@ -542,6 +542,9 @@ shutdown_reset(void *junk, int howto)
 
 #ifdef INVARIANTS
 static int kassert_warn_only = 0;
+#ifdef KDB
+static int kassert_do_kdb = 0;
+#endif
 #ifdef KTR
 static int kassert_do_ktr = 0;
 #endif
@@ -558,6 +561,12 @@ SYSCTL_INT(_debug_kassert, OID_AUTO, war
 "KASSERT triggers a panic (1) or just a warning (0)");
 TUNABLE_INT("debug.kassert.warn_only", &kassert_warn_only);
 
+#ifdef KDB
+SYSCTL_INT(_debug_kassert, OID_AUTO, do_kdb, CTLFLAG_RW | CTLFLAG_TUN,
+&kassert_do_kdb, 0, "KASSERT will enter the debugger");
+TUNABLE_INT("debug.kassert.do_kdb", &kassert_do_kdb);
+#endif
+
 #ifdef KTR
 SYSCTL_UINT(_debug_kassert, OID_AUTO, do_ktr, CTLFLAG_RW | CTLFLAG_TUN,
 &kassert_do_ktr, 0,
@@ -650,6 +659,11 @@ kassert_panic(const char *fmt, ...)
kdb_backtrace();
}
}
+#ifdef KDB
+   if (kassert_do_kdb) {
+   kdb_enter(KDB_WHY_KASSERT, buf);
+   }
+#endif
atomic_add_int(&kassert_warnings, 1);
 }
 #endif
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r244100 - head/sys/sys

2012-12-10 Thread Alfred Perlstein
Author: alfred
Date: Mon Dec 10 23:12:51 2012
New Revision: 244100
URL: http://svnweb.freebsd.org/changeset/base/244100

Log:
  Add constant missed in r244099
  
  KDB entered due to KASSERT.

Modified:
  head/sys/sys/kdb.h

Modified: head/sys/sys/kdb.h
==
--- head/sys/sys/kdb.h  Mon Dec 10 23:11:26 2012(r244099)
+++ head/sys/sys/kdb.h  Mon Dec 10 23:12:51 2012(r244100)
@@ -97,6 +97,7 @@ int   kdb_trap(int, int, struct trapframe 
 extern const char * volatile kdb_why;
 #defineKDB_WHY_UNSET   NULL/* No reason set. */
 #defineKDB_WHY_PANIC   "panic" /* panic() was called. 
*/
+#defineKDB_WHY_KASSERT "kassert"   /* kassert failed. */
 #defineKDB_WHY_SYSCTL  "sysctl"/* Sysctl entered 
debugger. */
 #defineKDB_WHY_BOOTFLAGS   "bootflags" /* Boot flags were set. 
*/
 #defineKDB_WHY_WITNESS "witness"   /* Witness entered 
debugger. */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r244098 - head/sys/kern

2012-12-10 Thread Konstantin Belousov
On Mon, Dec 10, 2012 at 11:09:56PM +, Alfred Perlstein wrote:
> Author: alfred
> Date: Mon Dec 10 23:09:55 2012
> New Revision: 244098
> URL: http://svnweb.freebsd.org/changeset/base/244098
> 
> Log:
>   make sysctls kern.{bootfile,conftxt} read-only

You just break installkernel.


pgp48R2J0Kf57.pgp
Description: PGP signature


svn commit: r244101 - head/sys/sys

2012-12-10 Thread Alfred Perlstein
Author: alfred
Date: Mon Dec 10 23:17:08 2012
New Revision: 244101
URL: http://svnweb.freebsd.org/changeset/base/244101

Log:
  Add CTLFLAG_STATS to sysctl flags
  
  In preparation for sysctl(8) growing the ability to only print
  out boot/run-time tunables we need a way to differentiate between
  RW sysctl nodes that tune a particular thing, or simply export
  a stat that we want to allow the sysadmin to reset to 0 (or some
  other value).
  
  To do so, we add the CTLFLAG_STATS which should be OR'd into the
  CTLFLAGs when exporting a "writable/resettable" statistic node via
  sysctl.

Modified:
  head/sys/sys/sysctl.h

Modified: head/sys/sys/sysctl.h
==
--- head/sys/sys/sysctl.h   Mon Dec 10 23:12:51 2012(r244100)
+++ head/sys/sys/sysctl.h   Mon Dec 10 23:17:08 2012(r244101)
@@ -90,6 +90,7 @@ struct ctlname {
 #defineCTLFLAG_DYING   0x0001  /* oid is being removed */
 #define CTLFLAG_CAPRD  0x8000  /* Can be read in capability mode */
 #define CTLFLAG_CAPWR  0x4000  /* Can be written in capability mode */
+#define CTLFLAG_STATS  0x2000  /* Statistics, not a tuneable */
 #define CTLFLAG_CAPRW  (CTLFLAG_CAPRD|CTLFLAG_CAPWR)
 
 /*
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r243960 - in head/sys: amd64/include i386/include x86/include

2012-12-10 Thread Niclas Zeising
On 12/06/12 23:33, Jim Harris wrote:
> Author: jimharris
> Date: Thu Dec  6 22:33:31 2012
> New Revision: 243960
> URL: http://svnweb.freebsd.org/changeset/base/243960
> 
> Log:
>   Add amd64 implementations for 8-byte bus_space routines.
>   

> +#include 
>  #include 
> +
> +#define KASSERT_BUS_SPACE_MEM_ONLY(tag) \
> + KASSERT((tag) == X86_BUS_SPACE_MEM, \
> + ("%s: can only handle mem space", __func__))
> +
> +static __inline uint64_t
> +bus_space_read_8(bus_space_tag_t tag, bus_space_handle_t bsh,
> +bus_size_t ofs)
> +{
> +
> + KASSERT_BUS_SPACE_MEM_ONLY(tag);
> +
> + return (*(volatile uint64_t *)(bsh + ofs));
> +}

Hi!
Can the include of  and the added KASSERTs please be hidden
under #ifdef _KERNEL or something similar?  devel/libpciaccess from the
experimental xorg-dev tree
(http://trillian.chruetertee.ch/ports/browser/trunk/devel/libpciaccess)
uses machine/bus.h on amd64 and i386 to be able to read/write to the pci
bus, and this change breaks the compile of devel/libpciaccess.
It is probably so that libpciaccess is wrong in using 
but I have no idea how to fix it.  If you have a better suggestion on
how to fix libpciaccess I am all ears.
Regards!
-- 
Niclas Zeising
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r243960 - in head/sys: amd64/include i386/include x86/include

2012-12-10 Thread Carl Delsey

On 12/10/12 16:20, Niclas Zeising wrote:

On 12/06/12 23:33, Jim Harris wrote:

Author: jimharris
Date: Thu Dec  6 22:33:31 2012
New Revision: 243960
URL: http://svnweb.freebsd.org/changeset/base/243960

Log:
   Add amd64 implementations for 8-byte bus_space routines.
   
+#include 

  #include 
+
+#define KASSERT_BUS_SPACE_MEM_ONLY(tag) \
+   KASSERT((tag) == X86_BUS_SPACE_MEM, \
+   ("%s: can only handle mem space", __func__))
+
+static __inline uint64_t
+bus_space_read_8(bus_space_tag_t tag, bus_space_handle_t bsh,
+bus_size_t ofs)
+{
+
+   KASSERT_BUS_SPACE_MEM_ONLY(tag);
+
+   return (*(volatile uint64_t *)(bsh + ofs));
+}

Hi!
Can the include of  and the added KASSERTs please be hidden
under #ifdef _KERNEL or something similar?  devel/libpciaccess from the
experimental xorg-dev tree
(http://trillian.chruetertee.ch/ports/browser/trunk/devel/libpciaccess)
uses machine/bus.h on amd64 and i386 to be able to read/write to the pci
bus, and this change breaks the compile of devel/libpciaccess.
It is probably so that libpciaccess is wrong in using 
but I have no idea how to fix it.  If you have a better suggestion on
how to fix libpciaccess I am all ears.
Regards!
Does libpciaccess make use of the bus_space_read/write_* routines in 
these files, or does it just use some constants and types from them?


___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r244098 - head/sys/kern

2012-12-10 Thread Alfred Perlstein

On 12/10/12 3:14 PM, Konstantin Belousov wrote:

On Mon, Dec 10, 2012 at 11:09:56PM +, Alfred Perlstein wrote:

Author: alfred
Date: Mon Dec 10 23:09:55 2012
New Revision: 244098
URL: http://svnweb.freebsd.org/changeset/base/244098

Log:
   make sysctls kern.{bootfile,conftxt} read-only

You just break installkernel.
My apologies, give me a few moments to double check this and I will back 
out.



-Alfred
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r243960 - in head/sys: amd64/include i386/include x86/include

2012-12-10 Thread Niclas Zeising
On 12/11/12 00:32, Carl Delsey wrote:
> On 12/10/12 16:20, Niclas Zeising wrote:
>> On 12/06/12 23:33, Jim Harris wrote:
>>> Author: jimharris
>>> Date: Thu Dec  6 22:33:31 2012
>>> New Revision: 243960
>>> URL: http://svnweb.freebsd.org/changeset/base/243960
>>>
>>> Log:
>>>Add amd64 implementations for 8-byte bus_space routines.
>>>+#include 
>>>   #include 
>>> +
>>> +#define KASSERT_BUS_SPACE_MEM_ONLY(tag) \
>>> +KASSERT((tag) == X86_BUS_SPACE_MEM, \
>>> +("%s: can only handle mem space", __func__))
>>> +
>>> +static __inline uint64_t
>>> +bus_space_read_8(bus_space_tag_t tag, bus_space_handle_t bsh,
>>> +bus_size_t ofs)
>>> +{
>>> +
>>> +KASSERT_BUS_SPACE_MEM_ONLY(tag);
>>> +
>>> +return (*(volatile uint64_t *)(bsh + ofs));
>>> +}
>> Hi!
>> Can the include of  and the added KASSERTs please be hidden
>> under #ifdef _KERNEL or something similar?  devel/libpciaccess from the
>> experimental xorg-dev tree
>> (http://trillian.chruetertee.ch/ports/browser/trunk/devel/libpciaccess)
>> uses machine/bus.h on amd64 and i386 to be able to read/write to the pci
>> bus, and this change breaks the compile of devel/libpciaccess.
>> It is probably so that libpciaccess is wrong in using 
>> but I have no idea how to fix it.  If you have a better suggestion on
>> how to fix libpciaccess I am all ears.
>> Regards!
> Does libpciaccess make use of the bus_space_read/write_* routines in
> these files, or does it just use some constants and types from them?
> 

libpciaccess uses bus_space_[read,write]_[1,2,4], which are defined in
x86/bus.h.  It does not use the quad functions.
Regards!
-- 
Niclas Zeising
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r244098 - head/sys/kern

2012-12-10 Thread Alfred Perlstein

On 12/10/12 3:38 PM, Alfred Perlstein wrote:

On 12/10/12 3:14 PM, Konstantin Belousov wrote:

On Mon, Dec 10, 2012 at 11:09:56PM +, Alfred Perlstein wrote:

Author: alfred
Date: Mon Dec 10 23:09:55 2012
New Revision: 244098
URL: http://svnweb.freebsd.org/changeset/base/244098

Log:
   make sysctls kern.{bootfile,conftxt} read-only

You just break installkernel.
My apologies, give me a few moments to double check this and I will 
back out.


So first off "installkernel" was not broken, the error is ignored by 
make, hence why I didn't see it.


Second off, this is pretty broken, the first time you "installkernel" it 
gets it right, the second time it just seems to set kern.bootfile to 
/boot/kernel.old/kernel no even though that's not really the boot kernel.


I will back out the change, but this just seems off.

If we are going to change kern.bootfile, then we ought to detect when 
it's no longer valid at all and just zero it.  or pretty much do 
something else.


-Alfred
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r243960 - in head/sys: amd64/include i386/include x86/include

2012-12-10 Thread Carl Delsey

On 12/10/12 16:40, Niclas Zeising wrote:

On 12/11/12 00:32, Carl Delsey wrote:

On 12/10/12 16:20, Niclas Zeising wrote:

On 12/06/12 23:33, Jim Harris wrote:

Author: jimharris
Date: Thu Dec  6 22:33:31 2012
New Revision: 243960
URL: http://svnweb.freebsd.org/changeset/base/243960

Log:
Add amd64 implementations for 8-byte bus_space routines.
+#include 
   #include 
+
+#define KASSERT_BUS_SPACE_MEM_ONLY(tag) \
+KASSERT((tag) == X86_BUS_SPACE_MEM, \
+("%s: can only handle mem space", __func__))
+
+static __inline uint64_t
+bus_space_read_8(bus_space_tag_t tag, bus_space_handle_t bsh,
+bus_size_t ofs)
+{
+
+KASSERT_BUS_SPACE_MEM_ONLY(tag);
+
+return (*(volatile uint64_t *)(bsh + ofs));
+}

Hi!
Can the include of  and the added KASSERTs please be hidden
under #ifdef _KERNEL or something similar?  devel/libpciaccess from the
experimental xorg-dev tree
(http://trillian.chruetertee.ch/ports/browser/trunk/devel/libpciaccess)
uses machine/bus.h on amd64 and i386 to be able to read/write to the pci
bus, and this change breaks the compile of devel/libpciaccess.
It is probably so that libpciaccess is wrong in using 
but I have no idea how to fix it.  If you have a better suggestion on
how to fix libpciaccess I am all ears.
Regards!

Does libpciaccess make use of the bus_space_read/write_* routines in
these files, or does it just use some constants and types from them?


libpciaccess uses bus_space_[read,write]_[1,2,4], which are defined in
x86/bus.h.  It does not use the quad functions.
Regards!
Ok. In that case I won't ifdef out the functions themselves, just the 
KASSERT in case libpciaccess expands in the future to 8 byte accesses 
:-)  I had another related change in the works. I'll add this change in.


Thanks,
Carl


___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r244098 - head/sys/kern

2012-12-10 Thread Alfred Perlstein

On 12/10/12 3:51 PM, Alfred Perlstein wrote:

On 12/10/12 3:38 PM, Alfred Perlstein wrote:

On 12/10/12 3:14 PM, Konstantin Belousov wrote:

On Mon, Dec 10, 2012 at 11:09:56PM +, Alfred Perlstein wrote:

Author: alfred
Date: Mon Dec 10 23:09:55 2012
New Revision: 244098
URL: http://svnweb.freebsd.org/changeset/base/244098

Log:
   make sysctls kern.{bootfile,conftxt} read-only

You just break installkernel.
My apologies, give me a few moments to double check this and I will 
back out.


So first off "installkernel" was not broken, the error is ignored by 
make, hence why I didn't see it.


Second off, this is pretty broken, the first time you "installkernel" 
it gets it right, the second time it just seems to set kern.bootfile 
to /boot/kernel.old/kernel no even though that's not really the boot 
kernel.


I will back out the change, but this just seems off.

If we are going to change kern.bootfile, then we ought to detect when 
it's no longer valid at all and just zero it.  or pretty much do 
something else.


-Alfred

and.. derp.  Florian explained how this works, how it doesn't rename 
kern.bootfile after the first rename of the kernel.


I'll be backing out the change now and adding some comments to the code 
shortly.

___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r244103 - head/sys/kern

2012-12-10 Thread Alfred Perlstein
Author: alfred
Date: Tue Dec 11 00:10:20 2012
New Revision: 244103
URL: http://svnweb.freebsd.org/changeset/base/244103

Log:
  back out half of 244098.
  
  kern.bootfile needs to be rw for installkernel.
  
  Pointed out by: kib, flo

Modified:
  head/sys/kern/kern_mib.c

Modified: head/sys/kern/kern_mib.c
==
--- head/sys/kern/kern_mib.cTue Dec 11 00:07:19 2012(r244102)
+++ head/sys/kern/kern_mib.cTue Dec 11 00:10:20 2012(r244103)
@@ -141,7 +141,7 @@ SYSCTL_INT(_kern, KERN_SAVED_IDS, saved_
 
 char kernelname[MAXPATHLEN] = "/kernel";   /* XXX bloat */
 
-SYSCTL_STRING(_kern, KERN_BOOTFILE, bootfile, CTLFLAG_RD,
+SYSCTL_STRING(_kern, KERN_BOOTFILE, bootfile, CTLFLAG_RW,
 kernelname, sizeof kernelname, "Name of kernel file booted");
 
 SYSCTL_INT(_hw, HW_NCPU, ncpu, CTLFLAG_RD|CTLFLAG_CAPRD,
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r243960 - in head/sys: amd64/include i386/include x86/include

2012-12-10 Thread Niclas Zeising
On 12/11/12 00:54, Carl Delsey wrote:
> On 12/10/12 16:40, Niclas Zeising wrote:
>> On 12/11/12 00:32, Carl Delsey wrote:
>>> On 12/10/12 16:20, Niclas Zeising wrote:
 On 12/06/12 23:33, Jim Harris wrote:
> Author: jimharris
> Date: Thu Dec  6 22:33:31 2012
> New Revision: 243960
> URL: http://svnweb.freebsd.org/changeset/base/243960
>
> Log:
> Add amd64 implementations for 8-byte bus_space routines.
> +#include 
>#include 
> +
> +#define KASSERT_BUS_SPACE_MEM_ONLY(tag) \
> +KASSERT((tag) == X86_BUS_SPACE_MEM, \
> +("%s: can only handle mem space", __func__))
> +
> +static __inline uint64_t
> +bus_space_read_8(bus_space_tag_t tag, bus_space_handle_t bsh,
> +bus_size_t ofs)
> +{
> +
> +KASSERT_BUS_SPACE_MEM_ONLY(tag);
> +
> +return (*(volatile uint64_t *)(bsh + ofs));
> +}
 Hi!
 Can the include of  and the added KASSERTs please be
 hidden
 under #ifdef _KERNEL or something similar?  devel/libpciaccess from the
 experimental xorg-dev tree
 (http://trillian.chruetertee.ch/ports/browser/trunk/devel/libpciaccess)
 uses machine/bus.h on amd64 and i386 to be able to read/write to the
 pci
 bus, and this change breaks the compile of devel/libpciaccess.
 It is probably so that libpciaccess is wrong in using 
 but I have no idea how to fix it.  If you have a better suggestion on
 how to fix libpciaccess I am all ears.
 Regards!
>>> Does libpciaccess make use of the bus_space_read/write_* routines in
>>> these files, or does it just use some constants and types from them?
>>>
>> libpciaccess uses bus_space_[read,write]_[1,2,4], which are defined in
>> x86/bus.h.  It does not use the quad functions.
>> Regards!
> Ok. In that case I won't ifdef out the functions themselves, just the
> KASSERT in case libpciaccess expands in the future to 8 byte accesses
> :-)  I had another related change in the works. I'll add this change in.

Sounds good to me, thank you very much!
Don't forget to ifdef the include o  as well as the KASSERTs.
Regards!
-- 
Niclas Zeising
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r244104 - head/sbin/sysctl

2012-12-10 Thread Xin LI
Author: delphij
Date: Tue Dec 11 01:12:29 2012
New Revision: 244104
URL: http://svnweb.freebsd.org/changeset/base/244104

Log:
  In parse():
  
   - Only operate on copy, don't operate on source.
   - Eliminate home-rolled strsep().
   - Constify the parameter.
  
  MFC after:2 weeks

Modified:
  head/sbin/sysctl/sysctl.c

Modified: head/sbin/sysctl/sysctl.c
==
--- head/sbin/sysctl/sysctl.c   Tue Dec 11 00:10:20 2012(r244103)
+++ head/sbin/sysctl/sysctl.c   Tue Dec 11 01:12:29 2012(r244104)
@@ -62,7 +62,7 @@ static intaflag, bflag, dflag, eflag, h
 static int Nflag, nflag, oflag, qflag, xflag, warncount;
 
 static int oidfmt(int *, int, char *, u_int *);
-static voidparse(char *);
+static voidparse(const char *);
 static int show_var(int *, int);
 static int sysctl_all(int *oid, int len);
 static int name2oid(char *, int *);
@@ -161,7 +161,7 @@ main(int argc, char **argv)
  * Set a new value if requested.
  */
 static void
-parse(char *string)
+parse(const char *string)
 {
int len, i, j;
void *newval = 0;
@@ -176,12 +176,11 @@ parse(char *string)
char *cp, *bufp, buf[BUFSIZ], *endptr, fmt[BUFSIZ];
u_int kind;
 
-   bufp = buf;
+   cp = buf;
if (snprintf(buf, BUFSIZ, "%s", string) >= BUFSIZ)
errx(1, "oid too long: '%s'", string);
-   if ((cp = strchr(string, '=')) != NULL) {
-   *strchr(buf, '=') = '\0';
-   *cp++ = '\0';
+   bufp = strsep(&cp, "=");
+   if (cp != NULL) {
while (isspace(*cp))
cp++;
newval = cp;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r244105 - in head/sys: kern sys

2012-12-10 Thread Alfred Perlstein
Author: alfred
Date: Tue Dec 11 01:23:50 2012
New Revision: 244105
URL: http://svnweb.freebsd.org/changeset/base/244105

Log:
  Switch the hardwired WITNESS panics to kassert_panic.
  
  This is an ongoing effort to provide runtime debug information
  useful in the field that does not panic existing installations.
  
  This gives us the flexibility needed when shipping images to a
  potentially large audience with WITNESS enabled without worrying
  about formerly non-fatal LORs hurting a release.
  
  Sponsored by: iXsystems

Modified:
  head/sys/kern/kern_shutdown.c
  head/sys/kern/subr_witness.c
  head/sys/sys/systm.h

Modified: head/sys/kern/kern_shutdown.c
==
--- head/sys/kern/kern_shutdown.c   Tue Dec 11 01:12:29 2012
(r244104)
+++ head/sys/kern/kern_shutdown.c   Tue Dec 11 01:23:50 2012
(r244105)
@@ -540,7 +540,7 @@ shutdown_reset(void *junk, int howto)
/* NOTREACHED */ /* assuming reset worked */
 }
 
-#ifdef INVARIANTS
+#if defined(WITNESS) || defined(INVARIANTS)
 static int kassert_warn_only = 0;
 #ifdef KDB
 static int kassert_do_kdb = 0;

Modified: head/sys/kern/subr_witness.c
==
--- head/sys/kern/subr_witness.cTue Dec 11 01:12:29 2012
(r244104)
+++ head/sys/kern/subr_witness.cTue Dec 11 01:23:50 2012
(r244105)
@@ -822,16 +822,16 @@ witness_init(struct lock_object *lock, c
class = LOCK_CLASS(lock);
if ((lock->lo_flags & LO_RECURSABLE) != 0 &&
(class->lc_flags & LC_RECURSABLE) == 0)
-   panic("%s: lock (%s) %s can not be recursable", __func__,
-   class->lc_name, lock->lo_name);
+   kassert_panic("%s: lock (%s) %s can not be recursable",
+   __func__, class->lc_name, lock->lo_name);
if ((lock->lo_flags & LO_SLEEPABLE) != 0 &&
(class->lc_flags & LC_SLEEPABLE) == 0)
-   panic("%s: lock (%s) %s can not be sleepable", __func__,
-   class->lc_name, lock->lo_name);
+   kassert_panic("%s: lock (%s) %s can not be sleepable",
+   __func__, class->lc_name, lock->lo_name);
if ((lock->lo_flags & LO_UPGRADABLE) != 0 &&
(class->lc_flags & LC_UPGRADABLE) == 0)
-   panic("%s: lock (%s) %s can not be upgradable", __func__,
-   class->lc_name, lock->lo_name);
+   kassert_panic("%s: lock (%s) %s can not be upgradable",
+   __func__, class->lc_name, lock->lo_name);
 
/*
 * If we shouldn't watch this lock, then just clear lo_witness.
@@ -847,7 +847,8 @@ witness_init(struct lock_object *lock, c
pending_locks[pending_cnt].wh_lock = lock;
pending_locks[pending_cnt++].wh_type = type;
if (pending_cnt > WITNESS_PENDLIST)
-   panic("%s: pending locks list is too small, bump it\n",
+   panic("%s: pending locks list is too small, "
+   "increase WITNESS_PENDLIST\n",
__func__);
} else
lock->lo_witness = enroll(type, class);
@@ -1073,7 +1074,8 @@ witness_checkorder(struct lock_object *l
 * all spin locks.
 */
if (td->td_critnest != 0 && !kdb_active)
-   panic("blockable sleep lock (%s) %s @ %s:%d",
+   kassert_panic("acquiring blockable sleep lock with "
+   "spinlock or critical section held (%s) %s @ %s:%d",
class->lc_name, lock->lo_name,
fixup_filename(file), line);
 
@@ -1117,7 +1119,7 @@ witness_checkorder(struct lock_object *l
fixup_filename(file), line);
printf("while exclusively locked from %s:%d\n",
fixup_filename(lock1->li_file), lock1->li_line);
-   panic("share->excl");
+   kassert_panic("share->excl");
}
if ((lock1->li_flags & LI_EXCLUSIVE) == 0 &&
(flags & LOP_EXCLUSIVE) != 0) {
@@ -1126,7 +1128,7 @@ witness_checkorder(struct lock_object *l
fixup_filename(file), line);
printf("while share locked from %s:%d\n",
fixup_filename(lock1->li_file), lock1->li_line);
-   panic("excl->share");
+   kassert_panic("excl->share");
}
return;
}
@@ -1433,26 +1435,30 @@ witness_upgrade(struct lock_object *lock
class = LOCK_CLASS(lock);
if (witness_watch) {
if ((lock->lo_flags & LO_UPGRADABLE) == 0)
-   panic("upgrade of non-upgradable lock (%s) %s @ %s:%d",
+

svn commit: r244106 - head/sbin/sysctl

2012-12-10 Thread Alfred Perlstein
Author: alfred
Date: Tue Dec 11 01:28:06 2012
New Revision: 244106
URL: http://svnweb.freebsd.org/changeset/base/244106

Log:
  Allow sysctl to filter boot and runtime tunables.
  
  Add the following flags to sysctl:
   -W  - show only writable sysctls
   -T  - show only tuneable sysctls
  
  This can be used to create a /var/run/sysctl.boot to
  compare set tunables versus booted tunables.
  
  Sponsored by: iXsystems

Modified:
  head/sbin/sysctl/sysctl.8
  head/sbin/sysctl/sysctl.c

Modified: head/sbin/sysctl/sysctl.8
==
--- head/sbin/sysctl/sysctl.8   Tue Dec 11 01:23:50 2012(r244105)
+++ head/sbin/sysctl/sysctl.8   Tue Dec 11 01:28:06 2012(r244106)
@@ -36,11 +36,11 @@
 .Nd get or set kernel state
 .Sh SYNOPSIS
 .Nm
-.Op Fl bdehiNnoqx
+.Op Fl bdehiNnoRTqx
 .Ar name Ns Op = Ns Ar value
 .Ar ...
 .Nm
-.Op Fl bdehNnoqx
+.Op Fl bdehNnoRTqx
 .Fl a
 .Sh DESCRIPTION
 The
@@ -121,6 +121,11 @@ sixteen bytes of the value.
 Suppress some warnings generated by
 .Nm
 to standard error.
+.It Fl T
+Display only variables that are setable via loader (CTLFLAG_TUN).
+.It Fl W
+Display only wriable variables that are not statistical.
+Useful for determining the set of runtime tunable sysctls.
 .It Fl X
 Equivalent to
 .Fl x a

Modified: head/sbin/sysctl/sysctl.c
==
--- head/sbin/sysctl/sysctl.c   Tue Dec 11 01:23:50 2012(r244105)
+++ head/sbin/sysctl/sysctl.c   Tue Dec 11 01:28:06 2012(r244106)
@@ -59,7 +59,7 @@ static const char rcsid[] =
 #include 
 
 static int aflag, bflag, dflag, eflag, hflag, iflag;
-static int Nflag, nflag, oflag, qflag, xflag, warncount;
+static int Nflag, nflag, oflag, qflag, Tflag, Wflag, xflag, warncount;
 
 static int oidfmt(int *, int, char *, u_int *);
 static voidparse(const char *);
@@ -74,8 +74,8 @@ usage(void)
 {
 
(void)fprintf(stderr, "%s\n%s\n",
-   "usage: sysctl [-bdehiNnoqx] name[=value] ...",
-   "   sysctl [-bdehNnoqx] -a");
+   "usage: sysctl [-bdehiNnoqTWx] name[=value] ...",
+   "   sysctl [-bdehNnoqTWx] -a");
exit(1);
 }
 
@@ -88,7 +88,7 @@ main(int argc, char **argv)
setbuf(stdout,0);
setbuf(stderr,0);
 
-   while ((ch = getopt(argc, argv, "AabdehiNnoqwxX")) != -1) {
+   while ((ch = getopt(argc, argv, "AabdehiNnoqTwWxX")) != -1) {
switch (ch) {
case 'A':
/* compatibility */
@@ -124,10 +124,16 @@ main(int argc, char **argv)
case 'q':
qflag = 1;
break;
+   case 'T':
+   Tflag = 1;
+   break;
case 'w':
/* compatibility */
/* ignored */
break;
+   case 'W':
+   Wflag = 1;
+   break;
case 'X':
/* compatibility */
aflag = xflag = 1;
@@ -181,6 +187,11 @@ parse(const char *string)
errx(1, "oid too long: '%s'", string);
bufp = strsep(&cp, "=");
if (cp != NULL) {
+   /* Tflag just lists tunables, do not allow assignment */
+   if (Tflag || Wflag) {
+   warnx("Can't set variables when using -T or -W");
+   usage();
+   }
while (isspace(*cp))
cp++;
newval = cp;
@@ -602,6 +613,14 @@ show_var(int *oid, int nlen)
sign = ctl_sign[ctltype];
intlen = ctl_size[ctltype];
 
+   /* if Wflag then only list sysctls that are writeable and not stats. */
+   if (Wflag && ((kind & CTLFLAG_WR) == 0 || (kind & CTLFLAG_STATS) != 0))
+   return 1;
+
+   /* if Tflag then only list sysctls that are tuneables. */
+   if (Tflag && (kind & CTLFLAG_TUN) == 0)
+   return 1;
+
switch (ctltype) {
case CTLTYPE_STRING:
if (!nflag)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r244107 - stable/9/lib/libc/net

2012-12-10 Thread Kevin Lo
Author: kevlo
Date: Tue Dec 11 01:49:57 2012
New Revision: 244107
URL: http://svnweb.freebsd.org/changeset/base/244107

Log:
  MFC r235767:
  
  Add missing header needed by free().
  
  Reported by:  tinderbox

Modified:
  stable/9/lib/libc/net/nsparser.y
Directory Properties:
  stable/9/lib/libc/   (props changed)

Modified: stable/9/lib/libc/net/nsparser.y
==
--- stable/9/lib/libc/net/nsparser.yTue Dec 11 01:28:06 2012
(r244106)
+++ stable/9/lib/libc/net/nsparser.yTue Dec 11 01:49:57 2012
(r244107)
@@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$");
 #define _NS_PRIVATE
 #include 
 #include 
+#include 
 #include 
 #include 
 #include "un-namespace.h"
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r244108 - stable/9/bin/expr

2012-12-10 Thread Kevin Lo
Author: kevlo
Date: Tue Dec 11 02:40:01 2012
New Revision: 244108
URL: http://svnweb.freebsd.org/changeset/base/244108

Log:
  MFC r235771:
  
  Remove redundant declaration of yyparse.
  
  Reported by:  tinderbox

Modified:
  stable/9/bin/expr/expr.y
Directory Properties:
  stable/9/bin/expr/   (props changed)

Modified: stable/9/bin/expr/expr.y
==
--- stable/9/bin/expr/expr.yTue Dec 11 01:49:57 2012(r244107)
+++ stable/9/bin/expr/expr.yTue Dec 11 02:40:01 2012(r244108)
@@ -74,7 +74,6 @@ int   to_integer(struct val *);
 void   to_string(struct val *);
 intyyerror(const char *);
 intyylex(void);
-intyyparse(void);
 
 %}
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r243960 - in head/sys: amd64/include i386/include x86/include

2012-12-10 Thread Bruce Evans

On Tue, 11 Dec 2012, Niclas Zeising wrote:


On 12/11/12 00:54, Carl Delsey wrote:

On 12/10/12 16:40, Niclas Zeising wrote:

...
libpciaccess uses bus_space_[read,write]_[1,2,4], which are defined in
x86/bus.h.  It does not use the quad functions.
Regards!

Ok. In that case I won't ifdef out the functions themselves, just the
KASSERT in case libpciaccess expands in the future to 8 byte accesses
:-)  I had another related change in the works. I'll add this change in.


Sounds good to me, thank you very much!
Don't forget to ifdef the include o  as well as the KASSERTs.


Including it at all is namespace pollution.

It is a bug for any kernel .c file to not include  always
and early in its includes, because other includes may have KASSERT()s
in them.  Not all includes that uses KASSERT() have the namespace
pollution, so adding it to some just breaks detection of the bug in
some cases.

The folowing headers in  have the pollution: libkern.h, mbuf.h,
pmckern.h, refcount.h.  refcount.h only has the pollution if _KERNEL is
defined.  It handles the problem of polluting userland (though I think
userland should be rewarded by syntax errors if it uses refcount.h or
machine/bus.h) by supplying a dummy KASSERT() for the !_KERNEL case.

The following headers in  use KASSERT(): buf.h, eventhandler.h,
lock.h, mbuf.h, mount.h, mutex.h, osd.h, proc.h, random.h, refcount.h.
Most of them are missing the pollution.

The pollution in libkern.h is circular: libkern.h includes systm.h, and
systm.h includes libkern.h.  systm.h's include of libkern.h and of many
other headers like machine/atomic.h and machine/cpufunc.h is standard
pollution -- direct includes of these are style bugs, and not including
systm.h always and early is a bug because it may break more than KASSERT()
(other headers may also use inlines in libkern.h etc.).  The circular
pollution in libkern.h is used because most files in libkern don't include
systm.h directly; they mostly only include libkern.h directly.

This and other pollution in mbuf.h is especially disgusting since
mbuf.h is one of few headers that I managed to finish the #include
de-pollution of in FreeBSD-3 or 2.

Bruce
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r244109 - head/sys/dev/ath

2012-12-10 Thread Adrian Chadd
Author: adrian
Date: Tue Dec 11 04:19:51 2012
New Revision: 244109
URL: http://svnweb.freebsd.org/changeset/base/244109

Log:
  There's no need to use a TXQ pointer here; we specifically need the
  hardware queue ID when queuing to EDMA descriptors.
  
  This is a small part of trying to reduce the size of ath_buf entries.

Modified:
  head/sys/dev/ath/if_ath_tx.c
  head/sys/dev/ath/if_athvar.h

Modified: head/sys/dev/ath/if_ath_tx.c
==
--- head/sys/dev/ath/if_ath_tx.cTue Dec 11 02:40:01 2012
(r244108)
+++ head/sys/dev/ath/if_ath_tx.cTue Dec 11 04:19:51 2012
(r244109)
@@ -372,7 +372,6 @@ ath_tx_chaindesclist(struct ath_softc *s
uint32_t segLenList[4];
int numTxMaps = 1;
int isFirstDesc = 1;
-   int qnum;
 
/*
 * XXX There's txdma and txdma_mgmt; the descriptor
@@ -426,18 +425,16 @@ ath_tx_chaindesclist(struct ath_softc *s
bf->bf_daddr + dd->dd_descsize * (dsp + 1));
 
/*
-* XXX this assumes that bfs_txq is the actual destination
-* hardware queue at this point.  It may not have been assigned,
-* it may actually be pointing to the multicast software
-* TXQ id.  These must be fixed!
+* XXX This assumes that bfs_txq is the actual destination
+* hardware queue at this point.  It may not have been
+* assigned, it may actually be pointing to the multicast
+* software TXQ id.  These must be fixed!
 */
-   qnum = bf->bf_state.bfs_txq->axq_qnum;
-
ath_hal_filltxdesc(ah, (struct ath_desc *) ds
, bufAddrList
, segLenList
, bf->bf_descid /* XXX desc id */
-   , qnum
+   , bf->bf_state.bfs_tx_queue
, isFirstDesc   /* first segment */
, i == bf->bf_nseg - 1  /* last segment */
, (struct ath_desc *) ds0   /* first descriptor */
@@ -478,7 +475,8 @@ ath_tx_chaindesclist(struct ath_softc *s
isFirstDesc = 0;
 #ifdef ATH_DEBUG
if (sc->sc_debug & ATH_DEBUG_XMIT)
-   ath_printtxbuf(sc, bf, qnum, 0, 0);
+   ath_printtxbuf(sc, bf, bf->bf_state.bfs_tx_queue,
+   0, 0);
 #endif
bf->bf_lastds = (struct ath_desc *) ds;
 
@@ -697,11 +695,11 @@ ath_tx_setds_11n(struct ath_softc *sc, s
  * during the beacon setup code.
  *
  * XXX TODO: since the AR9300 EDMA TX queue support wants the QCU ID
- * as part of the TX descriptor, bf_state.bfs_txq must be updated
+ * as part of the TX descriptor, bf_state.bfs_tx_queue must be updated
  * with the actual hardware txq, or all of this will fall apart.
  *
  * XXX It may not be a bad idea to just stuff the QCU ID into bf_state
- * and retire bfs_txq; then make sure the CABQ QCU ID is populated
+ * and retire bfs_tx_queue; then make sure the CABQ QCU ID is populated
  * correctly.
  */
 static void
@@ -1840,7 +1838,7 @@ ath_tx_start(struct ath_softc *sc, struc
 
/* Set local packet state, used to queue packets to hardware */
bf->bf_state.bfs_tid = tid;
-   bf->bf_state.bfs_txq = txq;
+   bf->bf_state.bfs_tx_queue = txq->axq_qnum;
bf->bf_state.bfs_pri = pri;
 
/*
@@ -1858,7 +1856,7 @@ ath_tx_start(struct ath_softc *sc, struc
 * queue, so the descriptor setup functions will
 * correctly initialise the descriptor 'qcuId' field.
 */
-   bf->bf_state.bfs_txq = sc->sc_cabq;
+   bf->bf_state.bfs_tx_queue = sc->sc_cabq->axq_qnum;
}
 
/* Do the generic frame setup */
@@ -2114,7 +2112,7 @@ ath_tx_raw_start(struct ath_softc *sc, s
 
/* Set local packet state, used to queue packets to hardware */
bf->bf_state.bfs_tid = WME_AC_TO_TID(pri);
-   bf->bf_state.bfs_txq = sc->sc_ac2q[pri];
+   bf->bf_state.bfs_tx_queue = sc->sc_ac2q[pri]->axq_qnum;
bf->bf_state.bfs_pri = pri;
 
/* XXX this should be done in ath_tx_setrate() */
@@ -2713,16 +2711,8 @@ ath_tx_xmit_aggr(struct ath_softc *sc, s
 struct ath_txq *txq, struct ath_buf *bf)
 {
struct ath_tid *tid = &an->an_tid[bf->bf_state.bfs_tid];
-// struct ath_txq *txq = bf->bf_state.bfs_txq;
struct ieee80211_tx_ampdu *tap;
 
-   if (txq != bf->bf_state.bfs_txq) {
-   device_printf(sc->sc_dev, "%s: txq %d != bfs_txq %d!\n",
-   __func__,
-   txq->axq_qnum,
-   bf->bf_state.bfs_txq->axq_qnum);
-   }
-
ATH_TX_LOCK_ASSERT(sc);
 
tap = ath_tx_get_tx_tid(an, tid->tid);
@@ -2821,9 +2811,8 @@ ath_tx_swq(struct ath_softc *sc, struct 
 
  

svn commit: r244110 - stable/9/sys/kern

2012-12-10 Thread Konstantin Belousov
Author: kib
Date: Tue Dec 11 05:11:28 2012
New Revision: 244110
URL: http://svnweb.freebsd.org/changeset/base/244110

Log:
  MFC r243868:
  Do not allocate buffer of the 255 bytes length on the stack.

Modified:
  stable/9/sys/kern/vfs_mountroot.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/kern/vfs_mountroot.c
==
--- stable/9/sys/kern/vfs_mountroot.c   Tue Dec 11 04:19:51 2012
(r244109)
+++ stable/9/sys/kern/vfs_mountroot.c   Tue Dec 11 05:11:28 2012
(r244110)
@@ -672,10 +672,11 @@ parse_mount_dev_present(const char *dev)
return (error != 0) ? 0 : 1;
 }
 
+#defineERRMSGL 255
 static int
 parse_mount(char **conf)
 {
-   char errmsg[255];
+   char *errmsg;
struct mntarg *ma;
char *dev, *fs, *opts, *tok;
int delay, error, timeout;
@@ -707,7 +708,7 @@ parse_mount(char **conf)
printf("Trying to mount root from %s:%s [%s]...\n", fs, dev,
(opts != NULL) ? opts : "");
 
-   bzero(errmsg, sizeof(errmsg));
+   errmsg = malloc(ERRMSGL, M_TEMP, M_WAITOK | M_ZERO);
 
if (vfs_byname(fs) == NULL) {
strlcpy(errmsg, "unknown file system", sizeof(errmsg));
@@ -734,7 +735,7 @@ parse_mount(char **conf)
ma = mount_arg(ma, "fstype", fs, -1);
ma = mount_arg(ma, "fspath", "/", -1);
ma = mount_arg(ma, "from", dev, -1);
-   ma = mount_arg(ma, "errmsg", errmsg, sizeof(errmsg));
+   ma = mount_arg(ma, "errmsg", errmsg, ERRMSGL);
ma = mount_arg(ma, "ro", NULL, 0);
ma = parse_mountroot_options(ma, opts);
error = kernel_mount(ma, MNT_ROOTFS);
@@ -748,11 +749,13 @@ parse_mount(char **conf)
printf(".\n");
}
free(fs, M_TEMP);
+   free(errmsg, M_TEMP);
if (opts != NULL)
free(opts, M_TEMP);
/* kernel_mount can return -1 on error. */
return ((error < 0) ? EDOOFUS : error);
 }
+#undef ERRMSGL
 
 static int
 vfs_mountroot_parse(struct sbuf *sb, struct mount *mpdevfs)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r244111 - head/sys/kern

2012-12-10 Thread Alfred Perlstein
Author: alfred
Date: Tue Dec 11 05:59:16 2012
New Revision: 244111
URL: http://svnweb.freebsd.org/changeset/base/244111

Log:
  Fix WITNESS when INVARIANT_SUPPORT is defined.
  
  This fixes tinderbox breakage from r244105.
  
  Pointed out by: adrian

Modified:
  head/sys/kern/subr_witness.c

Modified: head/sys/kern/subr_witness.c
==
--- head/sys/kern/subr_witness.cTue Dec 11 05:11:28 2012
(r244110)
+++ head/sys/kern/subr_witness.cTue Dec 11 05:59:16 2012
(r244111)
@@ -2263,6 +2263,7 @@ witness_assert(const struct lock_object 
else {
kassert_panic("Lock (%s) %s is not sleep or spin!",
class->lc_name, lock->lo_name);
+   return;
}
switch (flags) {
case LA_UNLOCKED:
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r243960 - in head/sys: amd64/include i386/include x86/include

2012-12-10 Thread Carl Delsey

On 12/10/2012 9:06 PM, Bruce Evans wrote:

On Tue, 11 Dec 2012, Niclas Zeising wrote:


On 12/11/12 00:54, Carl Delsey wrote:

On 12/10/12 16:40, Niclas Zeising wrote:

...
libpciaccess uses bus_space_[read,write]_[1,2,4], which are defined in
x86/bus.h.  It does not use the quad functions.
Regards!

Ok. In that case I won't ifdef out the functions themselves, just the
KASSERT in case libpciaccess expands in the future to 8 byte accesses
:-)  I had another related change in the works. I'll add this change 
in.


Sounds good to me, thank you very much!
Don't forget to ifdef the include o  as well as the 
KASSERTs.


Including it at all is namespace pollution.

It is a bug for any kernel .c file to not include  always
and early in its includes, because other includes may have KASSERT()s
in them.  Not all includes that uses KASSERT() have the namespace
pollution, so adding it to some just breaks detection of the bug in
some cases.

The folowing headers in  have the pollution: libkern.h, mbuf.h,
pmckern.h, refcount.h.  refcount.h only has the pollution if _KERNEL is
defined.  It handles the problem of polluting userland (though I think
userland should be rewarded by syntax errors if it uses refcount.h or
machine/bus.h) by supplying a dummy KASSERT() for the !_KERNEL case.

The following headers in  use KASSERT(): buf.h, eventhandler.h,
lock.h, mbuf.h, mount.h, mutex.h, osd.h, proc.h, random.h, refcount.h.
Most of them are missing the pollution.

The pollution in libkern.h is circular: libkern.h includes systm.h, and
systm.h includes libkern.h.  systm.h's include of libkern.h and of many
other headers like machine/atomic.h and machine/cpufunc.h is standard
pollution -- direct includes of these are style bugs, and not including
systm.h always and early is a bug because it may break more than 
KASSERT()

(other headers may also use inlines in libkern.h etc.).  The circular
pollution in libkern.h is used because most files in libkern don't 
include

systm.h directly; they mostly only include libkern.h directly.

This and other pollution in mbuf.h is especially disgusting since
mbuf.h is one of few headers that I managed to finish the #include
de-pollution of in FreeBSD-3 or 2.

Bruce
Thanks Bruce. I'll fix that in my change. It will make the bus.h file a 
bit cleaner.


This information should probably be in style(9). It talks a bit about 
how to include header files but it doesn't mention any of these details 
that I noticed. I'll take a stab at adding some of this info if I get a 
chance in the next few weeks.


Carl
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r244112 - head/sys/kern

2012-12-10 Thread Alfred Perlstein
Author: alfred
Date: Tue Dec 11 07:08:14 2012
New Revision: 244112
URL: http://svnweb.freebsd.org/changeset/base/244112

Log:
  Cleanup more of the kassert_panic.
  
  fix compile warnings on !amd64 and NULL derefs that would happen
  if kassert_panic() would return.

Modified:
  head/sys/kern/subr_witness.c

Modified: head/sys/kern/subr_witness.c
==
--- head/sys/kern/subr_witness.cTue Dec 11 05:59:16 2012
(r244111)
+++ head/sys/kern/subr_witness.cTue Dec 11 07:08:14 2012
(r244112)
@@ -1446,10 +1446,12 @@ witness_upgrade(struct lock_object *lock
fixup_filename(file), line);
}
instance = find_instance(curthread->td_sleeplocks, lock);
-   if (instance == NULL)
+   if (instance == NULL) {
kassert_panic("upgrade of unlocked lock (%s) %s @ %s:%d",
class->lc_name, lock->lo_name,
fixup_filename(file), line);
+   return;
+   }
if (witness_watch) {
if ((instance->li_flags & LI_EXCLUSIVE) != 0)
kassert_panic(
@@ -1490,10 +1492,12 @@ witness_downgrade(struct lock_object *lo
fixup_filename(file), line);
}
instance = find_instance(curthread->td_sleeplocks, lock);
-   if (instance == NULL)
+   if (instance == NULL) {
kassert_panic("downgrade of unlocked lock (%s) %s @ %s:%d",
class->lc_name, lock->lo_name,
fixup_filename(file), line);
+   return;
+   }
if (witness_watch) {
if ((instance->li_flags & LI_EXCLUSIVE) == 0)
kassert_panic(
@@ -1544,11 +1548,13 @@ witness_unlock(struct lock_object *lock,
 * We have to make sure we flush these queues, so just search for
 * eventual register locks and remove them.
 */
-   if (witness_watch > 0)
+   if (witness_watch > 0) {
kassert_panic("lock (%s) %s not locked @ %s:%d", class->lc_name,
lock->lo_name, fixup_filename(file), line);
-   else
return;
+   } else {
+   return;
+   }
 found:
 
/* First, check for shared/exclusive mismatches. */
@@ -1761,11 +1767,13 @@ enroll(const char *description, struct l
return (NULL);
else
typelist = &w_spin;
-   } else if ((lock_class->lc_flags & LC_SLEEPLOCK))
+   } else if ((lock_class->lc_flags & LC_SLEEPLOCK)) {
typelist = &w_sleep;
-   else
+   } else {
kassert_panic("lock class %s is not sleep or spin",
lock_class->lc_name);
+   return (NULL);
+   }
 
mtx_lock_spin(&w_mtx);
w = witness_hash_get(description);
@@ -1921,19 +1929,26 @@ adopt(struct witness *parent, struct wit
 static void
 itismychild(struct witness *parent, struct witness *child)
 {
+   int unlocked;
 
MPASS(child != NULL && parent != NULL);
if (witness_cold == 0)
mtx_assert(&w_mtx, MA_OWNED);
 
if (!witness_lock_type_equal(parent, child)) {
-   if (witness_cold == 0)
+   if (witness_cold == 0) {
+   unlocked = 1;
mtx_unlock_spin(&w_mtx);
+   } else {
+   unlocked = 0;
+   }
kassert_panic(
"%s: parent \"%s\" (%s) and child \"%s\" (%s) are not "
"the same lock type", __func__, parent->w_name,
parent->w_class->lc_name, child->w_name,
child->w_class->lc_name);
+   if (unlocked)
+   mtx_lock_spin(&w_mtx);
}
adopt(parent, child);
 }
@@ -2203,9 +2218,11 @@ witness_save(struct lock_object *lock, c
lock_list = PCPU_GET(spinlocks);
}
instance = find_instance(lock_list, lock);
-   if (instance == NULL)
+   if (instance == NULL) {
kassert_panic("%s: lock (%s) %s not locked", __func__,
class->lc_name, lock->lo_name);
+   return;
+   }
*filep = instance->li_file;
*linep = instance->li_line;
 }
@@ -2241,6 +2258,8 @@ witness_restore(struct lock_object *lock
class->lc_name, lock->lo_name);
lock->lo_witness->w_file = file;
lock->lo_witness->w_line = line;
+   if (instance == NULL)
+   return;
instance->li_file = file;
instance->li_line = line;
 }
@@ -2336,9 +2355,11 @@ witness_setflag(struct lock_object *lock
lock_list = PCPU_GET(spinlocks);
}
instance = find_instance(lock_list, lock);
-   if (instance == NULL)
+   if (instance == NULL) {
kassert_panic("%