freebsd.git
3 hours agoUse `sizeof(cam_errbuf)` instead of `CAM_ERRBUF_SIZE` in snprintf calls master github/master
ngie [Tue, 28 Mar 2017 08:24:16 +0000 (08:24 +0000)]
Use `sizeof(cam_errbuf)` instead of `CAM_ERRBUF_SIZE` in snprintf calls

Reindent snprintf calls' arguments to match style(9) guidelines with
respect to indentation.

MFC after: 3 days
Sponsored by: Dell EMC Isilon

3 hours agoFix some localized style(9) issues and reword CAM_ERRBUF_SIZE description
ngie [Tue, 28 Mar 2017 08:19:51 +0000 (08:19 +0000)]
Fix some localized style(9) issues and reword CAM_ERRBUF_SIZE description

The CAM_ERRBUF_SIZE description rewording fixes a typo by proxy.

MFC after: 3 days
Sponsored by: Dell EMC Isilon

4 hours agoSimply retire the sedification of the boot2.s file. It's been obsolete
imp [Tue, 28 Mar 2017 07:58:27 +0000 (07:58 +0000)]
Simply retire the sedification of the boot2.s file. It's been obsolete
for years.

clang before 96 free after 100 (+4)
gcc before 163 free after 156 (-7)

Suggested by: bde@
Sponsored by: Netflix

5 hours agogpt*boot: Save a bit more memory when LOADER_NO_GELI_SUPPORT is specified
ngie [Tue, 28 Mar 2017 07:10:35 +0000 (07:10 +0000)]
gpt*boot: Save a bit more memory when LOADER_NO_GELI_SUPPORT is specified

Don't compile geliargs into the image and don't pass geliargs to the respective
bootloader code via __exec(..).

This saves a negligible amount of memory/disk space.

X-MFC with: r296963
Obtained from: Isilon OneFS
Sponsored by: Dell EMC Isilon

5 hours agoUnbreak compilation with gcc 4.2.1
ngie [Tue, 28 Mar 2017 07:01:40 +0000 (07:01 +0000)]
Unbreak compilation with gcc 4.2.1

-Wtentative-definition-incomplete-type isn't implemented for 4.2.1

X-MFC with: r304321
Sponsored by: Dell EMC Isilon

5 hours agosys/boot/common: Make geli(4) support optional in MI sources
ngie [Tue, 28 Mar 2017 06:39:54 +0000 (06:39 +0000)]
sys/boot/common: Make geli(4) support optional in MI sources

This saves a negligible amount of memory for non-geli enabled
bootloaders.

MFC after: 1 week
Sponsored by: Dell EMC Isilon

11 hours agoRemove usfs(4) from arm kernel configs
emaste [Tue, 28 Mar 2017 00:57:33 +0000 (00:57 +0000)]
Remove usfs(4) from arm kernel configs

cfumass(4) is not usable if usfs(4) is loaded or compiled into the
kernel. Remove usfs so that the user may kldload the USB mass storage
target they prefer.

PR: 218169
Reviewed by: trasz, hselasky (no objection)
Relnotes: Yes
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D10153

11 hours agoRelease ccb if mode_buffer allocation fails.
bdrewery [Tue, 28 Mar 2017 00:39:41 +0000 (00:39 +0000)]
Release ccb if mode_buffer allocation fails.

MFC after: 2 weeks
Obtained from: OneFS
Sponsored by: Dell EMC Isilon

12 hours agoEnable route and LLE (ndp) caching in TCP/IPv6
karels [Mon, 27 Mar 2017 23:48:36 +0000 (23:48 +0000)]
Enable route and LLE (ndp) caching in TCP/IPv6

tcp_output.c was using a route on the stack for IPv6, which does not
allow route caching or LLE/ndp caching. Switch to using the route
(v6 flavor) in the in_pcb, which was already present, which caches
both L3 and L2 lookups.

Reviewed by: gnn hiren
MFC after: 2 weeks

13 hours agoFix build with path names with 'align' or 'nop' in them.
imp [Mon, 27 Mar 2017 22:53:36 +0000 (22:53 +0000)]
Fix build with path names with 'align' or 'nop' in them.

clang is now inserting .file directives with the entire path in
them. This is fine, except that our sed peephole optimizer removes
them if ${SRCTOP} or ${OBJTOP} contains 'align' or 'nop', leading to
build failures. The sed peephole optimizer removes useful things for
boot2 when used with clang, so restrict its use to gcc. Also, gcc no
longer generates nops to pad things, so there's no point in removing
it. Specialize the optimization to just removing the .align 4 lines to
preclude inadvertant path matching.

Sponsored by: Netflix
Commit brought to you the path: /home/xxx/NCD-3592-logsynopts/FreeBSD

13 hours ago[private] add libevent1 and sqlite3 include files for our private libraries.
adrian [Mon, 27 Mar 2017 22:34:43 +0000 (22:34 +0000)]
[private] add libevent1 and sqlite3 include files for our private libraries.

This, like including ucl private headers, is useful for writing new base
system tools.  Yes, anyone using these libraries shouldn't assume ABI
compatibility.

Reviewed by: bdrewery, bapt
Differential Revision: https://reviews.freebsd.org/D10123

14 hours agocxgbe/iw_cxgbe: Defer the handling of error CQEs and RDMA_TERMINATE to
np [Mon, 27 Mar 2017 22:00:03 +0000 (22:00 +0000)]
cxgbe/iw_cxgbe: Defer the handling of error CQEs and RDMA_TERMINATE to
the thread that deals with socket state changes.  This eliminates
various bad races with the ithread.

Submitted by: KrishnamRaju ErapaRaju @ Chelsio (original version)
MFC after: 3 days
Sponsored by: Chelsio Communications

15 hours agoUpdate pci_vendors to 2017-03-16
bapt [Mon, 27 Mar 2017 21:02:22 +0000 (21:02 +0000)]
Update pci_vendors to 2017-03-16

15 hours agoImport tzdata 2017b
bapt [Mon, 27 Mar 2017 21:00:49 +0000 (21:00 +0000)]
Import tzdata 2017b

MFC after: 2 days

15 hours agoDocument EVENTHANDLER_DEFINE(9).
trasz [Mon, 27 Mar 2017 20:32:12 +0000 (20:32 +0000)]
Document EVENTHANDLER_DEFINE(9).

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

15 hours agoThe cn_consume was removed in r296716.
trasz [Mon, 27 Mar 2017 20:28:56 +0000 (20:28 +0000)]
The cn_consume was removed in r296716.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

15 hours agomakefs: sort roundup with the other off_t members in fsinfo_t
emaste [Mon, 27 Mar 2017 20:24:18 +0000 (20:24 +0000)]
makefs: sort roundup with the other off_t members in fsinfo_t

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

16 hours ago[etherswitch] simplify kernconf for recently added etherswitch drivers
mizhka [Mon, 27 Mar 2017 19:26:09 +0000 (19:26 +0000)]
[etherswitch] simplify kernconf for recently added etherswitch drivers

This simple patch adds e6060sw, adm6996fc and ksz8995ma into conf/files.

Submitted by: Hiroki Mori <yamori813@yahoo.co.jp>
Reviewed by: adrian, mizhka
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D9255

16 hours agopthread_mutex_consistent: sort SEE ALSO by reference name
ngie [Mon, 27 Mar 2017 19:17:30 +0000 (19:17 +0000)]
pthread_mutex_consistent: sort SEE ALSO by reference name

MFC after: 3 days
Reported by: make manlint
Sponsored by: Dell EMC Isilon

17 hours ago[etherswitch] add support for Marvell 88E6065 ethernet switch incl. 802.1q
mizhka [Mon, 27 Mar 2017 19:06:29 +0000 (19:06 +0000)]
[etherswitch] add support for Marvell 88E6065 ethernet switch incl. 802.1q

This patch brings 802.1q support for Marvell 88E606x ethernet switches.
Test is done on 88E6065 chip (Aterm WR1200).

Submitted by: Hiroki Mori <yamori813@yahoo.co.jp>
Reviewed by: mizhka
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D10144

17 hours agoctldadm: sort #includes per style(9)
ngie [Mon, 27 Mar 2017 19:01:34 +0000 (19:01 +0000)]
ctldadm: sort #includes per style(9)

- Only include sys/types.h or sys/param.h, not both.
- Sort alphabetically.

MFC after: 3 days
Sponsored by: Dell EMC Isilon

17 hours agoctld: sort #includes per style(9)
ngie [Mon, 27 Mar 2017 18:59:49 +0000 (18:59 +0000)]
ctld: sort #includes per style(9)

- Only include sys/types.h or sys/param.h, not both.
- Sort alphabetically.

MFC after: 3 days
Sponsored by: Dell EMC Isilon

17 hours agoAllow WARNS to be overridden by the end-user
ngie [Mon, 27 Mar 2017 18:40:20 +0000 (18:40 +0000)]
Allow WARNS to be overridden by the end-user

MFC after: 3 days
Sponsored by: Dell EMC Isilon

17 hours agoTweak the Makefiles a bit to allow using "tcp" in MODULES_OVERRIDE
tuexen [Mon, 27 Mar 2017 18:20:32 +0000 (18:20 +0000)]
Tweak the Makefiles a bit to allow using "tcp" in MODULES_OVERRIDE
to build the tcp modules.

Sponsored by: Netflix, Inc.

18 hours agoMFV: 315989
jpaetzel [Mon, 27 Mar 2017 17:27:46 +0000 (17:27 +0000)]
MFV: 315989

7603 xuio_stat_wbuf_* should be declared (void)

illumos/illumos-gate@99aa8b55058e512798eafbd71f72f916bdc10181
https://github.com/illumos/illumos-gate/commit/99aa8b55058e512798eafbd71f72f916bdc10181

https://www.illumos.org/issues/7603

  The funcs are declared k&r style, where the args are not specified:

  void xuio_stat_wbuf_copied();
  They should be declared to take no arguments:

  void xuio_stat_wbuf_copied(void);
  Need to change both .c and .h.

Author: Prashanth Sreenivasa <pks@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Paul Dagnelie <pcd@delphix.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>
Approved by: Richard Lowe <richlowe@richlowe.net>

18 hours agoTypo.
markj [Mon, 27 Mar 2017 17:24:40 +0000 (17:24 +0000)]
Typo.

MFC after: 1 week

18 hours agoImplement vmalloc_32() in the LinuxKPI.
hselasky [Mon, 27 Mar 2017 17:18:04 +0000 (17:18 +0000)]
Implement vmalloc_32() in the LinuxKPI.

Obtained from: kmacy @
MFC after: 1 week
Sponsored by: Mellanox Technologies

19 hours agoAdd more platforms supporting the direct map feature in the LinuxKPI.
hselasky [Mon, 27 Mar 2017 17:09:11 +0000 (17:09 +0000)]
Add more platforms supporting the direct map feature in the LinuxKPI.

MFC after: 1 week
Sponsored by: Mellanox Technologies

19 hours agoImplement a series of physical page management related functions in
hselasky [Mon, 27 Mar 2017 17:04:11 +0000 (17:04 +0000)]
Implement a series of physical page management related functions in
the LinuxKPI for accessing user-space memory in the kernel.

Add functions to hold and wire physical page(s) based on a given range
of user-space virtual addresses.

Add functions to get and put a reference on, wire, hold, mark
accessed, copy and dirty a physical page.

Add new VM related structures and defines as a preparation step for
advancing the memory map capabilities of the LinuxKPI.

Add function to figure out if a virtual address was allocated using
malloc().

Add function to convert a virtual kernel address into its physical
page pointer.

Obtained from: kmacy @
MFC after: 1 week
Sponsored by: Mellanox Technologies

19 hours agoRefine r301173 a bit.
markj [Mon, 27 Mar 2017 16:25:58 +0000 (16:25 +0000)]
Refine r301173 a bit.

- Don't execute any of g_mirror_shutdown_post_sync() when panicking. We
  cannot safely idle the mirror or stop synchronization in that state, and
  the current attempts to do so complicate debugging of gmirror itself.
- Check for a non-NULL panicstr instead of using SCHEDULER_STOPPED(). The
  latter was added for use in the locking primitives.

Reviewed by: mav, pjd
MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

19 hours agoAdjust the constraint for "src" in atomic_(f)cmpset_8.
markj [Mon, 27 Mar 2017 16:18:19 +0000 (16:18 +0000)]
Adjust the constraint for "src" in atomic_(f)cmpset_8.

"r" is not sufficient to prevent the use of invalid byte-width registers
with at least gcc.

Reported and reviewed by: bde
X-MFC-With: r315718

20 hours agoAdd some useful examples to the sed man page.
brd [Mon, 27 Mar 2017 16:01:44 +0000 (16:01 +0000)]
Add some useful examples to the sed man page.

Reviewed by: wblock, bcr
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D9958

20 hours agolld: hack version and help output for compatibility with libtool
emaste [Mon, 27 Mar 2017 16:01:16 +0000 (16:01 +0000)]
lld: hack version and help output for compatibility with libtool

GNU libtool checks the output from invoking the linker with --version
and --help, in order to determine the linker "flavour" and the command-
ine arguments to use for various link operations (e.g. generating shared
libraries). To detect GNU ld it looks for the strings "GNU" and
"supported targets:.*elf". Since LLD is compatible with GNU ld we
include those same strings to fool libtool.

Quoting from a comment in the change:
    This is somewhat ugly hack, but in reality, we had no choice other
    than doing this. Considering the very long release cycle of Libtool,
    it is not easy to improve it to recognize LLD as a GNU compatible
    linker in a timely manner. Even if we can make it, there are still a
    lot of "configure" scripts out there that are generated by old
    version of Libtool. We cannot convince every software developer to
    migrate to the latest version and re-generate scripts. So we have
    this hack.

Upstream LLVM revisions r298532, r298568, r298591

Obtained from: LLVM
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

20 hours agoCheck to see if the kernel has cd9660 before running tests that require it
brd [Mon, 27 Mar 2017 15:20:31 +0000 (15:20 +0000)]
Check to see if the kernel has cd9660 before running tests that require it

Approved by: ngie
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D10096

21 hours agoAccess *correct* ifp data structure when debug sysctl is invoked.
sbruno [Mon, 27 Mar 2017 15:08:02 +0000 (15:08 +0000)]
Access *correct* ifp data structure when debug sysctl is invoked.

Submitted by: Kevin Bowling <kevin.bowling@kev009.com>
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D10126

21 hours agoChange the default rss_type to M_HASHTYPE_OPAQUE_HASH.
sbruno [Mon, 27 Mar 2017 14:55:23 +0000 (14:55 +0000)]
Change the default rss_type to M_HASHTYPE_OPAQUE_HASH.

Submitted by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D9905

21 hours agomacOS 10.12 release date added.
pluknet [Mon, 27 Mar 2017 14:37:35 +0000 (14:37 +0000)]
macOS 10.12 release date added.

21 hours agoFix pfil_add_hook() and pfil_remove_hook() type.
pluknet [Mon, 27 Mar 2017 14:32:34 +0000 (14:32 +0000)]
Fix pfil_add_hook() and pfil_remove_hook() type.

22 hours agoSame as r316022 (Fix hexadecimal escape codes in jail.conf(5)),
jamie [Mon, 27 Mar 2017 13:37:40 +0000 (13:37 +0000)]
Same as r316022 (Fix hexadecimal escape codes in jail.conf(5)),
but do it right this time.

Reported by: Kyle Evans <Kyle Evans>
MFC after: 3 days

22 hours agoFix hexadecimal escape codes in jail.conf(5).
jamie [Mon, 27 Mar 2017 13:27:39 +0000 (13:27 +0000)]
Fix hexadecimal escape codes in jail.conf(5).

PR: 218154
Submitted by: Masahiro Konishi <mkonishi@sea.plala.or.jp>
MFC after: 3 days

23 hours agorevert r315959 because it causes build problems
avg [Mon, 27 Mar 2017 12:34:29 +0000 (12:34 +0000)]
revert r315959 because it causes build problems

The change introduced a dependency between genassym.c and header files
generated from .m files, but that dependency is not specified in the
make files.

Also, the change could be not as useful as I thought it was.

Reported by: dchagin, Manfred Antar <null@pozo.com>, and many others

25 hours agoupdate comment describing topo_probe_amd()
avg [Mon, 27 Mar 2017 11:04:57 +0000 (11:04 +0000)]
update comment describing topo_probe_amd()

MFC after: 2 weeks
MFC with: r316017

25 hours agoOops, my fix for bright colors broke bright black some more (in cases
bde [Mon, 27 Mar 2017 10:48:28 +0000 (10:48 +0000)]
Oops, my fix for bright colors broke bright black some more (in cases
that used to work via the bold hack).

Fix the table entry for bright black.  Fix spelling of plain black in
nearby table entries (use the macro for black everywhere everywhere).
Fix the currently-unused non-bright color table to not have bright
colors in entries 9-15.

Improve nearby comments.  Start converting to the xterm terminology
and default rendering of "bright" instead of "light" for bright
colors.

Syscons wasn't affected by the bug since I optimized it a little by
converting colors 0-15 directly.  This also fixes the layering of
the conversion for these colors.

Apply the same optimization to vt (actually the layer above it).  This
also moves the conversion 1 closer to the correct layer for colors
0-15.

The optimization of just avoiding 2 calls to a trivial function is worth
about 10% for simple output to the virtual buffer with occasional
rendering.  The optimization is so large because the 2 calls are done
on every character, so although there are too many other calls and
other instructions per character, there are only about 10 times as
many.  Old versions of syscons were about 10 times faster for simple
output, by using a fast path with about 12 instructions per character.
Rendering to even slow hardware takes relatively little time provided
it is rarely actually done.

25 hours agoIntroduce an audit event identifier -> audit event name mapping
rwatson [Mon, 27 Mar 2017 10:38:53 +0000 (10:38 +0000)]
Introduce an audit event identifier -> audit event name mapping
database in the kernel audit implementation, similar the exist
class mapping database.  This will be used by the DTrace audit
provider to map audit event identifiers originating in the
system-call table back into strings for the purposes of setting
probe names.  The database is initialised and maintained by
auditd(8), which reads values in from the audit_events
configuration file, and then manages them using the A_GETEVENT
and A_SETEVENT auditon(2) operations.

Obtained from: TrustedBSD Project
Sponsored by: DARPA, AFRL
MFC after: 3 weeks

26 hours agoadd SMT detection for newer AMD processors
avg [Mon, 27 Mar 2017 09:45:27 +0000 (09:45 +0000)]
add SMT detection for newer AMD processors

The change seems to be more in the nomenclature than in the way the
topology is advertised by the hardware.

Tested by: truckman (earlier version of the change)
MFC after: 2 weeks

27 hours agoExtend comment describing path canonicalisation in audit.
rwatson [Mon, 27 Mar 2017 08:29:17 +0000 (08:29 +0000)]
Extend comment describing path canonicalisation in audit.

Sponsored by: DARPA, AFRL
Obtained from: TrustedBSD Project
MFC after: 3 days

27 hours agoake pfil's locking macros private.
ae [Mon, 27 Mar 2017 08:18:13 +0000 (08:18 +0000)]
ake pfil's locking macros private.

Obtained from: Yandex LLC
MFC after: 1 week

28 hours agoDeclare module version.
ae [Mon, 27 Mar 2017 07:56:41 +0000 (07:56 +0000)]
Declare module version.

MFC after: 1 week

29 hours agoTimeout DMAR commands.
kib [Mon, 27 Mar 2017 07:06:45 +0000 (07:06 +0000)]
Timeout DMAR commands.

Implement timeouts for register-based DMAR commands.  Tunable/sysctl
hw.dmar.timeout specifies the timeout in nanoseconds, set it to zero
to allow infinite wait.  Default is 1ms.

Runtime modification of the sysctl is not safe, it is allowed for
debugging.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

29 hours agoiwm: fix build without IWM_DEBUG.
avos [Mon, 27 Mar 2017 07:02:27 +0000 (07:02 +0000)]
iwm: fix build without IWM_DEBUG.

Reported by: O. Hartmann <ohartmann@walstatt.org>
Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D10146

29 hours agoFix TUNABLE_UINT64() on 32bit architectures.
kib [Mon, 27 Mar 2017 06:37:03 +0000 (06:37 +0000)]
Fix TUNABLE_UINT64() on 32bit architectures.

The macro is not used in the tree.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

32 hours agocxgbe/iw_cxgbe: Remove unused code.
np [Mon, 27 Mar 2017 03:11:51 +0000 (03:11 +0000)]
cxgbe/iw_cxgbe: Remove unused code.

MFC after: 3 days

38 hours agoMerge OpenBSM 1.2-alpha5 from vendor branch to FreeBSD -CURRENT:
rwatson [Sun, 26 Mar 2017 21:14:49 +0000 (21:14 +0000)]
Merge OpenBSM 1.2-alpha5 from vendor branch to FreeBSD -CURRENT:

- Add a new "qsize" parameter in audit_control and the getacqsize(3) API to
  query it, allowing to set the kernel's maximum audit queue length.
- Add support to push a mapping between audit event names and event numbers
  into the kernel (where supported) using new A_GETEVENT and A_SETEVENT
  auditon(2) operations.
- Add audit event identifiers for a number of new (and not-so-new) FreeBSD
  system calls including those for asynchronous I/O, thread management, SCTP,
  jails, multi-FIB support, and misc. POSIX interfaces such as
  posix_fallocate(2) and posix_fadvise(2).
- On operating systems supporting Capsicum, auditreduce(1) and praudit(1) now
  run sandboxed.
- Empty "flags" and "naflags" fields are now permitted in audit_control(5).

Many thanks to Christian Brueffer for producing the OpenBSM release and
importing/tagging it in the vendor branch.  This release will allow improved
auditing of a range of new FreeBSD functionality, as well as non-traditional
events (e.g., fine-grained I/O auditing) not required by the Orange Book or
Common Criteria.

Obtained from: TrustedBSD Project
Sponsored by: DARPA, AFRL
MFC after: 3 weeks

39 hours agoRevert r314907, and pull in r298713 from upstream compiler-rt trunk (by
dim [Sun, 26 Mar 2017 20:36:35 +0000 (20:36 +0000)]
Revert r314907, and pull in r298713 from upstream compiler-rt trunk (by
Weiming Zhao):

  builtins: Select correct code fragments when compiling for Thumb1/Thum2/ARM ISA.

  Summary:
  Value of __ARM_ARCH_ISA_THUMB isn't based on the actual compilation
  mode (-mthumb, -marm), it reflect's capability of given CPU.

  Due to this:
   - use  __tbumb__ and __thumb2__ insteand of __ARM_ARCH_ISA_THUMB
   - use '.thumb' directive consistently  in all affected files
   - decorate all thumb functions using
     DEFINE_COMPILERRT_THUMB_FUNCTION()

  ---------
  Note: This patch doesn't fix broken Thumb1 variant of __udivsi3 !

  Reviewers: weimingz, rengolin, compnerd

  Subscribers: aemerson, dim

  Differential Revision: https://reviews.llvm.org/D30938

Discussed with: mmel
X-MFC-With: r314564

39 hours agoSlightly improve consistency of "fooint" vs "foo_int" in DPCPU(9) examples.
rwatson [Sun, 26 Mar 2017 20:24:27 +0000 (20:24 +0000)]
Slightly improve consistency of "fooint" vs "foo_int" in DPCPU(9) examples.

MFC after: 3 days

39 hours agoAdd a man page for the kernel's dynamic per-CPU memory allocator.
rwatson [Sun, 26 Mar 2017 20:15:08 +0000 (20:15 +0000)]
Add a man page for the kernel's dynamic per-CPU memory allocator.

MFC after: 3 days

40 hours agodiff: Show nanoseconds in -u/-c header line.
jilles [Sun, 26 Mar 2017 19:47:43 +0000 (19:47 +0000)]
diff: Show nanoseconds in -u/-c header line.

Show nanoseconds in the -u/-c header line.

The present portability conditionals cannot handle the POSIX standard
st_mtim, so remove them and unconditionally use st_mtim.

PR: 218018
Reported by: jbeich
Reviewed by: bapt
Differential Revision: https://reviews.freebsd.org/D10145

41 hours agoFix printing of negative offsets (typically from frame pointers) again.
bde [Sun, 26 Mar 2017 18:46:35 +0000 (18:46 +0000)]
Fix printing of negative offsets (typically from frame pointers) again.
I fixed this in 1997, but the fix was over-engineered and fragile and
was broken in 2003 if not before.  i386 parameters were copied to 8
other arches verbatim, mostly after they stopped working on i386, and
mostly without the large comment saying how the values were chosen on
i386.  powerpc has a non-verbatim copy which just changes the uncritical
parameter and seems to add a sign extension bug to it.

Just treat negative offsets as offsets if they are no more negative than
-db_offset_max (default -64K), and remove all the broken parameters.

-64K is not very negative, but it is enough for frame and stack pointer
offsets since kernel stacks are small.

The over-engineering was mainly to go more negative than -64K for the
negative offset format, without affecting printing for more than a
single address.

Addresses in the top 64K of a (full 32-bit or 64-bit) address space
are now printed less well, but there aren't many interesting ones.
For arches that have many interesting ones very near the top (e.g.,
68k has interrupt vectors there), there would be no good limit for
the negative offset format and -64K is a good as anything.

42 hours agoiwn: fix debug message
avos [Sun, 26 Mar 2017 18:06:51 +0000 (18:06 +0000)]
iwn: fix debug message

42 hours agoiwn: fix error handling for one well-known corner case.
avos [Sun, 26 Mar 2017 17:59:51 +0000 (17:59 +0000)]
iwn: fix error handling for one well-known corner case.

42 hours agoProvide proper contemporary function prototypes for many of the functions
rwatson [Sun, 26 Mar 2017 17:22:44 +0000 (17:22 +0000)]
Provide proper contemporary function prototypes for many of the functions
implemented in top(1), rather than relying on K&R prototypes, which can
cause problems on targets where there are multiple incompatible calling
conventions and the compiler requires argument information to select the
correct one.

(There's a bit more to do here, since it looks like top(1) also sometimes
provides prototypes for various curses functions rather than relying on
the header file...)

Sponsored by: DARPA, AFRL
MFC after: 1 week

43 hours agoiwn: drop unneeded bus_dmamap_sync() calls.
avos [Sun, 26 Mar 2017 16:46:39 +0000 (16:46 +0000)]
iwn: drop unneeded bus_dmamap_sync() calls.

1) They are using wrong tag (Tx) + map (Rx) combination.
2) Rx descriptor is already synchronized in iwn_notif_intr()
3) It's not needed for transmitted data since device does not change
mbuf contents.

Tested with Intel 6205 (amd64), STA mode.

45 hours agoEmply contemporary function prototypes in bootpd, rather than relying on
rwatson [Sun, 26 Mar 2017 14:37:12 +0000 (14:37 +0000)]
Emply contemporary function prototypes in bootpd, rather than relying on
locally defined K&R prototypes in .c files; use appropriate casts for
pointer types now that types for arguments are available at compile time.
This ensures that compilers with multiple incompatible calling conventions
can select the correct calling convention for external functions.

Sponsored by: DARPA, AFRL
MFC after: 1 week

45 hours agoFix 3 entries in mode tables related to mono and 90-column text modes.
bde [Sun, 26 Mar 2017 14:31:29 +0000 (14:31 +0000)]
Fix 3 entries in mode tables related to mono and 90-column text modes.
Newer VGAs don't support any mono modes, but bugs in the tables created
2 virtual mono modes (#45 90x43 and #112 80x43) that behaved more
strangely than crashing.  90-column modes are tweaked 80-column ones
and also fail to work on newer VGAs.  #45 did crash (hang) on some
hardware.

46 hours agodiff: Fix mtime of file1 in -u/-c header line.
jilles [Sun, 26 Mar 2017 14:09:25 +0000 (14:09 +0000)]
diff: Fix mtime of file1 in -u/-c header line.

PR: 218018
Reviewed by: bapt
Differential Revision: https://reviews.freebsd.org/D10140

47 hours agoRestore switching to a separate kernel terminal "input" state and extend
bde [Sun, 26 Mar 2017 13:03:16 +0000 (13:03 +0000)]
Restore switching to a separate kernel terminal "input" state and extend
it to a separate state for each CPU.

Terminal "input" is user or kernel output.  Its state includes the current
parser state for escape sequences and multi-byte characters, and some
results of previous parsing (mainly attributes), and in teken the cursor
position, but not completed output.  This state must be switched for kernel
output since the kernel can preempt anything, including itself, and this
must not affect the preempted state more than necessary.  Since vty0 is
shared, it is necessary to affect the frame buffer and cursor position and
history, but escape sequences must not be affected and attributes for
further output must not be affected.

This used to work.  The syscons terminal state contained mainly the parser
state for escape sequences and attributes, but not the cursor position,
and was switched.  This was first broken by SMP and/or preemptive kernels.
Then there should really be a separate state for each thread, and one more
for ddb, or locking to prevent preemption.  Serialization of printf() helps.
But it is arcane that full syscons escape sequences mostly work in kernel
printf(), and I have never seen them used except by me to test this fix.
They worked perfectly except for the races, since "input" from the kernel
was not special in any way.

This was broken to use teken.  The general switch was removed, and the
kernel normal attribute was switched specially.  The kernel reverse
attribute (config option SC_CONS_REVERSE_ATTR) became unused, and is
still unusable because teken doesn't support default reverse attributes
(it used to only be used via the ANSI escape sequence to set reverse
video).

The only new difficulty for using teken seems to be that the cursor
position is in the "input" state, so it must be updated in the active
input state for each half of the switch.  Do this to complete the
restoration.

The per-CPU state is mainly to make per-CPU coloring work cleanly, at
a cost of some space.  Each CPU gets its own full set of attribute
(not just the current attribute) maintained in the usual way.  This
also reduces races from unserialized printf()s.  However, this gives
races for serialized printf()s that otherwise have none.  Nothing
prevents the CPU doing the a printf() changing in the middle of an
escape sequence.

2 days agoUse inline asm instead of unportable intrinsics for the SSE4 crc32
bde [Sun, 26 Mar 2017 10:31:48 +0000 (10:31 +0000)]
Use inline asm instead of unportable intrinsics for the SSE4 crc32
optimization.

This fixes building with gcc-4.2.1 (it doesn't support SSE4).
gas-2.17.50 [FreeBSD] supports SSE4 instructions, so this doesn't
need using .byte directives.

This fixes depending on host user headers in the kernel.

Fix user includes (don't depend on namespace pollution in <nmmintrin.h>
that is not included now).

The instrinsics had no advantages except to sometimes avoid compiler
pessimixations.  clang understands them a bit better than inline asm,
and generates better looking code which also runs better for cem, but
for me it just at the same speed or slower by doing excessive
unrollowing in all the wrong places.  gcc-4.2.1 also doesn't understand
what it is doing with unrolling, but with -O3 somehow it does more
unrolling that helps.

Reduce 1 of the the compiler pessimizations (copying a variable which
already satisfies an "rm" constraint in a good way by being in memory
and not used again, to different memory and accessing it there.  Force
copying it to a register instead).

Try to optimize the inner loops significantly, so as to run at full
speed on smaller inputs.  The algorithm is already very MD, and was
tuned for the throughput of 3 crc32 instructions per cycle found on
at least Sandybridge through Haswell.  Now it is even more tuned for
this, so depends more on the compiler not rearranging or unrolling
things too much.  The main inner loop for should have no difficulty
runing at full speed on these CPUs unless the compiler unrolls it too
much.  However, the main inner loop wasn't even used for buffers smaller
than 24K.  Now it is used for buffers larger than 384 bytes.  Now it
is not so long, and the main outer loop is used more.  The new
optimization is to try to arrange that the outer loop runs in parallel
with the next inner loop except for the final iteration; then reduce
the loop sizes significantly to take advantage of this.

Approved by: cem
Not tested in production by: bde

2 days agoiwn: deduplicate code in iwn_tx_data() and iwn_tx_data_raw().
avos [Sun, 26 Mar 2017 09:41:08 +0000 (09:41 +0000)]
iwn: deduplicate code in iwn_tx_data() and iwn_tx_data_raw().

Some code was additionally moved for (future) lock splitting.

Tested with Intel 6205, STA mode.

Differential Revision: https://reviews.freebsd.org/D10106

2 days agoiwn: omit unneeded bus_dmamap_sync() calls when compiled without
avos [Sun, 26 Mar 2017 09:10:01 +0000 (09:10 +0000)]
iwn: omit unneeded bus_dmamap_sync() calls when compiled without
'options IWN_DEBUG'

2 days agoPreserve VFP state across signal delivery.
mmel [Sun, 26 Mar 2017 08:36:56 +0000 (08:36 +0000)]
Preserve VFP state across signal delivery.

We don't have enouch space to store full VFP context within mcontext
stucture. Due to this:
 - follow i386/amd64 way and store VFP state outside of the mcontext_t
   but point to it. Use the size of VFP state structure as an 'magic'
   indicator of the saved VFP state presence.
 - teach set_mcontext() about this external storage.
 - for signal delivery, store VFP state to expanded 'struct sigframe'.

Submited by: Andrew Gierth (initial version)
PR: 217611
MFC after: 2 weeks

2 days agoSave VFP state on fork().
mmel [Sun, 26 Mar 2017 08:36:20 +0000 (08:36 +0000)]
Save VFP state on fork().
Update the copy of VFP state in PCB before it is cloned for new process.

MFC after: 2 weeks

2 days agoProvide less laborius way to enable busdma DMAR to only short list of devices.
kib [Sun, 26 Mar 2017 00:40:35 +0000 (00:40 +0000)]
Provide less laborius way to enable busdma DMAR to only short list of devices.

Kernel environment variable hw.busdma.default can take values 'bounce'
and 'dmar' and selects corresponding busdma backend as default.
Per-device environment variable hw.busdma.pci<domain>.<bus>.<slot>.<func>
takes the same values and overrides hw.busdma.default for the given device.

Note that even with hw.busdma.default=bounce, DMA translation engines
are still started if DMARs are enabled, to disable them use
hw.dmar.dma tunable, as before.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 days ago[rpi] Use compatibility string from upstream DTB for I2C controller
gonzo [Sat, 25 Mar 2017 22:58:37 +0000 (22:58 +0000)]
[rpi] Use compatibility string from upstream DTB for I2C controller

FreeBSD uses upstream DTB for RPi3 build and compatibility string for
i2c device is different there. Add this new string to compatibility data.

Reported by: Karl Denninger
MFC after: 3 days

2 days agoiwn: fix return code conflict in iwn_init_locked()
avos [Sat, 25 Mar 2017 22:07:21 +0000 (22:07 +0000)]
iwn: fix return code conflict in iwn_init_locked()

Do not try to use errno(2) codes here; instead, just return unique
value (1) when radio is disabled via hardware switch and another
one (-1) for any other error in initialization path.

Tested with Intel 6205, STA mode.

2 days agoftp.microsoft.com is dead and the document was not archived, point to the full
sevan [Sat, 25 Mar 2017 21:33:48 +0000 (21:33 +0000)]
ftp.microsoft.com is dead and the document was not archived, point to the full
protocol spec document instead.
Fix spelling mistake flagged by igor.
Rephrase bad sentence flagged by igor.

Approved by: bcr (mentor)
MFC after: 5 days
Differential Revision:  https://reviews.freebsd.org/D10111

2 days agoAdd ids for ALC233 found on Intel Skull Mountain NUC.
sbruno [Sat, 25 Mar 2017 19:12:09 +0000 (19:12 +0000)]
Add ids for ALC233 found on Intel Skull Mountain NUC.

2 days agodtrace sched:::preempt should fire only when there is preemption
avg [Sat, 25 Mar 2017 19:08:51 +0000 (19:08 +0000)]
dtrace sched:::preempt should fire only when there is preemption

The probe fire on any thread switch before.

Reviewed by: markj
MFC after: 1 week
Sponsored by: Panzura

2 days agospecific end of interrupt implementation for AMD Local APIC
avg [Sat, 25 Mar 2017 18:45:09 +0000 (18:45 +0000)]
specific end of interrupt implementation for AMD Local APIC

The change is more intrusive than I would like because the feature
requires that a vector number is written to a special register.
Thus, now the vector number has to be provided to lapic_eoi().
It was readily available in the IO-APIC and MSI cases, but the IPI
handlers required more work.
Also, we now store the VMM IPI number in a global variable, so that it
is available to the justreturn handler for the same reason.

Reviewed by: kib
MFC after: 6 weeks
Differential Revision: https://reviews.freebsd.org/D9880

2 days agoiwn: do not try to update node configuration when the node does not exist.
avos [Sat, 25 Mar 2017 15:57:47 +0000 (15:57 +0000)]
iwn: do not try to update node configuration when the node does not exist.

Firmware will just respond with status '0x8' (node does not exist) or
will hang -> cause 'device timeout's (sometimes).

2 days agoImplement Linux mincore() system call.
dchagin [Sat, 25 Mar 2017 15:47:29 +0000 (15:47 +0000)]
Implement Linux mincore() system call.
This is necessary for the upcoming drm-next.

Suggested by: hselasky@
MFC after: 1 month

2 days agoFix reference count leak with L2 caching.
karels [Sat, 25 Mar 2017 15:06:28 +0000 (15:06 +0000)]
Fix reference count leak with L2 caching.

ip_forward, TCP/IPv6, and probably SCTP leaked references to L2 cache
entry because they used their own routes on the stack, not in_pcb routes.
The original model for route caching was callers that provided a route
structure to ip{,6}input() would keep the route, and this model was used
for L2 caching as well. Instead, change L2 caching to be done by default
only when using a route structure in the in_pcb; the pcb deallocation
code frees L2 as well as L3 cacches. A separate change will add route
caching to TCP/IPv6.

Another suggestion was to have the transport protocols indicate willingness
to use L2 caching, but this approach keeps the changes in the network
level

Reviewed by:    ae gnn
MFC after:      2 weeks
Differential Revision:  https://reviews.freebsd.org/D10059
and those below, will be ignored--
> Description of fields to fill in above:                     76 columns --|
> PR:                       If and which Problem Report is related.
> Submitted by:             If someone else sent in the change.
> Reported by:              If someone else reported the issue.
> Reviewed by:              If someone else reviewed your modification.
> Approved by:              If you needed approval for this commit.
> Obtained from:            If the change is from a third party.
> MFC after:                N [day[s]|week[s]|month[s]].  Request a reminder email.
> MFH:                      Ports tree branch name.  Request approval for merge.
> Relnotes:                 Set to 'yes' for mention in release notes.
> Security:                 Vulnerability reference (one per line) or description.
> Sponsored by:             If the change was sponsored by an organization.
> Differential Revision:    https://reviews.freebsd.org/D### (*full* phabric URL needed).
> Empty fields above will be automatically removed.

M    netinet/in_pcb.c
M    netinet/ip_output.c
M    netinet6/ip6_output.c

2 days agoMFV r315950:
dchagin [Sat, 25 Mar 2017 14:14:11 +0000 (14:14 +0000)]
MFV r315950:

Update vendor/tcsh to git b605cb561d

Vendor changes:

1. PR/471: Daiki Ueno: Delay interpreting arginp until we've processed
our startup files (which can change the NLS environment).

2. Fix type of read in prompt confirmation (eg. rmstar) (David Kaspar).

3. Fix out of bounds read (Brooks Davis)
(reproduce by starting tcsh and hitting tab at the prompt).

4. Don't play pointer tricks that are undefined in modern c
(Brooks Davis).

2 days agoUpdate to tcsh 6.20.00
dchagin [Sat, 25 Mar 2017 13:32:28 +0000 (13:32 +0000)]
Update to tcsh 6.20.00

2 days agoImport libcxxrt master 8a853717e61d5d55cbdf74d9d0a7545da5d5ff92.
dim [Sat, 25 Mar 2017 13:17:48 +0000 (13:17 +0000)]
Import libcxxrt master 8a853717e61d5d55cbdf74d9d0a7545da5d5ff92.

Interesting fixes which were not already merged:
0c7c611 Merge C++ demangler bug fixes from ELF Tool Chain (#40)
2b208d9 __cxa_demangle_gnu3: demangle 'z' as '...', not 'ellipsis' (#41)

MFC after: 3 days

2 days agoiwn: add few missing notification types into iwn_intr_str()
avos [Sat, 25 Mar 2017 13:15:43 +0000 (13:15 +0000)]
iwn: add few missing notification types into iwn_intr_str()

3 days agoAdd a regression test for r31512 fix
bapt [Sat, 25 Mar 2017 10:47:58 +0000 (10:47 +0000)]
Add a regression test for r31512 fix

PR: 217934
MFC after: 1 week

3 days agoAvoid leaking allocated but unused context after creation race.
kib [Sat, 25 Mar 2017 10:47:35 +0000 (10:47 +0000)]
Avoid leaking allocated but unused context after creation race.

As noted in the comment, nothing special needs to be done to destroy
the unneeded context after the allocation race, but the context memory
itself still should to be freed.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

3 days agoDo not create RMRR entries for identity-mapped domains.
kib [Sat, 25 Mar 2017 10:45:16 +0000 (10:45 +0000)]
Do not create RMRR entries for identity-mapped domains.

It does not make sense since identity mapping already provides the
required mapping for RMRR ranges.  More, since identity page tables do
not reflect content of map entries for id domains, creating RMRR
entries makes domain data inconsistent.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

3 days agoSlight cleanup of the comment.
kib [Sat, 25 Mar 2017 10:42:10 +0000 (10:42 +0000)]
Slight cleanup of the comment.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

3 days agoFix and add comments to match selected frequency sample.
ganbold [Sat, 25 Mar 2017 10:39:24 +0000 (10:39 +0000)]
Fix and add comments to match selected frequency sample.
Add debug printfs when bootverbose is used.
No functional changes.

3 days ago[iwm] Add the BSS's basic rates to iwm's LQ command, not all the rates.
adrian [Sat, 25 Mar 2017 02:55:13 +0000 (02:55 +0000)]
[iwm] Add the BSS's basic rates to iwm's LQ command, not all the rates.

Makes the firmware use appropriate Tx rates for ACKs.

Obtained from: dragonflybsd.git ab1d3efc208e797c1e09759cd506c95c0aeaa06e

3 days ago[iwm] Enable Energy Based Scan (EBS).
adrian [Sat, 25 Mar 2017 02:49:20 +0000 (02:49 +0000)]
[iwm] Enable Energy Based Scan (EBS).

This can significantly reduce scan duration thus saving time and power.
EBS failure reported by FW disables EBS for current connection. It is
re-enabled upon new connection attempt on any WLAN interface.

Obtained from: dragonflybsd.git 89f579e9823a5c446ca172cf82bbc210d6a054a4

3 days ago[iwm] GC unused code from if_iwm_scan.c, copyied from iwn or iwlwifi/dvm.
adrian [Sat, 25 Mar 2017 02:44:25 +0000 (02:44 +0000)]
[iwm] GC unused code from if_iwm_scan.c, copyied from iwn or iwlwifi/dvm.

Obtained from: dragonflybsd.git 10881df269b93c26e5ee6af629c36db5672e6e52

3 days ago[iwm] Tiny cleanup in iwm_rx_addbuf().
adrian [Sat, 25 Mar 2017 02:42:52 +0000 (02:42 +0000)]
[iwm]  Tiny cleanup in iwm_rx_addbuf().

Obtained from: dragonflybsd.git 3370bc5504ebb3c1b9bb960a185cd0c8052a2845

3 days agocxgbe/iw_cxgbe: allocations that use GFP_KERNEL (which is M_WAITOK on
np [Sat, 25 Mar 2017 02:28:21 +0000 (02:28 +0000)]
cxgbe/iw_cxgbe: allocations that use GFP_KERNEL (which is M_WAITOK on
FreeBSD) cannot fail.

MFC after: 3 days

3 days agocxgbe/iw_cxgbe: alloc_ep expects a gfp_t, and it's always ok to sleep during
np [Sat, 25 Mar 2017 01:45:04 +0000 (01:45 +0000)]
cxgbe/iw_cxgbe: alloc_ep expects a gfp_t, and it's always ok to sleep during
alloc_ep.

3 days agocxgbe/iw_cxgbe: c4iw_connect should always returns a -ve errno on failure.
np [Sat, 25 Mar 2017 01:38:17 +0000 (01:38 +0000)]
cxgbe/iw_cxgbe: c4iw_connect should always returns a -ve errno on failure.

MFC after: 3 days

3 days agoAdd 'device iic' to bring in userland I2C driver.
imp [Fri, 24 Mar 2017 22:33:03 +0000 (22:33 +0000)]
Add 'device iic' to bring in userland I2C driver.

Submitted by: karl@

3 days agonet80211: fix possible panic when wlan(4) interface is destroyed.
avos [Fri, 24 Mar 2017 22:29:51 +0000 (22:29 +0000)]
net80211: fix possible panic when wlan(4) interface is destroyed.

If this is the last running vap wait until device will be powered off
(fixes panic when 'ifconfig wlan0 destroy' is executed for running iwn(4)
interface).

Tested with:
 - Intel 6205, STA mode.
 - RTL8188EU, STA / IBSS modes.
 - RTL8821AU, STA / HOSTAP modes.

3 days agoRemove buggy adjustment of page tables in db_write_bytes().
bde [Fri, 24 Mar 2017 17:34:55 +0000 (17:34 +0000)]
Remove buggy adjustment of page tables in db_write_bytes().

Long ago, perhaps only on i386, kernel text was mapped read-only and
it was necessary to change the mapping to read-write to set breakpoints
in kernel text.  Other writes by ddb to kernel text were also allowed.
This write protection is harder to implement with 4MB pages, and was
lost even for 4K pages when 4MB pages were implemented.  So changing
the mapping became useless.  It was actually worse than useless since
it followed followed various null and otherwise garbage pointers to
not change random memory instead of the mapping.  (On i386s, the
pointers became good in pmap_bootstrap(), and on amd64 the pointers
became bad in pmap_bootstrap() if not before.)

Another bug broke detection of following of null pointers on i386,
except early in boot where not detecting this was a feature.  When
I fixed the bug, I accidentally broke the feature and soon got traps
in db_write_bytes().  Setting breakpoints early in ddb was broken.

kib pointed out that a clean way to do the adjustment would be to use
a special [sub]map giving a small window on the bytes to be written.

The trap handler didn't know how to fix up errors for pagefaults
accessing the map itself.  Such errors rarely need fixups, since most
traps for the map are for the first access which is a read.

Reviewed by: kib