MFC updated ZFS
merge fast_net backport
add local changes
merge HEAD updates

191028
 - use a shared lock for reads
 - remove stale comment
191033
- update bufring for ALTQ
191080
Extend route command:
       - add show as alias for get
       - add weights to allow mpath to do more than equal cost
       - add sticky / nostick to disable / re-enable per-connection load balancing

 This adds a field to rt_metrics_lite so network bits of world will need to be re-built.

191117
add an llentry to struct route{_in6} to allow it to be passed around with
 the rtentry

191120
 make LLTABLE visible to netinet

191126
191148
Change if_output to take a struct route as its fourth argument in order
 to allow passing a cached struct llentry * down to L2
Import changes from HEAD

191038
191154
 add utility routine for updating an struct llentry *

191158
191159
191160
191161
191162
191221
191255
191257
191258
191259
191324
191440
191441
191442
191603
191611
191612
merge fixes

191605
191606
191607
191608
191609
191610
191899
192009
192011
192085
192282
make adaptive spinning on SX the default
merge rt+lle caching support
make lock shared on read for sendfile
glue in flowid
Merge dependent callout changes

171053
172025
172184
173760
173842
176013
merge 177085

 - Pass the priority argument from *sleep() into sleepq and down into
   sched_sleep().  This removes extra thread_lock() acquisition and
   allows the scheduler to decide what to do with the static boost.
 - Change the priority arguments to cv_* to match sleepq/msleep/etc.
   where 0 means no priority change.  Catch -1 in cv_broadcastpri() and
   convert it to 0 for now.
 - Set a flag when sleeping in a way that is compatible with swapping
   since direct priority comparisons are meaningless now.
 - Add a sysctl to ule, kern.sched.static_boost, that defaults to on which
   controls the boost behavior.  Turning it off gives better performance
   in some workloads but needs more investigation.
 - While we're modifying sleepq, change signal and broadcast to both
   return with the lock held as the lock was held on enter.
177491
Fix a race where timeout/untimeout could cause crashes for Giant locked
code.

The bug:

There exists a race condition for timeout/untimeout(9) due to the
way that the softclock thread dequeues timeouts.

The softclock thread sets the c_func and c_arg of the callout to
NULL while holding the callout lock but not Giant.  It then drops
the callout lock and acquires Giant.

It is at this point where untimeout(9) on another cpu/thread could
be called.

Since c_arg and c_func are cleared, untimeout(9) does not touch the
callout and returns as if the callout is canceled.

The softclock then tries to acquire Giant and likely blocks due to
the other cpu/thread holding it.

The other cpu/thread then likely deallocates the backing store that
c_arg points to and finishes working and hence drops Giant.

Softclock resumes and acquires giant and calls the function with
the now free'd c_arg and we have corruption/crash.

The fix:

We need to track curr_callout even for timeout(9) (LOCAL_ALLOC)
callouts.  We need to free the callout after the softclock processes
it to deal with the race here.

177859
Implement per-cpu callout threads, wheels, and locks.

 - Move callout thread creation from kern_intr.c to kern_timeout.c
 - Call callout_tick() on every processor via hardclock_cpu() rather than
   inspecting callout internal details in kern_clock.c.
 - Remove callout implementation details from callout.h
 - Package up all of the global variables into a per-cpu callout structure.
 - Start one thread per-cpu.  Threads are not strictly bound.  They prefer
   to execute on the native cpu but may migrate temporarily if interrupts
   are starving callout processing.
 - Run all callouts by default in the thread for cpu0 to maintain current
   ordering and concurrency guarantees.  Many consumers may not properly
   handle concurrent execution.
 - The new callout_reset_on() api allows specifying a particular cpu to
   execute the callout on.  This may migrate a callout to a new cpu.
   callout_reset() schedules on the last assigned cpu while
   callout_reset_curcpu() schedules on the current cpu.

177949
 - Correct a major error introduced in the per-cpu timeout commit.  Sleep
   and wakeup require the same wait channel to function properly.
180608:
Fix a race which could result in some timeout buckets being skipped.
 - When a tick occurs on a cpu, iterate from cs_softticks until ticks.
   The per-cpu tick processing happens asynchronously with the actual
   adjustment of the 'ticks' variable.  Sometimes the results may
   be visible before the local call and sometimes after.  Previously this
   could cause a one tick window where we didn't evaluate the bucket.
 - In softclock fetch curticks before incrementing cc_softticks so we
   don't skip insertions which were made for the current time.

Sponsored by:	Nokia

181191
add callout_schedule; besides being useful it also improves
compatibility with other systems

Reviewed by:	ed, battlez

184385
After a machine has been up for a bit more than 20 days with HZ=1000,
"ticks" goes negative.  This breaks the signed comparison in softclock.
This causes sleep() to never wake up, tcp to stop, etc etc.  This is
bad(TM).  Use the SEQ_LT() method from tcp's sequence number comparisons.
use per-cpu callouts for tcp timers
release sleepq in wakeup
merge hwpmc fix and new witness
180794
- Provide kernelname as the name for process with P_KTHREAD set as
    otherwise their textvp is NULL.

181695
 Introduce some WITNESS improvements:
 - Speedup the lock orderings lookup modifying the witness graph from a
   linked tree to a matrix. A table lookup caches the lock orderings in
   order to make a O(1) access for them. Any witness object has an unique
   index withing this lookup cache table.
 - Reduce the lock contention on w_mtx acquiring it only when the LOR
   actually happens and not in a sane case. In order to do this don't totally
   flush lock lists (per-CPU spinlocks list and per-thread sleeplocks list)
   but check for ll_count anytime we need to have to verify allocations sanity.
 - Introduce the function witness_thread_exit() in the witness namespace which
   should verify a thread doesn't hold any witness occurrence why exiting.
 - Rename the sysctl debug.witness.graphs into debug.witness.fullgraph and
   add debug.witness.badstacks which prints out stacks for LOR revealed.
   This is implemented using the stack(9) support, which makes WITNESS to be
   dependent by the STACK option or by the DDB (including STACK) option.
 - Fix style(9) for src/sys/kern/subr_witness.c

 The hash table approach has been developed by Ilya Maykov on the behalf of
 Isilon Systems which kindly released the patch.
 Jeff Roberson, ported the patch to -CURRENT and fixed w_mtx contention, on the
 behalf of Nokia.
merge 187681

- Make the keg abstraction more complete.  Permit a zone to have multiple
    backend kegs so it may source compatible memory from multiple backends.
    This is useful for cases such as NUMA or different layouts for the same
    memory type.
  - Provide a new api for adding new backend kegs to secondary zones.
  - Provide a new flag for adjusting the layout of zones to stagger
    allocations better across cache lines.

 Sponsored by: Nokia
merge 187880
  - Allocate apic vectors on a per-cpu basis.  This allows us to allocate
    more irqs as we have more cpus.  This is principally useful on systems
    with msi devices which may want many irqs per-cpu.

 Discussed with:       jhb
 Sponsored by: Nokia
merge 188904
  - Resolve an issue where we may clear an idt while an interrupt on a
    different cpu is still assigned to that vector by never clearing idt
    entries.  This was only provided as a debugging feature and the bugs
    are caught by other means.
  - Drop the sched lock when rebinding to reassign an interrupt vector
    to a new cpu so that pending interrupts have a chance to be delivered
    before removing the old vector.

 Discussed with:       tegge, jhb