MFC r269189:
Initialize zfs vnode v_hash when the vnode is allocated.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@269496 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r269290, r269291, r269293:

r269290:
  acpi_wmi(4): Remove trailing comma from standalone Xref.

r269291:
  hptiop(4): Remove trailing comma from ending Xref.

r269293:
  kernel_mount(9): Remove trailing comma from ending Xref.

Sponsored by:	The FreeBSD Foundation


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@269499 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r256571:
Add a function, memstr, which can be used to convert a buffer of
null-separated strings to a single string. This can be used to print the
full arguments of a process using execsnoop (from the DTrace toolkit) or
with the following one-liner:

dtrace -n 'syscall::execve:return {trace(curpsinfo->pr_psargs);}'

Note that this relies on the process arguments being cached via the struct
proc, which means that it will not work for argvs longer than
kern.ps_arg_cache_limit. However, the following rather non-portable
script can be used to extract any argv at exec time:

fbt::kern_execve:entry
{
    printf("%s", memstr(args[1]->begin_argv, ' ',
        args[1]->begin_envv - args[1]->begin_argv));
}

The debug.dtrace.memstr_max sysctl limits the maximum argument size to
memstr().


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@269521 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r256822:
When fetching function arguments out of a frame on amd64, explicitly select
the register based on the argument index rather than relying on the fields
in struct reg to be in the right order. This assumption is incorrect on
FreeBSD and generally led to bogus argument values for the sixth argument
of PID and USDT probes; the first five are passed directly to dtrace_probe()
via the fasttrap trap handler and so were correctly handled.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@269532 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r267706:
Allow creation of SDT probes from a module in which no providers are
defined. This ensures that the sdt:zfs:: probes appear despite the fact
the sdt provider is defined in the kernel rather than in zfs.ko.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@269544 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r268584:
Add a headphone redirection quirk for the Lenovo G580.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@269547 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r267759, r267761

r267759:
Fix a couple of bugs on amd64 when fetching probe arguments beyond the
first five for probes entered through a UD fault (i.e. FBT probes).

Specifically, handle the fact that dtrace_invop_callsite must be
16 byte-aligned and thus may not immediately follow the call to
dtrace_invop() in dtrace_invop_start(). Also fetch register arguments and
the stack pointer through a struct trapframe instead of a struct reg.

r267761:
Fix some bugs when fetching probe arguments in i386. Firstly ensure that
the 4 byte-aligned dtrace_invop_callsite can be found and that it
immediately follows the call to dtrace_invop(). Secondly, fix some pointer
arithmetic to account for differences between struct i386_frame and illumos'
struct frame. Finally, ensure that dtrace_getarg() isn't inlined. It works
by following a fixed number of frame pointers to the probe site, so inlining
breaks it.

PR:		191260


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@269556 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC: r260457

The changes in r233781 (MFCed to stable/9 in r235515) attempted to make
logging during a machine check exception more readable.  In practice they
prevented all logging during a machine check exception on at least some
systems.  Specifically, when an uncorrected ECC error is detected in a DIMM
on a Nehalem/Westmere class machine, all CPUs receive a machine check
exception, but only CPUs on the same package as the memory controller for
the erroring DIMM log an error.  The CPUs on the other package would complete
the scan of their machine check banks and panic before the first set of CPUs
could log an error.  The end result was a clearer display during the panic
(no interleaved messages), but a crashdump without any useful info about
the error that occurred.

To handle this case, make all CPUs spin in the machine check handler
once they have completed their scan of their machine check banks until
at least one machine check error is logged.  I tried using a DELAY()
instead so that the CPUs would not potentially hang forever, but that
was not reliable in testing.

While here, don't clear MCIP from MSR_MCG_STATUS before invoking panic.
Only clear it if the machine check handler does not panic and returns
to the interrupted thread.

MFC: r263113

Correct type for malloc().

Submitted by:	"Conrad Meyer" <conrad.meyer@isilon.com>

MFC: r269052, r269239, r269242

Intel desktop Haswell CPUs may report benign corrected parity errors (see
HSD131 erratum in [1]) at a considerable rate. So filter these (default),
unless logging is enabled. Unfortunately, there really is no better way to
reasonably implement suppressing these errors than to just skipping them
in mca_log(). Given that they are reported for bank 0, they'd need to be
masked in MSR_MC0_CTL. However, P6 family processors require that register
to be set to either all 0s or all 1s, disabling way more than the one error
in question when using all 0s there. Alternatively, it could be masked for
the corresponding CMCI, but that still wouldn't keep the periodic scanner
from detecting these spurious errors. Apart from that, register contents of
MSR_MC0_CTL{,2} don't seem to be publicly documented, neither in the Intel
Architectures Developer's Manual nor in the Haswell datasheets.

Note that while HSD131 actually is only about C0-stepping as of revision
014 of the Intel desktop 4th generation processor family specification
update, these corrected errors also have been observed with D0-stepping
aka "Haswell Refresh".

1: http://www.intel.de/content/dam/www/public/us/en/documents/specification-updates/4th-gen-core-family-desktop-specification-update.pdf

Reviewed by:	jhb
Sponsored by:	Bally Wulff Games & Entertainment GmbH


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@269593 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r269091:

Fix spelling of Camellia algorithm.  While here, replace blank lines
between examples with actual .Pp breaks.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@269633 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC of the r267935
	- Shared code update
	- em driver support for i218 devices
	- igb brought up to the 2.4.0 level


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@269647 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC of r269303:

When restoring a UFS dump onto a ZFS filesystem, an assertion in
restore was failing because ZFS was reporting a blocksize that was
not a multiple of 1024.  Replace restore's failed assertion with
code that writes restored files in a blocksize that works for
restore (a multiple of 1024) despite being non-optimal for ZFS.

Submitted by: Dmitry Morozovsky
Tested by:    Dmitry Morozovsky


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@269652 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Fix amd64 LINT.

hyperv is not in stable/9, thus partially revert MFC r257277.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@269663 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r265456, r265578:
Add a postinit debugger hook to rtld. This will be used by dtrace(1) to halt
the victim process before its entry point is called, at which point probes
and DOF data are registered with the kernel. The r_debug_state hook cannot
be used for this purpose, as it is called before the program's init routines
are invoked and in particular before DOF data is registered (via drti.o).


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@269681 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Merge OpenSSL 0.9.8zb.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@269687 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r265629, r265630

MFC r265629:
Handle the different event types properly in rd_event_addr(). In particular,
with r265456 _r_debug_postinit can be used for RD_POSTINIT events. rtld(1)
uses r_debug_state for dl state transitions, so we use its address for
RD_DLACTIVITY events.

MFC r265630:
Fix the rd_event_addr prototype and slightly clarify the use of the "event"
parameter.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@269719 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r269470: Avoid divide-by-zero panic when setting baudrate to 0.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@269721 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r265631:
Re-apply r248644. This fixes an annoying problem which caused dtrace -c to
fail to attach to stripped binaries. With the _r_debug_postinit symbol,
dtrace(1) can now set a breakpoint in the victim process after it has
registered its DOF table(s) with the kernel. r_debug_state cannot be used
for this purpose since it is called before DOF is made available, in which
case dtrace(1) cannot create USDT probes before the program begins
execution.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@269723 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r265308:
If the traced process stops because it received a signal, libproc needs
to ensure that the signal is forwarded when proc_continue() is called.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@269755 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFC r259211:
Correct the check for errors from proc_rwmem().


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@269757 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Merge r269489 from head (by peter):

  r262867 was described as fixing socket buffer checks for SOCK_SEQPACKET,
  but also changed one of the SOCK_DGRAM code paths to use the new
  sbappendaddr_nospacecheck_locked() function.  This lead to SOCK_DGRAM
  bypassing socket buffer limits.


git-svn-id: svn+ssh://svn.freebsd.org/base/stable/9@269789 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f