]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
8 years agoRemove dead code and dead comments, most notably the implemenation of the
nwhitehorn [Sun, 10 Jan 2016 18:00:01 +0000 (18:00 +0000)]
Remove dead code and dead comments, most notably the implemenation of the
now-obsolete setfault(). No NetBSD code exists in the AIM locore files, so
update the copyrights there.

8 years agoFix the domain iterator to not try the first-touch / fixed domain
adrian [Sun, 10 Jan 2016 17:53:43 +0000 (17:53 +0000)]
Fix the domain iterator to not try the first-touch / fixed domain
more than once when doing round-robin.

This lead to a panic because the iterator was trying the same domain
twice and not trying one of the other domains.

Reported by: pho
Tested by: pho

8 years agoUse setjmp() instead of the identical-except-for-having-a-wrong-prototype
nwhitehorn [Sun, 10 Jan 2016 16:42:14 +0000 (16:42 +0000)]
Use setjmp() instead of the identical-except-for-having-a-wrong-prototype
setfault() when testing for faults. This should also help the compiler
do the right thing with this complicated-to-optimize function.

8 years agosh: Update associated state when restoring locals while leaving a function.
jilles [Sun, 10 Jan 2016 16:31:28 +0000 (16:31 +0000)]
sh: Update associated state when restoring locals while leaving a function.

Some variables like PATH call a function when modified. Make sure to call
this also when leaving a function where such a variable was made local.

Make sure to restore local variables before shellparam, so getopts state is
not clobbered.

8 years agoSplit in6_selectsrc() into in6_selectsrc_addr() and in6_selectsrc_socket().
melifaro [Sun, 10 Jan 2016 13:40:29 +0000 (13:40 +0000)]
Split in6_selectsrc() into in6_selectsrc_addr() and in6_selectsrc_socket().

in6_selectsrc() has 2 class of users: socket-based one (raw/udp/pcb/etc) and
  socket-less (ND code). The main reason for that change is inability to
  specify non-default FIB for callers w/o socket since (internally) inpcb
  is used to determine fib.

As as result, add 2 wrappers for in6_selectsrc() (making in6_selectsrc()
  static):
1) in6_selectsrc_socket() for the former class. Embed scope_ambiguous check
  along with returning hop limit when needed.
2) in6_selectsrc_addr() for the latter case. Add 'fibnum' argument and
  pass IPv6 address  w/ explicitly specified scope as separate argument.

Reviewed by: ae (previous version)

8 years agoDo not hold ifaddr reference for the whole icmp6_reflect() exec time.
melifaro [Sun, 10 Jan 2016 11:59:55 +0000 (11:59 +0000)]
Do not hold ifaddr reference for the whole icmp6_reflect() exec time.

Copy source address, calculate hlim and release refcount instead.

8 years agocommitter-src.dot: Add {adrian,delphij}->me
sephe [Sun, 10 Jan 2016 08:41:01 +0000 (08:41 +0000)]
committer-src.dot: Add {adrian,delphij}->me

Approved by: adrian (mentor)

8 years agoInitialize error value ta_lookup_kfib() by default to please compiler.
melifaro [Sun, 10 Jan 2016 08:37:00 +0000 (08:37 +0000)]
Initialize error value ta_lookup_kfib() by default to please compiler.

8 years agoInitialize error after r293626 in case neither INET nor INET6 is
bz [Sun, 10 Jan 2016 08:14:25 +0000 (08:14 +0000)]
Initialize error after r293626 in case neither INET nor INET6 is
compiled into the kernel.  Ideally lots more code would just not
be called (or compiled in) in that case but that requires a lot
more surgery.  For now try to make IP-less kernels compile again.

8 years agoConvert ipfilter to the new routing KPI.
melifaro [Sun, 10 Jan 2016 07:50:35 +0000 (07:50 +0000)]
Convert ipfilter to the new routing KPI.

Differential Revision: D4764

8 years agoUnlock process lock when return error from getrobustlist call and add
dchagin [Sun, 10 Jan 2016 07:36:43 +0000 (07:36 +0000)]
Unlock process lock when return error from getrobustlist call and add
an forgotten dtrace probe when return the same error.

MFC after: 3 days
XMFC with: r292743

8 years agoMake ipfw addr:kfib lookup algo use new routing KPI.
melifaro [Sun, 10 Jan 2016 06:43:43 +0000 (06:43 +0000)]
Make ipfw addr:kfib lookup algo use new routing KPI.

8 years agoUse already pre-calculated number of entries instead of tc->count.
melifaro [Sun, 10 Jan 2016 00:28:44 +0000 (00:28 +0000)]
Use already pre-calculated number of entries instead of tc->count.

8 years agoRemove Makefile now that the testcases are all TAP based and
ngie [Sat, 9 Jan 2016 23:46:52 +0000 (23:46 +0000)]
Remove Makefile now that the testcases are all TAP based and
prove -rv can be used on them

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

8 years ago- Delete non-TAP testcases
ngie [Sat, 9 Jan 2016 23:45:25 +0000 (23:45 +0000)]
- Delete non-TAP testcases
- Add a conf.sh file for executing common functions with geom_gate
- Use attach_md for attaching md(4) devices
- Don't hardcode /tmp for temporary files, which violates the kyua sandbox
- Add/increase sleeps to try and improve synchronization
- Add debug output for when checksums fail

test-1.t:
- Use pkill for killing ggated

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

8 years agoFix improper duration for f_dialog_pause() API
dteske [Sat, 9 Jan 2016 23:13:43 +0000 (23:13 +0000)]
Fix improper duration for f_dialog_pause() API

MFC after: 3 days
X-MFC-to: stable/10

8 years agortwn: fix sequence number assignment (part of r290630)
avos [Sat, 9 Jan 2016 21:45:21 +0000 (21:45 +0000)]
rtwn: fix sequence number assignment (part of r290630)

Reviewed by: kevlo
Approved by: adrian (mentor)
Differential Revision: https://reviews.freebsd.org/D4819

8 years agoMake graphical consoles work under PowerKVM. Without using hypercalls, it is
nwhitehorn [Sat, 9 Jan 2016 21:28:56 +0000 (21:28 +0000)]
Make graphical consoles work under PowerKVM. Without using hypercalls, it is
not possible to write the framebuffer before pmap is up. Solve this by
deferring initialization until that happens, like on PS3.

MFC after: 1 week

8 years agoImplement vsyscall hack. Prior to 2.13 glibc uses vsyscall
dchagin [Sat, 9 Jan 2016 20:18:53 +0000 (20:18 +0000)]
Implement vsyscall hack. Prior to 2.13 glibc uses vsyscall
instead of vdso. An upcoming linux_base-c6 needs it.

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

Reviewed by: kib, trasz
MFC after: 1 week

8 years agoReturn call to init_zfs_bootenv to its previous location
allanjude [Sat, 9 Jan 2016 19:13:25 +0000 (19:13 +0000)]
Return call to init_zfs_bootenv to its previous location

When called to early, new_currdev->d_type was not yet set
zfs_fmtdev() would then return null

While here, guard call to init_zfs_bootenv with if d_type == DEVT_ZFS

Reported by: tsoome at me.com
MFC after: 3 days
Sponsored by: ScaleEngine Inc.

8 years agoFix userland build broken by r293470.
melifaro [Sat, 9 Jan 2016 18:42:12 +0000 (18:42 +0000)]
Fix userland build broken by r293470.

Pointy hat to: melifaro

8 years agoFinish r275196: do not dereference rtentry in if_output() routines.
melifaro [Sat, 9 Jan 2016 16:34:37 +0000 (16:34 +0000)]
Finish r275196: do not dereference rtentry in if_output() routines.

The only piece of information that is required is rt_flags subset.

In particular, if_loop() requires RTF_REJECT and RTF_BLACKHOLE flags
  to check if this particular mbuf needs to be dropped (and what
  error should be returned).
Note that if_loop() will always return EHOSTUNREACH for "reject" routes
  regardless of RTF_HOST flag existence. This is due to upcoming routing
  changes where RTF_HOST value won't be available as lookup result.

All other functions require RTF_GATEWAY flag to check if they need
  to return EHOSTUNREACH instead of EHOSTDOWN error.

There are 11 places where non-zero 'struct route' is passed to if_output().
For most of the callers (forwarding, bpf, arp) does not care about exact
  error value. In fact, the only place where this result is propagated
  is ip_output(). (ip6_output() passes NULL route to nd6_output_ifp()).

Given that, add 3 new 'struct route' flags (RT_REJECT, RT_BLACKHOLE and
  RT_IS_GW) and inline function (rt_update_ro_flags()) to copy necessary
  rte flags to ro_flags. Call this function in ip_output() after looking up/
  verifying rte.

Reviewed by: ae

8 years ago- Add the definition of CHARCLASS_NAME_MAX, as per POSIX.1-2001.
kevlo [Sat, 9 Jan 2016 14:53:23 +0000 (14:53 +0000)]
- Add the definition of CHARCLASS_NAME_MAX, as per POSIX.1-2001.
- Avoid namespace pollution and move definitions of _POSIX2_CHARCLASS_NAME_MAX
  and _POSIX2_COLL_WEIGHTS_MAX into the .2001 section.
  With input from bde.

Submitted by bde

8 years agoRemove prefix check from in6_addroute().
melifaro [Sat, 9 Jan 2016 11:41:37 +0000 (11:41 +0000)]
Remove prefix check from in6_addroute().

This check was added in initial? netinet6/ import
  back in 1999 (r53541).
It effectively became unnecessary after 'address/prefix clean-ups'
  KAME commit 90ff8792e676132096a440dd787f99a5a5860ee8 (github) in 2001
  (merged to FreeBSD in r78064) where prefix check was added to
  nd6_prefix_onlink(). Similar IPv4 check (in_addroute() was added
  in r137628).
Additionally, the right plance for this (or similar) check is the prefix
  addition code (nd6_prefix_onlink(), nd6_prefix_onlink_rtrequest(),
  in_addprefix() or rtinit()), but not the generic radix insert routine.

8 years agoRemove sys/eventhandler.h from net/route.h
melifaro [Sat, 9 Jan 2016 09:34:39 +0000 (09:34 +0000)]
Remove sys/eventhandler.h from net/route.h

Reviewed by: ae

8 years agoFix version number.
delphij [Sat, 9 Jan 2016 09:33:24 +0000 (09:33 +0000)]
Fix version number.

8 years agoMake tohex() work as expected.
ae [Sat, 9 Jan 2016 08:04:29 +0000 (08:04 +0000)]
Make tohex() work as expected.

8 years agoFix a typo.
ae [Sat, 9 Jan 2016 08:02:35 +0000 (08:02 +0000)]
Fix a typo.

PR: 205722

8 years ago(Temporarily) remove route_redirect_event eventhandler.
melifaro [Sat, 9 Jan 2016 06:26:40 +0000 (06:26 +0000)]
(Temporarily) remove route_redirect_event eventhandler.

Such handler should pass different set of variables, instead
  of directly providing 2 locked route entries.
Given that it hasn't been really used since at least 2012, remove
  current code.
Will re-add it after finishing most major routing-related changes.

Discussed with: np

8 years agoPlease Coverity by removing unneccessary check (rt_key() is always set).
melifaro [Sat, 9 Jan 2016 05:39:06 +0000 (05:39 +0000)]
Please Coverity by removing unneccessary check (rt_key() is always set).

Coverity CID: 1347797

8 years agoRemove hidden "Not ufs" printfs from boot code
smh [Sat, 9 Jan 2016 03:30:33 +0000 (03:30 +0000)]
Remove hidden "Not ufs" printfs from boot code

Remove the printf("Not ufs\n") from the boot code which was hidden by the
local printf implementations, allowing these to have that code removed too.

MFC after: 2 weeks
X-MFC-With: r293268
Sponsored by: Multiplay

8 years agoSwitch EFT boot1 to use libstand
smh [Sat, 9 Jan 2016 03:20:01 +0000 (03:20 +0000)]
Switch EFT boot1 to use libstand

ARM and i386 already required libstand so switch to using it for all
patforms, allowing the removal of custom print and memory methods.

This is also a pre-cursor to enabling WARNS which highlighted a number
of issues with the removed methods.

MFC after: 2 weeks
X-MFC-With: r293268
Sponsored by: Multiplay

8 years agoAdd netmap support for bhyve
gnn [Sat, 9 Jan 2016 03:08:21 +0000 (03:08 +0000)]
Add netmap support for bhyve

Submitted by: btw
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D4826

8 years agoPrevent cv_waiters wraparound.
markj [Sat, 9 Jan 2016 01:56:46 +0000 (01:56 +0000)]
Prevent cv_waiters wraparound.

r282971 attempted to fix this problem by decrementing cv_waiters after
waking up from sleeping on a condition variable, but this can result in
a use-after-free if the CV is freed before all woken threads have had a
chance to run. Instead, avoid incrementing cv_waiters past INT_MAX, and
have cv_signal() explicitly check for sleeping threads once cv_waiters has
reached this bound.

Reviewed by: jhb
MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division
Differential Revision: https://reviews.freebsd.org/D4822

8 years agoOnly call init_zfs_bootenv() when the system was booted with ZFS
allanjude [Sat, 9 Jan 2016 00:54:08 +0000 (00:54 +0000)]
Only call init_zfs_bootenv() when the system was booted with ZFS

Add a few other safeguards to ensure things do not break when the
boot device cannot be determined

Reported by: flo
MFC after: 3 days
Sponsored by: ScaleEngine Inc.

8 years agoRegen after r293450
emaste [Sat, 9 Jan 2016 00:47:01 +0000 (00:47 +0000)]
Regen after r293450

8 years agoSet FORCE_PKG_REGISTER=1 when installing packages to avoid failures
gjb [Sat, 9 Jan 2016 00:45:38 +0000 (00:45 +0000)]
Set FORCE_PKG_REGISTER=1 when installing packages to avoid failures
when re-using build chroot(8) environments.

This is based on the patch in the PR referenced below, but instead
of using 'reinstall' in two locations (one of which already uses
FORCE_PKG_REGISTER=1), changes the non-embedded behavior.

PR: 205998
Submitted by: ngie
MFC after: 5 days
Sponsored by: The FreeBSD Foundation

8 years agoUpdate dependencies.
bdrewery [Sat, 9 Jan 2016 00:43:11 +0000 (00:43 +0000)]
Update dependencies.

Sponsored by: EMC / Isilon Storage Division

8 years agoSupport use of LLVM's libunwind for exception unwinding
emaste [Sat, 9 Jan 2016 00:42:07 +0000 (00:42 +0000)]
Support use of LLVM's libunwind for exception unwinding

It is built in libgcc_s.so and libgcc_eh.a to simplify transition.

It is enabled by default on arm64 (where we previously had no other
unwinder) and may be enabled for testing on other platforms by setting
WITH_LLVM_LIBUNWIND in src.conf(5).

Also add compiler-rt's __gcc_personality_v0 implementation for use with
the LLVM unwinder.

Relnotes: Yes
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D4787

8 years agoChase r292622: Update path to ioctl.c for incremental build hack.
bdrewery [Fri, 8 Jan 2016 22:59:49 +0000 (22:59 +0000)]
Chase r292622: Update path to ioctl.c for incremental build hack.

Sponsored by: EMC / Isilon Storage Division

8 years ago- Move functions that might be used in class-specific cleanup functions
ngie [Fri, 8 Jan 2016 21:47:41 +0000 (21:47 +0000)]
- Move functions that might be used in class-specific cleanup functions
  (geom_test_cleanup, etc) down so the testcases don't emit noise when
  bailing
- Conform to the TAP protocol better when dealing with classes that can't
  be loaded and with temporary files that can't be allocated for tracking
  md(4) devices.

MFC after: 2 weeks
X-MFC with: r293028, r293029, r293048
Sponsored by: EMC / Isilon Storage Division

8 years ago- Make test-1.sh into a TAP testable testcase
ngie [Fri, 8 Jan 2016 21:38:26 +0000 (21:38 +0000)]
- Make test-1.sh into a TAP testable testcase
- Delete test-2.sh as it was an incomplete testcase, and the contents were
  basically a subset of test-1.sh
- Add a conf.sh file for executing common functions with geom_uzip
- Use attach_md for attaching md(4) devices
- Don't hardcode /tmp for temporary files, which violates the kyua sandbox

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

8 years ago- Add a geom_stripe specific cleanup function and trap on that function at
ngie [Fri, 8 Jan 2016 21:28:09 +0000 (21:28 +0000)]
- Add a geom_stripe specific cleanup function and trap on that function at
  exit so things are cleaned up properly
- Use attach_md for attaching md(4) devices
- Don't hardcode /tmp for temporary files, which violates the kyua sandbox

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

8 years ago- Add a geom_shsec specific cleanup function and trap on that function at
ngie [Fri, 8 Jan 2016 21:25:27 +0000 (21:25 +0000)]
- Add a geom_shsec specific cleanup function and trap on that function at
  exit so things are cleaned up properly
- Use attach_md for attaching md(4) devices
- Don't hardcode /tmp for temporary files, which violates the kyua sandbox

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

8 years agoFix upgrading from OSVERSION 1000002-1000032 after r288829.
bdrewery [Fri, 8 Jan 2016 21:07:34 +0000 (21:07 +0000)]
Fix upgrading from OSVERSION 1000002-1000032 after r288829.

r288829 states that lex requires the latest m4, but was not always building it.
Move lex to the same logic as m4 since they are closely tied now.

MFC after: 3 days
Sponsored by: EMC / Isilon Storage Division
Reported by: Slawa Olhovchenkov <slw@zxy.spb.ru>

8 years agoNew sendfile(2) syscall. A joint effort of NGINX and Netflix from 2013 and
glebius [Fri, 8 Jan 2016 20:34:57 +0000 (20:34 +0000)]
New sendfile(2) syscall. A joint effort of NGINX and Netflix from 2013 and
up to now.

The new sendfile is the code that Netflix uses to send their multiple tens
of gigabits of data per second. The new implementation features asynchronous
I/O, when I/O operations are launched, but not awaited to be complete. An
explanation of why such behavior is beneficial compared to old one is
going to be too long for a commit message, so we will skip it here.

Additional features of new syscall are extra flags, which provide an
application more control over data sent. The SF_NOCACHE flag tells
kernel that data shouldn't be cached after it was sent. The SF_READAHEAD()
macro allows to specify readahead size in pages.

The new syscalls is a drop in replacement. No modifications are required
to applications. One can take nginx binary for stable/10 and run it
successfully on head. Although SF_NODISKIO lost its original sense, as now
sendfile doesn't block, and now means something completely different (tm),
using the new sendfile the old way is absolutely safe.

Celebrates: Netflix global launch!
Sponsored by: Nginx, Inc.
Sponsored by: Netflix
Relnotes: yes

8 years ago- Add a geom_raid3 specific cleanup function and trap on that function at
ngie [Fri, 8 Jan 2016 19:47:49 +0000 (19:47 +0000)]
- Add a geom_raid3 specific cleanup function and trap on that function at
  exit so things are cleaned up properly
- Use attach_md for attaching md(4) devices
- Don't hardcode /tmp for temporary files, which violates the kyua sandbox

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

8 years ago- Add a conf.sh file for executing common functions with gnop
ngie [Fri, 8 Jan 2016 19:43:18 +0000 (19:43 +0000)]
- Add a conf.sh file for executing common functions with gnop
- Use attach_md for attaching md(4) devices
- Don't hardcode /tmp for temporary files, which violates the kyua sandbox

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

8 years ago- Add a conf.sh file for executing common functions with geli
ngie [Fri, 8 Jan 2016 19:38:59 +0000 (19:38 +0000)]
- Add a conf.sh file for executing common functions with geli
-- Use linear probing to find the first unique md(4) device, unlike the other
   code which uses attach_md, as geli(8) allocates the md(4) devices itself
- Don't hardcode /tmp for temporary files, which violates the kyua sandbox

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

8 years agoReduce libstand Makefile duplication
emaste [Fri, 8 Jan 2016 19:12:26 +0000 (19:12 +0000)]
Reduce libstand Makefile duplication

Userboot's copy of the libstand Makefile had more extensive changes
compared to the one in sys/boot/libstand32, but it turns out these are
not intentional and we can just include lib/libstand/Makefile as done
for libstand32 in r293040.

Reviewed by: imp, jhb
Tested by: allanjude
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D4793

8 years ago- Use attach_md for memory disks so they can be tracked.
ngie [Fri, 8 Jan 2016 19:10:52 +0000 (19:10 +0000)]
- Use attach_md for memory disks so they can be tracked.
- Add a geom_concat specific cleanup function and trap on that function at
  exit so things are cleaned up properly
- Don't hardcode /tmp for temporary files, which violates the kyua sandbox

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

8 years agoMake it possible for sbappend() to preserve M_NOTREADY on mbufs, just like
glebius [Fri, 8 Jan 2016 19:03:20 +0000 (19:03 +0000)]
Make it possible for sbappend() to preserve M_NOTREADY on mbufs, just like
sbappendstream() does. Although, M_NOTREADY may appear only on SOCK_STREAM
sockets, due to sendfile(2) supporting only the latter, there is a corner
case of AF_UNIX/SOCK_STREAM socket, that still uses records for the sake
of control data, albeit being stream socket.

Provide private version of m_clrprotoflags(), which understands PRUS_NOTREADY,
similar to m_demote().

8 years agoAvoid unintended $FreeBSD$ expansion in generate-fat.sh
emaste [Fri, 8 Jan 2016 17:33:34 +0000 (17:33 +0000)]
Avoid unintended $FreeBSD$ expansion in generate-fat.sh

8 years agoRevert r293405: it breaks socket buffer INVARIANTS when sending control
glebius [Fri, 8 Jan 2016 17:27:23 +0000 (17:27 +0000)]
Revert r293405: it breaks socket buffer INVARIANTS when sending control
data over local sockets.

8 years agoAdd safety belt for boot1.efi file size
emaste [Fri, 8 Jan 2016 16:37:22 +0000 (16:37 +0000)]
Add safety belt for boot1.efi file size

Reviewed by: smh
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D4833

8 years agoDo more fine-grained locking in rtrequest1_fib().
melifaro [Fri, 8 Jan 2016 16:25:11 +0000 (16:25 +0000)]
Do more fine-grained locking in rtrequest1_fib().

Last consumer using RTF_RNH_LOCKED flag was eliminated in r291643.
Restrict passing RTF_RNH_LOCKED to rtrequest1_fib() and do better
  locking for RTM_ADD / RTM_DELETE cases.

8 years agoMFV r293415:
delphij [Fri, 8 Jan 2016 15:53:48 +0000 (15:53 +0000)]
MFV r293415:

ntp 4.2.8p5

Reviewed by: cy, roberto
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D4828

8 years agoUpdate generated efi boot image templates
smh [Fri, 8 Jan 2016 13:58:36 +0000 (13:58 +0000)]
Update generated efi boot image templates

r279533 increased the boot1 size from 64k to 128k but didn't regenerate the
fat templates, hence the change was never activated.

With recent and upcoming changes the efi boot1 binary is now > 64k.

To avoid fat corruption in the created boot images regenerate the
templates to activate the boot1 size increase.

MFC after: 2 weeks
X-MFC-With: r293268

8 years agoFix issues found by mandoc -Tlint.
brueffer [Fri, 8 Jan 2016 13:33:22 +0000 (13:33 +0000)]
Fix issues found by mandoc -Tlint.

MFC after: 1 week

8 years agoLinuxKPI style changes:
hselasky [Fri, 8 Jan 2016 10:04:19 +0000 (10:04 +0000)]
LinuxKPI style changes:
- Properly prefix internal functions with "linux_" instead of only a
  single underscore to avoid future namespace collisions.
- Make some functions global instead of inline to ease debugging and
  to avoid unnecessary code duplication.
- Remove no longer existing kthread_create() function's prototype.

MFC after: 1 week
Sponsored by: Mellanox Technologies

8 years agoVendor import of ntp-4.2.8p5.
delphij [Fri, 8 Jan 2016 08:06:14 +0000 (08:06 +0000)]
Vendor import of ntp-4.2.8p5.

8 years agoAdd support for ZFS Boot Environments to userboot (for bhyve and others)
allanjude [Fri, 8 Jan 2016 05:09:55 +0000 (05:09 +0000)]
Add support for ZFS Boot Environments to userboot (for bhyve and others)

While here, also fix a possible null pointer

Reported by: lattera
MFC after: 3 days
Sponsored by: ScaleEngine Inc.

8 years agoFor SOCK_STREAM socket use sbappendstream() instead of sbappend().
glebius [Fri, 8 Jan 2016 01:16:03 +0000 (01:16 +0000)]
For SOCK_STREAM socket use sbappendstream() instead of sbappend().

8 years agoRevert r293201, r293202 (rtld: populate DT_DEBUG iff DYNAMIC segment is writable)
emaste [Fri, 8 Jan 2016 00:56:41 +0000 (00:56 +0000)]
Revert r293201, r293202 (rtld: populate DT_DEBUG iff DYNAMIC segment is writable)

It turns out MIPS binaries may have other oddities that can trigger a
fault at startup.

PR: 206017
Reported by: ray

8 years agoMake sure that the /set directive gets put at the top of the file,
imp [Fri, 8 Jan 2016 00:05:47 +0000 (00:05 +0000)]
Make sure that the /set directive gets put at the top of the file,
instead of in sort order. Slash sorts after period.

8 years agoSetup /pkg as a spot for pkg to operate. This is for testing purposes
imp [Fri, 8 Jan 2016 00:05:28 +0000 (00:05 +0000)]
Setup /pkg as a spot for pkg to operate. This is for testing purposes
only. You need to remount / rw and export TMPDIR=/pkg/tmp. pkg will
then work. It's slow though: 15 minutes to pkg install git on an RPi 2
with a decently fast SD card. Since this is for testing, we set
DEFAULT_ALWAYS_YES and ASSUME_ALWAYS_YES to YES.

8 years agosh: Reduce size of options table.
jilles [Thu, 7 Jan 2016 23:13:20 +0000 (23:13 +0000)]
sh: Reduce size of options table.

8 years agoioat(4): Add ioat_acquire_reserve() KPI
cem [Thu, 7 Jan 2016 23:02:15 +0000 (23:02 +0000)]
ioat(4): Add ioat_acquire_reserve() KPI

ioat_acquire_reserve() is an extended version of ioat_acquire().  It
allows users to reserve space in the channel for some number of
descriptors.  If this succeeds, it guarantees that at least submission
of N valid descriptors will succeed.

Sponsored by: EMC / Isilon Storage Division

8 years agoBump copyright (forgotten part of r293340)
dteske [Thu, 7 Jan 2016 22:13:17 +0000 (22:13 +0000)]
Bump copyright (forgotten part of r293340)

MFC after: 3 days
X-MFC-to: stable/10
X-MFC-with: r293340

8 years agosh: Add a test for 'cd -'.
jilles [Thu, 7 Jan 2016 21:46:07 +0000 (21:46 +0000)]
sh: Add a test for 'cd -'.

Redirect 'cd -' output to /dev/null since POSIX requires it to write the new
directory name even if not interactive, but we currently only write it if
interactive.

8 years agoext2fs: reading mmaped file in Ext4 causes panic
pfg [Thu, 7 Jan 2016 21:43:43 +0000 (21:43 +0000)]
ext2fs: reading mmaped file in Ext4 causes panic

Always call brelse(path.ep_bp), fixing reading EXT4 files using mmap().

Patch by Damjan Jovanovic.

PR: 205938
MFC after: 1 week

8 years agoismt: fix ISMT_DESC_ADDR_RW macro
jimharris [Thu, 7 Jan 2016 21:16:44 +0000 (21:16 +0000)]
ismt: fix ISMT_DESC_ADDR_RW macro

Submitted by: Masanobu SAITOH <msaitoh@netbsd.org>
MFC after: 3 days

8 years agoAllow libnv to be built externally using GCC.
bdrewery [Thu, 7 Jan 2016 20:52:35 +0000 (20:52 +0000)]
Allow libnv to be built externally using GCC.

GCC does not define _VA_LIST_DECLARED.  It defines _VA_LIST_ and others.
This was causing the prototype to not be defined and leading to an error
later due to using nvlist_add_stringv(3) without a prototype in
nvlist_add_stringf(3).

This uses the same check as other va_list prototypes in the original
change in r279438.

8 years agosh: Ensure OPTIND=1 in subshell without forking does not affect outer env.
jilles [Thu, 7 Jan 2016 20:48:24 +0000 (20:48 +0000)]
sh: Ensure OPTIND=1 in subshell without forking does not affect outer env.

Command substitutions containing a single simple command and here-document
expansion are performed in a subshell environment, but may not fork. Any
modified state of the shell environment should be restored afterward.

The state that OPTIND=1 had been done was not saved and restored here.

Note that the other parts of shellparam need not be saved and restored,
since they are not modified in these situations (a fork is done before such
modifications).

8 years agoObsolete inetd related files when WITHOUT_INETD is set
garga [Thu, 7 Jan 2016 20:37:18 +0000 (20:37 +0000)]
Obsolete inetd related files when WITHOUT_INETD is set

Reviewed by: bapt
Approved by: gnn
MFC after: 1 week
Sponsored by: Rubiconn Communications (Netgate)
Differential Revision: https://reviews.freebsd.org/D4742

8 years agonvme: replace NVME_CEILING macro with howmany()
jimharris [Thu, 7 Jan 2016 20:35:26 +0000 (20:35 +0000)]
nvme: replace NVME_CEILING macro with howmany()

Suggested by: rpokala
MFC after: 3 days

8 years agonvme: add hw.nvme.min_cpus_per_ioq tunable
jimharris [Thu, 7 Jan 2016 20:32:04 +0000 (20:32 +0000)]
nvme: add hw.nvme.min_cpus_per_ioq tunable

Due to FreeBSD system-wide limits on number of MSI-X vectors
(https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=199321),
it may be desirable to allocate fewer than the maximum number
of vectors for an NVMe device, in order to save vectors for
other devices (usually Ethernet) that can take better
advantage of them and may be probed after NVMe.

This tunable is expressed in terms of minimum number of CPUs
per I/O queue instead of max number of queues per controller,
to allow for a more even distribution of CPUs per queue.  This
avoids cases where some number of CPUs have a dedicated queue,
but other CPUs need to share queues.  Ideally the PR referenced
above will eventually be fixed and the mechanism implemented
here becomes obsolete anyways.

While here, fix a bug in the CPUs per I/O queue calculation to
properly account for the admin queue's MSI-X vector.

Reviewed by: gallatin
MFC after: 3 days
Sponsored by: Intel

8 years agoConvert sys/cam to use make_dev_s().
kib [Thu, 7 Jan 2016 20:22:55 +0000 (20:22 +0000)]
Convert sys/cam to use make_dev_s().

Reviewed by: hps, jhb
Sponsored by: The FreeBSD Foundation
MFC after: 3 weeks
Differential revision: https://reviews.freebsd.org/D4746

8 years agoConvert tty common code to use make_dev_s().
kib [Thu, 7 Jan 2016 20:15:09 +0000 (20:15 +0000)]
Convert tty common code to use make_dev_s().

Tty.c was untypical in that it handled the si_drv1 issue consistently
and correctly, by always checking for si_drv1 being non-NULL and
sleeping if NULL.  The removed code also illustrated unneeded
complications in drivers which are eliminated by the use of new KPI.

Reviewed by: hps, jhb
Discussed with: bde
Sponsored by: The FreeBSD Foundation
MFC after: 3 weeks
Differential revision: https://reviews.freebsd.org/D4746

8 years agoProvide yet another KPI for cdev creation, make_dev_s(9).
kib [Thu, 7 Jan 2016 20:08:02 +0000 (20:08 +0000)]
Provide yet another KPI for cdev creation, make_dev_s(9).

Immediate problem fixed by the new KPI is the long-standing race
between device creation and assignments to cdev->si_drv1 and
cdev->si_drv2, which allows the window where cdevsw methods might be
called with si_drv1,2 fields not yet set.  Devices typically checked
for NULL and returned spurious errors to usermode, and often left some
methods unchecked.

The new function interface is designed to be extensible, which should
allow to add more features to make_dev_s(9) without inventing yet
another name for function to create devices, while maintaining KPI and
even KBI backward-compatibility.

Reviewed by: hps, jhb
Sponsored by: The FreeBSD Foundation
MFC after: 3 weeks
Differential revision: https://reviews.freebsd.org/D4746

8 years agoDIRDEPS_BUILD: Update dependencies.
bdrewery [Thu, 7 Jan 2016 19:58:23 +0000 (19:58 +0000)]
DIRDEPS_BUILD: Update dependencies.

Sponsored by: EMC / Isilon Storage Division

8 years agoMove amd64 metadata.h to x86 and share with i386
emaste [Thu, 7 Jan 2016 19:47:26 +0000 (19:47 +0000)]
Move amd64 metadata.h to x86 and share with i386

MFC after: 1 week

8 years agoAlways try to upgrade to bmake if not already using it.
bdrewery [Thu, 7 Jan 2016 19:37:11 +0000 (19:37 +0000)]
Always try to upgrade to bmake if not already using it.

This is mostly targetting stable/10 which requires bmake to build and
has issues upgrading from <10.

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

8 years agoDon't install /usr/include/stand.h twice after r293040.
bdrewery [Thu, 7 Jan 2016 19:19:23 +0000 (19:19 +0000)]
Don't install /usr/include/stand.h twice after r293040.

Only install it from lib/libstand.

Sponsored by: EMC / Isilon Storage Division

8 years agoIncrease maximum buffer size for `-x cmd' value
dteske [Thu, 7 Jan 2016 18:50:02 +0000 (18:50 +0000)]
Increase maximum buffer size for `-x cmd' value

MFC after: 3 days
X-MFC-to: stable/10

8 years agonet80211 drivers: fix ieee80211_init_channels() usage
avos [Thu, 7 Jan 2016 18:41:03 +0000 (18:41 +0000)]
net80211 drivers: fix ieee80211_init_channels() usage

Fix out-of-bounds read (all) / write (11n capable) for drivers
that are using ieee80211_init_channels() to initialize channel list.

Tested with:
 * RTL8188EU, STA mode.
 * RTL8188CUS, STA mode.
 * WUSB54GC, HOSTAP mode.

Approved by: adrian (mentor)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D4818

8 years agoFix VF handling of VLANs.
sbruno [Thu, 7 Jan 2016 18:34:56 +0000 (18:34 +0000)]
Fix VF handling of VLANs.

This helps immensily with our ability to operate in the Amazon Cloud.

Discussed on Intel Networking Community call this morning.

Submitted by: Jarrod Petz(petz@nisshoko.net)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D4788

8 years agoFixup SFP module insertion on the 82599 when insertion happens after
sbruno [Thu, 7 Jan 2016 17:02:34 +0000 (17:02 +0000)]
Fixup SFP module insertion on the 82599 when insertion happens after
the system is booted and running.

Add PHY detection logic to ixgbe_handle_mod() and add locking to
ixgbe_handle_msf() as well.

PR: 150251
Submitted by: aboyer@averesystems.com
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D3188

8 years agoDisable the reuse of checksum offload context descriptors in the case
sbruno [Thu, 7 Jan 2016 16:48:47 +0000 (16:48 +0000)]
Disable the reuse of checksum offload context descriptors in the case
of multiple queues in em(4).  Document errata in the code.

MFC after: 2 weeks
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D3995

8 years agoSwitch em(4) to the extended RX descriptor format. This matches the
sbruno [Thu, 7 Jan 2016 16:42:48 +0000 (16:42 +0000)]
Switch em(4) to the extended RX descriptor format.  This matches the
e1000/e1000e split in linux.

Split rxbuffer and txbuffer apart to support the new RX descriptor format
structures. Move rxbuffer manipulation to em_setup_rxdesc() to unify the
new behavior changes.

Add a RSSKEYLEN macro for help in generating the RSSKEY data structures
in the card.

Change em_receive_checksum() to process the new rxdescriptor format
status bit.

MFC after: 2 weeks
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D3447

8 years agoWow, um ... sorry about that. The commit log for this code should have
sbruno [Thu, 7 Jan 2016 16:24:18 +0000 (16:24 +0000)]
Wow, um ... sorry about that.  The commit log for this code should have
read that it was for EM_MULTIQUEUE.  Revert this and try again.

8 years agoSwitch em(4) to the extended RX descriptor format. This matches the
sbruno [Thu, 7 Jan 2016 16:20:55 +0000 (16:20 +0000)]
Switch em(4) to the extended RX descriptor format.  This matches the
e1000/e1000e split in linux.

MFC after: 2 weeks
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D3447

8 years agonvme: do not revert o single I/O queue when per-CPU queues not possible
jimharris [Thu, 7 Jan 2016 16:18:32 +0000 (16:18 +0000)]
nvme: do not revert o single I/O queue when per-CPU queues not possible

Previously nvme(4) would revert to a signle I/O queue if it could not
allocate enought interrupt vectors or NVMe submission/completion queues
to have one I/O queue per core.  This patch determines how to utilize a
smaller number of available interrupt vectors, and assigns (as closely
as possible) an equal number of cores to each associated I/O queue.

MFC after: 3 days
Sponsored by: Intel

8 years agonvme: break out interrupt setup code into a separate function
jimharris [Thu, 7 Jan 2016 16:12:42 +0000 (16:12 +0000)]
nvme: break out interrupt setup code into a separate function

MFC after: 3 days
Sponsored by: Intel

8 years agonvme: do not pre-allocate MSI-X IRQ resources
jimharris [Thu, 7 Jan 2016 16:11:31 +0000 (16:11 +0000)]
nvme: do not pre-allocate MSI-X IRQ resources

The issue referenced here was resolved by other changes
in recent commits, so this code is no longer needed.

MFC after: 3 days
Sponsored by: Intel

8 years agonvme: remove per_cpu_io_queues from struct nvme_controller
jimharris [Thu, 7 Jan 2016 16:09:56 +0000 (16:09 +0000)]
nvme: remove per_cpu_io_queues from struct nvme_controller

Instead just use num_io_queues to make this determination.

This prepares for some future changes enabling use of multiple
queues when we do not have enough queues or MSI-X vectors
for one queue per CPU.

MFC after: 3 days
Sponsored by: Intel

8 years agonvme: simplify some of the nested ifs in interrupt setup code
jimharris [Thu, 7 Jan 2016 16:08:04 +0000 (16:08 +0000)]
nvme: simplify some of the nested ifs in interrupt setup code

This prepares for some follow-up commits which do more work in
this area.

MFC after: 3 days
Sponsored by: Intel

8 years agonvd: submit bios directly when BIO_ORDERED not set or in flight
jimharris [Thu, 7 Jan 2016 16:06:23 +0000 (16:06 +0000)]
nvd: submit bios directly when BIO_ORDERED not set or in flight

This significantly improves parallelism in the most common case.
The taskqueue is still used whenever BIO_ORDERED bios are in flight.

This patch is based heavily on a patch from gallatin@.

MFC after: 3 days
Sponsored by: Intel

8 years agonvd: break out submission logic into separate function
jimharris [Thu, 7 Jan 2016 15:59:51 +0000 (15:59 +0000)]
nvd: break out submission logic into separate function

This enables a future patch using this same logic to submit
I/O directly bypassing the taskqueue.

MFC after: 3 days
Sponsored by: Intel

8 years agonvd: skip BIO_ORDERED logic when bio fails submission
jimharris [Thu, 7 Jan 2016 15:58:44 +0000 (15:58 +0000)]
nvd: skip BIO_ORDERED logic when bio fails submission

This ensures the bio flags are not read after biodone().
The ordering will still be enforced, after the bio is
submitted successfully.

MFC after: 3 days
Sponsored by: Intel