svn commit: r280279 - head/sys/sys

2015-03-20 Thread John Baldwin
Author: jhb
Date: Fri Mar 20 10:27:06 2015
New Revision: 280279
URL: https://svnweb.freebsd.org/changeset/base/280279

Log:
  Expand the bitcount* API to support 64-bit integers, plain ints and longs
  and create a hidden API that can be used in other system headers without
  adding namespace pollution.
  - If the POPCNT instruction is enabled at compile time, use
__builtin_popcount*() to implement __bitcount*(), otherwise fall back
to software implementations.
  - Use the existing bitcount16() and bitcount32() from sys/systm.h to
implement the non-POPCNT __bitcount16() and __bitcount32() in
sys/types.h.
  - For the non-POPCNT __bitcount64(), use a similar SWAR method on 64-bit
systems.  For 32-bit systems, use two __bitcount32() operations on the
two halves.
  - Use __bitcount32() to provide a __bitcount() that operates on plain ints.
  - Use either __bitcount32() or __bitcount64() to provide a
__bitcountl() that operates on longs.
  - Add public bitcount*() wrappers for __bitcount*() for use in the kernel
in sys/libkern.h.
  - Use __builtinl() instead of __builtin_popcountl() in BIT_COUNT().
  
  Discussed with:   bde

Modified:
  head/sys/sys/bitset.h
  head/sys/sys/libkern.h
  head/sys/sys/systm.h
  head/sys/sys/types.h

Modified: head/sys/sys/bitset.h
==
--- head/sys/sys/bitset.h   Fri Mar 20 10:15:34 2015(r280278)
+++ head/sys/sys/bitset.h   Fri Mar 20 10:27:06 2015(r280279)
@@ -182,7 +182,7 @@
\
__count = 0;\
for (__i = 0; __i  __bitset_words((_s)); __i++)\
-   __count += __builtin_popcountl((p)-__bits[__i]);   \
+   __count += __bitcountl((p)-__bits[__i]);   \
__count;\
 })


Modified: head/sys/sys/libkern.h
==
--- head/sys/sys/libkern.h  Fri Mar 20 10:15:34 2015(r280278)
+++ head/sys/sys/libkern.h  Fri Mar 20 10:27:06 2015(r280279)
@@ -98,6 +98,11 @@ int   flsl(long);
 #ifndefHAVE_INLINE_FLSLL
 int flsll(long long);
 #endif
+#definebitcount64(x)   __bitcount64((uint64_t)(x))
+#definebitcount32(x)   __bitcount32((uint32_t)(x))
+#definebitcount16(x)   __bitcount16((uint16_t)(x))
+#definebitcountl(x)__bitcountl((u_long)(x))
+#definebitcount(x) __bitcount((u_int)(x))
 
 int fnmatch(const char *, const char *, int);
 int locc(int, char *, u_int);

Modified: head/sys/sys/systm.h
==
--- head/sys/sys/systm.hFri Mar 20 10:15:34 2015(r280278)
+++ head/sys/sys/systm.hFri Mar 20 10:27:06 2015(r280279)
@@ -428,33 +428,6 @@ int alloc_unr_specific(struct unrhdr *uh
 int alloc_unrl(struct unrhdr *uh);
 void free_unr(struct unrhdr *uh, u_int item);
 
-/*
- * Population count algorithm using SWAR approach
- * - SIMD Within A Register.
- */
-static __inline uint32_t
-bitcount32(uint32_t x)
-{
-
-   x = (x  0x) + ((x  0x)  1);
-   x = (x  0x) + ((x  0x)  2);
-   x = (x + (x  4))  0x0f0f0f0f;
-   x = (x + (x  8));
-   x = (x + (x  16))  0x00ff;
-   return (x);
-}
-
-static __inline uint16_t
-bitcount16(uint32_t x)
-{
-
-   x = (x  0x) + ((x  0x)  1);
-   x = (x  0x) + ((x  0x)  2);
-   x = (x + (x  4))  0x0f0f;
-   x = (x + (x  8))  0x00ff;
-   return (x);
-}
-
 void   intr_prof_stack_use(struct thread *td, struct trapframe *frame);
 
 #endif /* !_SYS_SYSTM_H_ */

Modified: head/sys/sys/types.h
==
--- head/sys/sys/types.hFri Mar 20 10:15:34 2015(r280278)
+++ head/sys/sys/types.hFri Mar 20 10:27:06 2015(r280279)
@@ -294,6 +294,68 @@ typedef_Bool   bool;
 
 #include sys/select.h
 
+#ifdef __POPCNT__
+#define__bitcount64(x) __builtin_popcountll((__uint64_t)(x))
+#define__bitcount32(x) __builtin_popcount((__uint32_t)(x))
+#define__bitcount16(x) __builtin_popcount((__uint16_t)(x))
+#define__bitcountl(x)  __builtin_popcountl((unsigned long)(x))
+#define__bitcount(x)   __builtin_popcount((unsigned int)(x))
+#else
+/*
+ * Population count algorithm using SWAR approach
+ * - SIMD Within A Register.
+ */
+static __inline __uint16_t
+__bitcount16(__uint16_t _x)
+{
+
+   _x = (_x  0x) + ((_x  0x)  1);
+   _x = (_x  0x) + ((_x  0x)  2);
+   _x = (_x + (_x  4))  0x0f0f;
+   _x = (_x + (_x  8))  0x00ff;
+   return (_x);
+}
+
+static __inline __uint32_t
+__bitcount32(__uint32_t _x)
+{
+

svn commit: r280308 - head/sys/fs/devfs

2015-03-20 Thread Xin LI
Author: delphij
Date: Sat Mar 21 01:14:11 2015
New Revision: 280308
URL: https://svnweb.freebsd.org/changeset/base/280308

Log:
  Disable timestamping on devfs read/write operations by default.
  
  Currently we update timestamps unconditionally when doing read or
  write operations.  This may slow things down on hardware where
  reading timestamps is expensive (e.g. HPET, because of the default
  vfs.timestamp_precision setting is nanosecond now) with limited
  benefit.
  
  A new sysctl variable, vfs.devfs.dotimes is added, which can be
  set to non-zero value when the old behavior is desirable.
  
  Differential Revision:https://reviews.freebsd.org/D2104
  Reported by:  Mike Tancsa mike sentex net
  Reviewed by:  kib
  Relnotes: yes
  Sponsored by: iXsystems, Inc.
  MFC after:2 weeks

Modified:
  head/sys/fs/devfs/devfs_devs.c
  head/sys/fs/devfs/devfs_vnops.c

Modified: head/sys/fs/devfs/devfs_devs.c
==
--- head/sys/fs/devfs/devfs_devs.c  Sat Mar 21 00:21:30 2015
(r280307)
+++ head/sys/fs/devfs/devfs_devs.c  Sat Mar 21 01:14:11 2015
(r280308)
@@ -61,7 +61,7 @@ static MALLOC_DEFINE(M_DEVFS2, DEVFS2,
 static MALLOC_DEFINE(M_DEVFS3, DEVFS3, DEVFS data 3);
 static MALLOC_DEFINE(M_CDEVP, DEVFS1, DEVFS cdev_priv storage);
 
-static SYSCTL_NODE(_vfs, OID_AUTO, devfs, CTLFLAG_RW, 0, DEVFS filesystem);
+SYSCTL_NODE(_vfs, OID_AUTO, devfs, CTLFLAG_RW, 0, DEVFS filesystem);
 
 static unsigned devfs_generation;
 SYSCTL_UINT(_vfs_devfs, OID_AUTO, generation, CTLFLAG_RD,

Modified: head/sys/fs/devfs/devfs_vnops.c
==
--- head/sys/fs/devfs/devfs_vnops.c Sat Mar 21 00:21:30 2015
(r280307)
+++ head/sys/fs/devfs/devfs_vnops.c Sat Mar 21 01:14:11 2015
(r280308)
@@ -57,6 +57,7 @@
 #include sys/proc.h
 #include sys/stat.h
 #include sys/sx.h
+#include sys/sysctl.h
 #include sys/time.h
 #include sys/ttycom.h
 #include sys/unistd.h
@@ -79,6 +80,12 @@ SX_SYSINIT(clone_drain_lock, clone_drai
 struct mtx cdevpriv_mtx;
 MTX_SYSINIT(cdevpriv_mtx, cdevpriv_mtx, cdevpriv lock, MTX_DEF);
 
+SYSCTL_DECL(_vfs_devfs);
+
+static int devfs_dotimes;
+SYSCTL_INT(_vfs_devfs, OID_AUTO, dotimes, CTLFLAG_RW,
+devfs_dotimes, 0, Update timestamps on DEVFS);
+
 static int
 devfs_fp_check(struct file *fp, struct cdev **devp, struct cdevsw **dswp,
 int *ref)
@@ -1221,7 +1228,8 @@ devfs_read_f(struct file *fp, struct uio
 
foffset_lock_uio(fp, uio, flags | FOF_NOLOCK);
error = dsw-d_read(dev, uio, ioflag);
-   if (uio-uio_resid != resid || (error == 0  resid != 0))
+   if (devfs_dotimes 
+   (uio-uio_resid != resid || (error == 0  resid != 0)))
vfs_timestamp(dev-si_atime);
td-td_fpop = fpop;
dev_relthread(dev, ref);
@@ -1700,7 +1708,8 @@ devfs_write_f(struct file *fp, struct ui
resid = uio-uio_resid;
 
error = dsw-d_write(dev, uio, ioflag);
-   if (uio-uio_resid != resid || (error == 0  resid != 0)) {
+   if (devfs_dotimes 
+   (uio-uio_resid != resid || (error == 0  resid != 0))) {
vfs_timestamp(dev-si_ctime);
dev-si_mtime = dev-si_ctime;
}
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r280307 - head/usr.bin/grep

2015-03-20 Thread Pedro F. Giffuni
Author: pfg
Date: Sat Mar 21 00:21:30 2015
New Revision: 280307
URL: https://svnweb.freebsd.org/changeset/base/280307

Log:
  bsdgrep: fix regression in the -f option since r268799
  
  Caused by an incomplete merge from NetBSD.
  
  PR:   198725
  MFC after:3 days

Modified:
  head/usr.bin/grep/grep.c

Modified: head/usr.bin/grep/grep.c
==
--- head/usr.bin/grep/grep.cFri Mar 20 23:48:11 2015(r280306)
+++ head/usr.bin/grep/grep.cSat Mar 21 00:21:30 2015(r280307)
@@ -316,7 +316,7 @@ read_patterns(const char *fn)
len = 0;
line = NULL;
while ((rlen = getline(line, len, f)) != -1)
-   add_pattern(line, line[0] == '\n' ? 0 : len);
+   add_pattern(line, line[0] == '\n' ? 0 : (size_t)rlen);
free(line);
if (ferror(f))
err(2, %s, fn);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r280306 - in head: secure/lib/libcrypto secure/lib/libssl sys/sys

2015-03-20 Thread Jung-uk Kim
Author: jkim
Date: Fri Mar 20 23:48:11 2015
New Revision: 280306
URL: https://svnweb.freebsd.org/changeset/base/280306

Log:
  Disable insecure SSLv2 support from the base OpenSSL.
  
  Differential Revision:https://reviews.freebsd.org/D1304

Modified:
  head/secure/lib/libcrypto/opensslconf-arm.h
  head/secure/lib/libcrypto/opensslconf-mips.h
  head/secure/lib/libcrypto/opensslconf-powerpc.h
  head/secure/lib/libcrypto/opensslconf-sparc64.h
  head/secure/lib/libcrypto/opensslconf-x86.h
  head/secure/lib/libssl/Makefile
  head/sys/sys/param.h

Modified: head/secure/lib/libcrypto/opensslconf-arm.h
==
--- head/secure/lib/libcrypto/opensslconf-arm.h Fri Mar 20 21:56:48 2015
(r280305)
+++ head/secure/lib/libcrypto/opensslconf-arm.h Fri Mar 20 23:48:11 2015
(r280306)
@@ -27,6 +27,9 @@ extern C {
 #ifndef OPENSSL_NO_SCTP
 # define OPENSSL_NO_SCTP
 #endif
+#ifndef OPENSSL_NO_SSL2
+# define OPENSSL_NO_SSL2
+#endif
 #ifndef OPENSSL_NO_STORE
 # define OPENSSL_NO_STORE
 #endif
@@ -69,6 +72,9 @@ extern C {
 # if defined(OPENSSL_NO_SCTP)  !defined(NO_SCTP)
 #  define NO_SCTP
 # endif
+# if defined(OPENSSL_NO_SSL2)  !defined(NO_SSL2)
+#  define NO_SSL2
+# endif
 # if defined(OPENSSL_NO_STORE)  !defined(NO_STORE)
 #  define NO_STORE
 # endif

Modified: head/secure/lib/libcrypto/opensslconf-mips.h
==
--- head/secure/lib/libcrypto/opensslconf-mips.hFri Mar 20 21:56:48 
2015(r280305)
+++ head/secure/lib/libcrypto/opensslconf-mips.hFri Mar 20 23:48:11 
2015(r280306)
@@ -27,6 +27,9 @@ extern C {
 #ifndef OPENSSL_NO_SCTP
 # define OPENSSL_NO_SCTP
 #endif
+#ifndef OPENSSL_NO_SSL2
+# define OPENSSL_NO_SSL2
+#endif
 #ifndef OPENSSL_NO_STORE
 # define OPENSSL_NO_STORE
 #endif
@@ -69,6 +72,9 @@ extern C {
 # if defined(OPENSSL_NO_SCTP)  !defined(NO_SCTP)
 #  define NO_SCTP
 # endif
+# if defined(OPENSSL_NO_SSL2)  !defined(NO_SSL2)
+#  define NO_SSL2
+# endif
 # if defined(OPENSSL_NO_STORE)  !defined(NO_STORE)
 #  define NO_STORE
 # endif

Modified: head/secure/lib/libcrypto/opensslconf-powerpc.h
==
--- head/secure/lib/libcrypto/opensslconf-powerpc.h Fri Mar 20 21:56:48 
2015(r280305)
+++ head/secure/lib/libcrypto/opensslconf-powerpc.h Fri Mar 20 23:48:11 
2015(r280306)
@@ -27,6 +27,9 @@ extern C {
 #ifndef OPENSSL_NO_SCTP
 # define OPENSSL_NO_SCTP
 #endif
+#ifndef OPENSSL_NO_SSL2
+# define OPENSSL_NO_SSL2
+#endif
 #ifndef OPENSSL_NO_STORE
 # define OPENSSL_NO_STORE
 #endif
@@ -69,6 +72,9 @@ extern C {
 # if defined(OPENSSL_NO_SCTP)  !defined(NO_SCTP)
 #  define NO_SCTP
 # endif
+# if defined(OPENSSL_NO_SSL2)  !defined(NO_SSL2)
+#  define NO_SSL2
+# endif
 # if defined(OPENSSL_NO_STORE)  !defined(NO_STORE)
 #  define NO_STORE
 # endif

Modified: head/secure/lib/libcrypto/opensslconf-sparc64.h
==
--- head/secure/lib/libcrypto/opensslconf-sparc64.h Fri Mar 20 21:56:48 
2015(r280305)
+++ head/secure/lib/libcrypto/opensslconf-sparc64.h Fri Mar 20 23:48:11 
2015(r280306)
@@ -27,6 +27,9 @@ extern C {
 #ifndef OPENSSL_NO_SCTP
 # define OPENSSL_NO_SCTP
 #endif
+#ifndef OPENSSL_NO_SSL2
+# define OPENSSL_NO_SSL2
+#endif
 #ifndef OPENSSL_NO_STORE
 # define OPENSSL_NO_STORE
 #endif
@@ -69,6 +72,9 @@ extern C {
 # if defined(OPENSSL_NO_SCTP)  !defined(NO_SCTP)
 #  define NO_SCTP
 # endif
+# if defined(OPENSSL_NO_SSL2)  !defined(NO_SSL2)
+#  define NO_SSL2
+# endif
 # if defined(OPENSSL_NO_STORE)  !defined(NO_STORE)
 #  define NO_STORE
 # endif

Modified: head/secure/lib/libcrypto/opensslconf-x86.h
==
--- head/secure/lib/libcrypto/opensslconf-x86.h Fri Mar 20 21:56:48 2015
(r280305)
+++ head/secure/lib/libcrypto/opensslconf-x86.h Fri Mar 20 23:48:11 2015
(r280306)
@@ -27,6 +27,9 @@ extern C {
 #ifndef OPENSSL_NO_SCTP
 # define OPENSSL_NO_SCTP
 #endif
+#ifndef OPENSSL_NO_SSL2
+# define OPENSSL_NO_SSL2
+#endif
 #ifndef OPENSSL_NO_STORE
 # define OPENSSL_NO_STORE
 #endif
@@ -66,6 +69,9 @@ extern C {
 # if defined(OPENSSL_NO_SCTP)  !defined(NO_SCTP)
 #  define NO_SCTP
 # endif
+# if defined(OPENSSL_NO_SSL2)  !defined(NO_SSL2)
+#  define NO_SSL2
+# endif
 # if defined(OPENSSL_NO_STORE)  !defined(NO_STORE)
 #  define NO_STORE
 # endif

Modified: head/secure/lib/libssl/Makefile
==
--- head/secure/lib/libssl/Makefile Fri Mar 20 21:56:48 2015
(r280305)
+++ head/secure/lib/libssl/Makefile Fri Mar 20 23:48:11 2015
(r280306)
@@ -12,11 +12,11 @@ NO_LINT=
 
 SRCS=  bio_ssl.c d1_both.c d1_clnt.c d1_enc.c d1_lib.c d1_meth.c d1_pkt.c \
d1_srtp.c d1_srvr.c s23_clnt.c 

Re: svn commit: r280279 - head/sys/sys

2015-03-20 Thread Konstantin Belousov
On Sat, Mar 21, 2015 at 09:42:51AM +1100, Bruce Evans wrote:
 On Fri, 20 Mar 2015, Konstantin Belousov wrote:
 
  On Fri, Mar 20, 2015 at 10:27:06AM +, John Baldwin wrote:
  Author: jhb
  Date: Fri Mar 20 10:27:06 2015
  New Revision: 280279
  URL: https://svnweb.freebsd.org/changeset/base/280279
 
  Log:
Expand the bitcount* API to support 64-bit integers, plain ints and longs
and create a hidden API that can be used in other system headers 
  without
adding namespace pollution.
- If the POPCNT instruction is enabled at compile time, use
  __builtin_popcount*() to implement __bitcount*(), otherwise fall back
  to software implementations.
 
  Are you aware of the Haswell errata HSD146 ?  I see the described behaviour
 
 I wasn't.
 
  on machines back to SandyBridge, but not on Nehalems.
  HSD146.   POPCNT Instruction May Take Longer to Execute Than Expected
  Problem: POPCNT instruction execution with a 32 or 64 bit operand may be
  delayed until previous non-dependent instructions have executed.
 
 If it only affects performance, then it is up to the compiler to fix it.
It affects performance on some cpu models.  It is too wrong for compiler
to issue cpuid before popcnt.  Always issuing xorl before popcnt, as
it is currently done by recent gcc, but not clang, is better, but still
I think it is up to the code author to decide.

 
  Jilles noted that gcc head and 4.9.2 already provides a workaround by
  xoring the dst register.  I have some patch for amd64 pmap, see the end
  of the message.
 
 IIRC, then patch never never uses asm, but intentionally uses the popcount
 builtin to avoid complications.
 
- Use the existing bitcount16() and bitcount32() from sys/systm.h to
  implement the non-POPCNT __bitcount16() and __bitcount32() in
  sys/types.h.
  Why is it in sys/types.h ?
 
 To make it easier to use, while minimizing namespace pollution and
 inefficiencies.  Like the functions used to implement ntohl(), except
 the implementation is MI so it doesn't need to be in machine.
 (The functions used to implement ntohl() are in machine/endian.h.
 sys/types.h always includes that, so it makes little difference to
 pollution and inefficiency that the implementation is not more directly
 in machine/_types.h.)  bitcount is simpler and not burdened by
 compatibility, so it doesn't need a separate header.)

Still, it is weird to provide functions from the sys/types.h namespace,
and even more weird to provide such special-purpose function.
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r280279 - head/sys/sys

2015-03-20 Thread Konstantin Belousov
On Fri, Mar 20, 2015 at 10:27:06AM +, John Baldwin wrote:
 Author: jhb
 Date: Fri Mar 20 10:27:06 2015
 New Revision: 280279
 URL: https://svnweb.freebsd.org/changeset/base/280279
 
 Log:
   Expand the bitcount* API to support 64-bit integers, plain ints and longs
   and create a hidden API that can be used in other system headers without
   adding namespace pollution.
   - If the POPCNT instruction is enabled at compile time, use
 __builtin_popcount*() to implement __bitcount*(), otherwise fall back
 to software implementations.
Are you aware of the Haswell errata HSD146 ?  I see the described behaviour
on machines back to SandyBridge, but not on Nehalems.
HSD146.   POPCNT Instruction May Take Longer to Execute Than Expected
Problem: POPCNT instruction execution with a 32 or 64 bit operand may be
delayed until previous non-dependent instructions have executed.

Jilles noted that gcc head and 4.9.2 already provides a workaround by
xoring the dst register.  I have some patch for amd64 pmap, see the end
of the message.

   - Use the existing bitcount16() and bitcount32() from sys/systm.h to
 implement the non-POPCNT __bitcount16() and __bitcount32() in
 sys/types.h.
Why is it in sys/types.h ?

   - For the non-POPCNT __bitcount64(), use a similar SWAR method on 64-bit
 systems.  For 32-bit systems, use two __bitcount32() operations on the
 two halves.
   - Use __bitcount32() to provide a __bitcount() that operates on plain ints.
   - Use either __bitcount32() or __bitcount64() to provide a
 __bitcountl() that operates on longs.
   - Add public bitcount*() wrappers for __bitcount*() for use in the kernel
 in sys/libkern.h.
   - Use __builtinl() instead of __builtin_popcountl() in BIT_COUNT().
   
   Discussed with: bde

diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c
index 6a4077c..f6fbc33 100644
--- a/sys/amd64/amd64/pmap.c
+++ b/sys/amd64/amd64/pmap.c
@@ -413,6 +417,7 @@ static void free_pv_chunk(struct pv_chunk *pc);
 static voidfree_pv_entry(pmap_t pmap, pv_entry_t pv);
 static pv_entry_t get_pv_entry(pmap_t pmap, struct rwlock **lockp);
 static int popcnt_pc_map_elem(uint64_t elem);
+static int popcnt_pc_map_elem_pq(uint64_t elem);
 static vm_page_t reclaim_pv_chunk(pmap_t locked_pmap, struct rwlock **lockp);
 static voidreserve_pv_entries(pmap_t pmap, int needed,
struct rwlock **lockp);
@@ -2997,6 +3020,29 @@ popcnt_pc_map_elem(uint64_t elem)
 }
 
 /*
+ * The erratas for Intel processors state that POPCNT Instruction May
+ * Take Longer to Execute Than Expected.  It is believed that the
+ * issue is the spurious dependency on the destination register.
+ * Provide a hint to the register rename logic that the destination
+ * value is overwritten, by clearing it, as suggested in the
+ * optimization manual.  It should be cheap for unaffected processors
+ * as well.
+ *
+ * Reference numbers for erratas are
+ * 4th Gen Core: HSD146
+ * 5th Gen Core: BDM85
+ */
+static int
+popcnt_pc_map_elem_pq(uint64_t elem)
+{
+   u_long result;
+
+   __asm __volatile(xorl %k0,%k0;popcntq %1,%0
+   : =r (result) : rm (elem));
+   return (result);
+}
+
+/*
  * Ensure that the number of spare PV entries in the specified pmap meets or
  * exceeds the given count, needed.
  *
@@ -3029,9 +3075,9 @@ retry:
free += popcnt_pc_map_elem(pc-pc_map[1]);
free += popcnt_pc_map_elem(pc-pc_map[2]);
} else {
-   free = popcntq(pc-pc_map[0]);
-   free += popcntq(pc-pc_map[1]);
-   free += popcntq(pc-pc_map[2]);
+   free = popcnt_pc_map_elem_pq(pc-pc_map[0]);
+   free += popcnt_pc_map_elem_pq(pc-pc_map[1]);
+   free += popcnt_pc_map_elem_pq(pc-pc_map[2]);
}
if (free == 0)
break;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r280285 - head/sys/arm/broadcom/bcm2835

2015-03-20 Thread Andrew Turner
Author: andrew
Date: Fri Mar 20 14:25:51 2015
New Revision: 280285
URL: https://svnweb.freebsd.org/changeset/base/280285

Log:
  Split out the common bcm283x fixes from the bcm2835 specific files.

Added:
  head/sys/arm/broadcom/bcm2835/files.bcm283x
 - copied, changed from r280125, head/sys/arm/broadcom/bcm2835/files.bcm2835
Modified:
  head/sys/arm/broadcom/bcm2835/files.bcm2835
  head/sys/arm/broadcom/bcm2835/std.bcm2835

Modified: head/sys/arm/broadcom/bcm2835/files.bcm2835
==
--- head/sys/arm/broadcom/bcm2835/files.bcm2835 Fri Mar 20 14:23:40 2015
(r280284)
+++ head/sys/arm/broadcom/bcm2835/files.bcm2835 Fri Mar 20 14:25:51 2015
(r280285)
@@ -1,54 +1,5 @@
 # $FreeBSD$
 
-arm/broadcom/bcm2835/bcm2835_bsc.c optional bcm2835_bsc
-arm/broadcom/bcm2835/bcm2835_common.c  optional fdt
-arm/broadcom/bcm2835/bcm2835_cpufreq.c standard
-arm/broadcom/bcm2835/bcm2835_dma.c standard
-arm/broadcom/bcm2835/bcm2835_fb.c  optional sc
-arm/broadcom/bcm2835/bcm2835_fbd.c optional vt
-arm/broadcom/bcm2835/bcm2835_gpio.coptional gpio
-arm/broadcom/bcm2835/bcm2835_intr.cstandard
-arm/broadcom/bcm2835/bcm2835_machdep.c standard
-arm/broadcom/bcm2835/bcm2835_mbox.cstandard
-arm/broadcom/bcm2835/bcm2835_sdhci.c   optional sdhci
-arm/broadcom/bcm2835/bcm2835_spi.c optional bcm2835_spi
 arm/broadcom/bcm2835/bcm2835_systimer.cstandard
-arm/broadcom/bcm2835/bcm2835_wdog.cstandard
 
-arm/broadcom/bcm2835/bcm283x_dwc_fdt.c optional dwcotg fdt
-
-arm/arm/bus_space_base.c   standard
-arm/arm/bus_space_generic.c standard
-arm/arm/bus_space_asm_generic.S standard
-arm/arm/cpufunc_asm_arm11.S standard
 arm/arm/cpufunc_asm_arm11x6.S   standard
-arm/arm/cpufunc_asm_armv5.S standard
-arm/arm/cpufunc_asm_armv6.S standard
-
-kern/kern_clocksource.c standard
-
-dev/mbox/mbox_if.m standard
-dev/ofw/ofw_cpu.c  standard
-
-arm/broadcom/bcm2835/bcm2835_audio.c   optional sound vchiq \
-   compile-with ${NORMAL_C} -DUSE_VCHIQ_ARM -D__VCCOREVER__=0x0400 
-I$S/contrib/vchiq
-
-# VideoCore driver
-contrib/vchiq/interface/compat/vchi_bsd.c  optional vchiq \
-   compile-with ${NORMAL_C} -DUSE_VCHIQ_ARM -D__VCCOREVER__=0x0400 
-I$S/contrib/vchiq
-contrib/vchiq/interface/vchiq_arm/vchiq_2835_arm.c optional vchiq \
-   compile-with ${NORMAL_C} -Wno-unused -DUSE_VCHIQ_ARM 
-D__VCCOREVER__=0x0400 -I$S/contrib/vchiq
-contrib/vchiq/interface/vchiq_arm/vchiq_arm.c  optional vchiq \
-   compile-with ${NORMAL_C} -Wno-unused -DUSE_VCHIQ_ARM 
-D__VCCOREVER__=0x0400 -I$S/contrib/vchiq
-contrib/vchiq/interface/vchiq_arm/vchiq_connected.coptional vchiq \
-   compile-with ${NORMAL_C} -DUSE_VCHIQ_ARM -D__VCCOREVER__=0x0400 
-I$S/contrib/vchiq
-contrib/vchiq/interface/vchiq_arm/vchiq_core.c optional vchiq \
-   compile-with ${NORMAL_C} -DUSE_VCHIQ_ARM -D__VCCOREVER__=0x0400 
-I$S/contrib/vchiq
-contrib/vchiq/interface/vchiq_arm/vchiq_kern_lib.c optional vchiq \
-   compile-with ${NORMAL_C} -DUSE_VCHIQ_ARM -D__VCCOREVER__=0x0400 
-I$S/contrib/vchiq
-contrib/vchiq/interface/vchiq_arm/vchiq_kmod.c optional vchiq \
-   compile-with ${NORMAL_C} -DUSE_VCHIQ_ARM -D__VCCOREVER__=0x0400 
-I$S/contrib/vchiq
-contrib/vchiq/interface/vchiq_arm/vchiq_shim.c optional vchiq \
-   compile-with ${NORMAL_C} -DUSE_VCHIQ_ARM -D__VCCOREVER__=0x0400 
-I$S/contrib/vchiq
-contrib/vchiq/interface/vchiq_arm/vchiq_util.c optional vchiq \
-   compile-with ${NORMAL_C} -DUSE_VCHIQ_ARM -D__VCCOREVER__=0x0400 
-I$S/contrib/vchiq

Copied and modified: head/sys/arm/broadcom/bcm2835/files.bcm283x (from r280125, 
head/sys/arm/broadcom/bcm2835/files.bcm2835)
==
--- head/sys/arm/broadcom/bcm2835/files.bcm2835 Sun Mar 15 21:57:44 2015
(r280125, copy source)
+++ head/sys/arm/broadcom/bcm2835/files.bcm283x Fri Mar 20 14:25:51 2015
(r280285)
@@ -12,16 +12,13 @@ arm/broadcom/bcm2835/bcm2835_machdep.c  
 arm/broadcom/bcm2835/bcm2835_mbox.cstandard
 arm/broadcom/bcm2835/bcm2835_sdhci.c   optional sdhci
 arm/broadcom/bcm2835/bcm2835_spi.c optional bcm2835_spi
-arm/broadcom/bcm2835/bcm2835_systimer.cstandard
 arm/broadcom/bcm2835/bcm2835_wdog.cstandard
-
 arm/broadcom/bcm2835/bcm283x_dwc_fdt.c optional dwcotg fdt
 
 arm/arm/bus_space_base.c   standard
 arm/arm/bus_space_generic.c standard
 arm/arm/bus_space_asm_generic.S 

svn commit: r280280 - head/sys/net

2015-03-20 Thread Gleb Smirnoff
Author: glebius
Date: Fri Mar 20 14:05:17 2015
New Revision: 280280
URL: https://svnweb.freebsd.org/changeset/base/280280

Log:
  Now, when r272244 introduced counter(9) based counters for all interfaces,
  revert the r271538, which did that for vlan(4) only.
  
  No objections:melifaro
  Sponsored by: Nginx, Inc.

Modified:
  head/sys/net/if_vlan.c

Modified: head/sys/net/if_vlan.c
==
--- head/sys/net/if_vlan.c  Fri Mar 20 10:27:06 2015(r280279)
+++ head/sys/net/if_vlan.c  Fri Mar 20 14:05:17 2015(r280280)
@@ -104,12 +104,6 @@ struct vlan_mc_entry {
 struct ifvlan {
struct  ifvlantrunk *ifv_trunk;
struct  ifnet *ifv_ifp;
-   counter_u64_t   ifv_ipackets;
-   counter_u64_t   ifv_ibytes;
-   counter_u64_t   ifv_opackets;
-   counter_u64_t   ifv_obytes;
-   counter_u64_t   ifv_omcasts;
-   counter_u64_t   ifv_oerrors;
 #defineTRUNK(ifv)  ((ifv)-ifv_trunk)
 #definePARENT(ifv) ((ifv)-ifv_trunk-parent)
void*ifv_cookie;
@@ -202,7 +196,6 @@ static  void vlan_init(void *foo);
 static void vlan_input(struct ifnet *ifp, struct mbuf *m);
 static int vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t addr);
 static void vlan_qflush(struct ifnet *ifp);
-static uint64_t vlan_get_counter(struct ifnet *ifp, ift_counter cnt);
 static int vlan_setflag(struct ifnet *ifp, int flag, int status,
 int (*func)(struct ifnet *, int));
 static int vlan_setflags(struct ifnet *ifp, int status);
@@ -955,14 +948,6 @@ vlan_clone_create(struct if_clone *ifc, 
return (ENOSPC);
}
SLIST_INIT(ifv-vlan_mc_listhead);
-   /* Prepare pcpu counters */
-   ifv-ifv_ipackets = counter_u64_alloc(M_WAITOK);
-   ifv-ifv_opackets = counter_u64_alloc(M_WAITOK);
-   ifv-ifv_ibytes = counter_u64_alloc(M_WAITOK);
-   ifv-ifv_obytes = counter_u64_alloc(M_WAITOK);
-   ifv-ifv_omcasts = counter_u64_alloc(M_WAITOK);
-   ifv-ifv_oerrors = counter_u64_alloc(M_WAITOK);
-
ifp-if_softc = ifv;
/*
 * Set the name manually rather than using if_initname because
@@ -981,7 +966,6 @@ vlan_clone_create(struct if_clone *ifc, 
ifp-if_qflush = vlan_qflush;
ifp-if_ioctl = vlan_ioctl;
ifp-if_flags = VLAN_IFFLAGS;
-   ifp-if_get_counter = vlan_get_counter;
ether_ifattach(ifp, eaddr);
/* Now undo some of the damage... */
ifp-if_baudrate = 0;
@@ -1024,12 +1008,6 @@ vlan_clone_destroy(struct if_clone *ifc,
ether_ifdetach(ifp);/* first, remove it from system-wide lists */
vlan_unconfig(ifp); /* now it can be unconfigured and freed */
if_free(ifp);
-   counter_u64_free(ifv-ifv_ipackets);
-   counter_u64_free(ifv-ifv_opackets);
-   counter_u64_free(ifv-ifv_ibytes);
-   counter_u64_free(ifv-ifv_obytes);
-   counter_u64_free(ifv-ifv_omcasts);
-   counter_u64_free(ifv-ifv_oerrors);
free(ifv, M_VLAN);
ifc_free_unit(ifc, unit);
 
@@ -1067,7 +1045,7 @@ vlan_transmit(struct ifnet *ifp, struct 
 */
if (!UP_AND_RUNNING(p)) {
m_freem(m);
-   counter_u64_add(ifv-ifv_oerrors, 1);
+   if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
return (ENETDOWN);
}
 
@@ -1094,7 +1072,7 @@ vlan_transmit(struct ifnet *ifp, struct 
 
if (n  0) {
if_printf(ifp, cannot pad short frame\n);
-   counter_u64_add(ifv-ifv_oerrors, 1);
+   if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
m_freem(m);
return (0);
}
@@ -1114,7 +1092,7 @@ vlan_transmit(struct ifnet *ifp, struct 
m = ether_vlanencap(m, ifv-ifv_vid);
if (m == NULL) {
if_printf(ifp, unable to prepend VLAN header\n);
-   counter_u64_add(ifv-ifv_oerrors, 1);
+   if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
return (0);
}
}
@@ -1124,40 +1102,14 @@ vlan_transmit(struct ifnet *ifp, struct 
 */
error = (p-if_transmit)(p, m);
if (error == 0) {
-   counter_u64_add(ifv-ifv_opackets, 1);
-   counter_u64_add(ifv-ifv_obytes, len);
-   counter_u64_add(ifv-ifv_omcasts, mcast);
+   if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
+   if_inc_counter(ifp, IFCOUNTER_OBYTES, len);
+   if_inc_counter(ifp, IFCOUNTER_OMCASTS, mcast);
} else
-   counter_u64_add(ifv-ifv_oerrors, 1);
+   if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
return (error);
 }
 
-static uint64_t
-vlan_get_counter(struct ifnet *ifp, ift_counter cnt)
-{
-   struct ifvlan *ifv;
-
-   ifv = ifp-if_softc;
-
-   switch (cnt) {
-   

svn commit: r280310 - head/usr.sbin/bsdinstall/scripts

2015-03-20 Thread Devin Teske
Author: dteske
Date: Sat Mar 21 03:52:43 2015
New Revision: 280310
URL: https://svnweb.freebsd.org/changeset/base/280310

Log:
  Whitespace cleanup(s).
  
  MFC after:3 days
  X-MFC-to: stable/10

Modified:
  head/usr.sbin/bsdinstall/scripts/zfsboot

Modified: head/usr.sbin/bsdinstall/scripts/zfsboot
==
--- head/usr.sbin/bsdinstall/scripts/zfsbootSat Mar 21 01:39:44 2015
(r280309)
+++ head/usr.sbin/bsdinstall/scripts/zfsbootSat Mar 21 03:52:43 2015
(r280310)
@@ -320,31 +320,34 @@ dialog_menu_main()
[ $ZFSBOOT_SWAP_MIRROR ]  swapmirror=$msg_yes
local disks n disks_grammar
f_count n $ZFSBOOT_DISKS
-   { [ $n -eq 1 ]  disks_grammar=$msg_disk_singular; } || 
+   { [ $n -eq 1 ]  disks_grammar=$msg_disk_singular; } ||
disks_grammar=$msg_disk_plural # grammar
local menu_list=
-   ' $msg_install''$msg_install_desc'
- '$msg_install_help'
-   'T $msg_pool_type_disks'  '$ZFSBOOT_VDEV_TYPE: $n 
$disks_grammar'
-  '$msg_pool_type_disks_help'
-   '- $msg_rescan_devices'   '*'
- '$msg_rescan_devices_help'
-   '- $msg_disk_info''*'
- '$msg_disk_info_help'
-   'N $msg_pool_name''$ZFSBOOT_POOL_NAME'
- '$msg_pool_name_help'
-   '4 $msg_force_4k_sectors' '$force4k'
- '$msg_force_4k_sectors_help'
-   'E $msg_encrypt_disks''$usegeli'
- '$msg_encrypt_disks_help'
-   'P $msg_partition_scheme' '$ZFSBOOT_PARTITION_SCHEME'
- '$msg_partition_scheme_help'
-   'S $msg_swap_size''$ZFSBOOT_SWAP_SIZE'
- '$msg_swap_size_help'
-   'M $msg_swap_mirror'  '$swapmirror'
- '$msg_swap_mirror_help'
-   'W $msg_swap_encrypt' '$swapgeli'
- '$msg_swap_encrypt_help'
+   ' $msg_install'  '$msg_install_desc'
+   '$msg_install_help'
+   'T $msg_pool_type_disks'
+   '$ZFSBOOT_VDEV_TYPE: $n $disks_grammar'
+   '$msg_pool_type_disks_help'
+   '- $msg_rescan_devices' '*'
+   '$msg_rescan_devices_help'
+   '- $msg_disk_info'  '*'
+   '$msg_disk_info_help'
+   'N $msg_pool_name'  '$ZFSBOOT_POOL_NAME'
+   '$msg_pool_name_help'
+   '4 $msg_force_4k_sectors'
+   '$force4k'
+   '$msg_force_4k_sectors_help'
+   'E $msg_encrypt_disks'  '$usegeli'
+   '$msg_encrypt_disks_help'
+   'P $msg_partition_scheme'
+   '$ZFSBOOT_PARTITION_SCHEME'
+   '$msg_partition_scheme_help'
+   'S $msg_swap_size'  '$ZFSBOOT_SWAP_SIZE'
+   '$msg_swap_size_help'
+   'M $msg_swap_mirror''$swapmirror'
+   '$msg_swap_mirror_help'
+   'W $msg_swap_encrypt'   '$swapgeli'
+   '$msg_swap_encrypt_help'
 # END-QUOTE
local defaultitem= # Calculated below
local hline=$hline_alnum_arrows_punc_tab_enter
@@ -937,12 +940,12 @@ zfs_create_diskpart()
# 5. Add freebsd-zfs partition for zroot
#
f_eval_catch $funcname gpart $GPART_ADD_INDEX \
-$mbrindex freebsd-zfs ${disk}s1 || return $FAILURE
+$mbrindex freebsd-zfs ${disk}s1 || return $FAILURE
f_eval_catch -d $funcname zpool $ZPOOL_LABELCLEAR_F \
-   /dev/$disk$targetpart # Pedantic
+   /dev/$disk$targetpart # Pedantic
f_eval_catch $funcname dd $DD_WITH_OPTIONS \
-/boot/zfsboot /dev/${disk}s1 count=1 ||
-return $FAILURE
+/boot/zfsboot /dev/${disk}s1 count=1 ||
+return $FAILURE
;;
 
esac # $ZFSBOOT_PARTITION_SCHEME
@@ -1123,7 +1126,7 @@ zfs_create_boot()
if [ $ZFSBOOT_GELI_ENCRYPTION ]; then
# Generate an encryption key using random(4)

svn commit: r280312 - head/sys/kern

2015-03-20 Thread Mateusz Guzik
Author: mjg
Date: Sat Mar 21 04:39:33 2015
New Revision: 280312
URL: https://svnweb.freebsd.org/changeset/base/280312

Log:
  coredump: protect corefilename access with a lock
  
  Previously format string traversal could happen while the string itself was
  being modified.
  
  Use allproc_lock as coredumping is a rare operation and as such we don't
  have to create a dedicated lock.
  
  Submitted by: Tiwei Bie btw mail.ustc.edu.cn
  Reviewed by:  kib
  X-Additional: JuniorJobs project

Modified:
  head/sys/kern/kern_sig.c

Modified: head/sys/kern/kern_sig.c
==
--- head/sys/kern/kern_sig.cSat Mar 21 03:54:11 2015(r280311)
+++ head/sys/kern/kern_sig.cSat Mar 21 04:39:33 2015(r280312)
@@ -3089,9 +3089,28 @@ SYSCTL_INT(_kern, OID_AUTO, compress_use
 static int compress_user_cores = 0;
 #endif
 
+/*
+ * Protect the access to corefilename[] by allproc_lock.
+ */
+#definecorefilename_lock   allproc_lock
+
 static char corefilename[MAXPATHLEN] = {%N.core};
-SYSCTL_STRING(_kern, OID_AUTO, corefile, CTLFLAG_RWTUN, corefilename,
-sizeof(corefilename), Process corefile name format string);
+
+static int
+sysctl_kern_corefile(SYSCTL_HANDLER_ARGS)
+{
+   int error;
+
+   sx_xlock(corefilename_lock);
+   error = sysctl_handle_string(oidp, corefilename, sizeof(corefilename),
+   req);
+   sx_xunlock(corefilename_lock);
+
+   return (error);
+}
+SYSCTL_PROC(_kern, OID_AUTO, corefile, CTLTYPE_STRING | CTLFLAG_RWTUN |
+CTLFLAG_MPSAFE, 0, 0, sysctl_kern_corefile, A,
+Process corefile name format string);
 
 /*
  * corefile_open(comm, uid, pid, td, compress, vpp, namep)
@@ -3120,6 +3139,7 @@ corefile_open(const char *comm, uid_t ui
name = malloc(MAXPATHLEN, M_TEMP, M_WAITOK | M_ZERO);
indexpos = -1;
(void)sbuf_new(sb, name, MAXPATHLEN, SBUF_FIXEDLEN);
+   sx_slock(corefilename_lock);
for (i = 0; format[i] != '\0'; i++) {
switch (format[i]) {
case '%':   /* Format character */
@@ -3162,6 +3182,7 @@ corefile_open(const char *comm, uid_t ui
break;
}
}
+   sx_sunlock(corefilename_lock);
free(hostname, M_TEMP);
if (compress)
sbuf_printf(sb, GZ_SUFFIX);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r280311 - head/usr.sbin/bsdinstall/scripts

2015-03-20 Thread Devin Teske
Author: dteske
Date: Sat Mar 21 03:54:11 2015
New Revision: 280311
URL: https://svnweb.freebsd.org/changeset/base/280311

Log:
  Update copyright(s)
  
  MFC after:3 days
  X-MFC-to: stable/10

Modified:
  head/usr.sbin/bsdinstall/scripts/zfsboot

Modified: head/usr.sbin/bsdinstall/scripts/zfsboot
==
--- head/usr.sbin/bsdinstall/scripts/zfsbootSat Mar 21 03:52:43 2015
(r280310)
+++ head/usr.sbin/bsdinstall/scripts/zfsbootSat Mar 21 03:54:11 2015
(r280311)
@@ -1,7 +1,7 @@
 #!/bin/sh
 #-
-# Copyright (c) 2013 Allan Jude
-# Copyright (c) 2013 Devin Teske
+# Copyright (c) 2013-2014 Allan Jude
+# Copyright (c) 2013-2015 Devin Teske
 # All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r280303 - head/sys/net

2015-03-20 Thread Gleb Smirnoff
Author: glebius
Date: Fri Mar 20 21:09:03 2015
New Revision: 280303
URL: https://svnweb.freebsd.org/changeset/base/280303

Log:
  Make vlan_config() the signle point of validity checks.
  
  Sponsored by: Nginx, Inc.

Modified:
  head/sys/net/if_vlan.c

Modified: head/sys/net/if_vlan.c
==
--- head/sys/net/if_vlan.c  Fri Mar 20 20:42:58 2015(r280302)
+++ head/sys/net/if_vlan.c  Fri Mar 20 21:09:03 2015(r280303)
@@ -817,14 +817,6 @@ vlan_clone_match_ethervid(const char *na
*cp = '\0';
if ((ifp = ifunit(ifname)) == NULL)
return (NULL);
-   /*
-* We can handle non-ethernet hardware types as long as
-* they handle the tagging and headers themselves.
-*/
-   if (ifp-if_type != IFT_ETHER 
-   (ifp-if_capenable  IFCAP_VLAN_HWTAGGING) == 0)
-   return (NULL);
-
/* Parse VID. */
if (*++cp == '\0')
return (NULL);
@@ -892,13 +884,7 @@ vlan_clone_create(struct if_clone *ifc, 
return error;
p = ifunit(vlr.vlr_parent);
if (p == NULL)
-   return ENXIO;
-   /*
-* Don't let the caller set up a VLAN VID with
-* anything except VLID bits.
-*/
-   if (vlr.vlr_tag  ~EVL_VLID_MASK)
-   return (EINVAL);
+   return (ENXIO);
error = ifc_name2unit(name, unit);
if (error != 0)
return (error);
@@ -910,13 +896,6 @@ vlan_clone_create(struct if_clone *ifc, 
ethertag = 1;
unit = -1;
wildcard = 0;
-
-   /*
-* Don't let the caller set up a VLAN VID with
-* anything except VLID bits.
-*/
-   if (vid  ~EVL_VLID_MASK)
-   return (EINVAL);
} else {
ethertag = 0;
 
@@ -1198,14 +1177,22 @@ vlan_config(struct ifvlan *ifv, struct i
struct ifnet *ifp;
int error = 0;
 
-   /* VID numbers 0x0 and 0xFFF are reserved */
-   if (vid == 0 || vid == 0xFFF)
-   return (EINVAL);
+   /*
+* We can handle non-ethernet hardware types as long as
+* they handle the tagging and headers themselves.
+*/
if (p-if_type != IFT_ETHER 
(p-if_capenable  IFCAP_VLAN_HWTAGGING) == 0)
return (EPROTONOSUPPORT);
if ((p-if_flags  VLAN_IFFLAGS) != VLAN_IFFLAGS)
return (EPROTONOSUPPORT);
+   /*
+* Don't let the caller set up a VLAN VID with
+* anything except VLID bits.
+* VID numbers 0x0 and 0xFFF are reserved.
+*/
+   if (vid == 0 || vid == 0xFFF || (vid  ~EVL_VLID_MASK))
+   return (EINVAL);
if (ifv-ifv_trunk)
return (EBUSY);
 
@@ -1670,14 +1657,6 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd
error = ENOENT;
break;
}
-   /*
-* Don't let the caller set up a VLAN VID with
-* anything except VLID bits.
-*/
-   if (vlr.vlr_tag  ~EVL_VLID_MASK) {
-   error = EINVAL;
-   break;
-   }
error = vlan_config(ifv, p, vlr.vlr_tag);
if (error)
break;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r280297 - in head: crypto/openssl crypto/openssl/apps crypto/openssl/crypto crypto/openssl/crypto/aes crypto/openssl/crypto/asn1 crypto/openssl/crypto/bf crypto/openssl/crypto/bio crypt...

2015-03-20 Thread Jung-uk Kim
Author: jkim
Date: Fri Mar 20 19:16:18 2015
New Revision: 280297
URL: https://svnweb.freebsd.org/changeset/base/280297

Log:
  Merge OpenSSL 1.0.1m.

Added:
  head/crypto/openssl/crypto/evp/evp_extra_test.c
 - copied unchanged from r280288, 
vendor-crypto/openssl/dist/crypto/evp/evp_extra_test.c
  head/crypto/openssl/doc/crypto/d2i_CMS_ContentInfo.pod
 - copied unchanged from r280288, 
vendor-crypto/openssl/dist/doc/crypto/d2i_CMS_ContentInfo.pod
  head/crypto/openssl/doc/crypto/d2i_ECPrivateKey.pod
 - copied unchanged from r280288, 
vendor-crypto/openssl/dist/doc/crypto/d2i_ECPrivateKey.pod
  head/crypto/openssl/doc/ssl/SSL_CTX_set_read_ahead.pod
 - copied unchanged from r280288, 
vendor-crypto/openssl/dist/doc/ssl/SSL_CTX_set_read_ahead.pod
  head/crypto/openssl/util/indent.pro
 - copied unchanged from r280288, vendor-crypto/openssl/dist/util/indent.pro
  head/crypto/openssl/util/openssl-format-source
 - copied unchanged from r280288, 
vendor-crypto/openssl/dist/util/openssl-format-source
  head/crypto/openssl/util/su-filter.pl
 - copied unchanged from r280288, 
vendor-crypto/openssl/dist/util/su-filter.pl
  head/secure/lib/libcrypto/man/d2i_CMS_ContentInfo.3   (contents, props 
changed)
  head/secure/lib/libcrypto/man/d2i_ECPrivateKey.3   (contents, props changed)
  head/secure/lib/libssl/man/SSL_CTX_set_read_ahead.3   (contents, props 
changed)
Modified:
  head/crypto/openssl/CHANGES
  head/crypto/openssl/Configure
  head/crypto/openssl/Makefile
  head/crypto/openssl/NEWS
  head/crypto/openssl/README
  head/crypto/openssl/apps/app_rand.c
  head/crypto/openssl/apps/apps.c
  head/crypto/openssl/apps/apps.h
  head/crypto/openssl/apps/asn1pars.c
  head/crypto/openssl/apps/ca.c
  head/crypto/openssl/apps/ciphers.c
  head/crypto/openssl/apps/cms.c
  head/crypto/openssl/apps/crl.c
  head/crypto/openssl/apps/crl2p7.c
  head/crypto/openssl/apps/dgst.c
  head/crypto/openssl/apps/dh.c
  head/crypto/openssl/apps/dhparam.c
  head/crypto/openssl/apps/dsa.c
  head/crypto/openssl/apps/dsaparam.c
  head/crypto/openssl/apps/ec.c
  head/crypto/openssl/apps/ecparam.c
  head/crypto/openssl/apps/enc.c
  head/crypto/openssl/apps/engine.c
  head/crypto/openssl/apps/errstr.c
  head/crypto/openssl/apps/gendh.c
  head/crypto/openssl/apps/gendsa.c
  head/crypto/openssl/apps/genpkey.c
  head/crypto/openssl/apps/genrsa.c
  head/crypto/openssl/apps/nseq.c
  head/crypto/openssl/apps/ocsp.c
  head/crypto/openssl/apps/openssl.c
  head/crypto/openssl/apps/passwd.c
  head/crypto/openssl/apps/pkcs12.c
  head/crypto/openssl/apps/pkcs7.c
  head/crypto/openssl/apps/pkcs8.c
  head/crypto/openssl/apps/pkey.c
  head/crypto/openssl/apps/pkeyparam.c
  head/crypto/openssl/apps/pkeyutl.c
  head/crypto/openssl/apps/prime.c
  head/crypto/openssl/apps/progs.h
  head/crypto/openssl/apps/rand.c
  head/crypto/openssl/apps/req.c
  head/crypto/openssl/apps/rsa.c
  head/crypto/openssl/apps/rsautl.c
  head/crypto/openssl/apps/s_apps.h
  head/crypto/openssl/apps/s_cb.c
  head/crypto/openssl/apps/s_client.c
  head/crypto/openssl/apps/s_server.c
  head/crypto/openssl/apps/s_socket.c
  head/crypto/openssl/apps/s_time.c
  head/crypto/openssl/apps/sess_id.c
  head/crypto/openssl/apps/smime.c
  head/crypto/openssl/apps/speed.c
  head/crypto/openssl/apps/spkac.c
  head/crypto/openssl/apps/srp.c
  head/crypto/openssl/apps/testdsa.h
  head/crypto/openssl/apps/testrsa.h
  head/crypto/openssl/apps/timeouts.h
  head/crypto/openssl/apps/ts.c
  head/crypto/openssl/apps/verify.c
  head/crypto/openssl/apps/version.c
  head/crypto/openssl/apps/x509.c
  head/crypto/openssl/crypto/LPdir_unix.c
  head/crypto/openssl/crypto/aes/aes.h
  head/crypto/openssl/crypto/aes/aes_cbc.c
  head/crypto/openssl/crypto/aes/aes_cfb.c
  head/crypto/openssl/crypto/aes/aes_core.c
  head/crypto/openssl/crypto/aes/aes_ctr.c
  head/crypto/openssl/crypto/aes/aes_ecb.c
  head/crypto/openssl/crypto/aes/aes_ige.c
  head/crypto/openssl/crypto/aes/aes_locl.h
  head/crypto/openssl/crypto/aes/aes_misc.c
  head/crypto/openssl/crypto/aes/aes_ofb.c
  head/crypto/openssl/crypto/aes/aes_wrap.c
  head/crypto/openssl/crypto/aes/aes_x86core.c
  head/crypto/openssl/crypto/arm_arch.h
  head/crypto/openssl/crypto/armcap.c
  head/crypto/openssl/crypto/asn1/a_bitstr.c
  head/crypto/openssl/crypto/asn1/a_bool.c
  head/crypto/openssl/crypto/asn1/a_bytes.c
  head/crypto/openssl/crypto/asn1/a_d2i_fp.c
  head/crypto/openssl/crypto/asn1/a_digest.c
  head/crypto/openssl/crypto/asn1/a_dup.c
  head/crypto/openssl/crypto/asn1/a_enum.c
  head/crypto/openssl/crypto/asn1/a_gentm.c
  head/crypto/openssl/crypto/asn1/a_i2d_fp.c
  head/crypto/openssl/crypto/asn1/a_int.c
  head/crypto/openssl/crypto/asn1/a_mbstr.c
  head/crypto/openssl/crypto/asn1/a_object.c
  head/crypto/openssl/crypto/asn1/a_octet.c
  head/crypto/openssl/crypto/asn1/a_print.c
  head/crypto/openssl/crypto/asn1/a_set.c
  head/crypto/openssl/crypto/asn1/a_sign.c
  head/crypto/openssl/crypto/asn1/a_strex.c
  

svn commit: r280293 - head/usr.sbin/bhyve

2015-03-20 Thread Alexander Motin
Author: mav
Date: Fri Mar 20 16:05:13 2015
New Revision: 280293
URL: https://svnweb.freebsd.org/changeset/base/280293

Log:
  Add missing variable initialization.
  
  Reported by:  Coverity
  CID:  1288938
  MFC after:3 days

Modified:
  head/usr.sbin/bhyve/pci_ahci.c

Modified: head/usr.sbin/bhyve/pci_ahci.c
==
--- head/usr.sbin/bhyve/pci_ahci.c  Fri Mar 20 15:41:23 2015
(r280292)
+++ head/usr.sbin/bhyve/pci_ahci.c  Fri Mar 20 16:05:13 2015
(r280293)
@@ -1759,7 +1759,7 @@ ata_ioreq_cb(struct blockif_req *br, int
 
DPRINTF(%s %d\n, __func__, err);
 
-   ncq = 0;
+   ncq = dsm = 0;
aior = br-br_param;
p = aior-io_pr;
cfis = aior-cfis;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r280294 - head/sys/arm/broadcom/bcm2835

2015-03-20 Thread Andrew Turner
Author: andrew
Date: Fri Mar 20 16:54:21 2015
New Revision: 280294
URL: https://svnweb.freebsd.org/changeset/base/280294

Log:
  Add a helper function to read clock frequencies from videocore and use this
  to get the default frequency of the sdhci device.
  
  While here use a u_int to hold the frequency as it may be too large to fit
  in a 32-bit signed integer. This is the case when we have a 250MHz clock.

Modified:
  head/sys/arm/broadcom/bcm2835/bcm2835_mbox.c
  head/sys/arm/broadcom/bcm2835/bcm2835_mbox_prop.h
  head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_mbox.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_mbox.cFri Mar 20 16:05:13 
2015(r280293)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_mbox.cFri Mar 20 16:54:21 
2015(r280294)
@@ -284,53 +284,63 @@ bcm2835_mbox_dma_cb(void *arg, bus_dma_s
*addr = PHYS_TO_VCBUS(segs[0].ds_addr);
 }
 
-int
-bcm2835_mbox_set_power_state(device_t dev, uint32_t device_id, boolean_t on)
+static void *
+bcm2835_mbox_init_dma(device_t dev, size_t len, bus_dma_tag_t *tag,
+bus_dmamap_t *map, bus_addr_t *phys)
 {
-   struct msg_set_power_state *msg;
-   bus_dma_tag_t msg_tag;
-   bus_dmamap_t msg_map;
-   bus_addr_t msg_phys;
-   void *msg_buf;
-   uint32_t reg;
-   device_t mbox;
+   void *buf;
int err;
 
-   /* get mbox device */
-   mbox = devclass_get_device(devclass_find(mbox), 0);
-   if (mbox == NULL) {
-   device_printf(dev, can't find mbox\n);
-   return (ENXIO);
-   }
-
err = bus_dma_tag_create(bus_get_dma_tag(dev), 16, 0,
BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
-   sizeof(struct msg_set_power_state), 1,
-   sizeof(struct msg_set_power_state), 0,
-   NULL, NULL, msg_tag);
+   len, 1, len, 0, NULL, NULL, tag);
if (err != 0) {
device_printf(dev, can't create DMA tag\n);
-   return (ENXIO);
+   return (NULL);
}
 
-   err = bus_dmamem_alloc(msg_tag, (void **)msg_buf, 0, msg_map);
+   err = bus_dmamem_alloc(*tag, buf, 0, map);
if (err != 0) {
-   bus_dma_tag_destroy(msg_tag);
+   bus_dma_tag_destroy(*tag);
device_printf(dev, can't allocate dmamem\n);
-   return (ENXIO);
+   return (NULL);
}
 
-   err = bus_dmamap_load(msg_tag, msg_map, msg_buf,
+   err = bus_dmamap_load(*tag, *map, buf,
sizeof(struct msg_set_power_state), bcm2835_mbox_dma_cb,
-   msg_phys, 0);
+   phys, 0);
if (err != 0) {
-   bus_dmamem_free(msg_tag, msg_buf, msg_map);
-   bus_dma_tag_destroy(msg_tag);
+   bus_dmamem_free(*tag, buf, *map);
+   bus_dma_tag_destroy(*tag);
device_printf(dev, can't load DMA map\n);
+   return (NULL);
+   }
+
+   return (buf);
+}
+
+int
+bcm2835_mbox_set_power_state(device_t dev, uint32_t device_id, boolean_t on)
+{
+   struct msg_set_power_state *msg;
+   bus_dma_tag_t msg_tag;
+   bus_dmamap_t msg_map;
+   bus_addr_t msg_phys;
+   uint32_t reg;
+   device_t mbox;
+
+   /* get mbox device */
+   mbox = devclass_get_device(devclass_find(mbox), 0);
+   if (mbox == NULL) {
+   device_printf(dev, can't find mbox\n);
return (ENXIO);
}
 
-   msg = msg_buf;
+   /* Allocate memory for the message */
+   msg = bcm2835_mbox_init_dma(dev, sizeof(*msg), msg_tag, msg_map,
+   msg_phys);
+   if (msg == NULL)
+   return (ENOMEM);
 
memset(msg, 0, sizeof(*msg));
msg-hdr.buf_size = sizeof(*msg);
@@ -350,7 +360,56 @@ bcm2835_mbox_set_power_state(device_t de
MBOX_READ(mbox, BCM2835_MBOX_CHAN_PROP, reg);
 
bus_dmamap_unload(msg_tag, msg_map);
-   bus_dmamem_free(msg_tag, msg_buf, msg_map);
+   bus_dmamem_free(msg_tag, msg, msg_map);
+   bus_dma_tag_destroy(msg_tag);
+
+   return (0);
+}
+
+int
+bcm2835_mbox_get_clock_rate(device_t dev, uint32_t clock_id, uint32_t *hz)
+{
+   struct msg_get_clock_rate *msg;
+   bus_dma_tag_t msg_tag;
+   bus_dmamap_t msg_map;
+   bus_addr_t msg_phys;
+   uint32_t reg;
+   device_t mbox;
+
+   /* get mbox device */
+   mbox = devclass_get_device(devclass_find(mbox), 0);
+   if (mbox == NULL) {
+   device_printf(dev, can't find mbox\n);
+   return (ENXIO);
+   }
+
+   /* Allocate memory for the message */
+   msg = bcm2835_mbox_init_dma(dev, sizeof(*msg), msg_tag, msg_map,
+   msg_phys);
+   if (msg == NULL)
+   return (ENOMEM);
+
+   memset(msg, 0, sizeof(*msg));
+   msg-hdr.buf_size = sizeof(*msg);
+   msg-hdr.code = 

svn commit: r280302 - head/sys/net

2015-03-20 Thread Gleb Smirnoff
Author: glebius
Date: Fri Mar 20 20:42:58 2015
New Revision: 280302
URL: https://svnweb.freebsd.org/changeset/base/280302

Log:
  In vlan_clone_match_ethervid():
  - Use ifunit() instead of going through the interface list ourselves.
  - Remove unused parameter.
  - Move the most important comment above the function.
  
  Sponsored by: Nginx, Inc.

Modified:
  head/sys/net/if_vlan.c

Modified: head/sys/net/if_vlan.c
==
--- head/sys/net/if_vlan.c  Fri Mar 20 20:08:36 2015(r280301)
+++ head/sys/net/if_vlan.c  Fri Mar 20 20:42:58 2015(r280302)
@@ -208,8 +208,7 @@ static  void vlan_link_state(struct ifnet
 static void vlan_capabilities(struct ifvlan *ifv);
 static void vlan_trunk_capabilities(struct ifnet *ifp);
 
-static struct ifnet *vlan_clone_match_ethervid(struct if_clone *,
-const char *, int *);
+static struct ifnet *vlan_clone_match_ethervid(const char *, int *);
 static int vlan_clone_match(struct if_clone *, const char *);
 static int vlan_clone_create(struct if_clone *, char *, size_t, caddr_t);
 static int vlan_clone_destroy(struct if_clone *, struct ifnet *);
@@ -801,40 +800,41 @@ VNET_SYSUNINIT(vnet_vlan_uninit, SI_SUB_
 vnet_vlan_uninit, NULL);
 #endif
 
+/*
+ * Check for etherif.vlan style interface names.
+ */
 static struct ifnet *
-vlan_clone_match_ethervid(struct if_clone *ifc, const char *name, int *vidp)
+vlan_clone_match_ethervid(const char *name, int *vidp)
 {
-   const char *cp;
+   char ifname[IFNAMSIZ];
+   char *cp;
struct ifnet *ifp;
int vid;
 
-   /* Check for etherif.vlan style interface names. */
-   IFNET_RLOCK_NOSLEEP();
-   TAILQ_FOREACH(ifp, V_ifnet, if_link) {
-   /*
-* We can handle non-ethernet hardware types as long as
-* they handle the tagging and headers themselves.
-*/
-   if (ifp-if_type != IFT_ETHER 
-   (ifp-if_capenable  IFCAP_VLAN_HWTAGGING) == 0)
-   continue;
-   if (strncmp(ifp-if_xname, name, strlen(ifp-if_xname)) != 0)
-   continue;
-   cp = name + strlen(ifp-if_xname);
-   if (*cp++ != '.')
-   continue;
-   if (*cp == '\0')
-   continue;
-   vid = 0;
-   for(; *cp = '0'  *cp = '9'; cp++)
-   vid = (vid * 10) + (*cp - '0');
-   if (*cp != '\0')
-   continue;
-   if (vidp != NULL)
-   *vidp = vid;
-   break;
-   }
-   IFNET_RUNLOCK_NOSLEEP();
+   strlcpy(ifname, name, IFNAMSIZ);
+   if ((cp = strchr(ifname, '.')) == NULL)
+   return (NULL);
+   *cp = '\0';
+   if ((ifp = ifunit(ifname)) == NULL)
+   return (NULL);
+   /*
+* We can handle non-ethernet hardware types as long as
+* they handle the tagging and headers themselves.
+*/
+   if (ifp-if_type != IFT_ETHER 
+   (ifp-if_capenable  IFCAP_VLAN_HWTAGGING) == 0)
+   return (NULL);
+
+   /* Parse VID. */
+   if (*++cp == '\0')
+   return (NULL);
+   vid = 0;
+   for(; *cp = '0'  *cp = '9'; cp++)
+   vid = (vid * 10) + (*cp - '0');
+   if (*cp != '\0')
+   return (NULL);
+   if (vidp != NULL)
+   *vidp = vid;
 
return (ifp);
 }
@@ -844,7 +844,7 @@ vlan_clone_match(struct if_clone *ifc, c
 {
const char *cp;
 
-   if (vlan_clone_match_ethervid(ifc, name, NULL) != NULL)
+   if (vlan_clone_match_ethervid(name, NULL) != NULL)
return (1);
 
if (strncmp(vlanname, name, strlen(vlanname)) != 0)
@@ -906,7 +906,7 @@ vlan_clone_create(struct if_clone *ifc, 
ethertag = 1;
vid = vlr.vlr_tag;
wildcard = (unit  0);
-   } else if ((p = vlan_clone_match_ethervid(ifc, name, vid)) != NULL) {
+   } else if ((p = vlan_clone_match_ethervid(name, vid)) != NULL) {
ethertag = 1;
unit = -1;
wildcard = 0;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r280299 - in head/release: scripts tools

2015-03-20 Thread Colin Percival
Author: cperciva
Date: Fri Mar 20 19:40:19 2015
New Revision: 280299
URL: https://svnweb.freebsd.org/changeset/base/280299

Log:
  When creating VM images, copy the contents of the created filesystem into
  a new filesystem before packaging it into a disk image.  This prevents
  remnants of deleted files from showing up in the VM images, and reduces
  their compressed size (by about 10% for the cloudware images) as a result.
  
  Looks good to:gjb

Modified:
  head/release/scripts/mk-vmimage.sh
  head/release/tools/vmimage.subr

Modified: head/release/scripts/mk-vmimage.sh
==
--- head/release/scripts/mk-vmimage.sh  Fri Mar 20 19:29:59 2015
(r280298)
+++ head/release/scripts/mk-vmimage.sh  Fri Mar 20 19:40:19 2015
(r280299)
@@ -102,6 +102,7 @@ main() {
vm_extra_pre_umount
vm_extra_pkg_rmcache
cleanup
+   vm_copy_base
vm_create_disk || return 0
vm_extra_create_disk
 

Modified: head/release/tools/vmimage.subr
==
--- head/release/tools/vmimage.subr Fri Mar 20 19:29:59 2015
(r280298)
+++ head/release/tools/vmimage.subr Fri Mar 20 19:40:19 2015
(r280299)
@@ -67,6 +67,35 @@ vm_create_base() {
return 0
 }
 
+vm_copy_base() {
+   # Creates a new UFS root filesystem and copies the contents of the
+   # current root filesystem into it.  This produces a clean disk
+   # image without any remnants of files which were created temporarily
+   # during image-creation and have since been deleted (e.g., downloaded
+   # package archives).
+
+   mkdir -p ${DESTDIR}/old
+   mdold=$(mdconfig -f ${VMBASE})
+   mount /dev/${mdold} ${DESTDIR}/old
+
+   truncate -s ${VMSIZE} ${VMBASE}.tmp
+   mkdir -p ${DESTDIR}/new
+   mdnew=$(mdconfig -f ${VMBASE}.tmp)
+   newfs -j /dev/${mdnew}
+   mount /dev/${mdnew} ${DESTDIR}/new
+
+   tar -cf- -C ${DESTDIR}/old . | tar -xf- -C ${DESTDIR}/new
+
+   umount /dev/${mdold}
+   rmdir ${DESTDIR}/old
+   mdconfig -d -u ${mdold}
+
+   umount /dev/${mdnew}
+   rmdir ${DESTDIR}/new
+   mdconfig -d -u ${mdnew}
+   mv ${VMBASE}.tmp ${VMBASE}
+}
+
 vm_install_base() {
# Installs the FreeBSD userland/kernel to the virtual machine disk.
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


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

2015-03-20 Thread Allan Jude
Author: allanjude (doc committer)
Date: Fri Mar 20 20:08:36 2015
New Revision: 280301
URL: https://svnweb.freebsd.org/changeset/base/280301

Log:
  Fix grammar in epair(4) man page
  
  PR:   196839
  Differential Revision:https://reviews.freebsd.org/D2090
  Submitted by: Jason Unovitch (original)
  Approved by:  wblock (mentor)
  Sponsored by: ScaleEngine Inc.

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

Modified: head/share/man/man4/epair.4
==
--- head/share/man/man4/epair.4 Fri Mar 20 19:51:24 2015(r280300)
+++ head/share/man/man4/epair.4 Fri Mar 20 20:08:36 2015(r280301)
@@ -28,7 +28,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd July 26, 2009
+.Dd March 18, 2015
 .Dt EPAIR 4
 .Os
 .Sh NAME
@@ -89,14 +89,16 @@ that is only guaranteed to be unique wit
 To change the default addresses one may use the SIOCSIFADDR ioctl(2) or
 ifconfig(8) utility.
 .Pp
-The basic intend is to provide connectivity between two virtual
+The basic intent is to provide connectivity between two virtual
 network stack instances.
-When connected to a
-.Xr if_bridge 4
+When connected to an
+.Xr if_bridge 4 ,
 one end of the interface pair can also be part of another (virtual) LAN.
-As with any other Ethernet interface one can configure
+As with any other Ethernet interface,
+.Nm epair
+can have a
 .Xr vlan 4
-support on top of it.
+configured on top of it.
 .Sh SEE ALSO
 .Xr ioctl 2 ,
 .Xr altq 4 ,
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r280298 - head/lib/libgpio

2015-03-20 Thread Luiz Otavio O Souza
Author: loos
Date: Fri Mar 20 19:29:59 2015
New Revision: 280298
URL: https://svnweb.freebsd.org/changeset/base/280298

Log:
  Add the missing manual page link to the recently added function.

Modified:
  head/lib/libgpio/Makefile

Modified: head/lib/libgpio/Makefile
==
--- head/lib/libgpio/Makefile   Fri Mar 20 19:16:18 2015(r280297)
+++ head/lib/libgpio/Makefile   Fri Mar 20 19:29:59 2015(r280298)
@@ -15,6 +15,7 @@ MLINKS=   gpio.3 gpio_open.3 \
gpio.3 gpio_pin_list.3 \
gpio.3 gpio_pin_config.3 \
gpio.3 gpio_pin_set_flags.3 \
+   gpio.3 gpio_pin_set_name.3 \
gpio.3 gpio_pin_get.3 \
gpio.3 gpio_pin_set.3 \
gpio.3 gpio_pin_low.3 \
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r280300 - in head: share/man/man4 sys/conf sys/dev/iicbus

2015-03-20 Thread Luiz Otavio O Souza
Author: loos
Date: Fri Mar 20 19:51:24 2015
New Revision: 280300
URL: https://svnweb.freebsd.org/changeset/base/280300

Log:
  Add a driver for the Dallas/Maxim DS1307, another common i2c RTC.
  
  Many thanks to ian who gently provided me the DS1307 breakout board.
  
  Tested on:Raspberry pi
  Differential Revision:https://reviews.freebsd.org/D2022
  Reviewed by:  rpaulo

Added:
  head/share/man/man4/ds1307.4   (contents, props changed)
  head/sys/dev/iicbus/ds1307.c   (contents, props changed)
  head/sys/dev/iicbus/ds1307reg.h   (contents, props changed)
Modified:
  head/share/man/man4/Makefile
  head/sys/conf/files

Modified: head/share/man/man4/Makefile
==
--- head/share/man/man4/MakefileFri Mar 20 19:40:19 2015
(r280299)
+++ head/share/man/man4/MakefileFri Mar 20 19:51:24 2015
(r280300)
@@ -119,6 +119,7 @@ MAN=aac.4 \
divert.4 \
${_dpms.4} \
dpt.4 \
+   ds1307.4 \
ds3231.4 \
dummynet.4 \
ed.4 \

Added: head/share/man/man4/ds1307.4
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/share/man/man4/ds1307.4Fri Mar 20 19:51:24 2015
(r280300)
@@ -0,0 +1,131 @@
+.\
+.\ Copyright (c) 2015 Luiz Otavio O Souza l...@freebsd.org
+.\ All rights reserved.
+.\
+.\ Redistribution and use in source and binary forms, with or without
+.\ modification, are permitted provided that the following conditions
+.\ are met:
+.\ 1. Redistributions of source code must retain the above copyright
+.\notice, this list of conditions and the following disclaimer.
+.\ 2. Redistributions in binary form must reproduce the above copyright
+.\notice, this list of conditions and the following disclaimer in the
+.\documentation and/or other materials provided with the distribution.
+.\
+.\ THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\ IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\ NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\
+.\ $FreeBSD$
+.\
+.Dd March 7, 2015
+.Dt DS1307 4
+.Os
+.Sh NAME
+.Nm ds1307
+.Nd 64 x 8, serial, i2c real-time clock
+.Sh SYNOPSIS
+.Cd device iic
+.Cd device iicbus
+.Cd device ds1307
+.Sh DESCRIPTION
+The
+.Nm
+serial real-time clock (RTC) is a low-power, full binary-coded decimal (BCD)
+clock/calendar plus 56 bytes of NV SRAM.
+.Pp
+The
+.Nm
+has a built-in power-sense circuit that detects power failures and
+automatically switches to the backup supply.
+Timekeeping operation continues while the part operates from the backup supply.
+.Pp
+Access to
+.Nm
+settings is made with the
+.Xr sysctl 8
+interface:
+.Bd -literal
+dev.ds1307.0.%desc: Maxim DS1307 RTC
+dev.ds1307.0.%driver: ds1307
+dev.ds1307.0.%location: addr=0xd0
+dev.ds1307.0.%pnpinfo: name=rtc compat=maxim,ds1307
+dev.ds1307.0.%parent: iicbus1
+dev.ds1307.0.sqwe: 1
+dev.ds1307.0.sqw_freq: 32768
+dev.ds1307.0.sqw_out: 0
+.Ed
+.Bl -tag -width .Va dev.ds1307.%d.sqw_freq
+.It Va dev.ds1307.%d.sqwe
+If set to 1, the SQW pin drives a square-wave of
+.Va dev.ds1307.%d.sqw_freq
+frequency.
+If set to 0, the output level of SQW pin is controlled by
+.Va dev.ds1307.%d.sqw_out .
+.It Va dev.ds1307.%d.sqw_freq
+Select the frequency of the SQW pin when the square-wave output is enabled on
+.Va dev.ds1307.%d.sqwe .
+It can be set to 1, 4096, 8192 and 32768.
+.It Va dev.ds1307.%d.sqw_out
+Set the output level of the SQW pin when
+.Va dev.ds1307.%d.sqwe
+is set to 0.
+.El
+.Pp
+Please check the
+.Nm
+datasheet for more details.
+.Pp
+On a
+.Xr device.hints 5
+based system, such as
+.Li MIPS ,
+these values are configurable for
+.Nm :
+.Bl -tag -width .Va hint.ds1307.%d.addr
+.It Va hint.ds1307.%d.at
+The
+.Xr iicbus 4
+that the
+.Nm
+is connected to.
+.It Va hint.ds1307.%d.addr
+The i2c address of
+.Nm .
+.El
+.Pp
+On a
+.Xr FDT 4
+based system the following properties must be set:
+.Bl -tag -width .Va compatible
+.It Va compatible
+Must always be set to dallas,ds1307 or maxim,ds1307.
+.It Va reg
+The i2c address of
+.Nm .
+The default address for
+.Nm
+is 0xd0.
+.El
+.Sh SEE ALSO
+.Xr fdt 4 ,
+.Xr iic 4 ,
+.Xr iicbus 4 ,
+.Xr sysctl 8
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 11.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver and this 

Re: svn commit: r280279 - head/sys/sys

2015-03-20 Thread Bruce Evans

On Fri, 20 Mar 2015, Konstantin Belousov wrote:


On Fri, Mar 20, 2015 at 10:27:06AM +, John Baldwin wrote:

Author: jhb
Date: Fri Mar 20 10:27:06 2015
New Revision: 280279
URL: https://svnweb.freebsd.org/changeset/base/280279

Log:
  Expand the bitcount* API to support 64-bit integers, plain ints and longs
  and create a hidden API that can be used in other system headers without
  adding namespace pollution.
  - If the POPCNT instruction is enabled at compile time, use
__builtin_popcount*() to implement __bitcount*(), otherwise fall back
to software implementations.



Are you aware of the Haswell errata HSD146 ?  I see the described behaviour


I wasn't.


on machines back to SandyBridge, but not on Nehalems.
HSD146.   POPCNT Instruction May Take Longer to Execute Than Expected
Problem: POPCNT instruction execution with a 32 or 64 bit operand may be
delayed until previous non-dependent instructions have executed.


If it only affects performance, then it is up to the compiler to fix it.


Jilles noted that gcc head and 4.9.2 already provides a workaround by
xoring the dst register.  I have some patch for amd64 pmap, see the end
of the message.


IIRC, then patch never never uses asm, but intentionally uses the popcount
builtin to avoid complications.


  - Use the existing bitcount16() and bitcount32() from sys/systm.h to
implement the non-POPCNT __bitcount16() and __bitcount32() in
sys/types.h.

Why is it in sys/types.h ?


To make it easier to use, while minimizing namespace pollution and
inefficiencies.  Like the functions used to implement ntohl(), except
the implementation is MI so it doesn't need to be in machine.
(The functions used to implement ntohl() are in machine/endian.h.
sys/types.h always includes that, so it makes little difference to
pollution and inefficiency that the implementation is not more directly
in machine/_types.h.)  bitcount is simpler and not burdened by
compatibility, so it doesn't need a separate header.)

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