svn commit: r313009 - head/lib/libclang_rt/profile

2017-01-30 Thread Ngie Cooper
Author: ngie
Date: Tue Jan 31 07:13:01 2017
New Revision: 313009
URL: https://svnweb.freebsd.org/changeset/base/313009

Log:
  Expose symbols in lib/libclang_rt/profile to fix --coverage
  
  The symbols currently hidden in libprofile_rt are needed for linking with
  `clang --coverage` to add coverage counters at link time and produce
  coverage numbers at runtime.
  
  In collaboration with:dim
  MFC after:1 month
  Sponsored by: Dell EMC Isilon
  Differential Revision:D9168

Modified:
  head/lib/libclang_rt/profile/Makefile

Modified: head/lib/libclang_rt/profile/Makefile
==
--- head/lib/libclang_rt/profile/Makefile   Tue Jan 31 06:12:51 2017
(r313008)
+++ head/lib/libclang_rt/profile/Makefile   Tue Jan 31 07:13:01 2017
(r313009)
@@ -4,6 +4,9 @@
 
 LIB=   clang_rt.profile-${CRTARCH}
 
+# This is needed for --coverage
+CFLAGS+=   -fvisibility=default
+
 SRCS+= profile/GCDAProfiling.c
 SRCS+= profile/InstrProfiling.c
 SRCS+= profile/InstrProfilingBuffer.c
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r313006 - in head: sys/conf sys/libkern sys/libkern/x86 sys/sys tests/sys/kern

2017-01-30 Thread Conrad Meyer
Hi Bruce,

On Mon, Jan 30, 2017 at 9:26 PM, Bruce Evans  wrote:
> On Tue, 31 Jan 2017, Conrad E. Meyer wrote:
>
>> Log:
>>  calculate_crc32c: Add SSE4.2 implementation on x86
>
>
> This breaks building with gcc-4.2.1,

gcc-4.2.1 is an ancient compiler.  Good riddance.

>> Added: head/sys/libkern/x86/crc32_sse42.c
>>
>> ==
>> --- /dev/null   00:00:00 1970   (empty, because file is newly added)
>> +++ head/sys/libkern/x86/crc32_sse42.c  Tue Jan 31 03:26:32 2017
>> (r313006)
>> +
>> +#include 
>
> ...
>
> Inline asm is much less unportable than intrinsics.  kib used the correct
> method of .byte's in asms to avoid depending on assembler support for newer
> instructions.  .byte is still used for clflush on amd64 and i386.  It
> used to be used for invpcid on amd64.  I can't find where it is or was
> used for xsave stuff.

Konstantin predicted this complaint in code review (phabricator).
Unfortunately, Clang does not automatically unroll asms, even with the
correct mnemonic.  Unrolling is essential to performance below the
by-3 block size (768 bytes in this implementation).  Hand unrolling in
C seems to generate less efficient assembly than the compiler's
unrolling.

The left column below is block size.  The measurements are nanoseconds
per buf, per CLOCK_VIRTUAL, averaged over 10^5 loops.  These numbers
do not vary more than +/- 1ns run to run on my idle Sandy Bridge
laptop.  "asm" is using __asm__(), "intrins" using the _mm_crc32
intrinsics that Clang can unroll, and multitable is the older
lookup-table implementation (still used on other architectures).

0x10: asm:0 intrins:0 multitable:0  (ns per buf)
0x20: asm:7 intrins:9 multitable:78  (ns per buf)
0x40: asm:10 intrins:7 multitable:50  (ns per buf)
0x80: asm:15 intrins:9 multitable:91  (ns per buf)
0x000100: asm:25 intrins:17 multitable:178  (ns per buf)
0x000200: asm:55 intrins:38 multitable:347  (ns per buf)
0x000400: asm:61 intrins:62 multitable:684  (ns per buf)

Both implementations are superior to the multitable approach, so it is
unreasonable not to make one of them standard on x86 platforms.

The unrolled intrinsics are consistently better than not unrolled on
objects 0x40-0x200 bytes large.  At 0x400 bytes we pass the first
unroll-by-3 threshold and it stops mattering as much.

At 0x40 bytes, it is the difference between 6.4 GB/s and 9.1 GB/s.  At
0x200 bytes, it is the difference between 9.3 GB/s and 13.5 GB/s.  I
think this justifies some minor ugliness.

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


svn commit: r313008 - head/tests/sys/geom/class/gate

2017-01-30 Thread Ngie Cooper
Author: ngie
Date: Tue Jan 31 06:12:51 2017
New Revision: 313008
URL: https://svnweb.freebsd.org/changeset/base/313008

Log:
  Wait for /dev/ggate* to appear after calling `ggatel create` in 
:ggatel_{file,md}
  
  The test assumed that `ggatel create` created a device on completion, but 
that's
  incorrect. This squashes the race by waiting for the device to appear, as
  `ggatel create` daemonizes before issuing an ioctl to geom_gate(4) if not 
called
  with `-v`.
  
  Discussed with:   asomers
  MFC after:1 week
  PR:   204616
  Sponsored by: Dell EMC Isilon

Modified:
  head/tests/sys/geom/class/gate/ggate_test.sh

Modified: head/tests/sys/geom/class/gate/ggate_test.sh
==
--- head/tests/sys/geom/class/gate/ggate_test.shTue Jan 31 03:40:13 
2017(r313007)
+++ head/tests/sys/geom/class/gate/ggate_test.shTue Jan 31 06:12:51 
2017(r313008)
@@ -74,7 +74,11 @@ ggatel_file_body()
 
atf_check ggatel create -u $us work
 
-   dd if=src of=/dev/ggate${us} bs=1m count=1 conv=notrunc
+   ggate_dev=/dev/ggate${us}
+
+   wait_for_ggate_device ${ggate_dev}
+
+   dd if=src of=${ggate_dev} bs=1m count=1 conv=notrunc
 
checksum src work
 }
@@ -104,7 +108,11 @@ ggatel_md_body()
 
atf_check ggatel create -u $us /dev/$work
 
-   dd if=/dev/$src of=/dev/ggate${us} bs=1m count=1 conv=notrunc
+   ggate_dev=/dev/ggate${us}
+
+   wait_for_ggate_device ${ggate_dev}
+
+   dd if=/dev/$src of=${ggate_dev} bs=1m count=1 conv=notrunc
 
checksum /dev/$src /dev/$work
 }
@@ -191,3 +199,14 @@ common_cleanup()
fi
true
 }
+
+# Bug 204616: ggatel(8) creates /dev/ggate* asynchronously if `ggatel create`
+# isn't called with `-v`.
+wait_for_ggate_device()
+{
+   ggate_device=$1
+
+   while [ ! -c $ggate_device ]; do
+   sleep 0.5
+   done
+}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r313006 - in head: sys/conf sys/libkern sys/libkern/x86 sys/sys tests/sys/kern

2017-01-30 Thread Bruce Evans

On Tue, 31 Jan 2017, Conrad E. Meyer wrote:


Log:
 calculate_crc32c: Add SSE4.2 implementation on x86


This breaks building with gcc-4.2.1, and depends on using non-kernel clang
headers for clang.


Modified: head/sys/conf/files.amd64
==
--- head/sys/conf/files.amd64   Tue Jan 31 01:55:29 2017(r313005)
+++ head/sys/conf/files.amd64   Tue Jan 31 03:26:32 2017(r313006)
@@ -593,6 +593,11 @@ compat/ndis/subr_pe.c  optionalndisapi
compat/ndis/subr_usbd.c optionalndisapi pci
compat/ndis/winx64_wrap.S   optionalndisapi pci
#
+crc32_sse42.o  standard\


I don't want it, but it is standard.


+   dependency  "$S/libkern/x86/crc32_sse42.c"\
+   compile-with"${CC} -c ${CFLAGS:N-nostdinc} ${WERROR} ${PROF} -msse4 
${.IMPSRC}" \


-msse4 is not supported by gcc-4.2.1,

Removing nostdinc pollutes the build with host headers, and the one needed
might not be installed, and it doesn't exist for gcc-4.2.1.

Similarly for i386.


Modified: head/sys/libkern/crc32.c
==
--- head/sys/libkern/crc32.cTue Jan 31 01:55:29 2017(r313005)
+++ head/sys/libkern/crc32.cTue Jan 31 03:26:32 2017(r313006)
@@ -46,8 +46,14 @@
__FBSDID("$FreeBSD$");

#include 
+#include 


Style bug.  libkern.h is part if systm.h.


#include 


Ordering bug.  systm.h is a prerequisite for all kernel headers except
param.h, since it defines macros which might be used by other headers.


Added: head/sys/libkern/x86/crc32_sse42.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/libkern/x86/crc32_sse42.c  Tue Jan 31 03:26:32 2017
(r313006)
@@ -0,0 +1,288 @@
...
+#ifdef USERSPACE_TESTING
+#include 
+#else
+#include 
+#include 
+#include 
+#include 
+#endif


Style and ordering bugs, as above.


+
+#include 


This header is outside of the kernel source tree.  It is not even in
/usr/include, but clang finds it in:

crc32_sse42.o:
  /usr/bin/../lib/clang/3.9.0/include/nmmintrin.h \
  /usr/bin/../lib/clang/3.9.0/include/smmintrin.h \
  /usr/bin/../lib/clang/3.9.0/include/tmmintrin.h \
  /usr/bin/../lib/clang/3.9.0/include/pmmintrin.h \
  /usr/bin/../lib/clang/3.9.0/include/emmintrin.h \
  /usr/bin/../lib/clang/3.9.0/include/xmmintrin.h \
  /usr/bin/../lib/clang/3.9.0/include/mmintrin.h \
  /usr/bin/../lib/clang/3.9.0/include/f16cintrin.h \
  /usr/bin/../lib/clang/3.9.0/include/popcntintrin.h

nmmintrin.h doesn't exist for gcc-4.2.1.  gcc-4.2.1 has some of the other
intrin.h files, but they aren't installed in FreeBSD-9, and of course they
don't support newer SSE.

Inline asm is much less unportable than intrinsics.  kib used the correct
method of .byte's in asms to avoid depending on assembler support for newer
instructions.  .byte is still used for clflush on amd64 and i386.  It
used to be used for invpcid on amd64.  I can't find where it is or was
used for xsave stuff.

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


svn commit: r313007 - head/sys/powerpc/include

2017-01-30 Thread Justin Hibbits
Author: jhibbits
Date: Tue Jan 31 03:40:13 2017
New Revision: 313007
URL: https://svnweb.freebsd.org/changeset/base/313007

Log:
  Don't retry a lost reservation in atomic_fcmpset()
  
  The desired behavior of atomic_fcmpset_() is to always exit on error.  Instead
  of retrying on lost reservation, leave the retry to the caller, and return
  error.
  
  Reported by:  kib

Modified:
  head/sys/powerpc/include/atomic.h

Modified: head/sys/powerpc/include/atomic.h
==
--- head/sys/powerpc/include/atomic.h   Tue Jan 31 03:26:32 2017
(r313006)
+++ head/sys/powerpc/include/atomic.h   Tue Jan 31 03:40:13 2017
(r313007)
@@ -678,18 +678,18 @@ atomic_fcmpset_int(volatile u_int *p, u_
int ret;
 
__asm __volatile (
-   "1:\tlwarx %0, 0, %3\n\t"   /* load old value */
+   "lwarx %0, 0, %3\n\t"   /* load old value */
"cmplw %4, %0\n\t"  /* compare */
-   "bne 2f\n\t"/* exit if not equal */
+   "bne 1f\n\t"/* exit if not equal */
"stwcx. %5, 0, %3\n\t"  /* attempt to store */
-   "bne- 1b\n\t"   /* spin if failed */
+   "bne- 1f\n\t"   /* exit if failed */
"li %0, 1\n\t"  /* success - retval = 1 */
-   "b 3f\n\t"  /* we've succeeded */
-   "2:\n\t"
+   "b 2f\n\t"  /* we've succeeded */
+   "1:\n\t"
"stwcx. %0, 0, %3\n\t"  /* clear reservation (74xx) */
"stwx %0, 0, %7\n\t"
"li %0, 0\n\t"  /* failure - retval = 0 */
-   "3:\n\t"
+   "2:\n\t"
: "=" (ret), "=m" (*p), "=m" (*cmpval)
: "r" (p), "r" (*cmpval), "r" (newval), "m" (*p), "r"(cmpval)
: "cr0", "memory");
@@ -703,20 +703,20 @@ atomic_fcmpset_long(volatile u_long *p, 
 
__asm __volatile (
#ifdef __powerpc64__
-   "1:\tldarx %0, 0, %3\n\t"   /* load old value */
+   "ldarx %0, 0, %3\n\t"   /* load old value */
"cmpld %4, %0\n\t"  /* compare */
-   "bne 2f\n\t"/* exit if not equal */
+   "bne 1f\n\t"/* exit if not equal */
"stdcx. %5, 0, %3\n\t"  /* attempt to store */
#else
-   "1:\tlwarx %0, 0, %3\n\t"   /* load old value */
+   "lwarx %0, 0, %3\n\t"   /* load old value */
"cmplw %4, %0\n\t"  /* compare */
-   "bne 2f\n\t"/* exit if not equal */
+   "bne 1f\n\t"/* exit if not equal */
"stwcx. %5, 0, %3\n\t"  /* attempt to store */
#endif
-   "bne- 1b\n\t"   /* spin if failed */
+   "bne- 1f\n\t"   /* exit if failed */
"li %0, 1\n\t"  /* success - retval = 1 */
-   "b 3f\n\t"  /* we've succeeded */
-   "2:\n\t"
+   "b 2f\n\t"  /* we've succeeded */
+   "1:\n\t"
#ifdef __powerpc64__
"stdcx. %0, 0, %3\n\t"  /* clear reservation (74xx) */
"stdx %0, 0, %7\n\t"
@@ -725,7 +725,7 @@ atomic_fcmpset_long(volatile u_long *p, 
"stwx %0, 0, %7\n\t"
#endif
"li %0, 0\n\t"  /* failure - retval = 0 */
-   "3:\n\t"
+   "2:\n\t"
: "=" (ret), "=m" (*p), "=m" (*cmpval)
: "r" (p), "r" (*cmpval), "r" (newval), "m" (*p), "r"(cmpval)
: "cr0", "memory");
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r313006 - in head: sys/conf sys/libkern sys/libkern/x86 sys/sys tests/sys/kern

2017-01-30 Thread Conrad Meyer
On Mon, Jan 30, 2017 at 7:26 PM, Conrad E. Meyer  wrote:
> (The CRC instruction takes 1 cycle but has 2-3 cycles of latency.)

My mistake, it's not 2 anywhere.  It's just 3 cycles on all
workstation/server CPUs since Nehalem.  Different on Atom chips and
AMD.

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


svn commit: r313006 - in head: sys/conf sys/libkern sys/libkern/x86 sys/sys tests/sys/kern

2017-01-30 Thread Conrad E. Meyer
Author: cem
Date: Tue Jan 31 03:26:32 2017
New Revision: 313006
URL: https://svnweb.freebsd.org/changeset/base/313006

Log:
  calculate_crc32c: Add SSE4.2 implementation on x86
  
  Derived from an implementation by Mark Adler.
  
  The fast loop performs three simultaneous CRCs over subsets of the data
  before composing them.  This takes advantage of certain properties of
  the CRC32 implementation in Intel hardware.  (The CRC instruction takes 1
  cycle but has 2-3 cycles of latency.)
  
  The CRC32 instruction does not manipulate FPU state.
  
  i386 does not have the crc32q instruction, so avoid it there.  Otherwise
  the implementation is identical to amd64.
  
  Add basic userland tests to verify correctness on a variety of inputs.
  
  PR:   216467
  Reported by:  Ben RUBSON 
  Reviewed by:  kib@, markj@ (earlier version)
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D9342

Added:
  head/sys/libkern/x86/
  head/sys/libkern/x86/crc32_sse42.c   (contents, props changed)
  head/tests/sys/kern/libkern_crc32.c   (contents, props changed)
Modified:
  head/sys/conf/files.amd64
  head/sys/conf/files.i386
  head/sys/libkern/crc32.c
  head/sys/sys/libkern.h
  head/tests/sys/kern/Makefile

Modified: head/sys/conf/files.amd64
==
--- head/sys/conf/files.amd64   Tue Jan 31 01:55:29 2017(r313005)
+++ head/sys/conf/files.amd64   Tue Jan 31 03:26:32 2017(r313006)
@@ -593,6 +593,11 @@ compat/ndis/subr_pe.c  optionalndisapi 
 compat/ndis/subr_usbd.coptionalndisapi pci
 compat/ndis/winx64_wrap.S  optionalndisapi pci
 #
+crc32_sse42.o  standard\
+   dependency  "$S/libkern/x86/crc32_sse42.c"  \
+   compile-with"${CC} -c ${CFLAGS:N-nostdinc} ${WERROR} ${PROF} -msse4 
${.IMPSRC}" \
+   no-implicit-rule\
+   clean   "crc32_sse42.o"
 libkern/memmove.c  standard
 libkern/memset.c   standard
 #

Modified: head/sys/conf/files.i386
==
--- head/sys/conf/files.i386Tue Jan 31 01:55:29 2017(r313005)
+++ head/sys/conf/files.i386Tue Jan 31 03:26:32 2017(r313006)
@@ -554,6 +554,11 @@ kern/kern_clocksource.cstandard
 kern/imgact_aout.c optional compat_aout
 kern/imgact_gzip.c optional gzip
 kern/subr_sfbuf.c  standard
+crc32_sse42.o  standard\
+   dependency  "$S/libkern/x86/crc32_sse42.c"  \
+   compile-with"${CC} -c ${CFLAGS:N-nostdinc} ${WERROR} ${PROF} -msse4 
${.IMPSRC}" \
+   no-implicit-rule\
+   clean   "crc32_sse42.o"
 libkern/divdi3.c   standard
 libkern/ffsll.cstandard
 libkern/flsll.cstandard

Modified: head/sys/libkern/crc32.c
==
--- head/sys/libkern/crc32.cTue Jan 31 01:55:29 2017(r313005)
+++ head/sys/libkern/crc32.cTue Jan 31 03:26:32 2017(r313006)
@@ -46,8 +46,14 @@
 __FBSDID("$FreeBSD$");
 
 #include 
+#include 
 #include 
 
+#if defined(__amd64__) || defined(__i386__)
+#include 
+#include 
+#endif
+
 const uint32_t crc32_tab[] = {
0x, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f,
0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
@@ -749,6 +755,11 @@ calculate_crc32c(uint32_t crc32c,
 const unsigned char *buffer,
 unsigned int length)
 {
+#if defined(__amd64__) || defined(__i386__)
+   if ((cpu_feature2 & CPUID2_SSE42) != 0) {
+   return (sse42_crc32c(crc32c, buffer, length));
+   } else
+#endif
if (length < 4) {
return (singletable_crc32c(crc32c, buffer, length));
} else {

Added: head/sys/libkern/x86/crc32_sse42.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/libkern/x86/crc32_sse42.c  Tue Jan 31 03:26:32 2017
(r313006)
@@ -0,0 +1,288 @@
+/*
+ * Derived from crc32c.c version 1.1 by Mark Adler.
+ *
+ * Copyright (C) 2013 Mark Adler
+ *
+ * This software is provided 'as-is', without any express or implied warranty.
+ * In no event will the author be held liable for any damages arising from the
+ * use of this software.
+ *
+ * Permission is granted to anyone to use this software for any purpose,
+ * including commercial applications, and to alter it and redistribute it
+ * freely, subject to the following restrictions:
+ *
+ * 1. The origin of this software must not be 

svn commit: r313005 - in head/sys: conf modules/zfs

2017-01-30 Thread Justin Hibbits
Author: jhibbits
Date: Tue Jan 31 01:55:29 2017
New Revision: 313005
URL: https://svnweb.freebsd.org/changeset/base/313005

Log:
  Update CFLAGS for clang compatibility
  
  * Clang/llvm does not (yet) support -m(no-)spe, so make it gcc-only
  * Clang now supports -msoft-float, and does not appear to recognize
"-disable-ppc-float-in-variadic", which appears to have been a crutch until
soft-float was implemented.  It's now implemented for both 32- and 64-bit.
  * Clang/llvm use a 'medium' code model by default for powerpc64, supporting up
to 4GB TOC, and does not support the '-mminimal-toc' option.  Given both of
these, make -mminimal-toc gcc-only.
  
  MFC after:2 weeks

Modified:
  head/sys/conf/kern.mk
  head/sys/modules/zfs/Makefile

Modified: head/sys/conf/kern.mk
==
--- head/sys/conf/kern.mk   Tue Jan 31 01:48:55 2017(r313004)
+++ head/sys/conf/kern.mk   Tue Jan 31 01:55:29 2017(r313005)
@@ -161,14 +161,12 @@ INLINE_LIMIT?=8000
 # Also explicitly disable Altivec instructions inside the kernel.
 #
 .if ${MACHINE_CPUARCH} == "powerpc"
-CFLAGS+=   -mno-altivec
-CFLAGS.clang+= -mllvm -disable-ppc-float-in-variadic=true
-CFLAGS.gcc+=   -msoft-float
+CFLAGS+=   -mno-altivec -msoft-float
 INLINE_LIMIT?= 15000
 .endif
 
 .if ${MACHINE_ARCH} == "powerpcspe"
-CFLAGS+=   -mno-spe
+CFLAGS.gcc+=   -mno-spe
 .endif
 
 #

Modified: head/sys/modules/zfs/Makefile
==
--- head/sys/modules/zfs/Makefile   Tue Jan 31 01:48:55 2017
(r313004)
+++ head/sys/modules/zfs/Makefile   Tue Jan 31 01:55:29 2017
(r313005)
@@ -94,7 +94,7 @@ CFLAGS+=-I${SUNW}/common
 CFLAGS+=-DBUILDING_ZFS
 
 .if ${MACHINE_ARCH} == "powerpc64"
-CFLAGS+=-mminimal-toc
+CFLAGS.gcc+=-mminimal-toc
 .endif
 
 .ifdef ZFS_DEBUG
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r313004 - head/sys/modules

2017-01-30 Thread Adrian Chadd
Author: adrian
Date: Tue Jan 31 01:48:55 2017
New Revision: 313004
URL: https://svnweb.freebsd.org/changeset/base/313004

Log:
  Fix compilation!

Modified:
  head/sys/modules/Makefile

Modified: head/sys/modules/Makefile
==
--- head/sys/modules/Makefile   Mon Jan 30 23:13:41 2017(r313003)
+++ head/sys/modules/Makefile   Tue Jan 31 01:48:55 2017(r313004)
@@ -523,8 +523,8 @@ SUBDIR+=zfs
 .endif
 
 .if ${MACHINE_CPUARCH} == "mips"
-   _hwpmc_mips24k= hwpmc_mips24k
-   _hwpmc_mips74k= hwpmc_mips74k
+_hwpmc_mips24k=hwpmc_mips24k
+_hwpmc_mips74k=hwpmc_mips74k
 .endif
 
 .if ${MACHINE_CPUARCH} != "aarch64" && ${MACHINE_CPUARCH} != "arm" && \
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r313003 - head/libexec/rtld-elf/mips

2017-01-30 Thread John Baldwin
Author: jhb
Date: Mon Jan 30 23:13:41 2017
New Revision: 313003
URL: https://svnweb.freebsd.org/changeset/base/313003

Log:
  Remove a duplicate store when performing REL32 relocations in rtld.
  
  The duplicate call to store_ptr() was added in r204687, but it should
  have no effect as it only stores an Elf_Sword and the later store_ptr()
  does a write that is at least as large if not larger.
  
  Reviewed by:  jmallett
  Obtained from:CheriBSD (sort of)
  Sponsored by: DARPA / AFRL

Modified:
  head/libexec/rtld-elf/mips/reloc.c

Modified: head/libexec/rtld-elf/mips/reloc.c
==
--- head/libexec/rtld-elf/mips/reloc.c  Mon Jan 30 23:00:51 2017
(r313002)
+++ head/libexec/rtld-elf/mips/reloc.c  Mon Jan 30 23:13:41 2017
(r313003)
@@ -215,7 +215,6 @@ _rtld_relocate_nonplt_self(Elf_Dyn *dynp
sym = symtab + r_symndx;
assert(ELF_ST_BIND(sym->st_info) == STB_LOCAL);
val += relocbase;
-   store_ptr(where, val, sizeof(Elf_Sword));
dbg("REL32/L(%p) %p -> %p in ",
where, (void *)old, (void *)val);
store_ptr(where, val, rlen);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r312988 - in head/sys: compat/cloudabi compat/linux kern sys

2017-01-30 Thread Gleb Smirnoff
On Mon, Jan 30, 2017 at 12:57:23PM +, Edward Tomasz Napierala wrote:
E> Author: trasz
E> Date: Mon Jan 30 12:57:22 2017
E> New Revision: 312988
E> URL: https://svnweb.freebsd.org/changeset/base/312988
E> 
E> Log:
E>   Add kern_listen(), kern_shutdown(), and kern_socket(), and use them
E>   instead of their sys_*() counterparts in various compats. The svr4
E>   is left untouched, because there's no point.

Btw, any good reasons to keep SVR4 support for FreeBSD 12?

I recently reviewed some socket code and noticed, that having SVR4-compatible
sockets we need COMPAT_OLDSOCK to be compiled in, which isn't in GENERIC, of
course. Thus doing just 'kldload svr4' on GENERIC won't allow to create
SVR4 compatible sockets. Not even mentioning that COMPAT_OLDSOCK is probably
broken since nobody needs it and it has no regression tests.

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


svn commit: r313002 - in head/lib/libedit: . TEST

2017-01-30 Thread Pedro F. Giffuni
Author: pfg
Date: Mon Jan 30 23:00:51 2017
New Revision: 313002
URL: https://svnweb.freebsd.org/changeset/base/313002

Log:
  MFV 312999:
  Update libedit 2016-03-21
  
  Minor cleanups plus some license syncing.
  
  Obtained from:NetBSD
  X-MFC with:   r312997

Modified:
  head/lib/libedit/Makefile
  head/lib/libedit/TEST/rl1.c
  head/lib/libedit/chartype.h
  head/lib/libedit/common.c
  head/lib/libedit/read.c
  head/lib/libedit/refresh.c
  head/lib/libedit/terminal.c
  head/lib/libedit/tty.c
  head/lib/libedit/vi.c
Directory Properties:
  head/lib/libedit/   (props changed)

Modified: head/lib/libedit/Makefile
==
--- head/lib/libedit/Makefile   Mon Jan 30 22:47:48 2017(r313001)
+++ head/lib/libedit/Makefile   Mon Jan 30 23:00:51 2017(r313002)
@@ -1,4 +1,4 @@
-#  $NetBSD: Makefile,v 1.55 2016/02/24 14:25:38 christos Exp $
+#  $NetBSD: Makefile,v 1.56 2016/03/02 19:24:20 christos Exp $
 #  @(#)Makefile8.1 (Berkeley) 6/4/93
 # $FreeBSD$
 
@@ -38,8 +38,8 @@ INCS= histedit.h
 SRCS+= tokenizern.c historyn.c
 CLEANFILES+=   tokenizern.c historyn.c
 CFLAGS+= -I. -I${.CURDIR} -I${.CURDIR}/edit -DWIDECHAR
-CFLAGS+= #-DDEBUG_TTY -DDEBUG_KEY -DDEBUG_READ -DDEBUG -DDEBUG_REFRESH
-CFLAGS+= #-DDEBUG_PASTE -DDEBUG_EDIT
+#CFLAGS+= -DDEBUG_TTY -DDEBUG_KEY -DDEBUG_READ -DDEBUG -DDEBUG_REFRESH
+#CFLAGS+= -DDEBUG_PASTE -DDEBUG_EDIT
 
 WARNS?=1
 

Modified: head/lib/libedit/TEST/rl1.c
==
--- head/lib/libedit/TEST/rl1.c Mon Jan 30 22:47:48 2017(r313001)
+++ head/lib/libedit/TEST/rl1.c Mon Jan 30 23:00:51 2017(r313002)
@@ -1,4 +1,4 @@
-/* $NetBSD: rl1.c,v 1.1 2010/09/16 20:08:51 christos Exp $ */
+/* $NetBSD: rl1.c,v 1.2 2016/02/29 00:54:19 christos Exp $ */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #if !defined(lint)
-__RCSID("$NetBSD: rl1.c,v 1.1 2010/09/16 20:08:51 christos Exp $");
+__RCSID("$NetBSD: rl1.c,v 1.2 2016/02/29 00:54:19 christos Exp $");
 #endif /* not lint  */
 __FBSDID("$FreeBSD$");
 

Modified: head/lib/libedit/chartype.h
==
--- head/lib/libedit/chartype.h Mon Jan 30 22:47:48 2017(r313001)
+++ head/lib/libedit/chartype.h Mon Jan 30 23:00:51 2017(r313002)
@@ -1,4 +1,4 @@
-/* $NetBSD: chartype.h,v 1.23 2016/02/24 17:20:01 christos Exp $   */
+/* $NetBSD: chartype.h,v 1.25 2016/03/07 00:05:20 christos Exp $   */
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -65,6 +65,7 @@
 #define FUNW(type) type ## _w
 #define TYPE(type) type ## W
 #define FSTR   "%ls"
+#define FSTARSTR   "%.*ls"
 #define STR(x) L ## x
 #define UC(c)  c
 #define Isalpha(x)  iswalpha(x)
@@ -117,6 +118,7 @@ Width(wchar_t c)
 #define FUNW(type) type
 #define TYPE(type) type
 #define FSTR   "%s"
+#define FSTARSTR   "%.*s"
 #define STR(x) x
 #define UC(c)  (unsigned char)(c)
 

Modified: head/lib/libedit/common.c
==
--- head/lib/libedit/common.c   Mon Jan 30 22:47:48 2017(r313001)
+++ head/lib/libedit/common.c   Mon Jan 30 23:00:51 2017(r313002)
@@ -1,4 +1,4 @@
-/* $NetBSD: common.c,v 1.39 2016/02/24 14:25:38 christos Exp $ */
+/* $NetBSD: common.c,v 1.40 2016/03/02 19:24:20 christos Exp $ */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)common.c   8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: common.c,v 1.39 2016/02/24 14:25:38 christos Exp $");
+__RCSID("$NetBSD: common.c,v 1.40 2016/03/02 19:24:20 christos Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 #include 
@@ -149,8 +149,9 @@ ed_delete_next_char(EditLine *el, wint_t
 {
 #ifdef DEBUG_EDIT
 #defineEL  el->el_line
-   (void) fprintf(el->el_errlfile,
-   "\nD(b: %x(%s)  c: %x(%s) last: %x(%s) limit: %x(%s)\n",
+   (void) fprintf(el->el_errfile,
+   "\nD(b: %p(" FSTR ")  c: %p(" FSTR ") last: %p(" FSTR
+   ") limit: %p(" FSTR ")\n",
EL.buffer, EL.buffer, EL.cursor, EL.cursor, EL.lastchar,
EL.lastchar, EL.limit, EL.limit);
 #endif

Modified: head/lib/libedit/read.c
==
--- head/lib/libedit/read.c Mon Jan 30 22:47:48 2017(r313001)
+++ head/lib/libedit/read.c Mon Jan 30 23:00:51 2017(r313002)
@@ -1,4 +1,4 @@
-/* $NetBSD: read.c,v 1.85 2016/02/24 17:20:01 christos Exp $   */
+/* $NetBSD: read.c,v 1.86 2016/03/02 19:24:20 christos Exp $   */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char 

svn commit: r313001 - head/sys/netpfil/pf

2017-01-30 Thread Gleb Smirnoff
Author: glebius
Date: Mon Jan 30 22:47:48 2017
New Revision: 313001
URL: https://svnweb.freebsd.org/changeset/base/313001

Log:
  Fix indentantion in pf_purge_thread().  No functional change.

Modified:
  head/sys/netpfil/pf/pf.c

Modified: head/sys/netpfil/pf/pf.c
==
--- head/sys/netpfil/pf/pf.cMon Jan 30 22:40:43 2017(r313000)
+++ head/sys/netpfil/pf/pf.cMon Jan 30 22:47:48 2017(r313001)
@@ -1437,35 +1437,41 @@ pf_purge_thread(void *unused __unused)
VNET_FOREACH(vnet_iter) {
CURVNET_SET(vnet_iter);
 
-   if (pf_end_threads) {
-   pf_end_threads++;
-   wakeup(pf_purge_thread);
-   kproc_exit(0);
-   }
+   if (pf_end_threads) {
+   pf_end_threads++;
+   wakeup(pf_purge_thread);
+   kproc_exit(0);
+   }
 
-   /* Wait while V_pf_default_rule.timeout is initialized. */
-   if (V_pf_vnet_active == 0) {
-   CURVNET_RESTORE();
-   continue;
-   }
+   /* Wait until V_pf_default_rule is initialized. */
+   if (V_pf_vnet_active == 0) {
+   CURVNET_RESTORE();
+   continue;
+   }
 
-   /* Process 1/interval fraction of the state table every run. */
-   idx = pf_purge_expired_states(idx, pf_hashmask /
+   /*
+*  Process 1/interval fraction of the state
+* table every run.
+*/
+   idx = pf_purge_expired_states(idx, pf_hashmask /
(V_pf_default_rule.timeout[PFTM_INTERVAL] * 10));
 
-   /* Purge other expired types every PFTM_INTERVAL seconds. */
-   if (idx == 0) {
/*
-* Order is important:
-* - states and src nodes reference rules
-* - states and rules reference kifs
+* Purge other expired types every
+* PFTM_INTERVAL seconds.
 */
-   pf_purge_expired_fragments();
-   pf_purge_expired_src_nodes();
-   pf_purge_unlinked_rules();
-   pfi_kif_purge();
-   }
-   CURVNET_RESTORE();
+   if (idx == 0) {
+   /*
+* Order is important:
+* - states and src nodes reference rules
+* - states and rules reference kifs
+*/
+   pf_purge_expired_fragments();
+   pf_purge_expired_src_nodes();
+   pf_purge_unlinked_rules();
+   pfi_kif_purge();
+   }
+   CURVNET_RESTORE();
}
VNET_LIST_RUNLOCK();
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r313000 - in vendor/NetBSD/libedit/2016-03-21: . TEST readline

2017-01-30 Thread Pedro F. Giffuni
Author: pfg
Date: Mon Jan 30 22:40:43 2017
New Revision: 313000
URL: https://svnweb.freebsd.org/changeset/base/313000

Log:
  Tag import of libedit 2016-03-21.

Added:
  vendor/NetBSD/libedit/2016-03-21/
 - copied from r312995, vendor/NetBSD/libedit/dist/
Replaced:
  vendor/NetBSD/libedit/2016-03-21/Makefile
 - copied unchanged from r312999, vendor/NetBSD/libedit/dist/Makefile
  vendor/NetBSD/libedit/2016-03-21/TEST/Makefile
 - copied unchanged from r312996, vendor/NetBSD/libedit/dist/TEST/Makefile
  vendor/NetBSD/libedit/2016-03-21/TEST/rl1.c
 - copied unchanged from r312999, vendor/NetBSD/libedit/dist/TEST/rl1.c
  vendor/NetBSD/libedit/2016-03-21/TEST/tc1.c
 - copied unchanged from r312996, vendor/NetBSD/libedit/dist/TEST/tc1.c
  vendor/NetBSD/libedit/2016-03-21/TEST/wtc1.c
 - copied unchanged from r312996, vendor/NetBSD/libedit/dist/TEST/wtc1.c
  vendor/NetBSD/libedit/2016-03-21/chared.c
 - copied unchanged from r312996, vendor/NetBSD/libedit/dist/chared.c
  vendor/NetBSD/libedit/2016-03-21/chared.h
 - copied unchanged from r312996, vendor/NetBSD/libedit/dist/chared.h
  vendor/NetBSD/libedit/2016-03-21/chartype.c
 - copied unchanged from r312996, vendor/NetBSD/libedit/dist/chartype.c
  vendor/NetBSD/libedit/2016-03-21/chartype.h
 - copied unchanged from r312999, vendor/NetBSD/libedit/dist/chartype.h
  vendor/NetBSD/libedit/2016-03-21/common.c
 - copied unchanged from r312999, vendor/NetBSD/libedit/dist/common.c
  vendor/NetBSD/libedit/2016-03-21/config.h
 - copied unchanged from r312996, vendor/NetBSD/libedit/dist/config.h
  vendor/NetBSD/libedit/2016-03-21/editline.3
 - copied unchanged from r312996, vendor/NetBSD/libedit/dist/editline.3
  vendor/NetBSD/libedit/2016-03-21/el.c
 - copied unchanged from r312996, vendor/NetBSD/libedit/dist/el.c
  vendor/NetBSD/libedit/2016-03-21/el.h
 - copied unchanged from r312996, vendor/NetBSD/libedit/dist/el.h
  vendor/NetBSD/libedit/2016-03-21/eln.c
 - copied unchanged from r312996, vendor/NetBSD/libedit/dist/eln.c
  vendor/NetBSD/libedit/2016-03-21/emacs.c
 - copied unchanged from r312996, vendor/NetBSD/libedit/dist/emacs.c
  vendor/NetBSD/libedit/2016-03-21/filecomplete.c
 - copied unchanged from r312996, vendor/NetBSD/libedit/dist/filecomplete.c
  vendor/NetBSD/libedit/2016-03-21/hist.c
 - copied unchanged from r312996, vendor/NetBSD/libedit/dist/hist.c
  vendor/NetBSD/libedit/2016-03-21/hist.h
 - copied unchanged from r312996, vendor/NetBSD/libedit/dist/hist.h
  vendor/NetBSD/libedit/2016-03-21/histedit.h
 - copied unchanged from r312996, vendor/NetBSD/libedit/dist/histedit.h
  vendor/NetBSD/libedit/2016-03-21/history.c
 - copied unchanged from r312996, vendor/NetBSD/libedit/dist/history.c
  vendor/NetBSD/libedit/2016-03-21/keymacro.c
 - copied unchanged from r312996, vendor/NetBSD/libedit/dist/keymacro.c
  vendor/NetBSD/libedit/2016-03-21/makelist
 - copied unchanged from r312996, vendor/NetBSD/libedit/dist/makelist
  vendor/NetBSD/libedit/2016-03-21/map.c
 - copied unchanged from r312996, vendor/NetBSD/libedit/dist/map.c
  vendor/NetBSD/libedit/2016-03-21/parse.c
 - copied unchanged from r312996, vendor/NetBSD/libedit/dist/parse.c
  vendor/NetBSD/libedit/2016-03-21/prompt.c
 - copied unchanged from r312996, vendor/NetBSD/libedit/dist/prompt.c
  vendor/NetBSD/libedit/2016-03-21/prompt.h
 - copied unchanged from r312996, vendor/NetBSD/libedit/dist/prompt.h
  vendor/NetBSD/libedit/2016-03-21/read.c
 - copied unchanged from r312999, vendor/NetBSD/libedit/dist/read.c
  vendor/NetBSD/libedit/2016-03-21/read.h
 - copied unchanged from r312996, vendor/NetBSD/libedit/dist/read.h
  vendor/NetBSD/libedit/2016-03-21/readline.c
 - copied unchanged from r312996, vendor/NetBSD/libedit/dist/readline.c
  vendor/NetBSD/libedit/2016-03-21/readline/Makefile
 - copied unchanged from r312996, 
vendor/NetBSD/libedit/dist/readline/Makefile
  vendor/NetBSD/libedit/2016-03-21/readline/readline.h
 - copied unchanged from r312996, 
vendor/NetBSD/libedit/dist/readline/readline.h
  vendor/NetBSD/libedit/2016-03-21/refresh.c
 - copied unchanged from r312999, vendor/NetBSD/libedit/dist/refresh.c
  vendor/NetBSD/libedit/2016-03-21/refresh.h
 - copied unchanged from r312996, vendor/NetBSD/libedit/dist/refresh.h
  vendor/NetBSD/libedit/2016-03-21/search.c
 - copied unchanged from r312996, vendor/NetBSD/libedit/dist/search.c
  vendor/NetBSD/libedit/2016-03-21/search.h
 - copied unchanged from r312996, vendor/NetBSD/libedit/dist/search.h
  vendor/NetBSD/libedit/2016-03-21/sig.c
 - copied unchanged from r312996, vendor/NetBSD/libedit/dist/sig.c
  vendor/NetBSD/libedit/2016-03-21/sig.h
 - copied unchanged from r312996, vendor/NetBSD/libedit/dist/sig.h
  vendor/NetBSD/libedit/2016-03-21/sys.h
 - copied unchanged from r312996, vendor/NetBSD/libedit/dist/sys.h
  vendor/NetBSD/libedit/2016-03-21/terminal.c
 - copied unchanged from r312999, 

svn commit: r312999 - in vendor/NetBSD/libedit/dist: . TEST

2017-01-30 Thread Pedro F. Giffuni
Author: pfg
Date: Mon Jan 30 22:35:42 2017
New Revision: 312999
URL: https://svnweb.freebsd.org/changeset/base/312999

Log:
  Import libedit 2016-03-21
  
  Obtained from:NetBSD

Modified:
  vendor/NetBSD/libedit/dist/Makefile
  vendor/NetBSD/libedit/dist/TEST/rl1.c
  vendor/NetBSD/libedit/dist/chartype.h
  vendor/NetBSD/libedit/dist/common.c
  vendor/NetBSD/libedit/dist/read.c
  vendor/NetBSD/libedit/dist/refresh.c
  vendor/NetBSD/libedit/dist/terminal.c
  vendor/NetBSD/libedit/dist/tty.c
  vendor/NetBSD/libedit/dist/vi.c

Modified: vendor/NetBSD/libedit/dist/Makefile
==
--- vendor/NetBSD/libedit/dist/Makefile Mon Jan 30 22:29:21 2017
(r312998)
+++ vendor/NetBSD/libedit/dist/Makefile Mon Jan 30 22:35:42 2017
(r312999)
@@ -1,4 +1,4 @@
-#  $NetBSD: Makefile,v 1.55 2016/02/24 14:25:38 christos Exp $
+#  $NetBSD: Makefile,v 1.56 2016/03/02 19:24:20 christos Exp $
 #  @(#)Makefile8.1 (Berkeley) 6/4/93
 
 USE_SHLIBDIR=  yes
@@ -53,8 +53,8 @@ CLEANFILES+=help.c.tmp help.h.tmp vi.h.t
 CLEANFILES+=tokenizern.c.tmp tokenizern.c tokenizerw.c.tmp tokenizerw.c
 CPPFLAGS+=-I. -I${LIBEDITDIR}
 CPPFLAGS+=-I. -I${.CURDIR}
-CPPFLAGS+=#-DDEBUG_TTY -DDEBUG_KEY -DDEBUG_READ -DDEBUG -DDEBUG_REFRESH
-CPPFLAGS+=#-DDEBUG_PASTE -DDEBUG_EDIT
+#CPPFLAGS+=-DDEBUG_TTY -DDEBUG_KEY -DDEBUG_READ -DDEBUG -DDEBUG_REFRESH
+#CPPFLAGS+=-DDEBUG_PASTE -DDEBUG_EDIT
 
 AHDR=vi.h emacs.h common.h
 ASRC=${LIBEDITDIR}/vi.c ${LIBEDITDIR}/emacs.c ${LIBEDITDIR}/common.c

Modified: vendor/NetBSD/libedit/dist/TEST/rl1.c
==
--- vendor/NetBSD/libedit/dist/TEST/rl1.c   Mon Jan 30 22:29:21 2017
(r312998)
+++ vendor/NetBSD/libedit/dist/TEST/rl1.c   Mon Jan 30 22:35:42 2017
(r312999)
@@ -1,4 +1,4 @@
-/* $NetBSD: rl1.c,v 1.1 2010/09/16 20:08:51 christos Exp $ */
+/* $NetBSD: rl1.c,v 1.2 2016/02/29 00:54:19 christos Exp $ */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -15,13 +15,6 @@
  * 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.
- * 3. All advertising materials mentioning features or use of this software
- *must display the following acknowledgement:
- *This product includes software developed by the NetBSD
- *Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- *contributors may be used to endorse or promote products derived
- *from this software without specific prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
@@ -38,7 +31,7 @@
 
 #include 
 #if !defined(lint)
-__RCSID("$NetBSD: rl1.c,v 1.1 2010/09/16 20:08:51 christos Exp $");
+__RCSID("$NetBSD: rl1.c,v 1.2 2016/02/29 00:54:19 christos Exp $");
 #endif /* not lint  */
 
 /*

Modified: vendor/NetBSD/libedit/dist/chartype.h
==
--- vendor/NetBSD/libedit/dist/chartype.h   Mon Jan 30 22:29:21 2017
(r312998)
+++ vendor/NetBSD/libedit/dist/chartype.h   Mon Jan 30 22:35:42 2017
(r312999)
@@ -1,4 +1,4 @@
-/* $NetBSD: chartype.h,v 1.23 2016/02/24 17:20:01 christos Exp $   */
+/* $NetBSD: chartype.h,v 1.25 2016/03/07 00:05:20 christos Exp $   */
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -12,13 +12,6 @@
  * 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.
- * 3. All advertising materials mentioning features or use of this software
- *must display the following acknowledgement:
- *This product includes software developed by the NetBSD
- *Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- *contributors may be used to endorse or promote products derived
- *from this software without specific prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
@@ -70,6 +63,7 @@
 #define FUNW(type) type ## _w
 #define TYPE(type) type ## W
 #define FSTR   "%ls"
+#define FSTARSTR   "%.*ls"
 #define STR(x) L ## x
 #define UC(c)  c
 #define Isalpha(x)  iswalpha(x)
@@ -122,6 +116,7 @@ Width(wchar_t c)
 #define FUNW(type) type
 #define TYPE(type) type
 #define FSTR   "%s"
+#define 

svn commit: r312998 - in head/sys/modules: . hwpmc_mips24k hwpmc_mips74k

2017-01-30 Thread Adrian Chadd
Author: adrian
Date: Mon Jan 30 22:29:21 2017
New Revision: 312998
URL: https://svnweb.freebsd.org/changeset/base/312998

Log:
  [mips] add some (temporary, I hope!) mips24k/mips74k hwpmc modules.
  
  Ideally we'd have a top level hwpmc module with the shared bits, then
  cpu specific glue as needed.  However, on the MIPS side, there's no
  probe code - {mips24k, mips74k, octeon} implement a set of methods
  that hwpmc_mips.c expects.
  
  So this populates separate modules with duplicate code.
  Ew, but it does work.
  
  This gets me off the hook - these work fine as copied into the relevant
  mfsroot for mips24k/mips74k systems.
  
  TODO:
  
  * do it the "right" way in the future.  Note that modules/hwpmc/ does
build fine on MIPS, it jusn't DO anything.  So it'd be nice to
maybe call that "hwpmc_core" and then "hwpmc" can be the CPU/arch glue.

Added:
  head/sys/modules/hwpmc_mips24k/
  head/sys/modules/hwpmc_mips24k/Makefile   (contents, props changed)
  head/sys/modules/hwpmc_mips74k/
  head/sys/modules/hwpmc_mips74k/Makefile   (contents, props changed)
Modified:
  head/sys/modules/Makefile

Modified: head/sys/modules/Makefile
==
--- head/sys/modules/Makefile   Mon Jan 30 22:11:53 2017(r312997)
+++ head/sys/modules/Makefile   Mon Jan 30 22:29:21 2017(r312998)
@@ -138,6 +138,8 @@ SUBDIR= \
${_hptnr} \
${_hptrr} \
hwpmc \
+   ${_hwpmc_mips24k} \
+   ${_hwpmc_mips74k} \
${_hyperv} \
i2c \
 ${_ibcore} \
@@ -520,6 +522,11 @@ _cxgbe=cxgbe
 SUBDIR+=   zfs
 .endif
 
+.if ${MACHINE_CPUARCH} == "mips"
+   _hwpmc_mips24k= hwpmc_mips24k
+   _hwpmc_mips74k= hwpmc_mips74k
+.endif
+
 .if ${MACHINE_CPUARCH} != "aarch64" && ${MACHINE_CPUARCH} != "arm" && \
${MACHINE_CPUARCH} != "mips" && ${MACHINE_CPUARCH} != "powerpc" && \
${MACHINE_CPUARCH} != "riscv"

Added: head/sys/modules/hwpmc_mips24k/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/modules/hwpmc_mips24k/Makefile Mon Jan 30 22:29:21 2017
(r312998)
@@ -0,0 +1,14 @@
+#
+# $FreeBSD$
+#
+
+.PATH: ${.CURDIR}/../../dev/hwpmc
+
+KMOD=  hwpmc_mips24k
+
+SRCS=  hwpmc_mod.c hwpmc_logging.c hwpmc_soft.c vnode_if.h
+SRCS+= hwpmc_mips.c
+
+SRCS+= hwpmc_mips24k.c
+
+.include 

Added: head/sys/modules/hwpmc_mips74k/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/modules/hwpmc_mips74k/Makefile Mon Jan 30 22:29:21 2017
(r312998)
@@ -0,0 +1,14 @@
+#
+# $FreeBSD$
+#
+
+.PATH: ${.CURDIR}/../../dev/hwpmc
+
+KMOD=  hwpmc_mips74k
+
+SRCS=  hwpmc_mod.c hwpmc_logging.c hwpmc_soft.c vnode_if.h
+SRCS+= hwpmc_mips.c
+
+SRCS+= hwpmc_mips74k.c
+
+.include 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r312997 - in head/lib/libedit: . TEST edit/readline

2017-01-30 Thread Pedro F. Giffuni
Author: pfg
Date: Mon Jan 30 22:11:53 2017
New Revision: 312997
URL: https://svnweb.freebsd.org/changeset/base/312997

Log:
  MFV r312996:
  Re-import libedit 2016-02-27
  
  This reverts r296435: the issues related to lldb and this update appear to
  have been identified (in lldb).
  
  Obtained from:NetBSD
  Reported by:  emaste
  MFC after:3 weeks

Modified:
  head/lib/libedit/Makefile
  head/lib/libedit/TEST/tc1.c
  head/lib/libedit/TEST/wtc1.c
  head/lib/libedit/chared.c
  head/lib/libedit/chared.h
  head/lib/libedit/chartype.c
  head/lib/libedit/chartype.h
  head/lib/libedit/common.c
  head/lib/libedit/config.h
  head/lib/libedit/edit/readline/readline.h
  head/lib/libedit/editline.3
  head/lib/libedit/el.c
  head/lib/libedit/el.h
  head/lib/libedit/eln.c
  head/lib/libedit/emacs.c
  head/lib/libedit/filecomplete.c
  head/lib/libedit/hist.c
  head/lib/libedit/hist.h
  head/lib/libedit/histedit.h
  head/lib/libedit/history.c
  head/lib/libedit/keymacro.c
  head/lib/libedit/makelist
  head/lib/libedit/map.c
  head/lib/libedit/parse.c
  head/lib/libedit/prompt.c
  head/lib/libedit/prompt.h
  head/lib/libedit/read.c
  head/lib/libedit/read.h
  head/lib/libedit/readline.c
  head/lib/libedit/refresh.c
  head/lib/libedit/refresh.h
  head/lib/libedit/search.c
  head/lib/libedit/search.h
  head/lib/libedit/sig.c
  head/lib/libedit/sig.h
  head/lib/libedit/sys.h
  head/lib/libedit/terminal.c
  head/lib/libedit/terminal.h
  head/lib/libedit/tokenizer.c
  head/lib/libedit/tty.c
  head/lib/libedit/tty.h
  head/lib/libedit/vi.c
Directory Properties:
  head/lib/libedit/   (props changed)
  head/lib/libedit/edit/readline/   (props changed)

Modified: head/lib/libedit/Makefile
==
--- head/lib/libedit/Makefile   Mon Jan 30 21:06:07 2017(r312996)
+++ head/lib/libedit/Makefile   Mon Jan 30 22:11:53 2017(r312997)
@@ -1,4 +1,4 @@
-#  $NetBSD: Makefile,v 1.37 2009/01/18 12:17:49 lukem Exp $
+#  $NetBSD: Makefile,v 1.55 2016/02/24 14:25:38 christos Exp $
 #  @(#)Makefile8.1 (Berkeley) 6/4/93
 # $FreeBSD$
 
@@ -7,7 +7,7 @@ LIB=edit
 SHLIB_MAJOR=   7
 SHLIBDIR?= /lib
 
-OSRCS= chared.c common.c el.c emacs.c fcns.c filecomplete.c help.c \
+OSRCS= chared.c common.c el.c eln.c emacs.c fcns.c filecomplete.c help.c \
hist.c keymacro.c map.c chartype.c \
parse.c prompt.c read.c refresh.c search.c sig.c terminal.c tty.c vi.c
 
@@ -35,7 +35,6 @@ CLEANFILES+= common.h editline.c emacs.h
 
 INCS=  histedit.h
 
-OSRCS+=eln.c
 SRCS+= tokenizern.c historyn.c
 CLEANFILES+=   tokenizern.c historyn.c
 CFLAGS+= -I. -I${.CURDIR} -I${.CURDIR}/edit -DWIDECHAR

Modified: head/lib/libedit/TEST/tc1.c
==
--- head/lib/libedit/TEST/tc1.c Mon Jan 30 21:06:07 2017(r312996)
+++ head/lib/libedit/TEST/tc1.c Mon Jan 30 22:11:53 2017(r312997)
@@ -1,4 +1,4 @@
-/* $NetBSD: tc1.c,v 1.6 2014/06/18 20:12:15 christos Exp $ */
+/* $NetBSD: tc1.c,v 1.7 2016/02/17 19:47:49 christos Exp $ */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1992, 19
 #if 0
 static char sccsid[] = "@(#)test.c 8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: tc1.c,v 1.6 2014/06/18 20:12:15 christos Exp $");
+__RCSID("$NetBSD: tc1.c,v 1.7 2016/02/17 19:47:49 christos Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 __FBSDID("$FreeBSD$");
@@ -50,15 +50,15 @@ __FBSDID("$FreeBSD$");
 /*
  * test.c: A little test program
  */
-#include 
-#include 
-#include 
 #include 
 #include 
-#include 
-#include 
 #include 
 #include 
+#include 
+#include 
+#include 
+#include 
+#include 
 
 #include "histedit.h"
 
@@ -158,7 +158,7 @@ main(int argc, char *argv[])
/* Add a user-defined function  */
el_set(el, EL_ADDFN, "ed-complete", "Complete argument", complete);
 
-   /* Bind tab to it   */
+   /* Bind tab to it   */
el_set(el, EL_BIND, "^I", "ed-complete", NULL);
 
/*

Modified: head/lib/libedit/TEST/wtc1.c
==
--- head/lib/libedit/TEST/wtc1.cMon Jan 30 21:06:07 2017
(r312996)
+++ head/lib/libedit/TEST/wtc1.cMon Jan 30 22:11:53 2017
(r312997)
@@ -5,13 +5,16 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
-#include 
-#include 
 #include 
+#include 
 #include 
 #include 
+#include 
+#include 
+#include 
+#include 
+#include 
 
 #include "../histedit.h"
 

Modified: head/lib/libedit/chared.c
==
--- head/lib/libedit/chared.c   Mon Jan 30 21:06:07 2017(r312996)
+++ head/lib/libedit/chared.c   Mon Jan 30 22:11:53 2017(r312997)
@@ 

svn commit: r312996 - in vendor/NetBSD/libedit: 2016-02-27 dist dist/TEST dist/readline

2017-01-30 Thread Pedro F. Giffuni
Author: pfg
Date: Mon Jan 30 21:06:07 2017
New Revision: 312996
URL: https://svnweb.freebsd.org/changeset/base/312996

Log:
  Import libedit 2016-02-27
  
  This basically reverts r296500: there are many changes in the latest
  version and this intermediate step lets us save all the work done
  for the previous update.
  
  Obtained from:NetBSD

Added:
  vendor/NetBSD/libedit/2016-02-27/
 - copied from r296499, vendor/NetBSD/libedit/2016-02-27/
Modified:
  vendor/NetBSD/libedit/dist/Makefile
  vendor/NetBSD/libedit/dist/TEST/Makefile
  vendor/NetBSD/libedit/dist/TEST/rl1.c
  vendor/NetBSD/libedit/dist/TEST/tc1.c
  vendor/NetBSD/libedit/dist/TEST/wtc1.c
  vendor/NetBSD/libedit/dist/chared.c
  vendor/NetBSD/libedit/dist/chared.h
  vendor/NetBSD/libedit/dist/chartype.c
  vendor/NetBSD/libedit/dist/chartype.h
  vendor/NetBSD/libedit/dist/common.c
  vendor/NetBSD/libedit/dist/config.h
  vendor/NetBSD/libedit/dist/editline.3
  vendor/NetBSD/libedit/dist/el.c
  vendor/NetBSD/libedit/dist/el.h
  vendor/NetBSD/libedit/dist/eln.c
  vendor/NetBSD/libedit/dist/emacs.c
  vendor/NetBSD/libedit/dist/filecomplete.c
  vendor/NetBSD/libedit/dist/hist.c
  vendor/NetBSD/libedit/dist/hist.h
  vendor/NetBSD/libedit/dist/histedit.h
  vendor/NetBSD/libedit/dist/history.c
  vendor/NetBSD/libedit/dist/keymacro.c
  vendor/NetBSD/libedit/dist/makelist
  vendor/NetBSD/libedit/dist/map.c
  vendor/NetBSD/libedit/dist/parse.c
  vendor/NetBSD/libedit/dist/prompt.c
  vendor/NetBSD/libedit/dist/prompt.h
  vendor/NetBSD/libedit/dist/read.c
  vendor/NetBSD/libedit/dist/read.h
  vendor/NetBSD/libedit/dist/readline.c
  vendor/NetBSD/libedit/dist/readline/Makefile
  vendor/NetBSD/libedit/dist/readline/readline.h
  vendor/NetBSD/libedit/dist/refresh.c
  vendor/NetBSD/libedit/dist/refresh.h
  vendor/NetBSD/libedit/dist/search.c
  vendor/NetBSD/libedit/dist/search.h
  vendor/NetBSD/libedit/dist/sig.c
  vendor/NetBSD/libedit/dist/sig.h
  vendor/NetBSD/libedit/dist/sys.h
  vendor/NetBSD/libedit/dist/terminal.c
  vendor/NetBSD/libedit/dist/terminal.h
  vendor/NetBSD/libedit/dist/tokenizer.c
  vendor/NetBSD/libedit/dist/tty.c
  vendor/NetBSD/libedit/dist/tty.h
  vendor/NetBSD/libedit/dist/vi.c

Modified: vendor/NetBSD/libedit/dist/Makefile
==
--- vendor/NetBSD/libedit/dist/Makefile Mon Jan 30 19:49:08 2017
(r312995)
+++ vendor/NetBSD/libedit/dist/Makefile Mon Jan 30 21:06:07 2017
(r312996)
@@ -1,4 +1,4 @@
-#  $NetBSD: Makefile,v 1.53 2015/01/29 20:30:02 joerg Exp $
+#  $NetBSD: Makefile,v 1.55 2016/02/24 14:25:38 christos Exp $
 #  @(#)Makefile8.1 (Berkeley) 6/4/93
 
 USE_SHLIBDIR=  yes
@@ -15,7 +15,7 @@ COPTS+=   -Wunused-parameter
 CWARNFLAGS.gcc+=   -Wconversion
 CWARNFLAGS.clang+= -Wno-cast-qual
 
-OSRCS= chared.c common.c el.c emacs.c fcns.c filecomplete.c help.c \
+OSRCS= chared.c common.c el.c eln.c emacs.c fcns.c filecomplete.c help.c \
hist.c keymacro.c map.c chartype.c \
parse.c prompt.c read.c refresh.c search.c sig.c terminal.c tty.c vi.c
 
@@ -37,7 +37,6 @@ MLINKS=   editline.3 el_init.3 editline.3 
 SRCS=  editline.c readline.c tokenizer.c history.c
 
 .if ${WIDECHAR} == "yes"
-OSRCS += eln.c
 SRCS += tokenizern.c historyn.c
 CLEANFILES+=tokenizern.c.tmp tokenizern.c historyn.c.tmp historyn.c
 CPPFLAGS+=-DWIDECHAR
@@ -52,12 +51,12 @@ CLEANFILES+=editline.c
 CLEANFILES+=common.h.tmp editline.c.tmp emacs.h.tmp fcns.c.tmp fcns.h.tmp
 CLEANFILES+=help.c.tmp help.h.tmp vi.h.tmp tc1.o tc1
 CLEANFILES+=tokenizern.c.tmp tokenizern.c tokenizerw.c.tmp tokenizerw.c
-CPPFLAGS+=-I. -I${LIBEDITDIR} 
+CPPFLAGS+=-I. -I${LIBEDITDIR}
 CPPFLAGS+=-I. -I${.CURDIR}
 CPPFLAGS+=#-DDEBUG_TTY -DDEBUG_KEY -DDEBUG_READ -DDEBUG -DDEBUG_REFRESH
 CPPFLAGS+=#-DDEBUG_PASTE -DDEBUG_EDIT
 
-AHDR=vi.h emacs.h common.h 
+AHDR=vi.h emacs.h common.h
 ASRC=${LIBEDITDIR}/vi.c ${LIBEDITDIR}/emacs.c ${LIBEDITDIR}/common.c
 
 DPSRCS+=   ${AHDR} fcns.h help.h fcns.c help.c
@@ -120,7 +119,7 @@ historyn.c: makelist Makefile
 
 tc1.o: ${LIBEDITDIR}/TEST/tc1.c
 
-tc1:   libedit.a tc1.o 
+tc1:   libedit.a tc1.o
${_MKTARGET_LINK}
${CC} ${LDFLAGS} ${.ALLSRC} -o ${.TARGET} libedit.a ${LDADD} -ltermlib
 

Modified: vendor/NetBSD/libedit/dist/TEST/Makefile
==
--- vendor/NetBSD/libedit/dist/TEST/MakefileMon Jan 30 19:49:08 2017
(r312995)
+++ vendor/NetBSD/libedit/dist/TEST/MakefileMon Jan 30 21:06:07 2017
(r312996)
@@ -1,4 +1,6 @@
-# $NetBSD: Makefile,v 1.5 2010/02/03 15:34:43 roy Exp $
+# $NetBSD: Makefile,v 1.6 2016/02/15 21:38:07 christos Exp $
+
+WIDECHAR ?= yes
 
 NOMAN=1
 PROG=wtc1
@@ -6,6 +8,10 @@ CPPFLAGS=-I${.CURDIR}/..
 LDADD+=-ledit -ltermlib
 DPADD+=${LIBEDIT} ${LIBTERMLIB}
 
+.if "${WIDECHAR}" == "yes"
+CPPFLAGS+=-DWIDECHAR
+.endif
+
 .ifdef DEBUG
 CPPFLAGS+=-DDEBUG
 .endif

Modified: 

svn commit: r312995 - head/sys/dev/mpr

2017-01-30 Thread Alan Somers
Author: asomers
Date: Mon Jan 30 19:49:08 2017
New Revision: 312995
URL: https://svnweb.freebsd.org/changeset/base/312995

Log:
  Initialize a stack variable in mprsas_get_sas_address_for_sata_disk
  
  Thought it's difficult to reproduce, I think this variable was responsible
  for a use-after-free panic when a SATA disk timed out responding to a SATA
  identify command during boot.
  
  Submitted by: slm
  Reviewed by:  slm
  MFC after:4 weeks
  Sponsored by: Spectra Logic Corp
  Differential Revision:https://reviews.freebsd.org/D9364

Modified:
  head/sys/dev/mpr/mpr_sas_lsi.c

Modified: head/sys/dev/mpr/mpr_sas_lsi.c
==
--- head/sys/dev/mpr/mpr_sas_lsi.c  Mon Jan 30 18:51:43 2017
(r312994)
+++ head/sys/dev/mpr/mpr_sas_lsi.c  Mon Jan 30 19:49:08 2017
(r312995)
@@ -911,6 +911,7 @@ mprsas_get_sas_address_for_sata_disk(str
u8 sas_status;
 
memset(_identify, 0, sizeof(ata_identify));
+   memset(_reply, 0, sizeof(mpi_reply));
try_count = 0;
do {
rc = mprsas_get_sata_identify(sc, handle, _reply,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r312994 - head/sys/vm

2017-01-30 Thread Mark Johnston
Author: markj
Date: Mon Jan 30 18:51:43 2017
New Revision: 312994
URL: https://svnweb.freebsd.org/changeset/base/312994

Log:
  Avoid page lookups in the top-level object in vm_object_madvise().
  
  We can iterate over consecutive resident pages in the top-level object
  using the object's page list rather than by performing lookups in the
  object radix tree. This extends one of the optimizations in r312208 to the
  case where a shadow chain is present.
  
  Suggested by: alc
  Reviewed by:  alc, kib (previous version)
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D9282

Modified:
  head/sys/vm/vm_object.c

Modified: head/sys/vm/vm_object.c
==
--- head/sys/vm/vm_object.c Mon Jan 30 18:35:24 2017(r312993)
+++ head/sys/vm/vm_object.c Mon Jan 30 18:51:43 2017(r312994)
@@ -1075,6 +1075,33 @@ vm_object_sync(vm_object_t object, vm_oo
 }
 
 /*
+ * Determine whether the given advice can be applied to the object.  Advice is
+ * not applied to unmanaged pages since they never belong to page queues, and
+ * since MADV_FREE is destructive, it can apply only to anonymous pages that
+ * have been mapped at most once.
+ */
+static bool
+vm_object_advice_applies(vm_object_t object, int advice)
+{
+
+   if ((object->flags & OBJ_UNMANAGED) != 0)
+   return (false);
+   if (advice != MADV_FREE)
+   return (true);
+   return ((object->type == OBJT_DEFAULT || object->type == OBJT_SWAP) &&
+   (object->flags & OBJ_ONEMAPPING) != 0);
+}
+
+static void
+vm_object_madvise_freespace(vm_object_t object, int advice, vm_pindex_t pindex,
+vm_size_t size)
+{
+
+   if (advice == MADV_FREE && object->type == OBJT_SWAP)
+   swap_pager_freespace(object, pindex, size);
+}
+
+/*
  * vm_object_madvise:
  *
  * Implements the madvise function at the object/page level.
@@ -1101,100 +1128,102 @@ vm_object_madvise(vm_object_t object, vm
 {
vm_pindex_t tpindex;
vm_object_t backing_object, tobject;
-   vm_page_t m;
+   vm_page_t m, tm;
 
if (object == NULL)
return;
 
-   VM_OBJECT_WLOCK(object);
-   for (m = NULL; pindex < end; pindex++) {
 relookup:
+   VM_OBJECT_WLOCK(object);
+   if (!vm_object_advice_applies(object, advice)) {
+   VM_OBJECT_WUNLOCK(object);
+   return;
+   }
+   for (m = vm_page_find_least(object, pindex); pindex < end; pindex++) {
tobject = object;
-   tpindex = pindex;
-shadowlookup:
-   /*
-* MADV_FREE only operates on OBJT_DEFAULT or OBJT_SWAP pages
-* and those pages must be OBJ_ONEMAPPING.
-*/
-   if (advice == MADV_FREE) {
-   if ((tobject->type != OBJT_DEFAULT &&
-tobject->type != OBJT_SWAP) ||
-   (tobject->flags & OBJ_ONEMAPPING) == 0) {
-   goto unlock_tobject;
-   }
-   } else if ((tobject->flags & OBJ_UNMANAGED) != 0)
-   goto unlock_tobject;
 
/*
-* In the common case where the object has no backing object, we
-* can avoid performing lookups at each pindex.  In either case,
-* when applying MADV_FREE we take care to release any swap
-* space used to store non-resident pages.
+* If the next page isn't resident in the top-level object, we
+* need to search the shadow chain.  When applying MADV_FREE, we
+* take care to release any swap space used to store
+* non-resident pages.
 */
-   if (object->backing_object == NULL) {
-   m = (m != NULL) ? TAILQ_NEXT(m, listq) :
-   vm_page_find_least(object, pindex);
-   tpindex = (m != NULL && m->pindex < end) ?
-   m->pindex : end;
-   if (advice == MADV_FREE && object->type == OBJT_SWAP &&
-   tpindex > pindex)
-   swap_pager_freespace(object, pindex,
-   tpindex - pindex);
-   if ((pindex = tpindex) == end)
-   break;
-   } else if ((m = vm_page_lookup(tobject, tpindex)) == NULL) {
-   if (advice == MADV_FREE && tobject->type == OBJT_SWAP)
-   swap_pager_freespace(tobject, tpindex, 1);
+   if (m == NULL || pindex < m->pindex) {
/*
-* Prepare to search the next object in the chain.
+* Optimize a common case: if the top-level object has
+* no backing object, 

svn commit: r312993 - head/contrib/llvm/lib/Transforms/Scalar

2017-01-30 Thread Dimitry Andric
Author: dim
Date: Mon Jan 30 18:35:24 2017
New Revision: 312993
URL: https://svnweb.freebsd.org/changeset/base/312993

Log:
  Pull in r279454 from upstream llvm trunk (by James Molloy):
  
[SROA] Remove incorrect assertion
  
Confirmed with aprantl, this assertion is incorrect - code can get
here (for example 80-bit FP types) and if it does it's benign. This
is exposed by a completely unrelated patch of mine, so stop the
compiler falling over.
  
Original differential: http://reviews.llvm.org/D16187
aprantl's advice to remove assertion:

http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20160815/382129.html
  
  This should fix assertions when building the math/opensolaris-libm port.
  
  Reported by:  marino
  MFC after:3 days

Modified:
  head/contrib/llvm/lib/Transforms/Scalar/SROA.cpp

Modified: head/contrib/llvm/lib/Transforms/Scalar/SROA.cpp
==
--- head/contrib/llvm/lib/Transforms/Scalar/SROA.cppMon Jan 30 16:32:53 
2017(r312992)
+++ head/contrib/llvm/lib/Transforms/Scalar/SROA.cppMon Jan 30 18:35:24 
2017(r312993)
@@ -4040,9 +4040,6 @@ bool SROA::splitAlloca(AllocaInst , A
   Size = std::min(Size, AbsEnd - Start);
 }
 PieceExpr = DIB.createBitPieceExpression(Start, Size);
-  } else {
-assert(Pieces.size() == 1 &&
-   "partition is as large as original alloca");
   }
 
   // Remove any existing dbg.declare intrinsic describing the same alloca.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r312755 - head/sys/net

2017-01-30 Thread John Baldwin
On Monday, January 30, 2017 09:18:56 AM Sean Bruno wrote:
> 
> On 01/27/17 12:28, John Baldwin wrote:
> > On Wednesday, January 25, 2017 02:37:05 PM Sean Bruno wrote:
> >> Author: sbruno
> >> Date: Wed Jan 25 14:37:05 2017
> >> New Revision: 312755
> >> URL: https://svnweb.freebsd.org/changeset/base/312755
> >>
> >> Log:
> >>   Add error checking to the pci_find_cap(, PCIY_MSIX,) call that is returns
> >>   success and a good value.  Only then try to use it and set the 
> >> MSIX_ENABLE
> >>   bit.
> >>   
> >>   With the current em(4) driver we have observed failures in this case in a
> >>   specific environment when pci_find_cap() would not return the assumed
> >>   value, which meant we ended up writing to PCI register 2 (PCI_DEVICE_ID)
> >>   which is read-only.
> > 
> > Why is this writing directly to the MSIX registers at all?  pci_alloc_msix()
> > etc. handle those registers for all other drivers and proper suspend/resume
> > depends on drivers using the existing PCI API for managing MSI and MSI-X.
> > 
> 
> The comment above this code block explains what's up.  Basically,
> virtualized environments are sometimes "lazy" about correct register setup.

Can you provide more details here?  We already deploy workarounds for
specific versions of Xen that emulate MSI-X incorrectly, though for
Xen your change actually makes things worse (older versions of Xen don't
"see" updates to the MSI-X table while MSI-X is enabled).  However, you are
still enabling MSI-X while there is uninitialized junk in the table meaning
that if the device asserted an interrupt it could trigger a panic.

If there are bugs with hypervisors, we need to work around them in the
base PCI code as we have done with the Xen workarounds.  They are not
going to be e1000-specific (or even NIC-specific), so iflib is the wrong
place to handle them.

> If MSIX caps aren't set, try to enable them.  If that fails, assume MSI.

Enabling MSI-X with an uninitialized table is not safe.

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


svn commit: r312992 - in head: contrib/openresolv sbin/resolvconf

2017-01-30 Thread Pedro F. Giffuni
Author: pfg
Date: Mon Jan 30 16:32:53 2017
New Revision: 312992
URL: https://svnweb.freebsd.org/changeset/base/312992

Log:
  MFV r312970:
  openresolv: update to version 3.9.0.
  
  It is now possible to drop the _WITH_ARG vars thanks to a change to the
  pdns_recursor upstreamed by Guy Yur.
  
  MFC after:3 weeks

Modified:
  head/contrib/openresolv/Makefile
  head/contrib/openresolv/configure
  head/contrib/openresolv/libc.in
  head/contrib/openresolv/pdns_recursor.in
  head/contrib/openresolv/resolvconf.8.in
  head/contrib/openresolv/resolvconf.conf.5.in
  head/contrib/openresolv/resolvconf.in
  head/sbin/resolvconf/Makefile
Directory Properties:
  head/contrib/openresolv/   (props changed)

Modified: head/contrib/openresolv/Makefile
==
--- head/contrib/openresolv/MakefileMon Jan 30 15:20:13 2017
(r312991)
+++ head/contrib/openresolv/MakefileMon Jan 30 16:32:53 2017
(r312992)
@@ -37,6 +37,11 @@ SED_STATUSARG=   -e 's:@STATUSARG@:${STAT
 DISTPREFIX?=   ${PKG}-${VERSION}
 DISTFILEGZ?=   ${DISTPREFIX}.tar.gz
 DISTFILE?= ${DISTPREFIX}.tar.xz
+DISTINFO=  ${DISTFILE}.distinfo
+DISTINFOSIGN=  ${DISTINFO}.asc
+CKSUM?=cksum -a SHA256
+PGP?=  netpgp
+
 FOSSILID?= current
 
 .SUFFIXES: .in
@@ -53,7 +58,7 @@ clean:
rm -f ${TARGET}
 
 distclean: clean
-   rm -f config.mk ${DISTFILE}
+   rm -f config.mk ${DISTFILE} ${DISTINFO} ${DISTINFOSIGN}
 
 installdirs:
 
@@ -83,3 +88,11 @@ dist:
fossil tarball --name ${DISTPREFIX} ${FOSSILID} ${DISTFILEGZ}
gunzip -c ${DISTFILEGZ} | xz >${DISTFILE}
rm ${DISTFILEGZ}
+
+distinfo: dist
+   rm -f ${DISTINFO} ${DISTINFOSIGN}
+   ${CKSUM} ${DISTFILE} >${DISTINFO}
+   #printf "SIZE (${DISTFILE}) = %s\n" $$(wc -c <${DISTFILE}) >>${DISTINFO}
+   ${PGP} --clearsign --output=${DISTINFOSIGN} ${DISTINFO}
+   chmod 644 ${DISTINFOSIGN}
+   ls -l ${DISTFILE} ${DISTINFO} ${DISTINFOSIGN}

Modified: head/contrib/openresolv/configure
==
--- head/contrib/openresolv/configure   Mon Jan 30 15:20:13 2017
(r312991)
+++ head/contrib/openresolv/configure   Mon Jan 30 16:32:53 2017
(r312992)
@@ -120,14 +120,21 @@ echo "Configuring openresolv for ... $OS
 rm -rf $CONFIG_MK
 echo "# $OS" >$CONFIG_MK
 
-# On FreeBSD, /etc/init.d/foo status returns 0 if foo is not enabled
-# regardless of if it's not running.
-# So we force onestatus to work around this silly bug.
-if [ -z "$STATUSARG" ]; then
-   case "$OS" in
-   freebsd*)   STATUSARG="onestatus";;
-   esac
-fi
+case "$OS" in
+freebsd*)
+   # On FreeBSD, /etc/init.d/foo status returns 0 if foo is not enabled
+   # regardless of if it's not running.
+   # So we force onestatus to work around this silly bug.
+   if [ -z "$STATUSARG" ]; then
+   STATUSARG="onestatus"
+   fi
+   ;;
+linux*)
+   # cksum does't support -a and netpgp is rare
+   echo "CKSUM=sha256sum --tag" >>$CONFIG_MK
+   echo "PGP=  gpg2" >>$CONFIG_MK
+   ;;
+esac
 
 for x in SYSCONFDIR SBINDIR LIBEXECDIR VARDIR MANDIR RESTARTCMD RCDIR STATUSARG
 do

Modified: head/contrib/openresolv/libc.in
==
--- head/contrib/openresolv/libc.in Mon Jan 30 15:20:13 2017
(r312991)
+++ head/contrib/openresolv/libc.in Mon Jan 30 16:32:53 2017
(r312992)
@@ -216,7 +216,7 @@ fi
 if $backup; then
if [ "$newconf" = "$signature$NL" ]; then
if [ -e "$resolv_conf.bak" ]; then
-   newconf="$(cat "$resolv_conf.bak")"
+   newconf="$(cat "$resolv_conf.bak")$NL"
fi
elif [ -e "$resolv_conf" ]; then
read line <"$resolv_conf"

Modified: head/contrib/openresolv/pdns_recursor.in
==
--- head/contrib/openresolv/pdns_recursor.inMon Jan 30 15:20:13 2017
(r312991)
+++ head/contrib/openresolv/pdns_recursor.inMon Jan 30 16:32:53 2017
(r312992)
@@ -34,7 +34,6 @@ NL="
 "
 
 : ${pdns_service:=pdns_recursor}
-: ${pdns_restart:=@RESTARTCMD ${pdns_service}@}
 
 newzones=
 
@@ -68,5 +67,12 @@ if [ ! -f "$pdns_zones" ] || \
[ "$(cat "$pdns_zones")" != "$(printf %s "$newzones")" ]
 then
printf %s "$newzones" >"$pdns_zones"
-   eval $pdns_restart
+   if [ -n "$pdns_restart" ]; then
+   eval $pdns_restart
+   elif [ -n "$RESTARTCMD" ]; then
+   set -- ${pdns_service}
+   eval $RESTARTCMD
+   else
+   @SBINDIR@/resolvconf -r ${pdns_service}
+   fi
 fi

Modified: head/contrib/openresolv/resolvconf.8.in

Re: svn commit: r312755 - head/sys/net

2017-01-30 Thread Sean Bruno


On 01/27/17 12:28, John Baldwin wrote:
> On Wednesday, January 25, 2017 02:37:05 PM Sean Bruno wrote:
>> Author: sbruno
>> Date: Wed Jan 25 14:37:05 2017
>> New Revision: 312755
>> URL: https://svnweb.freebsd.org/changeset/base/312755
>>
>> Log:
>>   Add error checking to the pci_find_cap(, PCIY_MSIX,) call that is returns
>>   success and a good value.  Only then try to use it and set the MSIX_ENABLE
>>   bit.
>>   
>>   With the current em(4) driver we have observed failures in this case in a
>>   specific environment when pci_find_cap() would not return the assumed
>>   value, which meant we ended up writing to PCI register 2 (PCI_DEVICE_ID)
>>   which is read-only.
> 
> Why is this writing directly to the MSIX registers at all?  pci_alloc_msix()
> etc. handle those registers for all other drivers and proper suspend/resume
> depends on drivers using the existing PCI API for managing MSI and MSI-X.
> 

The comment above this code block explains what's up.  Basically,
virtualized environments are sometimes "lazy" about correct register setup.

If MSIX caps aren't set, try to enable them.  If that fails, assume MSI.

Later on the code does the proper pci_alloc_msix() calls in the proper
sequence, IMO.

sean



signature.asc
Description: OpenPGP digital signature


Re: svn commit: r312973 - head/sys/powerpc/include

2017-01-30 Thread Justin Hibbits
On Mon, Jan 30, 2017 at 9:32 AM, Justin Hibbits  wrote:
> On Mon, Jan 30, 2017 at 4:53 AM, Konstantin Belousov
>  wrote:
>>> +#ifdef __GNUCLIKE_ASM
>>> + __asm __volatile (
>>> + "1:\tlwarx %0, 0, %3\n\t"   /* load old value */
>>> + "cmplw %4, %0\n\t"  /* compare */
>>> + "bne 2f\n\t"/* exit if not equal */
>>> + "stwcx. %5, 0, %3\n\t"  /* attempt to store */
>>> + "bne- 1b\n\t"   /* spin if failed */
>>> + "li %0, 1\n\t"  /* success - retval = 1 */
>>> + "b 3f\n\t"  /* we've succeeded */
>>> + "2:\n\t"
>>> + "stwcx. %0, 0, %3\n\t"  /* clear reservation (74xx) */
>>> + "stwx %0, 0, %7\n\t"
>>> + "li %0, 0\n\t"  /* failure - retval = 0 */
>>> + "3:\n\t"
>>> + : "=" (ret), "=m" (*p), "=m" (*cmpval)
>>> + : "r" (p), "r" (*cmpval), "r" (newval), "m" (*p), "r"(cmpval)
>>> + : "cr0", "memory");
>>> +#endif
>>
>> It seems that in case of failed conditional store, the code retries.
>> Note that this is not incorrect but also not a desirable behaviour
>> with fcmpset:  the function should return error and leave the retry
>> to the caller.  There is no point in having embedded loop.

(stupid gmail web UI being so slow it registered me clicking Send when
I clicked the ...)

Thanks, Kib.  I discussed this with mjg on IRC, and it was kind of a
toss-up how to implement it, so I took the easiest route.  I'll update
it tonight and remove the loop.

There is an instruction on newer ISAs that would reduce this inline
asm even further, 'mfocrf', but it doesn't exist on all supported
PowerPC architectures, so it will be just a minor tweak.

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


Re: svn commit: r312973 - head/sys/powerpc/include

2017-01-30 Thread Justin Hibbits
On Mon, Jan 30, 2017 at 4:53 AM, Konstantin Belousov
 wrote:
>> +#ifdef __GNUCLIKE_ASM
>> + __asm __volatile (
>> + "1:\tlwarx %0, 0, %3\n\t"   /* load old value */
>> + "cmplw %4, %0\n\t"  /* compare */
>> + "bne 2f\n\t"/* exit if not equal */
>> + "stwcx. %5, 0, %3\n\t"  /* attempt to store */
>> + "bne- 1b\n\t"   /* spin if failed */
>> + "li %0, 1\n\t"  /* success - retval = 1 */
>> + "b 3f\n\t"  /* we've succeeded */
>> + "2:\n\t"
>> + "stwcx. %0, 0, %3\n\t"  /* clear reservation (74xx) */
>> + "stwx %0, 0, %7\n\t"
>> + "li %0, 0\n\t"  /* failure - retval = 0 */
>> + "3:\n\t"
>> + : "=" (ret), "=m" (*p), "=m" (*cmpval)
>> + : "r" (p), "r" (*cmpval), "r" (newval), "m" (*p), "r"(cmpval)
>> + : "cr0", "memory");
>> +#endif
>
> It seems that in case of failed conditional store, the code retries.
> Note that this is not incorrect but also not a desirable behaviour
> with fcmpset:  the function should return error and leave the retry
> to the caller.  There is no point in having embedded loop.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r312991 - head/sys/kern

2017-01-30 Thread Andriy Gapon
Author: avg
Date: Mon Jan 30 15:20:13 2017
New Revision: 312991
URL: https://svnweb.freebsd.org/changeset/base/312991

Log:
  put very expensive sanity checks of advisory locks under DIAGNOSTIC
  
  The checks have quadratic complexity over a number of advisory locks
  active for a file and that could be a lot.  What's the worse is that the
  checks are done while holding ls_lock.  That could lead to a long a very
  long backlog and performance degradation even if all requested locks are
  compatible (e.g. all shared locks).
  
  The checks used to be under INVARIANTS.
  
  Discussed with:   kib
  MFC after:2 weeks
  Sponsored by: Panzura

Modified:
  head/sys/kern/kern_lockf.c

Modified: head/sys/kern/kern_lockf.c
==
--- head/sys/kern/kern_lockf.c  Mon Jan 30 14:34:04 2017(r312990)
+++ head/sys/kern/kern_lockf.c  Mon Jan 30 15:20:13 2017(r312991)
@@ -689,7 +689,7 @@ retry_setlock:
break;
}
 
-#ifdef INVARIANTS
+#ifdef DIAGNOSTIC
/*
 * Check for some can't happen stuff. In this case, the active
 * lock list becoming disordered or containing mutually
@@ -917,7 +917,7 @@ lf_add_edge(struct lockf_entry *x, struc
struct lockf_edge *e;
int error;
 
-#ifdef INVARIANTS
+#ifdef DIAGNOSTIC
LIST_FOREACH(e, >lf_outedges, le_outlink)
KASSERT(e->le_to != y, ("adding lock edge twice"));
 #endif
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r312990 - stable/10/sys/amd64/vmm

2017-01-30 Thread Andriy Gapon
Author: avg
Date: Mon Jan 30 14:34:04 2017
New Revision: 312990
URL: https://svnweb.freebsd.org/changeset/base/312990

Log:
  MFC r312531: vmm_dev: work around a bogus error with gcc 6.3.0

Modified:
  stable/10/sys/amd64/vmm/vmm_dev.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/amd64/vmm/vmm_dev.c
==
--- stable/10/sys/amd64/vmm/vmm_dev.c   Mon Jan 30 14:33:53 2017
(r312989)
+++ stable/10/sys/amd64/vmm/vmm_dev.c   Mon Jan 30 14:34:04 2017
(r312990)
@@ -258,7 +258,7 @@ alloc_memseg(struct vmmdev_softc *sc, st
if (VM_MEMSEG_NAME(mseg)) {
sysmem = false;
name = malloc(SPECNAMELEN + 1, M_VMMDEV, M_WAITOK);
-   error = copystr(VM_MEMSEG_NAME(mseg), name, SPECNAMELEN + 1, 0);
+   error = copystr(mseg->name, name, SPECNAMELEN + 1, 0);
if (error)
goto done;
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r312989 - stable/11/sys/amd64/vmm

2017-01-30 Thread Andriy Gapon
Author: avg
Date: Mon Jan 30 14:33:53 2017
New Revision: 312989
URL: https://svnweb.freebsd.org/changeset/base/312989

Log:
  MFC r312531: vmm_dev: work around a bogus error with gcc 6.3.0

Modified:
  stable/11/sys/amd64/vmm/vmm_dev.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/amd64/vmm/vmm_dev.c
==
--- stable/11/sys/amd64/vmm/vmm_dev.c   Mon Jan 30 12:57:22 2017
(r312988)
+++ stable/11/sys/amd64/vmm/vmm_dev.c   Mon Jan 30 14:33:53 2017
(r312989)
@@ -258,7 +258,7 @@ alloc_memseg(struct vmmdev_softc *sc, st
if (VM_MEMSEG_NAME(mseg)) {
sysmem = false;
name = malloc(SPECNAMELEN + 1, M_VMMDEV, M_WAITOK);
-   error = copystr(VM_MEMSEG_NAME(mseg), name, SPECNAMELEN + 1, 0);
+   error = copystr(mseg->name, name, SPECNAMELEN + 1, 0);
if (error)
goto done;
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r312988 - in head/sys: compat/cloudabi compat/linux kern sys

2017-01-30 Thread Edward Tomasz Napierala
Author: trasz
Date: Mon Jan 30 12:57:22 2017
New Revision: 312988
URL: https://svnweb.freebsd.org/changeset/base/312988

Log:
  Add kern_listen(), kern_shutdown(), and kern_socket(), and use them
  instead of their sys_*() counterparts in various compats. The svr4
  is left untouched, because there's no point.
  
  Reviewed by:  ed@, kib@
  MFC after:2 weeks
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D9367

Modified:
  head/sys/compat/cloudabi/cloudabi_fd.c
  head/sys/compat/cloudabi/cloudabi_sock.c
  head/sys/compat/linux/linux_socket.c
  head/sys/kern/uipc_syscalls.c
  head/sys/sys/syscallsubr.h

Modified: head/sys/compat/cloudabi/cloudabi_fd.c
==
--- head/sys/compat/cloudabi/cloudabi_fd.c  Mon Jan 30 12:24:47 2017
(r312987)
+++ head/sys/compat/cloudabi/cloudabi_fd.c  Mon Jan 30 12:57:22 2017
(r312988)
@@ -100,9 +100,6 @@ cloudabi_sys_fd_create1(struct thread *t
 struct cloudabi_sys_fd_create1_args *uap)
 {
struct filecaps fcaps = {};
-   struct socket_args socket_args = {
-   .domain = AF_UNIX,
-   };
 
switch (uap->type) {
case CLOUDABI_FILETYPE_POLL:
@@ -113,14 +110,11 @@ cloudabi_sys_fd_create1(struct thread *t
CAP_MMAP_RWX);
return (kern_shm_open(td, SHM_ANON, O_RDWR, 0, ));
case CLOUDABI_FILETYPE_SOCKET_DGRAM:
-   socket_args.type = SOCK_DGRAM;
-   return (sys_socket(td, _args));
+   return (kern_socket(td, AF_UNIX, SOCK_DGRAM, 0));
case CLOUDABI_FILETYPE_SOCKET_SEQPACKET:
-   socket_args.type = SOCK_SEQPACKET;
-   return (sys_socket(td, _args));
+   return (kern_socket(td, AF_UNIX, SOCK_SEQPACKET, 0));
case CLOUDABI_FILETYPE_SOCKET_STREAM:
-   socket_args.type = SOCK_STREAM;
-   return (sys_socket(td, _args));
+   return (kern_socket(td, AF_UNIX, SOCK_STREAM, 0));
default:
return (EINVAL);
}

Modified: head/sys/compat/cloudabi/cloudabi_sock.c
==
--- head/sys/compat/cloudabi/cloudabi_sock.cMon Jan 30 12:24:47 2017
(r312987)
+++ head/sys/compat/cloudabi/cloudabi_sock.cMon Jan 30 12:57:22 2017
(r312988)
@@ -35,7 +35,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 
@@ -165,37 +164,31 @@ int
 cloudabi_sys_sock_listen(struct thread *td,
 struct cloudabi_sys_sock_listen_args *uap)
 {
-   struct listen_args listen_args = {
-   .s = uap->sock,
-   .backlog = uap->backlog,
-   };
 
-   return (sys_listen(td, _args));
+   return (kern_listen(td, uap->sock, uap->backlog));
 }
 
 int
 cloudabi_sys_sock_shutdown(struct thread *td,
 struct cloudabi_sys_sock_shutdown_args *uap)
 {
-   struct shutdown_args shutdown_args = {
-   .s = uap->sock,
-   };
+   int how;
 
switch (uap->how) {
case CLOUDABI_SHUT_RD:
-   shutdown_args.how = SHUT_RD;
+   how = SHUT_RD;
break;
case CLOUDABI_SHUT_WR:
-   shutdown_args.how = SHUT_WR;
+   how = SHUT_WR;
break;
case CLOUDABI_SHUT_RD | CLOUDABI_SHUT_WR:
-   shutdown_args.how = SHUT_RDWR;
+   how = SHUT_RDWR;
break;
default:
return (EINVAL);
}
 
-   return (sys_shutdown(td, _args));
+   return (kern_shutdown(td, uap->sock, how));
 }
 
 int

Modified: head/sys/compat/linux/linux_socket.c
==
--- head/sys/compat/linux/linux_socket.cMon Jan 30 12:24:47 2017
(r312987)
+++ head/sys/compat/linux/linux_socket.cMon Jan 30 12:57:22 2017
(r312988)
@@ -697,32 +697,26 @@ goout:
 int
 linux_socket(struct thread *td, struct linux_socket_args *args)
 {
-   struct socket_args /* {
-   int domain;
-   int type;
-   int protocol;
-   } */ bsd_args;
-   int retval_socket;
+   int domain, retval_socket, type;
 
-   bsd_args.protocol = args->protocol;
-   bsd_args.type = args->type & LINUX_SOCK_TYPE_MASK;
-   if (bsd_args.type < 0 || bsd_args.type > LINUX_SOCK_MAX)
+   type = args->type & LINUX_SOCK_TYPE_MASK;
+   if (type < 0 || type > LINUX_SOCK_MAX)
return (EINVAL);
retval_socket = linux_set_socket_flags(args->type & 
~LINUX_SOCK_TYPE_MASK,
-   _args.type);
+   );
if (retval_socket != 0)
return (retval_socket);
-   bsd_args.domain = linux_to_bsd_domain(args->domain);
-   if (bsd_args.domain == -1)
+   domain = linux_to_bsd_domain(args->domain);
+   

svn commit: r312987 - in head/sys: compat/cloudabi compat/freebsd32 compat/linux kern sys

2017-01-30 Thread Edward Tomasz Napierala
Author: trasz
Date: Mon Jan 30 12:24:47 2017
New Revision: 312987
URL: https://svnweb.freebsd.org/changeset/base/312987

Log:
  Add kern_lseek() and use it instead of sys_lseek() in various compats.
  I didn't touch svr4/, there's no point.
  
  Reviewed by:  ed@, kib@
  MFC after:2 weeks
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D9366

Modified:
  head/sys/compat/cloudabi/cloudabi_fd.c
  head/sys/compat/freebsd32/freebsd32_misc.c
  head/sys/compat/linux/linux_file.c
  head/sys/kern/vfs_syscalls.c
  head/sys/sys/syscallsubr.h

Modified: head/sys/compat/cloudabi/cloudabi_fd.c
==
--- head/sys/compat/cloudabi/cloudabi_fd.c  Mon Jan 30 11:50:54 2017
(r312986)
+++ head/sys/compat/cloudabi/cloudabi_fd.c  Mon Jan 30 12:24:47 2017
(r312987)
@@ -209,26 +209,23 @@ cloudabi_sys_fd_replace(struct thread *t
 int
 cloudabi_sys_fd_seek(struct thread *td, struct cloudabi_sys_fd_seek_args *uap)
 {
-   struct lseek_args lseek_args = {
-   .fd = uap->fd,
-   .offset = uap->offset
-   };
+   int whence;
 
switch (uap->whence) {
case CLOUDABI_WHENCE_CUR:
-   lseek_args.whence = SEEK_CUR;
+   whence = SEEK_CUR;
break;
case CLOUDABI_WHENCE_END:
-   lseek_args.whence = SEEK_END;
+   whence = SEEK_END;
break;
case CLOUDABI_WHENCE_SET:
-   lseek_args.whence = SEEK_SET;
+   whence = SEEK_SET;
break;
default:
return (EINVAL);
}
 
-   return (sys_lseek(td, _args));
+   return (kern_lseek(td, uap->fd, uap->offset, whence));
 }
 
 /* Converts a file descriptor to a CloudABI file descriptor type. */

Modified: head/sys/compat/freebsd32/freebsd32_misc.c
==
--- head/sys/compat/freebsd32/freebsd32_misc.c  Mon Jan 30 11:50:54 2017
(r312986)
+++ head/sys/compat/freebsd32/freebsd32_misc.c  Mon Jan 30 12:24:47 2017
(r312987)
@@ -1477,12 +1477,8 @@ freebsd32_pwrite(struct thread *td, stru
 int
 ofreebsd32_lseek(struct thread *td, struct ofreebsd32_lseek_args *uap)
 {
-   struct lseek_args nuap;
 
-   nuap.fd = uap->fd;
-   nuap.offset = uap->offset;
-   nuap.whence = uap->whence;
-   return (sys_lseek(td, ));
+   return (kern_lseek(td, uap->fd, uap->offset, uap->whence));
 }
 #endif
 
@@ -1490,13 +1486,10 @@ int
 freebsd32_lseek(struct thread *td, struct freebsd32_lseek_args *uap)
 {
int error;
-   struct lseek_args ap;
off_t pos;
 
-   ap.fd = uap->fd;
-   ap.offset = PAIR32TO64(off_t,uap->offset);
-   ap.whence = uap->whence;
-   error = sys_lseek(td, );
+   error = kern_lseek(td, uap->fd, PAIR32TO64(off_t, uap->offset),
+   uap->whence);
/* Expand the quad return into two parts for eax and edx */
pos = td->td_uretoff.tdu_off;
td->td_retval[RETVAL_LO] = pos & 0x;/* %eax */
@@ -1593,13 +1586,10 @@ int
 freebsd6_freebsd32_lseek(struct thread *td, struct 
freebsd6_freebsd32_lseek_args *uap)
 {
int error;
-   struct lseek_args ap;
off_t pos;
 
-   ap.fd = uap->fd;
-   ap.offset = PAIR32TO64(off_t,uap->offset);
-   ap.whence = uap->whence;
-   error = sys_lseek(td, );
+   error = kern_lseek(td, uap->fd, PAIR32TO64(off_t, uap->offset),
+   uap->whence);
/* Expand the quad return into two parts for eax and edx */
pos = *(off_t *)(td->td_retval);
td->td_retval[RETVAL_LO] = pos & 0x;/* %eax */

Modified: head/sys/compat/linux/linux_file.c
==
--- head/sys/compat/linux/linux_file.c  Mon Jan 30 11:50:54 2017
(r312986)
+++ head/sys/compat/linux/linux_file.c  Mon Jan 30 12:24:47 2017
(r312987)
@@ -210,31 +210,19 @@ linux_open(struct thread *td, struct lin
 int
 linux_lseek(struct thread *td, struct linux_lseek_args *args)
 {
-   struct lseek_args /* {
-   int fd;
-   int pad;
-   off_t offset;
-   int whence;
-   } */ tmp_args;
-   int error;
 
 #ifdef DEBUG
if (ldebug(lseek))
printf(ARGS(lseek, "%d, %ld, %d"),
args->fdes, (long)args->off, args->whence);
 #endif
-   tmp_args.fd = args->fdes;
-   tmp_args.offset = (off_t)args->off;
-   tmp_args.whence = args->whence;
-   error = sys_lseek(td, _args);
-   return (error);
+   return (kern_lseek(td, args->fdes, args->off, args->whence));
 }
 
 #if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32))
 int
 linux_llseek(struct thread *td, struct linux_llseek_args *args)
 {
-   struct lseek_args bsd_args;
int error;
 

svn commit: r312986 - in head/sys: amd64/linux32 compat/freebsd32 compat/linux i386/linux kern

2017-01-30 Thread Edward Tomasz Napierala
Author: trasz
Date: Mon Jan 30 11:50:54 2017
New Revision: 312986
URL: https://svnweb.freebsd.org/changeset/base/312986

Log:
  Replace sys_ftruncate() with kern_ftruncate() in various compats.
  
  Reviewed by:  kib@
  MFC after:2 weeks
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D9368

Modified:
  head/sys/amd64/linux32/linux32_machdep.c
  head/sys/compat/freebsd32/freebsd32_misc.c
  head/sys/compat/linux/linux_file.c
  head/sys/i386/linux/linux_machdep.c
  head/sys/kern/vfs_syscalls.c

Modified: head/sys/amd64/linux32/linux32_machdep.c
==
--- head/sys/amd64/linux32/linux32_machdep.cMon Jan 30 11:46:06 2017
(r312985)
+++ head/sys/amd64/linux32/linux32_machdep.cMon Jan 30 11:50:54 2017
(r312986)
@@ -645,7 +645,6 @@ linux_sigaltstack(struct thread *td, str
 int
 linux_ftruncate64(struct thread *td, struct linux_ftruncate64_args *args)
 {
-   struct ftruncate_args sa;
 
 #ifdef DEBUG
if (ldebug(ftruncate64))
@@ -653,9 +652,7 @@ linux_ftruncate64(struct thread *td, str
(intmax_t)args->length);
 #endif
 
-   sa.fd = args->fd;
-   sa.length = args->length;
-   return sys_ftruncate(td, );
+   return (kern_ftruncate(td, args->fd, args->length));
 }
 
 int

Modified: head/sys/compat/freebsd32/freebsd32_misc.c
==
--- head/sys/compat/freebsd32/freebsd32_misc.c  Mon Jan 30 11:46:06 2017
(r312985)
+++ head/sys/compat/freebsd32/freebsd32_misc.c  Mon Jan 30 11:50:54 2017
(r312986)
@@ -1517,11 +1517,8 @@ freebsd32_truncate(struct thread *td, st
 int
 freebsd32_ftruncate(struct thread *td, struct freebsd32_ftruncate_args *uap)
 {
-   struct ftruncate_args ap;
 
-   ap.fd = uap->fd;
-   ap.length = PAIR32TO64(off_t,uap->length);
-   return (sys_ftruncate(td, ));
+   return (kern_ftruncate(td, uap->fd, PAIR32TO64(off_t, uap->length)));
 }
 
 #ifdef COMPAT_43
@@ -1623,11 +1620,8 @@ freebsd6_freebsd32_truncate(struct threa
 int
 freebsd6_freebsd32_ftruncate(struct thread *td, struct 
freebsd6_freebsd32_ftruncate_args *uap)
 {
-   struct ftruncate_args ap;
 
-   ap.fd = uap->fd;
-   ap.length = PAIR32TO64(off_t,uap->length);
-   return (sys_ftruncate(td, ));
+   return (kern_ftruncate(td, uap->fd, PAIR32TO64(off_t, uap->length)));
 }
 #endif /* COMPAT_FREEBSD6 */
 

Modified: head/sys/compat/linux/linux_file.c
==
--- head/sys/compat/linux/linux_file.c  Mon Jan 30 11:46:06 2017
(r312985)
+++ head/sys/compat/linux/linux_file.c  Mon Jan 30 11:50:54 2017
(r312986)
@@ -939,15 +939,8 @@ linux_truncate64(struct thread *td, stru
 int
 linux_ftruncate(struct thread *td, struct linux_ftruncate_args *args)
 {
-   struct ftruncate_args /* {
-   int fd;
-   int pad;
-   off_t length;
-   } */ nuap;
-
-   nuap.fd = args->fd;
-   nuap.length = args->length;
-   return (sys_ftruncate(td, ));
+
+   return (kern_ftruncate(td, args->fd, args->length));
 }
 
 int

Modified: head/sys/i386/linux/linux_machdep.c
==
--- head/sys/i386/linux/linux_machdep.c Mon Jan 30 11:46:06 2017
(r312985)
+++ head/sys/i386/linux/linux_machdep.c Mon Jan 30 11:50:54 2017
(r312986)
@@ -611,7 +611,6 @@ linux_sigaltstack(struct thread *td, str
 int
 linux_ftruncate64(struct thread *td, struct linux_ftruncate64_args *args)
 {
-   struct ftruncate_args sa;
 
 #ifdef DEBUG
if (ldebug(ftruncate64))
@@ -619,9 +618,7 @@ linux_ftruncate64(struct thread *td, str
(intmax_t)args->length);
 #endif
 
-   sa.fd = args->fd;
-   sa.length = args->length;
-   return sys_ftruncate(td, );
+   return (kern_ftruncate(td, args->fd, args->length));
 }
 
 int

Modified: head/sys/kern/vfs_syscalls.c
==
--- head/sys/kern/vfs_syscalls.cMon Jan 30 11:46:06 2017
(r312985)
+++ head/sys/kern/vfs_syscalls.cMon Jan 30 11:50:54 2017
(r312986)
@@ -3365,11 +3365,8 @@ freebsd6_truncate(struct thread *td, str
 int
 freebsd6_ftruncate(struct thread *td, struct freebsd6_ftruncate_args *uap)
 {
-   struct ftruncate_args ouap;
 
-   ouap.fd = uap->fd;
-   ouap.length = uap->length;
-   return (sys_ftruncate(td, ));
+   return (kern_ftruncate(td, uap->fd, uap->length));
 }
 #endif
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r312973 - head/sys/powerpc/include

2017-01-30 Thread Konstantin Belousov
> +#ifdef __GNUCLIKE_ASM
> + __asm __volatile (
> + "1:\tlwarx %0, 0, %3\n\t"   /* load old value */
> + "cmplw %4, %0\n\t"  /* compare */
> + "bne 2f\n\t"/* exit if not equal */
> + "stwcx. %5, 0, %3\n\t"  /* attempt to store */
> + "bne- 1b\n\t"   /* spin if failed */
> + "li %0, 1\n\t"  /* success - retval = 1 */
> + "b 3f\n\t"  /* we've succeeded */
> + "2:\n\t"
> + "stwcx. %0, 0, %3\n\t"  /* clear reservation (74xx) */
> + "stwx %0, 0, %7\n\t"
> + "li %0, 0\n\t"  /* failure - retval = 0 */
> + "3:\n\t"
> + : "=" (ret), "=m" (*p), "=m" (*cmpval)
> + : "r" (p), "r" (*cmpval), "r" (newval), "m" (*p), "r"(cmpval)
> + : "cr0", "memory");
> +#endif

It seems that in case of failed conditional store, the code retries.
Note that this is not incorrect but also not a desirable behaviour
with fcmpset:  the function should return error and leave the retry
to the caller.  There is no point in having embedded loop.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r312984 - in head: lib/libsysdecode libexec/rtld-elf

2017-01-30 Thread Peter Jeremy
Author: peterj
Date: Mon Jan 30 08:38:32 2017
New Revision: 312984
URL: https://svnweb.freebsd.org/changeset/base/312984

Log:
  Extend LD_UTRACE by also generating utrace(2) log events for runtime linker
  errors.
  
  Reviewed by:  kib, jhb
  Approved by:  jhb(mentor)
  MFC after:1 week
  Differential Revision: D9347

Modified:
  head/lib/libsysdecode/utrace.c
  head/libexec/rtld-elf/rtld.c
  head/libexec/rtld-elf/rtld_utrace.h

Modified: head/lib/libsysdecode/utrace.c
==
--- head/lib/libsysdecode/utrace.c  Mon Jan 30 08:35:15 2017
(r312983)
+++ head/lib/libsysdecode/utrace.c  Mon Jan 30 08:38:32 2017
(r312984)
@@ -124,6 +124,10 @@ print_utrace_rtld(FILE *fp, void *p)
fprintf(fp, "RTLD: %p = dlsym(%p, %s)", ut->mapbase, ut->handle,
ut->name);
break;
+   case UTRACE_RTLD_ERROR:
+   fprintf(fp, "RTLD: error: %s\n", ut->name);
+   break;
+
default:
return (0);
}

Modified: head/libexec/rtld-elf/rtld.c
==
--- head/libexec/rtld-elf/rtld.cMon Jan 30 08:35:15 2017
(r312983)
+++ head/libexec/rtld-elf/rtld.cMon Jan 30 08:38:32 2017
(r312984)
@@ -764,6 +764,7 @@ _rtld_error(const char *fmt, ...)
 rtld_vsnprintf(buf, sizeof buf, fmt, ap);
 error_message = buf;
 va_end(ap);
+LD_UTRACE(UTRACE_RTLD_ERROR, NULL, NULL, 0, 0, error_message);
 }
 
 /*

Modified: head/libexec/rtld-elf/rtld_utrace.h
==
--- head/libexec/rtld-elf/rtld_utrace.h Mon Jan 30 08:35:15 2017
(r312983)
+++ head/libexec/rtld-elf/rtld_utrace.h Mon Jan 30 08:38:32 2017
(r312984)
@@ -45,6 +45,7 @@
 #defineUTRACE_FINI_CALL10
 #defineUTRACE_DLSYM_START  11
 #defineUTRACE_DLSYM_STOP   12
+#defineUTRACE_RTLD_ERROR   13
 
 #defineRTLD_UTRACE_SIG_SZ  4
 #defineRTLD_UTRACE_SIG "RTLD"
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r312983 - head/sys/dev/mlx5

2017-01-30 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Jan 30 08:35:15 2017
New Revision: 312983
URL: https://svnweb.freebsd.org/changeset/base/312983

Log:
  Make "desc" pointer non-constant inside the mlx5_core_diagnostics_entry
  structure. This fixes compilation with amd64-xtoolchain-gcc.
  
  PR:   216588
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/dev/mlx5/diagnostics.h

Modified: head/sys/dev/mlx5/diagnostics.h
==
--- head/sys/dev/mlx5/diagnostics.h Mon Jan 30 04:51:18 2017
(r312982)
+++ head/sys/dev/mlx5/diagnostics.h Mon Jan 30 08:35:15 2017
(r312983)
@@ -33,7 +33,7 @@
 #defineMLX5_CORE_DIAGNOSTICS_ENTRY(n, s, t) { #s, (t) },
 
 struct mlx5_core_diagnostics_entry {
-   const char *const desc;
+   const char *desc;
u16 counter_id;
 };
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"