]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
7 years agohyperv/hn: Factor out hn_nvs_send/hn_nvs_send_sglist
sephe [Tue, 16 Aug 2016 07:26:53 +0000 (07:26 +0000)]
hyperv/hn: Factor out hn_nvs_send/hn_nvs_send_sglist

Avoid unnecessary message type setting and centralize the send context
to transaction id cast.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7500

7 years agotcp/lro: Make # of LRO entries tunable
sephe [Tue, 16 Aug 2016 06:40:27 +0000 (06:40 +0000)]
tcp/lro: Make # of LRO entries tunable

Reviewed by: hps, gallatin
Obtained from: rrs, gallatin
MFC after: 2 weeks
Sponsored by: Netflix (rrs, gallatin), Microsoft (sephe)
Differential Revision: https://reviews.freebsd.org/D7499

7 years agoRegenerate DTrace tests.
markj [Tue, 16 Aug 2016 02:34:25 +0000 (02:34 +0000)]
Regenerate DTrace tests.

7 years agoMFV r304057:
markj [Tue, 16 Aug 2016 02:30:19 +0000 (02:30 +0000)]
MFV r304057:
7085 add support for "if" and "else" statements in dtrace

illumos/illumos-gate@c3bd3abd8856e8e75d820f65c58031cd6cbac818

Add syntactic sugar to dtrace: "if" and "else" statements. The sugar is
baked down to standard dtrace features by adding additional clauses with
the appropriate predicates.

Reviewed by: Adam Leventhal <ahl@delphix.com>
Reviewed by: Sebastien Roy <sebastien.roy@delphix.com>
Reviewed by: Paul Dagnelie <pcd@delphix.com>
Reviewed by: Bryan Cantrill <bryan@joyent.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
Author: Matthew Ahrens <mahrens@delphix.com>

MFC after: 2 weeks
Relnotes: yes

7 years agoMFV r301526:
markj [Tue, 16 Aug 2016 02:25:19 +0000 (02:25 +0000)]
MFV r301526:
7035 string-related subroutines should validate input earlier

Reviewed by: Alex Wilson <alex.wilson@joyent.com>
Reviewed by: Bryan Cantrill <bryan@joyent.com>
Approved by: Matthew Ahrens <mahrens@delphix.com>
Author: Patrick Mooney <pmooney@pfmooney.com>

illumos/illumos-gate@771e39c3b1d6e2e0ba230442d782d83c60098296

MFC after: 2 weeks

7 years agoMFV r301525:
markj [Tue, 16 Aug 2016 02:20:02 +0000 (02:20 +0000)]
MFV r301525:
7033 ustack helper should fault on bad return values

Reviewed by: Patrick Mooney <patrick.mooney@joyent.com>
Reviewed by: Bryan Cantrill <bryan@joyent.com>
Approved by: Matthew Ahrens <mahrens@delphix.com>
Author: Alex Wilson <alex.wilson@joyent.com>

illumos/illumos-gate@a2f72b65ebc430aaf277ad797e554bb4deba9b95

MFC after: 2 weeks

7 years agoMFV r301524:
markj [Tue, 16 Aug 2016 02:18:34 +0000 (02:18 +0000)]
MFV r301524:
7034 negative record sizes should be rejected

Reviewed by: Patrick Mooney <patrick.mooney@joyent.com>
Reviewed by: Bryan Cantrill <bryan@joyent.com>
Approved by: Matthew Ahrens <mahrens@delphix.com>
Author: Alex Wilson <alex.wilson@joyent.com>

illumos/illumos-gate@0b8049bfb0e291160e960697b554596289d7f0bc

MFC after: 2 weeks

7 years agoMFV r296989:
markj [Tue, 16 Aug 2016 02:16:54 +0000 (02:16 +0000)]
MFV r296989:
6734 dtrace_canstore_statvar() fails for some valid static variables

Reviewed by: Dan McDonald <danmcd@omniti.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
Author: Bryan Cantrill <bryan@joyent.com>

illumos/illumos-gate@d65f2bb4e50559c6c375a2aa9f728cbc34379015

MFC after: 2 weeks

7 years agoMFV r304056:
markj [Tue, 16 Aug 2016 02:14:36 +0000 (02:14 +0000)]
MFV r304056:
5396 fix longjmp clobbering errors

illumos/illumos-gate@67a4bb8f9ad4c49e9aa9e21e2114a7c093c3a73a

Reviewed by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
Reviewed by: Igor Kozhukhov <ikozhukhov@gmail.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
Author: Gary Mills <gary_mills@fastmail.fm>

7 years agoFix r304026 so that it builds for gcc.
rmacklem [Tue, 16 Aug 2016 00:48:13 +0000 (00:48 +0000)]
Fix r304026 so that it builds for gcc.

Reported by: np
Tested by: np
MFC after: 1 month

7 years agoFix ko_KR, zh_CN, zh_HK, and zh_TW locales. r304045 did not fully revert
jkim [Tue, 16 Aug 2016 00:15:15 +0000 (00:15 +0000)]
Fix ko_KR, zh_CN, zh_HK, and zh_TW locales.  r304045 did not fully revert
date/time formats for these locales.

7 years agoelfcopy: correct comment typo in r304151
emaste [Mon, 15 Aug 2016 23:20:55 +0000 (23:20 +0000)]
elfcopy: correct comment typo in r304151

7 years agoRemove the mcd(4) driver for Mitsumi CD-ROM players.
jhb [Mon, 15 Aug 2016 20:38:02 +0000 (20:38 +0000)]
Remove the mcd(4) driver for Mitsumi CD-ROM players.

This is a driver for a pre-ATAPI ISA CD-ROM adapter.  As noted in
the manpage, this driver is only useful as a backend to cdcontrol to
play audio CDs since it doesn't use DMA, so its data performance is
"abysmal" (and that was true in the mid 90's).

7 years agoClean up the new sc cn open and close functions (old sc cn grab and ungrab
bde [Mon, 15 Aug 2016 20:17:48 +0000 (20:17 +0000)]
Clean up the new sc cn open and close functions (old sc cn grab and ungrab
functions).  Mainly, spell sc as itself instead of as scp->sc.

7 years agoEliminate use of sys_fsync() and sys_fdatasync().
ed [Mon, 15 Aug 2016 20:11:52 +0000 (20:11 +0000)]
Eliminate use of sys_fsync() and sys_fdatasync().

Make the kern_fsync() function public, so that it can be used by other
parts of the kernel. Fix up existing consumers to make use of it.

Requested by: kib

7 years agosem_post(): wake up the sleeper only after adjusting has_waiters
badger [Mon, 15 Aug 2016 20:09:09 +0000 (20:09 +0000)]
sem_post(): wake up the sleeper only after adjusting has_waiters

If the caller of sem_post() wakes up a thread sleeping via sem_wait()
before it clears the has_waiters flag, the caller of sem_wait() has no way of
knowing when it is safe to destroy the semaphore and reuse the memory. This is
because the caller of sem_post() may be interrupted between the wake step and
the clearing of has_waiters. It will then write into the has_waiters flag in
userspace after being preempted for some unknown amount of time.

Reviewed by: jhb, kib, vangyzen
Approved by: kib (mentor), vangyzen (mentor)
MFC after: 2 weeks
Sponsored by: Dell Inc.
Differential Revision: https://reviews.freebsd.org/D7505

7 years agodtraceUtil/tst.DataModel32.d.ksh passes on amd64.
markj [Mon, 15 Aug 2016 19:47:04 +0000 (19:47 +0000)]
dtraceUtil/tst.DataModel32.d.ksh passes on amd64.

7 years agoLet CloudABI use fdatasync() as well.
ed [Mon, 15 Aug 2016 19:42:21 +0000 (19:42 +0000)]
Let CloudABI use fdatasync() as well.

Now that FreeBSD supports fdatasync() natively, we can tidy up
CloudABI's equivalent system call to use that instead.

7 years agoRestructure the grabbing functions into mere wrappers of new open and
bde [Mon, 15 Aug 2016 19:37:18 +0000 (19:37 +0000)]
Restructure the grabbing functions into mere wrappers of new open and
close functions.  Scattered calls to sc_cnputc() and sc_cngetc() were
broken by turning the semi-reentrant inline context-switching code in
these functions into the grabbing functions.  cncheckc() calls for
panic dumps are the main broken case.  The grabbing functions have
special behaviour (mainly screen switching in sc_cngrab()) which makes
them unsuitable as replacements for the inline code.

7 years agoImplement VOP_FDATASYNC() for UFS.
kib [Mon, 15 Aug 2016 19:22:23 +0000 (19:22 +0000)]
Implement VOP_FDATASYNC() for UFS.

Reviewed by: mckusick
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D7471

7 years agoImplement VOP_FDATASYNC() for msdosfs.
kib [Mon, 15 Aug 2016 19:17:00 +0000 (19:17 +0000)]
Implement VOP_FDATASYNC() for msdosfs.

Standard VOP_FSYNC() implementation just syncs data buffers, and due
to this, is the correct and efficient implementation for msdosfs or
any other filesystem which uses bufer cache trivially.  Provide
globally visible wrapper vop_stdfdatasync_buf() for future consumption
by other filesystems.

Reviewed by: mckusick
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D7471

7 years agoRegen after r304176, fdatasync(2) addition.
kib [Mon, 15 Aug 2016 19:15:46 +0000 (19:15 +0000)]
Regen after r304176, fdatasync(2) addition.

7 years agoAdd an implementation of fdatasync(2).
kib [Mon, 15 Aug 2016 19:08:51 +0000 (19:08 +0000)]
Add an implementation of fdatasync(2).

The syscall is a trivial wrapper around new VOP_FDATASYNC(), sharing
code with fsync(2).  For all filesystems, this commit provides the
implementation which delegates the work of VOP_FDATASYNC() to
VOP_FSYNC().  This is functionally correct but not efficient.

This is not yet POSIX-compliant implementation, because it does not
ensure that queued AIO requests are completed before returning.

Reviewed by: mckusick
Discussed with: avg (ZFS), jhb (AIO part)
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D7471

7 years agoDisable tests for non-standard behaviour of dirname(3)/basename(3).
ed [Mon, 15 Aug 2016 19:05:41 +0000 (19:05 +0000)]
Disable tests for non-standard behaviour of dirname(3)/basename(3).

The NetBSD ATF tests explicitly check that these functions do not modify
their input. These tests are NetBSD-specific. They test for something
that is not part of POSIX.

PR: 211873
Reviewed by: ngie
Differential Revision: https://reviews.freebsd.org/D7506

7 years agoVOP_FSYNC() does not take cred as an argument. Correct comment.
kib [Mon, 15 Aug 2016 18:55:33 +0000 (18:55 +0000)]
VOP_FSYNC() does not take cred as an argument.  Correct comment.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years agoFix restoring the kbd_mode part of the keyboard state in grab/ungrab.
bde [Mon, 15 Aug 2016 18:02:37 +0000 (18:02 +0000)]
Fix restoring the kbd_mode part of the keyboard state in grab/ungrab.
Simply change the mode to K_XLATE using a local variable and use the
grab level as a flag to tell screen switches not to change it again,
so that we don't need to switch scp->kbd_mode.  We did the latter,
but didn't have the complications to update the keyboard mode switch
for every screen switch.  sc->kbd_mode remains at its user setting
for all scp's and ungrabbing restores to it.

7 years agoAdd support for register dumps on VF devices.
jhb [Mon, 15 Aug 2016 17:42:54 +0000 (17:42 +0000)]
Add support for register dumps on VF devices.

- Add handling of VF register sets to t4_get_regs_len() and t4_get_regs().
- While here, use t4_get_regs_len() in the ioctl handler for regdump
  instead of inlining it.

Reviewed by: np
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D7484

7 years agoUpdate mailbox writes to work with VF devices.
jhb [Mon, 15 Aug 2016 17:41:34 +0000 (17:41 +0000)]
Update mailbox writes to work with VF devices.

- Use alternate register locations for the data and control registers for
  VFs.
- Do a dummy read to force the writes to the  mailbox data registers to
  post before the write to the control register on VFs.
- Do not check the PCI-e firmware register for errors on VFs.

Reviewed by: np
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D7483

7 years agoMake SGE parameter handling more VF-friendly.
jhb [Mon, 15 Aug 2016 17:40:05 +0000 (17:40 +0000)]
Make SGE parameter handling more VF-friendly.

Add fields to hold the SGE control register and free list buffer sizes to
the sge_params structure.  Populate these new fields in
t4_init_sge_params() for PF devices and change t4_read_chip_settings() to
pull these values out of the params structure instead of reading
registers directly.  This will permit t4_read_chip_settings() to be reused
for VF devices which cannot read SGE registers directly.

While here, move the call to t4_init_sge_params() to
get_params__post_init().  The VF driver will populate the SGE parameters
structure via a different method before calling t4_read_chip_settings().

Reviewed by: np
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D7476

7 years ago[Oops, the previous commit was missing the update to syscons.h.]
bde [Mon, 15 Aug 2016 17:11:05 +0000 (17:11 +0000)]
[Oops, the previous commit was missing the update to syscons.h.]

Like scr_lock, the grab count needs to be per-physical-device to work.

This bug corrupted the grab count on both vtys if the ungrabbed vty is
different from the console, and failed to restore the keyboard state
on the ungrabbed vty, but not restoring it usually left the keyboard
mode part of the keyboard state uncorrupted at 1 (K_XLATE), while
after this fix the keyboard mode part is usually corrupted to 0 (K_RAW).

While here, rename the grab count from grabbed to grab_level.

7 years agoLike scr_lock, the grab count needs to be per-physical-device to work.
bde [Mon, 15 Aug 2016 17:08:25 +0000 (17:08 +0000)]
Like scr_lock, the grab count needs to be per-physical-device to work.

This bug corrupted the grab count on both vtys if the ungrabbed vty is
different from the console, and failed to restore the keyboard state
on the ungrabbed vty, but not restoring the latter usually left the
keyboard mode part of it uncorrupted at 1 (K_XLATE), while after this
fix the keyboard mode part is usually corrupted to 0 (K_RAW).

While here, rename the grab count from 'grabbed' to grab_level.

7 years agoDisable some more unsafe things in (low level) console mode:
bde [Mon, 15 Aug 2016 15:34:53 +0000 (15:34 +0000)]
Disable some more unsafe things in (low level) console mode:
- never call up to the tty layer to restart output for keyboard input in
  console mode.  This was already disallowed in kdb mode.  Other cases
  are rarely reached.
- disable the reboot, halt and powerdown keys in console mode.  The suspend,
  standby and panic keys are still allowed, and aren't even conditonal
  on excessive configuration options.  Some of these actions are still
  available in ddb mode as ddb commands which are equally unsafe.  Some
  are useful at input prompts and should be restored when the locking is
  fixed.
- disallow bells in kdb mode (should be in console mode, but the flag for
  that is not available).  Visual bell gives very alarming behaviour by
  trying to use callouts which don't work in kdb mode.  Audio bell uses
  timeouts and hardware resources with mutexes that can deadlock in
  reasonable use of ddb.

Screen switches in kdb mode are not very safe, but they are important
functionality and there is a lot of code to make them sort of work.

7 years agoDecrease the anti-congestion sleep in 480.leapfile-ntpd to 1 hour
asomers [Mon, 15 Aug 2016 14:58:25 +0000 (14:58 +0000)]
Decrease the anti-congestion sleep in 480.leapfile-ntpd to 1 hour

24 hours is too long. Periodic scripts are executed serially, so when
combined with the sleep in 410.pkg-audit periodic could actually take more
than 24 hours and block the next invocation.

Reviewed by: cy
MFC after: 4 weeks
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D7481

7 years agoChange all uses of 'debugger' to kdb_active and remove this variable. This
bde [Mon, 15 Aug 2016 14:28:16 +0000 (14:28 +0000)]
Change all uses of 'debugger' to kdb_active and remove this variable.  This
restores avoidance of doing dangerous things like calling wakeup() and
callouts while in ddb.

Initialization of 'debugger' was broken by removing the cndbctl() console
method that was used mainly in this driver to initialize 'debugger' and
switch to the console screen on entry to ddb.  The screen switch was
restored using the cngrab() method, but cngrab() is more general so it
should not initialize 'debugger' and never did.  'debugger' was just
an over-engineered alias for kdb_active anyway.  It existed because
kdb_active (when it was named ddb_active) was considered as a private
kdb variable, and there are ordering problems initializing the variables
atomically with the state that they represent, but an extra variable and
method to set it increased these problems.

The bug caused LORs, but WITNESS is normally misconfigured with
WITNESS_SKIPSIN so it doesn't check the spinlocks used by wakeup() and
callouts.

7 years agoelfcopy: add elf64-littleaarch64 output target support
emaste [Mon, 15 Aug 2016 14:28:08 +0000 (14:28 +0000)]
elfcopy: add elf64-littleaarch64 output target support

Sponsored by: The FreeBSD Foundation

7 years agoFix command: ipfw set (enable|disable) N (where N > 4).
oleg [Mon, 15 Aug 2016 13:06:29 +0000 (13:06 +0000)]
Fix command: ipfw set (enable|disable) N (where N > 4).
enable_sets() expects set bitmasks, not set numbers.

MFC after: 3 days

7 years agoQuick fix for locking fixes in r172250. The lock added there was per-
bde [Mon, 15 Aug 2016 12:56:45 +0000 (12:56 +0000)]
Quick fix for locking fixes in r172250.  The lock added there was per-
virtual-device, but needs to be per-physical-device so that it protects
shared data.  Usually, scp->sc->write_in_progress got corrupted first
and further corruption was limited when this variable was left at nonzero
with no write in progress.

Attempt to fix missing lock destruction in r162285.  Put it with the
lock destruction for r172250 after moving the latter.  Both might be
unreachable.

To demonstrate the bug, find a buggy syscall or sysctl that calls
printf(9) and run this often.  Run hd /dev/zero >/dev/ttyvN for any
N != 0.  The console spam goes to ttyv0 and the non-console spam goes
to ttyvN, so the lock provided no protection (but it helped for
N == 0).

7 years agopf: Add missing byte-order swap to pf_match_addr_range
kp [Mon, 15 Aug 2016 12:13:14 +0000 (12:13 +0000)]
pf: Add missing byte-order swap to pf_match_addr_range

Without this, rules using address ranges (e.g. "10.1.1.1 - 10.1.1.5") did not
match addresses correctly on little-endian systems.

PR: 211796
Obtained from: OpenBSD (sthen)
MFC after: 3 days

7 years agoelfcopy: silence GCC 5.3 unitialized variable warning
emaste [Mon, 15 Aug 2016 11:54:39 +0000 (11:54 +0000)]
elfcopy: silence GCC 5.3 unitialized variable warning

Although it's a false positive there is little cost to initializing it
always.

Submitted by: adrian

7 years agoe1000: Add support for Kaby Lake IDs
sbruno [Mon, 15 Aug 2016 11:24:30 +0000 (11:24 +0000)]
e1000:  Add support for Kaby Lake IDs

Fixup some errors when transitioning to/from low power states.

Submitted by: erj
Reviewed by: Jeffery Piper (jeffrey.e.piper@intel.com)
MFC after: 3 days
Relnotes: yes
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D7478

7 years agoRemove duplicate definition of get_pcb_td(). gcc works for detecting
bde [Mon, 15 Aug 2016 10:46:33 +0000 (10:46 +0000)]
Remove duplicate definition of get_pcb_td().  gcc works for detecting
this error.

7 years agoEnsure that sctp_it_ctl.cur_it does not point to a free object (during
tuexen [Mon, 15 Aug 2016 10:16:08 +0000 (10:16 +0000)]
Ensure that sctp_it_ctl.cur_it does not point to a free object (during
a small time window).
Thanks to Byron Campen for reporting the issue and
suggesting a fix.

MFC after: 3 days

7 years agoEnsure that the sector size is a multiple of 4096 to avoid creating
des [Mon, 15 Aug 2016 09:30:21 +0000 (09:30 +0000)]
Ensure that the sector size is a multiple of 4096 to avoid creating
unaligned partitions when the actual sector size is hidden from us.

PR: 211361
MFC after: 3 days

7 years agoAdd the ARMv8.1 identification registers to the list we print when booting.
andrew [Mon, 15 Aug 2016 09:23:08 +0000 (09:23 +0000)]
Add the ARMv8.1 identification registers to the list we print when booting.

MFC after: 1 week
Sponsored by: ABT Systems Ltd

7 years agohyperv/hn: Switch to vmbus xact APIs for sub-channel alloc request.
sephe [Mon, 15 Aug 2016 05:08:41 +0000 (05:08 +0000)]
hyperv/hn: Switch to vmbus xact APIs for sub-channel alloc request.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7480

7 years agohyperv/hn: Simplify chimney sending buffer disconnection.
sephe [Mon, 15 Aug 2016 05:00:37 +0000 (05:00 +0000)]
hyperv/hn: Simplify chimney sending buffer disconnection.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D7479

7 years agoUnbreak LINT build.
sephe [Mon, 15 Aug 2016 04:59:38 +0000 (04:59 +0000)]
Unbreak LINT build.

Sponsored by: Microsoft

7 years agoAdd timingsafe_bcmp and timingsafe_memcmp.
delphij [Sun, 14 Aug 2016 23:38:50 +0000 (23:38 +0000)]
Add timingsafe_bcmp and timingsafe_memcmp.

Obtained from: OpenBSD
Reviewed by: trasz
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D7280

7 years agoEliminate unneeded vm_page_xbusy() and vm_page_xunbusy() operations when
alc [Sun, 14 Aug 2016 22:00:45 +0000 (22:00 +0000)]
Eliminate unneeded vm_page_xbusy() and vm_page_xunbusy() operations when
neither vm_pager_has_page() nor vm_pager_get_pages() is called.

Reviewed by: kib, markj
MFC after: 3 weeks

7 years ago[mips] convert over =v to =r for the inline assembly.
adrian [Sun, 14 Aug 2016 19:04:37 +0000 (19:04 +0000)]
[mips] convert over =v to =r for the inline assembly.

Later gcc and clang have deprecated =v (which maps to a specific temp
register) and instead we should just use =r to have the assembler
(hopefully!) save/restore things appropriately after choosing
a register.

Tested:

* AR9344 SoC, with userreg support
* AR9331 SoC, with no userreg support

Sponsored by: Sponsored by: DARPA, AFRL (MIPS TLS user register work)

7 years agoAdd an ability to attach comment to check-state rules.
ae [Sun, 14 Aug 2016 18:34:16 +0000 (18:34 +0000)]
Add an ability to attach comment to check-state rules.

MFC after: 1 week

7 years agoDo not warn about ambiguous state name when we inspect a comment token.
ae [Sun, 14 Aug 2016 18:05:41 +0000 (18:05 +0000)]
Do not warn about ambiguous state name when we inspect a comment token.

Reported by: lev

7 years agoFix the variables $esp, $ds, $es, $fs, $gs and $ss in vm86 mode.
bde [Sun, 14 Aug 2016 16:51:25 +0000 (16:51 +0000)]
Fix the variables $esp, $ds, $es, $fs, $gs and $ss in vm86 mode.

Fix PC_REGS() so that printing of instructions works in some useful
cases.  ddb only understands a single flat address space, but this
macro allows mapping $cs:$eip into vm86's flat address space well
enough for the MI parts of ddb.  This doesn't work for the MD parts
that do stack traces, and there are no similar macros for data addresses.

PC_REGS() has to use the trapframe pointer instead of the pcb for this.
For other CPUs, the trapframe pointer is not available except by tracing
back to it.  But tracing back through vm86 trapframes is broken even
starting with one.

7 years agoPrint the tid of curthread in "show pcpu" in ddb.
bde [Sun, 14 Aug 2016 15:52:00 +0000 (15:52 +0000)]
Print the tid of curthread in "show pcpu" in ddb.

It was remarkably hard to trace all current threads.  "show pcpu" only
showed the pid, and there was nothing (?) better than searching ps output
to find the tids on CPUs.  This change simplifies the search, but you
still have to trace the tid for each CPU manually.

7 years agoIn ddb ps, left justify the non-numeric fields 'state' and 'wmesg' and
bde [Sun, 14 Aug 2016 15:26:40 +0000 (15:26 +0000)]
In ddb ps, left justify the non-numeric fields 'state' and 'wmesg' and
the fixed-width numeric field 'wchan', as in ps(1).  They were sort
of centered, although the template shows 'state' as right-justified.
The `wmesg' field very rarely has a prefix of '*' (for lock names)
that is still to the left of the header, and the width of this field
is reduced from 8 to 7 (more than 6 is an error).

The 'wmesg' and 'wchan' fields are still misnamed and poorly handled.
They are named sort of backwards relative to ps(1):
- wmesg in ddb = mwchan in ps
- wmesg in ddb = wchan in ps (if it is a wait channel name, not a lock name)
- wchan in ddb = nwchan in ps
ddb ps wastes lots of space for the unimportant 'wchan' field (20
columns altogether on 64-bit arches).  ps(1) documents using a
compressed format, but the compression only omits leading nybbles of
0 so it has neveqr worked on arches that put the kernel in the top half
of the address space.  It just avoids wasting space for an 0x prefix.

7 years agoDon't print an extra newline after the instruction when printing for
bde [Sun, 14 Aug 2016 13:23:02 +0000 (13:23 +0000)]
Don't print an extra newline after the instruction when printing for
single stepping of multiple instructions (e.g., s/p,<count> and n/p).
db_print_loc_and_inst() already prints a newline on all arches although
it probably shouldn't.

Especially on SMP systems, single stepping tends to deadlock or panic
too quickly to be useful for anything except finding bugs in itself,
but with printing "itself" includes console drivers so it is useful
for generating stress tests for console drivers.

7 years agoCorrect the size of the softc in a10_ehci
manu [Sun, 14 Aug 2016 13:17:59 +0000 (13:17 +0000)]
Correct the size of the softc in a10_ehci

Reported by: andrew
MFC after: 1 week

7 years agoMake statistics nat64lsn, nat64stl an nptv6 output netstat-like:
ae [Sun, 14 Aug 2016 13:17:55 +0000 (13:17 +0000)]
Make statistics nat64lsn, nat64stl an nptv6 output netstat-like:
 "@value @description" and fix build due to -Wformat errors.

7 years agoMFV r304060:
mm [Sun, 14 Aug 2016 09:26:10 +0000 (09:26 +0000)]
MFV r304060:
Sync libarchive with vendor including three security fixes

Vendor issues fixed:

Issue #744: Very long pathnames evade symlink checks
Issue #748: libarchive can compress, but cannot decompress zip some files
PR #750: ustar: fix out of bounds read on empty string ("") filename
PR #755: fix use of acl_get_flagset_np() on FreeBSD

MFC after: 3 days

7 years agoNow that the portsnap buildbox is generating the raw bits for INDEX-12,
delphij [Sun, 14 Aug 2016 05:18:38 +0000 (05:18 +0000)]
Now that the portsnap buildbox is generating the raw bits for INDEX-12,
add it to the set of INDEX files built by portsnap.

Switch to INDEX-12 for head/.

7 years agoOFWPCI: Don't strip RF_ACTIVE from flags when parent bus method is called.
mmel [Sun, 14 Aug 2016 05:10:26 +0000 (05:10 +0000)]
OFWPCI: Don't strip RF_ACTIVE from flags when parent bus method is called.

Reviewed by: nwhitehorn
MFC after: 3 weeks

7 years agoReturn 0 instead of an error code on failure to find dcsr.
jhibbits [Sun, 14 Aug 2016 04:11:36 +0000 (04:11 +0000)]
Return 0 instead of an error code on failure to find dcsr.

mpc85xx_map_dcsr() returns a vm_offset_t, not an error code.
mpc85xx_fix_errata() will gracefully exit if mpc85xx_map_dcsr() returns 0, as
that indicates an error (NULL pointer).

7 years agoOnly flush bp_kernload from the dcache, no need to sync the icache on the boot CPU.
jhibbits [Sun, 14 Aug 2016 03:49:37 +0000 (03:49 +0000)]
Only flush bp_kernload from the dcache, no need to sync the icache on the boot CPU.

__syncicache() only syncs the icache on the current CPU, it doesn't touch the
cache on any other core.  Replace the call with cpu_flush_dcache() instead.
Since bp_kernload is not touched again by the boot CPU in this code path, dcbf
is no less efficient than the dcbst from __syncicache() by invalidating the
cache line.

7 years agonfsstat depends on libdevstat as of r304058.
markj [Sun, 14 Aug 2016 00:24:00 +0000 (00:24 +0000)]
nfsstat depends on libdevstat as of r304058.

X-MFC-With: r304058

7 years agoCorrect date ov VJ day (1945-08-15, about 03:00 UTC).
grog [Sat, 13 Aug 2016 23:35:20 +0000 (23:35 +0000)]
Correct date ov VJ day (1945-08-15, about 03:00 UTC).

7 years agoUse %ju to print unsigned 64-bit value.
ae [Sat, 13 Aug 2016 22:14:16 +0000 (22:14 +0000)]
Use %ju to print unsigned 64-bit value.

Reported by: kib

7 years agoUpdate vendor/libarchive to git 6a0d970f70102fe50ee9f1e51a2e4c048985e616
mm [Sat, 13 Aug 2016 21:20:06 +0000 (21:20 +0000)]
Update vendor/libarchive to git 6a0d970f70102fe50ee9f1e51a2e4c048985e616

Vendor issues fixed:

Issue #744: Very long pathnames evade symlink checks
Issue #748: libarchive can compress, but cannot decompress zip some files
PR #750: ustar: fix out of bounds read on empty string ("") filename
PR #755: fix use of acl_get_flagset_np() on FreeBSD

7 years agoUpdate the man page to descibe the "-d" option added by r304058.
rmacklem [Sat, 13 Aug 2016 20:21:32 +0000 (20:21 +0000)]
Update the man page to descibe the "-d" option added by r304058.

This is a content change.

Submitted by: will (earlier version)
Reviewed by: ken, wblock
MFC after: 1 month
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D1626

7 years agoUpdate nfsstat.c to use the new kernel nfsstat structure and
rmacklem [Sat, 13 Aug 2016 20:14:44 +0000 (20:14 +0000)]
Update nfsstat.c to use the new kernel nfsstat structure and
add the new "-d" flag from D1626.
The man page will be updated in a subsequent commit.

Submitted by: will (earlier version)
Reviewed by: ken
MFC after: 1 month
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D1626

7 years ago7085 add support for "if" and "else" statements in dtrace
markj [Sat, 13 Aug 2016 19:57:36 +0000 (19:57 +0000)]
7085 add support for "if" and "else" statements in dtrace

illumos/illumos-gate@c3bd3abd8856e8e75d820f65c58031cd6cbac818

Add syntactic sugar to dtrace: "if" and "else" statements. The sugar is
baked down to standard dtrace features by adding additional clauses with
the appropriate predicates.

Reviewed by: Adam Leventhal <ahl@delphix.com>
Reviewed by: Sebastien Roy <sebastien.roy@delphix.com>
Reviewed by: Paul Dagnelie <pcd@delphix.com>
Reviewed by: Bryan Cantrill <bryan@joyent.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
Author: Matthew Ahrens <mahrens@delphix.com>

7 years ago5396 fix longjmp clobbering errors
markj [Sat, 13 Aug 2016 19:54:32 +0000 (19:54 +0000)]
5396 fix longjmp clobbering errors

illumos/illumos-gate@67a4bb8f9ad4c49e9aa9e21e2114a7c093c3a73a

Reviewed by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
Reviewed by: Igor Kozhukhov <ikozhukhov@gmail.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
Author: Gary Mills <gary_mills@fastmail.fm>

7 years agoFix handling of forward enum declarations in the CTF tools.
markj [Sat, 13 Aug 2016 19:51:00 +0000 (19:51 +0000)]
Fix handling of forward enum declarations in the CTF tools.

Reported by: mmacy
MFC after: 2 weeks

7 years agoStrengthen assertions about the busy state of newly-allocated pages.
markj [Sat, 13 Aug 2016 19:49:32 +0000 (19:49 +0000)]
Strengthen assertions about the busy state of newly-allocated pages.

Reviewed by: alc
MFC after: 1 week

7 years agoInitialize page busy lock state in vm_phys_add_page().
markj [Sat, 13 Aug 2016 19:48:43 +0000 (19:48 +0000)]
Initialize page busy lock state in vm_phys_add_page().

MFC after: 1 week

7 years agoAdd missing pmap_kenter() method for book-e.
jhibbits [Sat, 13 Aug 2016 18:57:14 +0000 (18:57 +0000)]
Add missing pmap_kenter() method for book-e.

This isn't added to AIM yet, because it's not yet needed.  It's needed for
Book-E ePAPR boot support.

X-MFC With: r304047

7 years agoAdd a kdb show command to print arbitrary SPRs on PowerPC
jhibbits [Sat, 13 Aug 2016 18:46:49 +0000 (18:46 +0000)]
Add a kdb show command to print arbitrary SPRs on PowerPC

Summary:
There is often a need at the debugger to print arbitrary special
purpose registers (SPRs) on PowerPC.  Using a rewritable asm stub, print any SPR
provided on the command line.

Note, as there is no checking in this, attempting to print a nonexistent SPR
may cause a Program exception (illegal instruction, or boundedly undefined).

Note also that this relies on the kernel text pages being writable.  If in the
future this is made not the case, this will need to be reworked.

Test Plan:
Printing the Processor Version Register (PVR, SPR 287):

db> show spr 11f
SPR 287(11f): 80240012

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

7 years agoEliminate two calls to vm_page_xunbusy() that are both unnecessary and
alc [Sat, 13 Aug 2016 18:10:32 +0000 (18:10 +0000)]
Eliminate two calls to vm_page_xunbusy() that are both unnecessary and
incorrect from the error cases in exec_map_first_page().  They are
unnecessary because we automatically unbusy the page in vm_page_free()
when we remove it from the object.  The calls are incorrect because they
happen after the page is freed, so we might actually unbusy the page
after it has been reallocated to a different object.  (This error was
introduced in r292373.)

Reviewed by: kib
MFC after: 1 week

7 years agoAdd `stats reset` command implementation to NPTv6 module
ae [Sat, 13 Aug 2016 16:45:14 +0000 (16:45 +0000)]
Add `stats reset` command implementation to NPTv6 module
to be able reset statistics counters.

Obtained from: Yandex LLC
Sponsored by: Yandex LLC

7 years agoReplace __noinline with special debug macro NAT64NOINLINE.
ae [Sat, 13 Aug 2016 16:26:15 +0000 (16:26 +0000)]
Replace __noinline with special debug macro NAT64NOINLINE.

7 years agoAdd ePAPR boot support for PowerPC book-E (MPC85xx) hardware
jhibbits [Sat, 13 Aug 2016 16:16:02 +0000 (16:16 +0000)]
Add ePAPR boot support for PowerPC book-E (MPC85xx) hardware

Summary:
u-boot, following the ePAPR specification, puts secondary cores into a
spinloop at boot, rather than leaving them shut off.  It then relies on the host
OS to write the correct values to a special spin table, located in coherent
memory (on newer implementations), or noncoherent memory (older
implementations).

This supports both implementations of ePAPR, as well as continuing to support
non-ePAPR booting, by first attempting to use the spintable, and falling back to
expecting non-started CPUs.

Test Plan:
Booted on a P5020 board.  Tested before and after the changes.
Before the changes, prints the error "SMP: CPU 1 already out of hold-off state!"
and panics shortly thereafter.  After the changes, same boot method lets it
complete boot.

Reviewed by: nwhitehorn
MFC after: 2 weeks
Relnotes: Yes
Sponsored by: Alex Perez/Inertial Computing
Differential Revision: https://reviews.freebsd.org/D7494

7 years agoAdd ipfw_nat64 module that implements stateless and stateful NAT64.
ae [Sat, 13 Aug 2016 16:09:49 +0000 (16:09 +0000)]
Add ipfw_nat64 module that implements stateless and stateful NAT64.

The module works together with ipfw(4) and implemented as its external
action module.

Stateless NAT64 registers external action with name nat64stl. This
keyword should be used to create NAT64 instance and to address this
instance in rules. Stateless NAT64 uses two lookup tables with mapped
IPv4->IPv6 and IPv6->IPv4 addresses to perform translation.

A configuration of instance should looks like this:
 1. Create lookup tables:
 # ipfw table T46 create type addr valtype ipv6
 # ipfw table T64 create type addr valtype ipv4
 2. Fill T46 and T64 tables.
 3. Add rule to allow neighbor solicitation and advertisement:
 # ipfw add allow icmp6 from any to any icmp6types 135,136
 4. Create NAT64 instance:
 # ipfw nat64stl NAT create table4 T46 table6 T64
 5. Add rules that matches the traffic:
 # ipfw add nat64stl NAT ip from any to table(T46)
 # ipfw add nat64stl NAT ip from table(T64) to 64:ff9b::/96
 6. Configure DNS64 for IPv6 clients and add route to 64:ff9b::/96
    via NAT64 host.

Stateful NAT64 registers external action with name nat64lsn. The only
one option required to create nat64lsn instance - prefix4. It defines
the pool of IPv4 addresses used for translation.

A configuration of instance should looks like this:
 1. Add rule to allow neighbor solicitation and advertisement:
 # ipfw add allow icmp6 from any to any icmp6types 135,136
 2. Create NAT64 instance:
 # ipfw nat64lsn NAT create prefix4 A.B.C.D/28
 3. Add rules that matches the traffic:
 # ipfw add nat64lsn NAT ip from any to A.B.C.D/28
 # ipfw add nat64lsn NAT ip6 from any to 64:ff9b::/96
 4. Configure DNS64 for IPv6 clients and add route to 64:ff9b::/96
    via NAT64 host.

Obtained from: Yandex LLC
Relnotes: yes
Sponsored by: Yandex LLC
Differential Revision: https://reviews.freebsd.org/D6434

7 years agoSet date and time formats back to what they were before CLDR
bapt [Sat, 13 Aug 2016 15:59:18 +0000 (15:59 +0000)]
Set date and time formats back to what they were before CLDR

While CLDR brings us a good and up to date source data to generate locales for
all databses we are using for locales, it is not the case of LC_TIME. Where it
does not defines the informations we need.

Put back all the date and time formats from the old locales.
Make it statically for now (in order to be able to merge it now into
11.0-RELEASE). The generation tools will be updated soon.

That gives us time to properly work on LC_TIME during the 12 timeframe.

While here fix abbreviated month for af_ZA (which are already fixed in CLDR
data upstream)

In locales where AP/PM was not defined before CLDR data, remove again the AP/PM
informations

For locales where AP/PM was defined before CLDR data, keep the CLDR information
which was properly translated.

MFC after: 3 days

7 years agoAdd three helper function to manage tables from external modules.
ae [Sat, 13 Aug 2016 15:48:56 +0000 (15:48 +0000)]
Add three helper function to manage tables from external modules.

ipfw_objhash_lookup_table_kidx does lookup kernel index of table;
ipfw_ref_table/ipfw_unref_table takes and releases reference to table.

Obtained from: Yandex LLC
Sponsored by: Yandex LLC

7 years agoMove logging via BPF support into separate file.
ae [Sat, 13 Aug 2016 15:41:04 +0000 (15:41 +0000)]
Move logging via BPF support into separate file.

* make interface cloner VNET-aware;
* simplify cloner code and use if_clone_simple();
* migrate LOGIF_LOCK() to rmlock;
* add ipfw_bpf_mtap2() function to pass mbuf to BPF;
* introduce new additional ipfwlog0 pseudo interface. It differs from
  ipfw0 by DLT type used in bpfattach. This interface is intended to
  used by ipfw modules to dump packets with additional info attached.
  Currently pflog format is used. ipfw_bpf_mtap2() function uses second
  argument to determine which interface use for dumping. If dlen is equal
  to ETHER_HDR_LEN it uses old ipfw0 interface, if dlen is equal to
  PFLOG_HDRLEN - ipfwlog0 will be used.

Obtained from: Yandex LLC
Sponsored by: Yandex LLC

7 years agoRedirect the output of the testcases to stderr instead of
ngie [Sat, 13 Aug 2016 06:26:33 +0000 (06:26 +0000)]
Redirect the output of the testcases to stderr instead of
redirecting it to /dev/null

This will aid in debugging failures

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division

7 years agoInitialize `ai` to NULL and test for `ai` with type-appropriate values
ngie [Sat, 13 Aug 2016 02:05:06 +0000 (02:05 +0000)]
Initialize `ai` to NULL and test for `ai` with type-appropriate values

Depending on the address family and ai_flags containing AI_V4MAPPED,
it might not do a proper DNS lookup on the provided DNS address

Convert some `ai` boolean true/false checks to NULL/non-NULL while here.

MFC after: 1 week
PR: 211790
Reported by: Herbie.Robinson@stratus.com
Sponsored by: EMC / Isilon Storage Division

7 years agoIncrease timeout from 10 minutes to 20 minutes for all tests
ngie [Sat, 13 Aug 2016 01:49:11 +0000 (01:49 +0000)]
Increase timeout from 10 minutes to 20 minutes for all tests

On particular slow networks, it can (on average) take longer to
resolve hosts to IP* addresses. 20 minutes seemed reasonable for
my work network

This will be solved in a more meaningful way (if possible) using
concurrency in the near future

MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division

7 years agoUpdate the nfsstats structure to include the changes needed by
rmacklem [Fri, 12 Aug 2016 22:44:59 +0000 (22:44 +0000)]
Update the nfsstats structure to include the changes needed by
the patch in D1626 plus changes so that it includes counts for
NFSv4.1 (and the draft of NFSv4.2).
Also, make all the counts uint64_t and add a vers field at the
beginning, so that future revisions can easily be implemented.
There is code in place to handle the old vesion of the nfsstats
structure for backwards binary compatibility.

Subsequent commits will update nfsstat(8) to use the new fields.

Submitted by: will (earlier version)
Reviewed by: ken
MFC after: 1 month
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D1626

7 years agoReviewed by: allanjude
tsoome [Fri, 12 Aug 2016 22:25:01 +0000 (22:25 +0000)]
Reviewed by:    allanjude
Approved by: allanjude (mentor)
Differential Revision: https://reviews.freebsd.org/D7491

7 years agoRemove unused "X" vnode lock assertion, somehow missed in r303743.
trasz [Fri, 12 Aug 2016 22:22:11 +0000 (22:22 +0000)]
Remove unused "X" vnode lock assertion, somehow missed in r303743.

MFC after: 1 month

7 years agoPrint vnode details when vnode locking assertion gets triggered.
trasz [Fri, 12 Aug 2016 22:20:52 +0000 (22:20 +0000)]
Print vnode details when vnode locking assertion gets triggered.

MFC after: 1 month

7 years agoUpdate iflib to support more NIC designs
shurd [Fri, 12 Aug 2016 21:29:44 +0000 (21:29 +0000)]
Update iflib to support more NIC designs

- Move group task queue into kern/subr_gtaskqueue.c
- Change intr_enable to return an int so it can be detected if it's not
  implemented
- Allow different TX/RX queues per set to be different sizes
- Don't split up TX mbufs before transmit
- Allow a completion queue for TX as well as RX
- Pass the RX budget to isc_rxd_available() to allow an earlier return
  and avoid multiple calls

Submitted by: shurd
Reviewed by: gallatin
Approved by: scottl
Differential Revision: https://reviews.freebsd.org/D7393

7 years agoAdd defines needed to export SMBIOS serial numbers
jhb [Fri, 12 Aug 2016 19:47:20 +0000 (19:47 +0000)]
Add defines needed to export SMBIOS serial numbers

Some defines needed for exporting serial numbers from the SMBIOS were
missed during integration of SMBIOS support in the EFI boot loader (r281138).
This is needed for getting the hostid set from the system hardware UUID.

PR: 206031
Submitted by: Thomas Eberhardt <sneakywumpus@gmail.com>
MFC after: 1 week

7 years agoMove defines common between rtld and libsysdecode into the header,
kib [Fri, 12 Aug 2016 19:31:41 +0000 (19:31 +0000)]
Move defines common between rtld and libsysdecode into the header,
instead of copying inline into sources.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years agoFill phdr and phsize for rtld object. It is needed for
kib [Fri, 12 Aug 2016 18:31:44 +0000 (18:31 +0000)]
Fill phdr and phsize for rtld object.  It is needed for
dl_iterate_phdr() reporting the correct values.

PR: 211367
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years agoRemove all remaining uses of TAILQ_FOREACH_FROM() from rtld-elf.
kib [Fri, 12 Aug 2016 18:29:11 +0000 (18:29 +0000)]
Remove all remaining uses of TAILQ_FOREACH_FROM() from rtld-elf.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years agoRemove description of P_FOLLOWFORK as this flag was removed.
jhb [Fri, 12 Aug 2016 16:13:50 +0000 (16:13 +0000)]
Remove description of P_FOLLOWFORK as this flag was removed.

7 years agoAvoid taking PROC_LOCK in syscalls if not being traced.
bdrewery [Fri, 12 Aug 2016 16:05:53 +0000 (16:05 +0000)]
Avoid taking PROC_LOCK in syscalls if not being traced.

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division

7 years agoCorrect the history of where ps first appeared.
wblock [Fri, 12 Aug 2016 14:10:11 +0000 (14:10 +0000)]
Correct the history of where ps first appeared.

PR: 211741
Submitted by: Sevan Janiyan <venture37@geeklan.co.uk>
MFC after: 1 week

7 years agoAvoid showing the bootstrap make command for check-old, etc.
bdrewery [Fri, 12 Aug 2016 13:52:51 +0000 (13:52 +0000)]
Avoid showing the bootstrap make command for check-old, etc.

Reported by: koobs
MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division