23 hours agoImprove check for whether ${DESTDIR}/dev is mounted. master github/master
cperciva [Mon, 30 Mar 2015 09:08:24 +0000 (09:08 +0000)]
Improve check for whether ${DESTDIR}/dev is mounted.

Submitted by: gcooper

23 hours agoAdd some additional quirks for various Western Digital Caviar MHDDs
eadler [Mon, 30 Mar 2015 09:05:20 +0000 (09:05 +0000)]
Add some additional quirks for various Western Digital Caviar MHDDs

Submitted by: Jeremy Chadwick
PR: 188685
MFC After: 1 month

23 hours agoAnd it turns out someone beat me to it....
eadler [Mon, 30 Mar 2015 08:54:59 +0000 (08:54 +0000)]
And it turns out someone beat me to it....

PR: 199013

23 hours agoAdd support for "MosChip MCS9922 PCIe to Peripheral Controller" to uart
eadler [Mon, 30 Mar 2015 08:48:35 +0000 (08:48 +0000)]
Add support for "MosChip MCS9922 PCIe to Peripheral Controller" to uart

Submitted by: <>
PR: 199013
MFC After: 1 month

23 hours agoRemove support for CPU_FA626TE. It's unused by any of our kernel configs.
andrew [Mon, 30 Mar 2015 08:38:18 +0000 (08:38 +0000)]
Remove support for CPU_FA626TE. It's unused by any of our kernel configs.

23 hours agoOnly build cpufunc_asm_armv4.S when needed.
andrew [Mon, 30 Mar 2015 08:37:03 +0000 (08:37 +0000)]
Only build cpufunc_asm_armv4.S when needed.

23 hours agoClean up filesystem unmounting in vmimage builds:
cperciva [Mon, 30 Mar 2015 08:33:19 +0000 (08:33 +0000)]
Clean up filesystem unmounting in vmimage builds:
* Remove vm_umount_base function which is currently unused.
* Add umount_loop function which loops attempting to unmount one filesystem.
* Replace calls to umount with calls to umount_loop.
* Don't attempt to unmount ${DESTDIR}/dev if it isn't mounted.

The looping is necessary because sometimes umount fails due to filesystems
being busy.  The most common cause of such busyness is periodic(8) jobs
running `find / ...`.

Reviewed by: gjb

25 hours agoxen: add a handler for the debug interrupt
royger [Mon, 30 Mar 2015 07:09:07 +0000 (07:09 +0000)]
xen: add a handler for the debug interrupt

Handle the VIRQ_DEBUG signal and print a stack trace of each vCPU on the Xen
console. This is only used for debug purposes and is triggered by the
administrator of the Xen host.

Sponsored by: Citrix Systems R&D
MFC after: 1 week

28 hours agoFix ping(8) and ping6(8) usage in a couple of ip provider tests, and
markj [Mon, 30 Mar 2015 04:06:36 +0000 (04:06 +0000)]
Fix ping(8) and ping6(8) usage in a couple of ip provider tests, and
update expected test output to reflect differences in default TTL and
payload length.

MFC after: 1 week

28 hours agoFix ping(8) usage in funcs/tst.system.d so that the test actually completes.
markj [Mon, 30 Mar 2015 04:03:01 +0000 (04:03 +0000)]
Fix ping(8) usage in funcs/tst.system.d so that the test actually completes.

MFC after: 1 week

28 hours agoReplace, the upstream DTrace test suite harness, with a shell
markj [Mon, 30 Mar 2015 04:01:49 +0000 (04:01 +0000)]
Replace, the upstream DTrace test suite harness, with a shell
script. This reimplementation is much simpler than and is more
amenable to being run under Kyua - writes error output to a
temporary directory that is deleted when the run finishes, making it hard
to debug test failures. This change also removes the test suite's dependency
on perl.

28 hours agoImport a missing piece of commit b8fac8e162eda7e98d from illumos-gate.
markj [Mon, 30 Mar 2015 03:55:51 +0000 (03:55 +0000)]
Import a missing piece of commit b8fac8e162eda7e98d from illumos-gate.

This adds an upper bound, dtrace_ustackdepth_max, to the number of frames
traversed when computing the userland stack depth. Some programs - notably
firefox - are otherwise able to trigger an infinite loop in
dtrace_getustack_common(), causing a panic.

MFC after: 1 week

33 hours agoarm11_sleep is no longer needed, remove it.
andrew [Sun, 29 Mar 2015 22:46:07 +0000 (22:46 +0000)]
arm11_sleep is no longer needed, remove it.

33 hours agopj4b_config and pj4bv7_setup are only used when CPU_MV_PJ4B is defined.
andrew [Sun, 29 Mar 2015 22:45:33 +0000 (22:45 +0000)]
pj4b_config and pj4bv7_setup are only used when CPU_MV_PJ4B is defined.

33 hours agoBuild the cpufunc_asm_* files based on the cpu type, not which config file
andrew [Sun, 29 Mar 2015 22:43:39 +0000 (22:43 +0000)]
Build the cpufunc_asm_* files based on the cpu type, not which config file
we happen to be building.

34 hours agowordexp(): Add testcase for non-default IFS in environment.
jilles [Sun, 29 Mar 2015 22:00:24 +0000 (22:00 +0000)]
wordexp(): Add testcase for non-default IFS in environment.

The non-default IFS is expected to be used.

MFC after: 1 week

34 hours agoAdd initial support for the HAL channel survey support to the AR9300 HAL.
adrian [Sun, 29 Mar 2015 21:53:08 +0000 (21:53 +0000)]
Add initial support for the HAL channel survey support to the AR9300 HAL.

This is used by the 'athsurvey' command to print out channel survey
statistics - % busy times transmit, receive and airtime.

It's as buggy and incomplete as the rest of the HAL survey support -
notably, tying into the ANI code to read channel stats and occasionally
getting garbage counters isn't very nice.  It also doesn't (yet!) get
channel survey information during a scan.  But it's good enough for
basic air-time debugging, which is why I'm committing it in this state.


* AR9380, STA mode

34 hours agoMove the HAL channel survey support out to be in the top-level HAL,
adrian [Sun, 29 Mar 2015 21:50:21 +0000 (21:50 +0000)]
Move the HAL channel survey support out to be in the top-level HAL,
rathe than private in each HAL module.

Whilst here, modify ath_hal_private to always have the per-channel
noisefloor stats, rather than conditionally.  This just makes
life easier in general (no strange ABI differences between different
HAL compile options.)

Add a couple of methods (clear/reset, add) rather than using
hand-rolled versions of things.

34 hours agoAdd a new field to HAL_ANISTATS - the extension channel busy count.
adrian [Sun, 29 Mar 2015 21:45:48 +0000 (21:45 +0000)]
Add a new field to HAL_ANISTATS - the extension channel busy count.

This is only used by the AR9300 HAL for now - but just be careful if
you decide to recompile the kernel with NO_CLEAN=1.

34 hours agoRemove cpufunc_asm_arm11.S from the ARMv7 configs, it's not used.
andrew [Sun, 29 Mar 2015 21:45:28 +0000 (21:45 +0000)]
Remove cpufunc_asm_arm11.S from the ARMv7 configs, it's not used.

34 hours agoFix more ticks wrapping bugs exposed by the ticks wrapping bug check.
adrian [Sun, 29 Mar 2015 21:41:05 +0000 (21:41 +0000)]
Fix more ticks wrapping bugs exposed by the ticks wrapping bug check.

This symptom is "calibrations don't ever run", which may cause some
pretty spectacularly bad behaviour in noisy environments or with longer

Thanks to dtrace to make it easy to check if specific non-inlined functions
are getting called by things like the ANI and calibration HAL methods.


* AR9380, STA mode

35 hours agoRemove arm1136 support. We don't have any configs that use it, and I don't
andrew [Sun, 29 Mar 2015 21:12:59 +0000 (21:12 +0000)]
Remove arm1136 support. We don't have any configs that use it, and I don't
expect us to add support for any more arm11 SoCs.

35 hours agoRemove the bootconfig parsing. We never used it and always passed either an
andrew [Sun, 29 Mar 2015 20:37:28 +0000 (20:37 +0000)]
Remove the bootconfig parsing. We never used it and always passed either an
empty string or NULL to the setup functions that called into it.

36 hours agoSome cosmetic polishing. No functional change.
mav [Sun, 29 Mar 2015 20:28:18 +0000 (20:28 +0000)]
Some cosmetic polishing.  No functional change.

MFC after: 1 week

36 hours agoWe only need cpufunc_asm_arm11.S on bcm2835, not bcm2836
andrew [Sun, 29 Mar 2015 20:21:59 +0000 (20:21 +0000)]
We only need cpufunc_asm_arm11.S on bcm2835, not bcm2836

36 hours agoClean some spaces vs tabs.
pfg [Sun, 29 Mar 2015 20:20:45 +0000 (20:20 +0000)]
Clean some spaces vs tabs.

No, this file doesn't conform with KNF at all.

36 hours agoFormatting changes to the pthread_testcancel(3).
kib [Sun, 29 Mar 2015 19:37:41 +0000 (19:37 +0000)]
Formatting changes to the pthread_testcancel(3).

Use list for the cancellation points enumeration.  Move notes about
functions into the list inline.

The discussion of the idiomatic use of cancellation facilities does
not belong to RETURN VALUES section, move it to NOTES.

Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

37 hours agoMake kevent(2) a cancellation point.
kib [Sun, 29 Mar 2015 19:14:41 +0000 (19:14 +0000)]
Make kevent(2) a cancellation point.

Note that to cancel blocked kevent(2) call, changelist must be empty,
since we cannot cancel a call which already made changes to the
process state.  And in reverse, call which only makes changes to the
kqueue state, without waiting for an event, is not cancellable.  This
makes a natural usage model to migrate kqueue loop to support
cancellation, where existing single kevent(2) call must be split into
two: first uncancellable update of kqueue, then cancellable wait for

Note that this is ABI-incompatible change, but it is believed that
there is no cancel-safe code that relies on kevent(2) not being a
cancellation point.  Option to preserve the ABI would be to keep
kevent(2) as is, but add new call with flags to specify cancellation
behaviour, which only value seems to add complications.

Suggested and reviewed by: jilles
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

37 hours agoRemove ARM9_CACHE_WRITE_THROUGH, none of our configs define it.
andrew [Sun, 29 Mar 2015 18:59:04 +0000 (18:59 +0000)]
Remove ARM9_CACHE_WRITE_THROUGH, none of our configs define it.

37 hours agoChange compiler setting to make default visibility of the symbols for
kib [Sun, 29 Mar 2015 18:53:21 +0000 (18:53 +0000)]
Change compiler setting to make default visibility of the symbols for
rtld on x86 to be hidden.  This is a micro-optimization, which allows
intrinsic references inside rtld to be handled without indirection
through PLT.  The visibility of rtld symbols for other objects in the
symbol namespace is controlled by a version script.

Reviewed by: kan, jilles
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

37 hours agoRemove the unused armv5 cpufunc code.
andrew [Sun, 29 Mar 2015 18:46:12 +0000 (18:46 +0000)]
Remove the unused armv5 cpufunc code.

37 hours agodrm: Import Linux commit 9bc3cd5673d84d29272fa7181a4dfca83cbb48c1
dumbbell [Sun, 29 Mar 2015 18:45:51 +0000 (18:45 +0000)]
drm: Import Linux commit 9bc3cd5673d84d29272fa7181a4dfca83cbb48c1

Author: Ville Syrjälä <>
Date:   Fri May 31 12:17:08 2013 +0000

    drm: Sort connector modes based on vrefresh

    Keeping the modes sorted by vrefresh before the pixel clock makes the
    mode list somehow more pleasing to the eye.

Signed-off-by: Ville Syrjälä <>
Reviewed-by: Alex Deucher <>
Signed-off-by: Dave Airlie <>
PR: 198936
Obtained from: Linux
MFC after: 1 month
MFC with: r280183

37 hours agoRemove unused cpufunc arm11 and armv6 code. While here only define the
andrew [Sun, 29 Mar 2015 18:44:15 +0000 (18:44 +0000)]
Remove unused cpufunc arm11 and armv6 code. While here only define the
remaining functions in the context we use them in.

37 hours agoWe don't use cpufunc_asm_armv5.S in any of these configs, remove it.
andrew [Sun, 29 Mar 2015 18:41:43 +0000 (18:41 +0000)]
We don't use cpufunc_asm_armv5.S in any of these configs, remove it.

38 hours agoRemove unused arm10_* functions. The remaining functions are only used in
andrew [Sun, 29 Mar 2015 17:42:32 +0000 (17:42 +0000)]
Remove unused arm10_* functions. The remaining functions are only used in
mv configs.

38 hours agoStop building unused cpuvunc_* files, we don't need anything from these.
andrew [Sun, 29 Mar 2015 17:33:03 +0000 (17:33 +0000)]
Stop building unused cpuvunc_* files, we don't need anything from these.

39 hours agoRemove support for CPU_ARM10. No kernel configs could possibly use this as
andrew [Sun, 29 Mar 2015 17:13:44 +0000 (17:13 +0000)]
Remove support for CPU_ARM10. No kernel configs could possibly use this as
it's not an available option. Along with this we will never support this
cpu type as very few arm10 chips were made.

40 hours agoReorder to help with moving the efi loader parts to sys/boot/efi. As these
andrew [Sun, 29 Mar 2015 15:43:24 +0000 (15:43 +0000)]
Reorder to help with moving the efi loader parts to sys/boot/efi. As these
will depend on ficl having been built, and are set via we
need to place this after ficl.

As Makefile.amd64 is now late enough we can add the i386 directory to this.

41 hours agosfxge: fix bug in TSO when a DMA segment has both header and data
arybchik [Sun, 29 Mar 2015 15:18:04 +0000 (15:18 +0000)]
sfxge: fix bug in TSO when a DMA segment has both header and data

Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision:

46 hours agoAdd four new DDB commands to display vmem(9) statistics.
mav [Sun, 29 Mar 2015 10:02:29 +0000 (10:02 +0000)]
Add four new DDB commands to display vmem(9) statistics.

In particular, such DDB commands were added:
        show vmem <addr>
        show all vmem
        show vmemdump <addr>
        show all vmemdump

As possible usage, that allows to see KVA usage and fragmentation.

2 days agoFix a long-standing bug with the early MAC address initialisation path,
adrian [Sun, 29 Mar 2015 06:05:00 +0000 (06:05 +0000)]
Fix a long-standing bug with the early MAC address initialisation path,
which showed up after I started changing addresses this early.

It turns out that there's some other malarky going on behind the scenes
in the HAL and merely setting the net80211/ifp mac address this early
isn't enough.  If the MAC is set from kenv at attach time, the HAL
also needs to be programmed early.

Without this, the VAP wouldn't work enough for finishing association -
probe requests would be fine as they're broadcast, but association
request would fail.

2 days agocdefs.h: Fix macros for pre-C99 compilers.
pfg [Sun, 29 Mar 2015 03:16:52 +0000 (03:16 +0000)]
cdefs.h: Fix macros for pre-C99 compilers.

Older compilers, and compatibility modes, may not support variadic macros.
I normally wouldn't go out of my way to support those old compilers but
there is a prescendent in other system headers for using the same macro
multiple times, and the solution (although non-elegant IMHO) works.

Requested by: bde
Solution by: tijl

2 days agoAdd hints to set the board MAC address and derived values for each interface.
adrian [Sat, 28 Mar 2015 23:42:59 +0000 (23:42 +0000)]
Add hints to set the board MAC address and derived values for each interface.

This allows the TL-WDR3600 to use the correct MAC address for ath0, ath1
and arge0.  arge1 isn't used; until I disable it entirely it'll just
show up with a randomly generated MAC.

2 days agoUpdate if_ath(4) to check for "hint.ath.X.macaddr" for an override MAC address.
adrian [Sat, 28 Mar 2015 23:41:23 +0000 (23:41 +0000)]
Update if_ath(4) to check for "hint.ath.X.macaddr" for an override MAC address.

This is used by the AR71xx platform code to choose a local MAC based on
the "board MAC address", versus whatever potentially invalid/garbage
values are stored in the Atheros calibration data.

2 days agoBegin moving support for board MAC addresses over to being explicitly defined.
adrian [Sat, 28 Mar 2015 23:40:29 +0000 (23:40 +0000)]
Begin moving support for board MAC addresses over to being explicitly defined.

A lot of these dinky atheros based MIPS boards don't have a nice, well,
anything consistent defining their MAC addresses for things.

The Atheros reference design boards will happily put MAC addresses
into the wifi module calibration data like they should, and individual
ethernet MAC addresses into the calibration area in flash.
That makes my life easy - "hint.arge.X.eeprommac=<addr>" reads from
that flash address to extract a MAC, and everything works fine.

However, aside from some very well behaved vendors (eg the Carambola 2
board), everyone else does something odd.


* a MAC address in the environment (eg ubiquiti routerstation/RSPRO)
   that you derive arge0/arge1 MAC addresses from.
* a MAC address in flash that you derive arge0/arge1 MAC addresses from.
* The wifi devices having their own MAC addresses in calibration data,
  like normal.
* The wifi devices having a fixed, default or garbage value for a MAC
  address in calibration data, and it has to be derived from the
  system MAC.

So to support this complete nonsense of a situation, there needs to be
a few hacks:

* The "board" MAC address needs to be derived from somewhere and squirreled
  away.  For now it's either redboot or a MAC address stored in calibration

* Then, a "map" set of hints to populate kenv with some MAC addresses
  that are derived/local, based on the board address.  Each board has
  a totally different idea of what you do to derive things, so each
  map entry has an "offset" (+ve or -ve) that's added to the board
  MAC address.

* Then if_arge (and later, if_ath) should check kenv for said hint and
  if it's found, use that rather than the EEPROM MAC address - which may
  be totally garbage and not actually work right.

In order to do this, I've undone some of the custom redboot expecting
hacks in if_arge and the stuff that magically adds one to the MAC
address supplied by the board - instead, as I continue to test this
out on more hardware, I'll update the hints file with a map explaining
(a) where the board MAC should come from, and (b) what offsets to use
for each device.

The aim is to have all of the tplink, dlink and other random hardware
we run on have valid MAC addresses at boot, so (a) people don't get
random B:S:D:x:x:x ethernet MACs, and (b) the wifi MAC is valid
so it works rather than trying to use an invalid address that
actually upsets systems (think: multicast bit set in BSSID.)


* TP-Link TL_WDR3600 - subsequent commits will add the hints map
  and the if_ath support.


* Since this is -HEAD, and I'm all for debugging, there's a lot of
  printf()s in here.  They'll eventually go under bootverbose.
* I'd like to turn the macaddr routines into something available
  to all drivers - too many places hand-roll random MAC addresses
  and parser stuff.  I'd rather it just be shared code.
  However, that'll require more formal review.
* More boards.

2 days agoMake debug.vmem_check a tunable. It is useful to set it early.
kib [Sat, 28 Mar 2015 23:30:51 +0000 (23:30 +0000)]
Make debug.vmem_check a tunable.  It is useful to set it early.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 days agoTurns out the AR933x looks like the AR7240/AR7241 switch as far as VLAN
adrian [Sat, 28 Mar 2015 23:20:46 +0000 (23:20 +0000)]
Turns out the AR933x looks like the AR7240/AR7241 switch as far as VLAN
configuration is concerned.

So, remove the now-erroneous comment.


* AR9331 - Carambola2, with transmitting dot1q tagged packets around.

2 days agoRemove the second MODULES_OVERRIDE; add if_vlan to the list.
adrian [Sat, 28 Mar 2015 23:01:59 +0000 (23:01 +0000)]
Remove the second MODULES_OVERRIDE; add if_vlan to the list.

2 days agoWrap #ifdef guards around pmap_bootstrap ap. It's only used in SMP, and
jhibbits [Sat, 28 Mar 2015 21:39:42 +0000 (21:39 +0000)]
Wrap #ifdef guards around pmap_bootstrap ap.  It's only used in SMP, and
building without SMP causes a build failure.

MFC after: 1 month

2 days agopmcstat.8: fix -a flag description; improve -m flag to match
vangyzen [Sat, 28 Mar 2015 21:28:22 +0000 (21:28 +0000)]
pmcstat.8: fix -a flag description; improve -m flag to match

The -a flag reads a file saved by -O, not -o.

The -m flag requires the -R flag.  Copy that paragraph from -a.

Reviewed by: adrian
Approved by: kib (mentor)
MFC after: 1 week
Sponsored by: Dell Inc

2 days agoClean up some cosmetic nits in kern_umtx.c, found during recent work
vangyzen [Sat, 28 Mar 2015 21:21:40 +0000 (21:21 +0000)]
Clean up some cosmetic nits in kern_umtx.c, found during recent work
in this area and by the Clang static analyzer.

Remove some dead assignments.

Fix a typo in a panic string.

Use umtx_pi_disown() instead of duplicate code.

Use an existing variable instead of curthread.

Approved by: kib (mentor)
MFC after: 3 days
Sponsored by: Dell Inc

2 days agoAdd the MAC address hints for arge0/arge1 on the CARAMBOLA2.
adrian [Sat, 28 Mar 2015 19:59:33 +0000 (19:59 +0000)]
Add the MAC address hints for arge0/arge1 on the CARAMBOLA2.

Obtained from: Linux OpenWRT

2 days agoRemove all the handcrafted assembly in hwpmc_armv7.c and use the
bz [Sat, 28 Mar 2015 18:57:13 +0000 (18:57 +0000)]
Remove all the handcrafted assembly in hwpmc_armv7.c and use the
common (autogenerated) versions.   Removes extra vertical space,
and makes it easier to grep for usage throughout the tree.
Conditionally compile only for arm6 [1] (yes sounds odd but is right).

Submitted by: andrew [1]
Reviewed by: gnn, andrew (ian earlier version I think)
Differential Revision:
Obtained from: Cambridge/L41
Sponsored by: DARPA, AFRL

2 days agoImport lldb r233478: Fix build failure on Freebsd with gcc 4.9.
emaste [Sat, 28 Mar 2015 18:29:13 +0000 (18:29 +0000)]
Import lldb r233478: Fix build failure on Freebsd with gcc 4.9.

Submitted by: rodrigc

2 days agoVNETalize random IP ID engine.
glebius [Sat, 28 Mar 2015 16:59:57 +0000 (16:59 +0000)]
VNETalize random IP ID engine.

Sponsored by: Nginx, Inc.

2 days agoInitialize random IP ID engine via SYSINIT() instead of doing that on
glebius [Sat, 28 Mar 2015 16:06:46 +0000 (16:06 +0000)]
Initialize random IP ID engine via SYSINIT() instead of doing that on
first packet.  This allow to use M_WAITOK and cut down some error handling.

Sponsored by: Nginx, Inc.

2 days agoTry to unbreak !SMP kernels broken in r280785 by using the proper macros
bz [Sat, 28 Mar 2015 15:07:19 +0000 (15:07 +0000)]
Try to unbreak !SMP kernels  broken in r280785 by using the proper macros
to access cc_cpu.

2 days agoChange the callout to supply -1 to indicate we are not changing
rrs [Sat, 28 Mar 2015 12:50:24 +0000 (12:50 +0000)]
Change the callout to supply -1 to indicate we are not changing
CPU, also add protection against invalid CPU's as well as
split c_flags and c_iflags so that if a user plays with the active
flag (the one expected to be played with by callers in MPSAFE) without
a lock, it won't adversely affect the callout system by causing a corrupt
list. This also means that all callers need to use the macros and *not*
play with the falgs directly (like netgraph used to).

Differential Revision: htts://
Reviewed by: .. timed out but looked at by jhb, imp, adrian hselasky
             tested by hiren and netflix.
Sponsored by: Netflix Inc.

2 days agoRe-enable using -mllvm -enable-load-pre=false in CLANG_OPT_SMALL for
dim [Sat, 28 Mar 2015 12:23:15 +0000 (12:23 +0000)]
Re-enable using -mllvm -enable-load-pre=false in CLANG_OPT_SMALL for
clang versions before 3.5.0.  This should enable building head's version
of sys/boot/i386/boot2 on 9.x and 10.x again.

Reported by: bz

2 days agosfxge: set correct RSS hash type instead of opaque
arybchik [Sat, 28 Mar 2015 10:20:20 +0000 (10:20 +0000)]
sfxge: set correct RSS hash type instead of opaque

Reviewed by:    adrian, gnn
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:

2 days agoAdd an SCTP symbol which was missed in
tuexen [Sat, 28 Mar 2015 09:08:57 +0000 (09:08 +0000)]
Add an SCTP symbol which was missed in
This fixes
Thanks to Jukka Ukkonen for reporting the bug and providing a fix.

MFC after: 3 days

2 days agoMake it possible for the signal handler to act on #ss. Load the
kib [Sat, 28 Mar 2015 09:03:54 +0000 (09:03 +0000)]
Make it possible for the signal handler to act on #ss.  Load the
canonical user data segment' selector into %ss when calling the

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 days agoThe #ss fault handler erronously does not check for the fault
kib [Sat, 28 Mar 2015 09:02:19 +0000 (09:02 +0000)]
The #ss fault handler erronously does not check for the fault
originated from the return to usermode. #ss must be handled same as

Reported by: Andrew Lutomirski through secteam
Sponsored by: The FreeBSD Foundation
MFC after: 3 days

3 days agoSet VM_KMEM_SIZE_SCALE=1 for the AR91xx SoCs.
adrian [Sat, 28 Mar 2015 06:54:18 +0000 (06:54 +0000)]
Set VM_KMEM_SIZE_SCALE=1 for the AR91xx SoCs.

Without this the autotuning fails for small amounts of RAM (32mb),
which all the AR91xx shipping products seemed to have.

Thanks to gjb for reminding me to re-test this stuff.


* AR91xx, TP-Link TL-WR1043nd v1

3 days agoFix the RTC device model to operate correctly in 12-hour mode. The following
neel [Sat, 28 Mar 2015 02:55:16 +0000 (02:55 +0000)]
Fix the RTC device model to operate correctly in 12-hour mode. The following
table documents the values in the RTC 'hour' field in the two modes:

Hour-of-the-day 12-hour mode 24-hour mode
12 AM 12 0
[1-11] AM [1-11] [1-11]
12 PM 0x80 | 12 12
[1-11] PM 0x80 | [1-11] [13-23]

Reported by: Julian Hsiao (
MFC after: 1 week

3 days ago - Eliminate pagequeue locking in the dirty code in vm_pageout_scan().
jeff [Sat, 28 Mar 2015 02:36:49 +0000 (02:36 +0000)]
 - Eliminate pagequeue locking in the dirty code in vm_pageout_scan().
 - Use a more precise series of tests to see if the page changed while we
   were locking the vnode.

Reviewed by: alc
Sponsored by: EMC / Isilon

3 days agotcp provider tests: sleep for a bit after closing the socket so that
markj [Sat, 28 Mar 2015 01:11:18 +0000 (01:11 +0000)]
tcp provider tests: sleep for a bit after closing the socket so that
libdtrace has a chance to capture the traced data.

MFC after: 1 week

3 days agoMake simplebus a base class of ofwbus. This allows the elimination of
ian [Fri, 27 Mar 2015 23:10:15 +0000 (23:10 +0000)]
Make simplebus a base class of ofwbus.  This allows the elimination of
duplicated code in the two classes, and also allows devices in FDT-based
systems to declare simplebus as their parent and still work correctly
when the FDT data describes the device at the root of the tree rather
than as a child of a simplebus (which is common for interrupt, clock,
and power controllers).

Differential Revision:
Submitted by: Michal Meloun

3 days agoRevert the __ALWAYS_NO stuff. It had already been committed as BROKEN.
imp [Fri, 27 Mar 2015 21:47:15 +0000 (21:47 +0000)]
Revert the __ALWAYS_NO stuff. It had already been committed as BROKEN.

3 days agolldb: Move debug register output into __amd64__
emaste [Fri, 27 Mar 2015 19:42:38 +0000 (19:42 +0000)]
lldb: Move debug register output into __amd64__

This debug register diagnostic is really only applicable to amd64 at

Sponsored by: The FreeBSD Foundation

3 days agocrunchide: arm64 support
emaste [Fri, 27 Mar 2015 19:34:24 +0000 (19:34 +0000)]
crunchide: arm64 support

Submitted by: andrew@
Sponsored by: The FreeBSD Foundation

3 days agoFix variable casting:
hselasky [Fri, 27 Mar 2015 19:08:11 +0000 (19:08 +0000)]
Fix variable casting:
- Jiffies or ticks in FreeBSD have integer type and are not long.

MFC after: 1 week
Sponsored by: Mellanox Technologies

3 days agoFix remaining warnings.
delphij [Fri, 27 Mar 2015 18:23:06 +0000 (18:23 +0000)]
Fix remaining warnings.

MFC after: 2 weeks

3 days agoAdd a note of clarification. MK_* variables only control what modules
imp [Fri, 27 Mar 2015 17:36:22 +0000 (17:36 +0000)]
Add a note of clarification. MK_* variables only control what modules
are built by default. You can still override that with MODULES_EXTRA
for experimental features like ZFS and dtrace on some
architectures. Also note that kernel config files are not affected by
MK_ options listed, though some targets might be.

3 days agoMention support for 16h family processors, added in r263169.
brueffer [Fri, 27 Mar 2015 17:15:17 +0000 (17:15 +0000)]
Mention support for 16h family processors, added in r263169.

PR: 198933
Submitted by:
MFC after: 1 week

3 days agoFixes for the LinuxAPI completion wrappers:
hselasky [Fri, 27 Mar 2015 16:16:23 +0000 (16:16 +0000)]
Fixes for the LinuxAPI completion wrappers:
- make sure the timeout computations are always above zero by using
the existing "linux_timer_jiffies_until()" function. Negative timeouts
can result in undefined behaviour.
- declare all completion functions like external symbols and move the
code to the LinuxAPI kernel module.
- add a proper prefix to all LinuxAPI kernel functions to avoid
namespace collision with other parts of the FreeBSD kernel.
- clean up header file inclusions in the linux/completion.h, linux/in.h
and linux/fs.h header files.

MFC after: 1 week
Sponsored by: Mellanox Technologies

3 days agoFix build (with gcc).
kib [Fri, 27 Mar 2015 15:49:21 +0000 (15:49 +0000)]
Fix build (with gcc).

Reported by: bz, ian
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

3 days agoRemove ALPHA leftover
emaste [Fri, 27 Mar 2015 14:40:58 +0000 (14:40 +0000)]
Remove ALPHA leftover

3 days agoFix the hand after the immediate reboot when the following command
kib [Fri, 27 Mar 2015 13:55:56 +0000 (13:55 +0000)]
Fix the hand after the immediate reboot when the following command
sequence is performed on UFS SU+J rootfs:
cp -Rp /sbin/init /sbin/init.old
mv -f /sbin/init.old /sbin/init

Hang occurs on the rootfs unmount.  There are two issues:

1. Removed init binary, which is still mapped, creates a reference to
the removed vnode. The inodeblock for such vnode must have active
inodedep, which is (eventually) linked through the unlinked list. This
means that ffs_sync(MNT_SUSPEND) cannot succeed, because number of
softdep workitems for the mp is always > 0.  FFS is suspended during
unmount, so unmount just hangs.

2. As noted above, the inodedep is linked eventually.  It is not
linked until the superblock is written.  But at the vfs_unmountall()
time, when the rootfs is unmounted, the call is made to
ffs_unmount()->ffs_sync() before vflush(), and ffs_sync() only calls
ffs_sbupdate() after all workitems are flushed.  It is masked for
normal system operations, because syncer works in parallel and
eventually flushes superblock.  Syncer is stopped when rootfs
unmounted, so ffs_sync() must do sb update on its own.

Correct the issues listed above. For MNT_SUSPEND, count the number of
linked unlinked inodedeps (this is not a typo) and substract the count
of such workitems from the total. For the second issue, the
ffs_sbupdate() is called right after device sync in ffs_sync() loop.

There is third problem, occuring with both SU and SU+J. The
softdep_waitidle() loop, which waits for softdep_flush() thread to
clear the worklist, only waits 20ms max. It seems that the 1 tick,
specified for msleep(9), was a typo.

Add fsync(devvp, MNT_WAIT) call to softdep_waitidle(), which seems to
significantly help the softdep thread, and change the MNT_LAZY update
at the reboot time to MNT_WAIT for similar reasons.  Note that
userspace cannot create more work while devvp is flushed, since the
mount point is always suspended before the call to softdep_waitidle()
in unmount or remount path.

PR: 195458
In collaboration with: gjb, pho
Reviewed by: mckusick
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

3 days agoOn multi CPU systems, we may emit successive packets with the same id.
fabient [Fri, 27 Mar 2015 13:26:59 +0000 (13:26 +0000)]
On multi CPU systems, we may emit successive packets with the same id.
Fix the race by using an atomic operation.

Differential Revision:
Obtained from:
MFC after: 1 week
Sponsored by: Stormshield

3 days agoRemove extra semicolon.
mav [Fri, 27 Mar 2015 12:45:20 +0000 (12:45 +0000)]
Remove extra semicolon.

MFC after: 1 week

3 days agoRemove request sorting from GEOM_MIRROR and GEOM_RAID.
mav [Fri, 27 Mar 2015 12:44:28 +0000 (12:44 +0000)]
Remove request sorting from GEOM_MIRROR and GEOM_RAID.

When CPU is not busy, those queues are typically empty.  When CPU is busy,
then one more extra sorting is the last thing it needs.  If specific device
(HDD) really needs sorting, then it will be done later by CAM.

This supposed to fix livelock reported for mirror of two SSDs, when UFS
fires zillion of BIO_DELETE requests, that totally blocks I/O subsystem by
pointless sorting of requests and responses under single mutex lock.

MFC after: 2 weeks

3 days agoFix bug on memory allocation error in split method.
mav [Fri, 27 Mar 2015 11:14:12 +0000 (11:14 +0000)]
Fix bug on memory allocation error in split method.

While there, use bioq_takefirst() in place where it is convenient.

MFC after: 1 week

3 days agoRather than defining our own magic checks here use INKERNEL() for
bz [Fri, 27 Mar 2015 08:47:16 +0000 (08:47 +0000)]
Rather than defining our own magic checks here use INKERNEL() for
the PMC_IN_KERNEL() macro definition.

Add missing macros to extract the return address (LR) from the trapframe.

Discussed with: andrew
Obtained from: Cambridge/L41
Sponsored by: DARPA, AFRL
MFC after: 2 weeks

4 days agosym and cxgb build on arm, add them to the build.
imp [Fri, 27 Mar 2015 02:35:33 +0000 (02:35 +0000)]
sym and cxgb build on arm, add them to the build.

Differential Revision:

4 days agoCategorize certain kernel builds as being broken in certain places.
imp [Fri, 27 Mar 2015 02:35:25 +0000 (02:35 +0000)]
Categorize certain kernel builds as being broken in certain places.

Differential Revision:

4 days agoAdd support for specifying unsupported / broken options that override
imp [Fri, 27 Mar 2015 02:35:11 +0000 (02:35 +0000)]
Add support for specifying unsupported / broken options that override
any defaults or user specified actions on the command line. This would
be useful for specifying features that are always broken or that
cannot make sense on a specific architecture, like ACPI on pc98 or
EISA on !i386 (!x86 usage of EISA is broken and there's no supported
hardware that could have it in any event). Any items in
__ALWAYS_NO_OPTIONS are forced to "no" regardless of other settings.

Differential Revision:

4 days agoFix __size_alloc()
pfg [Fri, 27 Mar 2015 02:01:22 +0000 (02:01 +0000)]
Fix __size_alloc()

Use underscore for the attributes name: this should fix the use of the
attributes in macros for lint(1).

Suggested by: bde

X-MFC with: r280700

4 days agoMove legacy interrupt allocation for virtio devices to common code.
grehan [Fri, 27 Mar 2015 01:58:44 +0000 (01:58 +0000)]
Move legacy interrupt allocation for virtio devices to common code.
There are a number of assumptions about legacy interrupts always
being available in virtio so don't allow back-ends to make the
decision to support them.

This fixes the issue seen with virtio-rnd on OpenBSD. MSI-x vectors
were not being used, and the virtio-rnd backend wasn't allocating a
legacy interrupt resulting in a bhyve assert and guest exit.

Reported by: Julian Hsiao, madoka at nyanisore dot net
Reviewed by: neel
MFC after: 1 week

4 days agoAllow additional flags to be passed to netstat -i in the daily status check.
jhb [Fri, 27 Mar 2015 00:37:41 +0000 (00:37 +0000)]
Allow additional flags to be passed to netstat -i in the daily status check.
In particular, this allows an administrator to specify "-h" for human
readable output if that is preferred.

The default setting passes "-d", so that can be excluded by using a custom

Differential Revision:
Submitted by: Lystopad Aleksandr <>
(patch to add option for -h)
Reviewed by: bz
MFC after: 1 week

4 days agoFix a possible mbuf leak on interface departure.
ae [Thu, 26 Mar 2015 23:40:22 +0000 (23:40 +0000)]
Fix a possible mbuf leak on interface departure.

Reported by: Alexandre Martins

4 days agoAdd --sysroot to the compiler flags for clang or gcc external toolchains
rodrigc [Thu, 26 Mar 2015 23:37:03 +0000 (23:37 +0000)]
Add --sysroot to the compiler flags for clang or gcc external toolchains

Before this fix, --sysroot was only added to the compiler flags if a clang
external toolchain was used.

Reviewed by:   imp

4 days ago - Correct type for checkAgainst.
delphij [Thu, 26 Mar 2015 22:34:27 +0000 (22:34 +0000)]
 - Correct type for checkAgainst.
 - Staticify flags that are not used outside the file scope.

PR: bin/193471
Submitted by: Robert Sprowson <webpages>
MFC after: 2 weeks

4 days agoImprove the selection of the destination address of SACK chunks.
tuexen [Thu, 26 Mar 2015 22:05:31 +0000 (22:05 +0000)]
Improve the selection of the destination address of SACK chunks.
This fixes
and is joint work with rrs@.

MFC after: 1 week

4 days agosetmode(): Use sysctl kern.proc.umask instead of umask() if possible.
jilles [Thu, 26 Mar 2015 21:58:06 +0000 (21:58 +0000)]
setmode(): Use sysctl kern.proc.umask instead of umask() if possible.

The kern.proc.umask.<pid> sysctl allows querying the umask without
temporarily modifying it.

4 days agoNew pmap code for armv6. Disabled by default, option ARM_NEW_PMAP enables it.
ian [Thu, 26 Mar 2015 21:13:53 +0000 (21:13 +0000)]
New pmap code for armv6. Disabled by default, option ARM_NEW_PMAP enables it.

This is pretty much a complete rewrite based on the existing i386 code.  The
patches have been circulating for a couple years and have been looked at by
plenty of people, but I'm not putting anybody on the hook as having reviewed
this in any formal sense except myself.

After this has gotten wider testing from the user community, ARM_NEW_PMAP
will become the default and various dregs of the old pmap code will be

Submitted by: Svatopluk Kraus <>,
   Michal Meloun <>

4 days agoAdd more arm64 machine dependent headers. With this we now have the minimum
andrew [Thu, 26 Mar 2015 21:10:42 +0000 (21:10 +0000)]
Add more arm64 machine dependent headers. With this we now have the minimum
set of machine headers needed to build the userland toolchain.

Differential Revision:
Reviewed by: imp
Sponsored by: The FreeBSD Foundation

4 days agoPer Gleb, add the pmcstudy.1.gz which was moved to pmcstudy.8.gz
rrs [Thu, 26 Mar 2015 20:08:25 +0000 (20:08 +0000)]
Per Gleb, add the pmcstudy.1.gz which was moved to pmcstudy.8.gz

4 days agoUse pmap_mapdev()/unmapdev() to temporarily map on-chip sram while copying
ian [Thu, 26 Mar 2015 19:33:07 +0000 (19:33 +0000)]
Use pmap_mapdev()/unmapdev() to temporarily map on-chip sram while copying
the startup trampoline code.  The old code allocated a kva page, mapped it
using using pmap_kenter_nocache(), then freed the kva without destroying
the mapping.  This is the only use of pmap_kenter_nocache() in the system,
so redoing this one use of allows it to be garbage collected in the
near future.

4 days agocxgbe(4): provide the exact RSS hash type instead of a catch-all value
np [Thu, 26 Mar 2015 18:45:51 +0000 (18:45 +0000)]
cxgbe(4): provide the exact RSS hash type instead of a catch-all value
to the upper layers.