]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agoUpgrade Unbound to 1.6.1. More to follow.
des [Sat, 12 May 2018 14:04:48 +0000 (14:04 +0000)]
Upgrade Unbound to 1.6.1.  More to follow.

6 years agoUpgrade Unbound to 1.6.1. More to follow.
des [Sat, 12 May 2018 14:04:30 +0000 (14:04 +0000)]
Upgrade Unbound to 1.6.1.  More to follow.

6 years agoaw_mmc: Rework regulator handling
manu [Sat, 12 May 2018 13:14:01 +0000 (13:14 +0000)]
aw_mmc: Rework regulator handling

Don't enable regulator on attach but dealt with them on power_up/power_off
Only set the voltage for the signaling regulator since I don't have boards
that can change the supply voltage.
Enable 1.8v signaling voltage.

6 years agoaw_mmc: Do not fully init the controller in attach
manu [Sat, 12 May 2018 13:13:34 +0000 (13:13 +0000)]
aw_mmc: Do not fully init the controller in attach

Only do a reset of the controller at attach and init it at power_up.
We use to enable some interrupts in reset, only enable the interrupts
we are interested in when doing a request.
While here remove the regulators handling in power_on as it is very wrong
and will be dealt with in another commit.

Tested on: A31, A64

6 years agoaw_mmc: Remove hardware reset
manu [Sat, 12 May 2018 13:12:59 +0000 (13:12 +0000)]
aw_mmc: Remove hardware reset

From all the BSP (Board Source Package) source that I've looked at it seems
that it's never done, remove it.

Tested On: A31, A64

6 years agoaw_mmc: Read interrupt register value before writing to it
manu [Sat, 12 May 2018 13:12:26 +0000 (13:12 +0000)]
aw_mmc: Read interrupt register value before writing to it

Reported by: jmcneill

6 years agoUpgrade Unbound to 1.6.0. More to follow.
des [Sat, 12 May 2018 12:57:34 +0000 (12:57 +0000)]
Upgrade Unbound to 1.6.0.  More to follow.

6 years agoUpgrade LDNS to 1.7.0.
des [Sat, 12 May 2018 12:00:18 +0000 (12:00 +0000)]
Upgrade LDNS to 1.7.0.

I've been holding back on this because 1.7.0 requires OpenSSL 1.1.0 or
newer for full DANE support.  But we can't wait forever, and nothing in
base uses DANE anyway, so here we go.

6 years agoAdd a test for vm86(2), simple to use and diagnose.
kib [Sat, 12 May 2018 11:53:49 +0000 (11:53 +0000)]
Add a test for vm86(2), simple to use and diagnose.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

6 years agoVendor import of Unbound 1.6.1.
des [Sat, 12 May 2018 11:49:30 +0000 (11:49 +0000)]
Vendor import of Unbound 1.6.1.

6 years agoKernel entry from vm86 mode, where PCB_VM86CALL pcb flag is not set,
kib [Sat, 12 May 2018 11:06:59 +0000 (11:06 +0000)]
Kernel entry from vm86 mode, where PCB_VM86CALL pcb flag is not set,
is executed on the right stack already.  No copy from the entry stack
to the kstack must be performed for vm86 bios call code to function.

To access the pcb flags on kernel entry, unconditionally switch to
kernel address space if vm86 mode is detected.

This fixes very early vm86 bios calls, typically done when boot is
performed by boot2 without loader, and kernel falls back to BIOS calls
to get SMAP.

Reported by: bde
Sponsored by: The FreeBSD Foundation

6 years agoOn return from exception or interrupt, returns to vm86 mode with
kib [Sat, 12 May 2018 11:02:39 +0000 (11:02 +0000)]
On return from exception or interrupt, returns to vm86 mode with
PCB_VM86CALL pcb flag not set should be treated same as return to
userspace.

Most important, the address space must be switched.  This fixes
usermode vm86 operations after the 4/4 split.

Sponsored by: The FreeBSD Foundation

6 years agoInitialize tramp_idleptd during cold pmap startup, before the
kib [Sat, 12 May 2018 10:57:34 +0000 (10:57 +0000)]
Initialize tramp_idleptd during cold pmap startup, before the
exception code is copied to the trampoline.

The correct value is then copied to trampoline automatically, so
tramp_idleptd_reloced can be eliminated.

This will allow to use the same exception entry code to handle traps
from vm86 bios calls on early boot stage, as after the trampoline is
configured.

Sponsored by: The FreeBSD Foundation

6 years agoCreate a macro for PIC code which loads %cr3 from tramp_idleptd.
kib [Sat, 12 May 2018 10:51:50 +0000 (10:51 +0000)]
Create a macro for PIC code which loads %cr3 from tramp_idleptd.

Sponsored by: The FreeBSD Foundation

6 years agoFix use of the custom TSS on i386 after the 4/4 split.
kib [Sat, 12 May 2018 10:48:53 +0000 (10:48 +0000)]
Fix use of the custom TSS on i386 after the 4/4 split.

Record common_tssd, the descriptor to be written in GDT to point to
the common TSS, before LTR is executed.  The LTR instruction sets the
loaded descriptor type to 386 TSS busy, which traps on reloads.

Sponsored by: The FreeBSD Foundation

6 years agoPROC_PDEATHSIG_CTL will appear first in 11.2.
kib [Sat, 12 May 2018 10:11:33 +0000 (10:11 +0000)]
PROC_PDEATHSIG_CTL will appear first in 11.2.

Submitted by: Thomas Munro
MFC after: 3 days
Differential revision: https://reviews.freebsd.org/D15399

6 years agoRemove the ability to generate long since useless SSH1 RSA keys.
des [Sat, 12 May 2018 08:23:17 +0000 (08:23 +0000)]
Remove the ability to generate long since useless SSH1 RSA keys.

6 years agodwatch(1): Refactor sendrecv profile
dteske [Sat, 12 May 2018 06:23:30 +0000 (06:23 +0000)]
dwatch(1): Refactor sendrecv profile

The profile for send(2)/recv(2) observation has been refactored to
eliminate alloca() in favor of translations available in HEAD.

Sponsored by: Smule, Inc.

6 years agodwatch(1): Expose process for ip/tcp/udp
dteske [Sat, 12 May 2018 06:18:15 +0000 (06:18 +0000)]
dwatch(1): Expose process for ip/tcp/udp

Knowing the value of execname during these probes is of some value even
if it is commonly the interrupt kernel thread (intr[12]) -- quite often
it is not, but that depends on the probe.

Sponsored by: Smule, Inc.

6 years agodwatch(1): Allow `-E code' to override profile EVENT_DETAILS
dteske [Sat, 12 May 2018 06:01:41 +0000 (06:01 +0000)]
dwatch(1): Allow `-E code' to override profile EVENT_DETAILS

This allows quick changes to the formatted output of a profile.

Sponsored by: Smule, Inc.

6 years agodwatch(1): Export ARGV to profiles loaded via load_profile()
dteske [Sat, 12 May 2018 05:49:31 +0000 (05:49 +0000)]
dwatch(1): Export ARGV to profiles loaded via load_profile()

A module that wishes to post-process the output needs to know which
arguments were passed in order to re-execute a child in a pipe-chain.
Further, the expansion of ARGV needs to be such that items are escaped
properly.

Sponsored by: Smule, Inc.

6 years agodwatch(1): Simplify info message test
dteske [Sat, 12 May 2018 05:43:47 +0000 (05:43 +0000)]
dwatch(1): Simplify info message test

The info() function already tests $QUIET

Sponsored by: Smule, Inc.

6 years agodwatch(1): Separate default values so `-[BK] num' don't affect usage
dteske [Sat, 12 May 2018 05:41:28 +0000 (05:41 +0000)]
dwatch(1): Separate default values so `-[BK] num' don't affect usage

If you were to pass an invalid option after `-B num' or `-K num' you
would see that the usage statement would show the value you passed
instead of the actual default.

Moving the default values to separate variables that are unaffected
by the options-parsing allows the usage statement to correctly show
the hard-coded default values if no flags are used.

Sponsored by: Smule, Inc.

6 years agodwatch(1): Bugfix, usage displayed with `-1Q'
dteske [Sat, 12 May 2018 05:36:47 +0000 (05:36 +0000)]
dwatch(1): Bugfix, usage displayed with `-1Q'

A return statement should have been an exit in list_profiles().
If the user passed `-Q' to list profiles and asked for one-line
per profile (`-1'), list_profiles() would not exit as should.

Sponsored by: Smule, Inc.

6 years agohwpmc(9): clear remaining sample work for hardclock
mmacy [Sat, 12 May 2018 03:45:30 +0000 (03:45 +0000)]
hwpmc(9): clear remaining sample work for hardclock

- fix last minute change in 333509 where by runcount references
  to a pmc would remaining causing us to pause loop forever

Approved by: sbruno

6 years agoRemove extra copy of bcopy.c now that we're using the libkern version
imp [Sat, 12 May 2018 01:43:32 +0000 (01:43 +0000)]
Remove extra copy of bcopy.c now that we're using the libkern version
of this file.

6 years agohwpmc(9): Make pmclog buffer pcpu and update constants
mmacy [Sat, 12 May 2018 01:26:34 +0000 (01:26 +0000)]
hwpmc(9): Make pmclog buffer pcpu and update constants

On non-trivial SMP systems the contention on the pmc_owner mutex leads
to a substantial number of samples captured being from the pmc process
itself. This change a) makes buffers larger to avoid contention on the
global list b) makes the working sample buffer per cpu.

Run pmcstat in the background (default event rate of 64k):
pmcstat -S UNHALTED_CORE_CYCLES -O /dev/null sleep 600 &

Before:
make -j96 buildkernel -s >&/dev/null 3336.68s user 24684.10s system 7442% cpu 6:16.50 total

After:
make -j96 buildkernel -s >&/dev/null 2697.82s user 1347.35s system 6058% cpu 1:06.77 total

For more realistic overhead measurement set the sample rate for ~2khz
on a 2.1Ghz processor:
pmcstat -n 1050000 -S UNHALTED_CORE_CYCLES -O /dev/null sleep 6000 &

Collecting 10 samples of `make -j96 buildkernel` from each:

x before
+ after

real time:
    N           Min           Max        Median           Avg        Stddev
x  10          76.4        127.62        84.845        88.577     15.100031
+  10         59.71         60.79        60.135        60.179    0.29957192
Difference at 95.0% confidence
        -28.398 +/- 10.0344
        -32.0602% +/- 7.69825%
        (Student's t, pooled s = 10.6794)

system time:
    N           Min           Max        Median           Avg        Stddev
x  10       2277.96       6948.53       2949.47      3341.492     1385.2677
+  10        1038.7       1081.06      1070.555      1064.017      15.85404
Difference at 95.0% confidence
        -2277.47 +/- 920.425
        -68.1574% +/- 8.77623%
        (Student's t, pooled s = 979.596)

x no pmc
+ pmc running
real time:

HEAD:
    N           Min           Max        Median           Avg        Stddev
x  10         58.38         59.15         58.86        58.847    0.22504567
+  10          76.4        127.62        84.845        88.577     15.100031
Difference at 95.0% confidence
        29.73 +/- 10.0335
        50.5208% +/- 17.0525%
        (Student's t, pooled s = 10.6785)

patched:
    N           Min           Max        Median           Avg        Stddev
x  10         58.38         59.15         58.86        58.847    0.22504567
+  10         59.71         60.79        60.135        60.179    0.29957192
Difference at 95.0% confidence
        1.332 +/- 0.248939
        2.2635% +/- 0.426506%
        (Student's t, pooled s = 0.264942)

system time:

HEAD:
    N           Min           Max        Median           Avg        Stddev
x  10       1010.15       1073.31      1025.465      1031.524     18.135705
+  10       2277.96       6948.53       2949.47      3341.492     1385.2677
Difference at 95.0% confidence
        2309.97 +/- 920.443
        223.937% +/- 89.3039%
        (Student's t, pooled s = 979.616)

patched:
    N           Min           Max        Median           Avg        Stddev
x  10       1010.15       1073.31      1025.465      1031.524     18.135705
+  10        1038.7       1081.06      1070.555      1064.017      15.85404
Difference at 95.0% confidence
        32.493 +/- 16.0042
        3.15% +/- 1.5794%
        (Student's t, pooled s = 17.0331)

Reviewed by: jeff@
Approved by: sbruno@
Differential Revision: https://reviews.freebsd.org/D15155

6 years agoAdd support for the TestStateID operation to the NFSv4.1 server.
rmacklem [Fri, 11 May 2018 22:16:23 +0000 (22:16 +0000)]
Add support for the TestStateID operation to the NFSv4.1 server.

The Linux client now uses the TestStateID operation, so this patch adds
support for it to the NFSv4.1 server. The FreeBSD client never uses this
operation, so it should not be affected.

MFC after: 2 months

6 years agosh: Test that backslash-newline within single-quotes is not special
jilles [Fri, 11 May 2018 21:56:01 +0000 (21:56 +0000)]
sh: Test that backslash-newline within single-quotes is not special

This works correctly, but the test may be helpful when modifying the parser.

6 years agoFix LORs in in6?_leave_group()
shurd [Fri, 11 May 2018 21:42:27 +0000 (21:42 +0000)]
Fix LORs in in6?_leave_group()

r333175 updated the join_group functions, but not the leave_group ones.

Reviewed by: sbruno
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D15393

6 years agoRemove dead declaration.
kib [Fri, 11 May 2018 20:47:45 +0000 (20:47 +0000)]
Remove dead declaration.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

6 years agoiflib(9): Add support for cloning pseudo interfaces
mmacy [Fri, 11 May 2018 20:08:28 +0000 (20:08 +0000)]
iflib(9): Add support for cloning pseudo interfaces

Part 3 of many ...
The VPC framework relies heavily on cloning pseudo interfaces
(vmnics, vpc switch, vcpswitch port, hostif, vxlan if, etc).

This pulls in that piece. Some ancillary changes get pulled
in as a side effect.

Reviewed by: shurd@
Approved by: sbruno@
Sponsored by: Joyent, Inc.
Differential Revision: https://reviews.freebsd.org/D15347

6 years agoFix mld6query(8) and add a new -g option
shurd [Fri, 11 May 2018 19:37:18 +0000 (19:37 +0000)]
Fix mld6query(8) and add a new -g option

The mld6query command relies on KAME behaviour which allows the
ipv6mr_multiaddr member of the request object in a IPV6_JOIN_GROUP
setsockopt() call to be INADDR6_ANY. The FreeBSD stack doesn't allow
this, so mld6query has been non-functional.

Also, add a -g option which sends a General Query (query INADDR6_ANY)

Reviewed by: sbruno, mmacy
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D15384

6 years agoepoch(9): always set inited in epoch_init
mmacy [Fri, 11 May 2018 18:37:14 +0000 (18:37 +0000)]
epoch(9): always set inited in epoch_init

- set inited in the !usedomains case

Reported by: jhibbits
Approved by: sbruno

6 years agovxge(4): deprecation notice
sbruno [Fri, 11 May 2018 17:26:59 +0000 (17:26 +0000)]
vxge(4): deprecation notice

This hardware isn't totally ancient, about equal to a mxge(4) or mlx4en(4),
but the company was sold to Exar which then promptly exited the Ethernet
business so the card was commercially available for under 2 years. On deep
search, the only usage of these cards I found was by the importing of the
driver. There are code quality issues identified by Brooks and Hiren and
no visible use nor maintainership that warrant removal from FreeBSD 12.0.

Submitted by: kbowling
Reviewed by: gnn brooks
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D15363

6 years agoRevert r333496.
bdrewery [Fri, 11 May 2018 17:24:04 +0000 (17:24 +0000)]
Revert r333496.

I didn't put the correct paths, nor lib32, and I may have been comparing
against the wrong source tree.

6 years agoApply the change from r272770 to if_ipsec(4) interface.
ae [Fri, 11 May 2018 16:50:25 +0000 (16:50 +0000)]
Apply the change from r272770 to if_ipsec(4) interface.

It is guaranteed that if_ipsec(4) interface is used only for tunnel
mode IPsec, i.e. decrypted and decapsultaed packet has its own IP header.
Thus we can consider it as new packet and clear the protocols flags.
This allows ICMP/ICMPv6 properly handle errors that may cause this packet.

PR: 228108
MFC after: 1 week

6 years agoAdd a bunch of orphaned libraries.
bdrewery [Fri, 11 May 2018 16:46:52 +0000 (16:46 +0000)]
Add a bunch of orphaned libraries.

MFC after: 3 days

6 years agoStrip trailing / from TESTSDIR
emaste [Fri, 11 May 2018 16:11:24 +0000 (16:11 +0000)]
Strip trailing / from TESTSDIR

Otherwise makefs gets upset:
makefs: ./usr/tests/sys/cddl/zfs/tests/exec/: empty leaf element

Sponsored by: The FreeBSD Foundation

6 years agoImprove development(7):
trasz [Fri, 11 May 2018 15:11:53 +0000 (15:11 +0000)]
Improve development(7):

 - Use Fx when referring to FreeBSD.
 - Use Ql instead of Cm for command invocations.
 - Remove some redundant Pp macros.
 - Use a literal indented Bd instead of a series of Dl macros.

Submitted by: 0mp@
Reviewed by: eadler@
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D15126

6 years agoSet kldxref_enable="YES" for ARM images. Without it, the images are missing
trasz [Fri, 11 May 2018 14:52:35 +0000 (14:52 +0000)]
Set kldxref_enable="YES" for ARM images. Without it, the images are missing
the /boot/kernel/linker.hints file, which breaks loading some of the modules
with dependencies, eg cfiscsi.ko.

This is a minimal fix for ARM images, in order to safely MFC it before
11.2-RELEASE.  Afterwards, however, I believe we should actually just change
the default (as in, etc/defaults/rc.conf).  The reason is that it's required
for every image that's being cross-built, as kldxref(1) cannot handle files
for non-native architectures.  For the one that is not - amd64 - having it
on by default doesn't change anything - the script is noop if the linker.hints
already exists.

The long-term solution would be to rewrite kldxref(1) to handle other
architectures, and generate linker.hints at build time.

Reviewed by: gjb@
MFC after: 3 days
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14534

6 years agoClear out the entire structure, not just the size of a pointer to it.
ken [Fri, 11 May 2018 14:50:26 +0000 (14:50 +0000)]
Clear out the entire structure, not just the size of a pointer to it.

sys/dev/ocs/ocs_os.c:
In ocs_thread_create(), use sizeof(*thread) (instead of
sizeof(thread)) as the size argument to memset so that we clear
out the entire thread structure instead of just a few bytes of it.

Submitted by: jtl
MFC after: 3 days

6 years agoMake /etc/rc.d/kldxref not print anything for directories that don't
trasz [Fri, 11 May 2018 14:43:21 +0000 (14:43 +0000)]
Make /etc/rc.d/kldxref not print anything for directories that don't
contain any kernel modules.  This makes the common case completely silent,
as it should be.

Reviewed by: imp@
MFC after: 2 weeks
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14694

6 years agoUpgrade to OpenSSH 7.7p1.
des [Fri, 11 May 2018 13:22:43 +0000 (13:22 +0000)]
Upgrade to OpenSSH 7.7p1.

6 years agousbdevs: add new Microchip USB-Ethernet device IDs
emaste [Fri, 11 May 2018 13:09:21 +0000 (13:09 +0000)]
usbdevs: add new Microchip USB-Ethernet device IDs

LAN7800 USB 3.1 to 10/100/1000 Ethernet with PHY
LAN7801 USB 3.1 to 10/100/1000 Ethernet with RGMII interface

Also update manufacturer name for the Vendor ID.  Microchip acquired
SMSC in May 2012.

Sponsored by: The FreeBSD Foundation

6 years agogpart.8: list all options in table form for each command
emaste [Fri, 11 May 2018 12:58:36 +0000 (12:58 +0000)]
gpart.8: list all options in table form for each command

Previously gpart's man page listed some command options in prose, and
some in table form, which made it more difficult to use as a reference.

Reviewed by: bcr
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D15135

6 years agogpart.8: sort suboptions per mdoc(7)
emaste [Fri, 11 May 2018 12:57:25 +0000 (12:57 +0000)]
gpart.8: sort suboptions per mdoc(7)

Alphabetical order, uppercase before lowercase for each letter and with
no regard to whether an option takes an argument.

Sponsored by: The FreeBSD Foundation

6 years agoamd64: align the .data.exclusive_cache_line section to 128
mjg [Fri, 11 May 2018 08:56:39 +0000 (08:56 +0000)]
amd64: align the .data.exclusive_cache_line section to 128

This aligns the section itself compared to other sections, does not change
internal alignment of fields stored inside. This may or may not come later.

The motivation is partially combating adverse effects of the adjacent cache
line prefetcher. Without the annotation part of read_mostly section was on
the line of fire.

6 years agoepoch(9): callback task fixes
mmacy [Fri, 11 May 2018 08:16:56 +0000 (08:16 +0000)]
epoch(9): callback task fixes

- initialize the pcpu STAILQ in the NUMA case
- don't enqueue the callback task if there isn't sufficient work to be done

Reported by: pho@
Approved by: sbruno@

6 years agouma: increase alignment to 128 bytes on amd64
mjg [Fri, 11 May 2018 07:04:57 +0000 (07:04 +0000)]
uma: increase alignment to 128 bytes on amd64

Current UMA internals are not suited for efficient operation in
multi-socket environments. In particular there is very common use of
MAXCPU arrays and other fields which are not always properly aligned and
are not local for target threads (apart from the first node of course).
Turns out the existing UMA_ALIGN macro can be used to mostly work around
the problem until the code get fixed. The current setting of 64 bytes
runs into trouble when adjacent cache line prefetcher gets to work.

An example 128-way benchmark doing a lot of malloc/frees has the following
instruction samples:

before:
kernel`lf_advlockasync+0x43b            32940
          kernel`malloc+0xe5            42380
           kernel`bzero+0x19            47798
   kernel`spinlock_exit+0x26            60423
         kernel`0xffffffff80            78238
                         0x0           136947
   kernel`uma_zfree_arg+0x46           159594
 kernel`uma_zalloc_arg+0x672           180556
   kernel`uma_zfree_arg+0x2a           459923
 kernel`uma_zalloc_arg+0x5ec           489910

after:
            kernel`bzero+0xd            46115
kernel`lf_advlockasync+0x25f            46134
kernel`lf_advlockasync+0x38a            49078
   kernel`fget_unlocked+0xd1            49942
kernel`lf_advlockasync+0x43b            55392
          kernel`copyin+0x4a            56963
           kernel`bzero+0x19            81983
   kernel`spinlock_exit+0x26            91889
         kernel`0xffffffff80           136357
                         0x0           239424

See the review for more details.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D15346

6 years agormlock: partially depessimize lock/unlock fastpath
mjg [Fri, 11 May 2018 06:59:54 +0000 (06:59 +0000)]
rmlock: partially depessimize lock/unlock fastpath

Previusly the slow path was folded in and partially jumped over in the
common case.

6 years ago[expand] add __dead2 annotation to usage
eadler [Fri, 11 May 2018 06:55:02 +0000 (06:55 +0000)]
[expand] add __dead2 annotation to usage

6 years agoAllow different bridge types to coexist
mmacy [Fri, 11 May 2018 05:00:40 +0000 (05:00 +0000)]
Allow different bridge types to coexist

if_bridge has a lot of limitations that make it scale poorly to higher data
rates. In my projects/VPC branch I leverage the bridge interface between
layers for my high speed soft switch as well as for purposes of stacking
in general.

Reviewed by: sbruno@
Approved by: sbruno@
Differential Revision: https://reviews.freebsd.org/D15344

6 years agoepoch(9): fix priority handling, make callback lists pcpu, and other fixes
mmacy [Fri, 11 May 2018 04:54:12 +0000 (04:54 +0000)]
epoch(9): fix priority handling, make callback lists pcpu, and other fixes

- Lend priority to preempted threads in epoch_wait to handle the case
  in which we've had priority lent to us. Previously we borrowed the
  priority of the lowest priority preempted thread. (pointed out by mjg@)

- Don't attempt allocate memory per-domain on powerpc, we don't currently
  handle empty sockets (as is the case on jhibbits Talos' board).

- Handle deferred callbacks as pcpu lists and poll the lists periodically.
  Currently the interval is 1/hz.

- Drop the thread lock when adaptive spinning. Holding the lock starves
  other threads and can even lead to lockups.

- Keep a generation count pcpu so that we don't keep spining if a thread
  has left and re-entered an epoch section.

- Actually removed the callback from the callback list so that we don't
  double free. Sigh ...

Approved by: sbruno@

6 years agoTest priority handling in epoch test.
mmacy [Fri, 11 May 2018 04:47:05 +0000 (04:47 +0000)]
Test priority handling in epoch test.

- Double the number of test threads to mp_ncpu*2
- Give each thread a different scheduling priority

6 years agoNo need to bzero splpar_vpa entries
jhibbits [Fri, 11 May 2018 02:04:01 +0000 (02:04 +0000)]
No need to bzero splpar_vpa entries

splpar_vpa is in the BSS, so is already zeroed when the kernel starts up.

Tested by: Leandro Lupori

6 years agoUpdate jemalloc to version 5.1.0.
jasone [Fri, 11 May 2018 00:32:31 +0000 (00:32 +0000)]
Update jemalloc to version 5.1.0.

6 years agoSlight cleanup of interface event logging.
des [Fri, 11 May 2018 00:19:49 +0000 (00:19 +0000)]
Slight cleanup of interface event logging.

Make if_printf() use vlog() instead of vprintf().  This means it can no
longer return the number of characters printed, as it used to, but every
single call to if_printf() in the entire kernel ignores the return value
anyway; just return 0 so we don't have to change the prototype.

Consistently use if_printf() throughout sys/net/if.c, instead of a
mixture of if_printf() and log().

In ifa_maintain_loopback_route(), don't needlessly log an error if we
either failed to add a route because it already existed or failed to
remove one because it did not.  We still return an error code, though.

MFC after: 1 week

6 years agoReduce <sys/queue.h> pollution.
des [Fri, 11 May 2018 00:01:43 +0000 (00:01 +0000)]
Reduce <sys/queue.h> pollution.

While <sys/sysctl.h> includes <sys/queue.h> unconditionally, it is only
actually used in code which is conditional on _KERNEL.  Make the #include
itself conditional as well, and fix userland code that uses <sys/queue.h>
for other purposes but relied on <sys/sysctl.h> to bring it in.

MFC after: 1 week

6 years agoAdd a special GCE_LICENSE variable to Makefile.gce, which when set,
gjb [Thu, 10 May 2018 21:46:58 +0000 (21:46 +0000)]
Add a special GCE_LICENSE variable to Makefile.gce, which when set,
will include license metadata in the resultant GCE image.

GCE_LICENSE is unset by default, as it primarily pertains to images
produced by the FreeBSD Project, but for downstream FreeBSD consumers,
it can be set in the make(1) environment in the format of:

 --licenses="projects/PROJECT_ID/global/licenses/LICENSE_NAME"

The "license" is not a license, per se, but required metadata that
is required by the GCE marketplace.  For the FreeBSD Project, the
license name is simply 'freebsd', with the description of 'FreeBSD'.

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

6 years agocxgbe(4): Add fields to support configuration of hardware NAT and
np [Thu, 10 May 2018 20:39:04 +0000 (20:39 +0000)]
cxgbe(4): Add fields to support configuration of hardware NAT and
swapmac (SMAC/DMAC switcheroo) from userspace.

Sponsored by: Chelsio Communications

6 years agoRevert r333365
imp [Thu, 10 May 2018 20:27:12 +0000 (20:27 +0000)]
Revert r333365

Even though we don't use it, it appears something else requires it to
be != 0 to work. This breaks tftp boot in loader.efi, so revert until
that can be sorted out.

6 years agoError out on attempt to link amd64 kernel with old binutils linker
emaste [Thu, 10 May 2018 20:10:02 +0000 (20:10 +0000)]
Error out on attempt to link amd64 kernel with old binutils linker

As of r333461 we require ifunc support to link a working amd64 kernel.
The default in-tree bootstrap linker is lld and it has the required
support, as does any modern out-of-tree binutils linker.  The in-tree
GNU ld is from binutils 2.17.50 and it does not have ifunc support,
so produce an error rather than a broken kernel.

Reviewed by: kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D15378

6 years agoAllocate epoch for networking at startup
mmacy [Thu, 10 May 2018 19:13:00 +0000 (19:13 +0000)]
Allocate epoch for networking at startup

Additionally add CK to include paths for modules

Approved by: sbruno@

6 years agoRevert accidentally commited local change to bmake to prevent debilitating
mmacy [Thu, 10 May 2018 17:57:46 +0000 (17:57 +0000)]
Revert accidentally commited local change to bmake to prevent debilitating
excess system time from poor API usage.

Approved by: sbruno@

6 years agoAdd simple preempt safe epoch API
mmacy [Thu, 10 May 2018 17:55:24 +0000 (17:55 +0000)]
Add simple preempt safe epoch API

Read locking is over used in the kernel to guarantee liveness. This API makes
it easy to provide livenes guarantees without atomics.

Includes epoch_test kernel module to stress test the API.

Documentation will follow initial use case.

Test case and improvements to preemption handling in response to discussion
with mjg@

Reviewed by: imp@, shurd@
Approved by: sbruno@

6 years agoFix build for platforms using GCC:
lwhsu [Thu, 10 May 2018 17:22:04 +0000 (17:22 +0000)]
Fix build for platforms using GCC:

- Remove unused or dead store variable
- Remove unused function ctl_copyin_alloc
- Add missing curly brackets, this seems a regression in r287720

Reviewed by: jhibbits
Differential Revision: https://reviews.freebsd.org/D15383

6 years agovt(4): Use default VGA palette
dumbbell [Thu, 10 May 2018 17:00:33 +0000 (17:00 +0000)]
vt(4): Use default VGA palette

Before this change, the VGA palette was configured to match the shell
palette (e.g. color #1 was red). There was one glitch early in boot when
the vt(4)'s VGA palette was loaded: the loader's logo would switch from
red to blue. Likewise for the "Booting..." message switching from blue
to red. That's because the loader's logo was drawed with the default VGA
palette where a few colors are swapped compared to the shell palette
(e.g. blue <-> red).

This change configures the default VGA palette during initialization and
converts input's colors from shell to VGA palette index.

There should be no visible changes, except the loader's logo which will
keep its original color.

Reviewed by: eadler

6 years agovt(4): Put for() loop outside switch() in vt_generate_cons_palette()
dumbbell [Thu, 10 May 2018 16:41:47 +0000 (16:41 +0000)]
vt(4): Put for() loop outside switch() in vt_generate_cons_palette()

This makes it more logical:
 1. It checks the requested color format
 2. It fills the palette accordingly

Also vt_palette_init() is only called when needed (i.e. when the format
is `COLOR_FORMAT_RGB`).

6 years agoFix a panic in the IPv6 multicast code.
gallatin [Thu, 10 May 2018 16:19:41 +0000 (16:19 +0000)]
Fix a panic in the IPv6 multicast code.

Use LIST_FOREACH_SAFE in in6m_disconnect() since we're
deleting and freeing item from the membership list
while traversing the list.

Reviewed by: mmacy
Sponsored by: Netflix

6 years agoMake fpusave() and fpurestore() on amd64 ifuncs.
kib [Thu, 10 May 2018 15:01:43 +0000 (15:01 +0000)]
Make fpusave() and fpurestore() on amd64 ifuncs.

From now on, linking amd64 kernel requires either lld or newer ld.bfd.

Reviewed by: jhb (as part of the large patch)
Discussed with: emaste
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D13838

6 years agoAdd the test program to examine CPU behaviour for pop ss issue
kib [Thu, 10 May 2018 13:52:52 +0000 (13:52 +0000)]
Add the test program to examine CPU behaviour for pop ss issue
CVE-2018-8897.

Requested by: emaste
Sponsored by: The FreeBSD Foundation
MFC after: 3 days

6 years agoFix the build after r333457
gallatin [Thu, 10 May 2018 13:19:42 +0000 (13:19 +0000)]
Fix the build after r333457

In r333457, the arguments to kern_pwritev() were accidentally
re-ordered as part of ANSIfication, breaking the build.

6 years agoFix the printing of rule comments.
ae [Thu, 10 May 2018 12:25:01 +0000 (12:25 +0000)]
Fix the printing of rule comments.

Change uint8_t type of opcode argument to int in the print_opcode()
function. Use negative value to print the rest of opcodes, because
zero value is O_NOP, and it can't be uses for this purpose.

Reported by: lev
MFC after: 1 week

6 years agoANSIfy sys_generic.c
emaste [Thu, 10 May 2018 11:36:16 +0000 (11:36 +0000)]
ANSIfy sys_generic.c

6 years agoDo not pass header length to the ENA controller
mw [Thu, 10 May 2018 09:37:54 +0000 (09:37 +0000)]
Do not pass header length to the ENA controller

Header length is optional hint for the ENA device. Because It is not
guaranteed that every packet header will be in the first mbuf
segment, it is better to skip passing any information. If the header
length will be indicating invalid value (different than 0), then the
packet will be dropped.

This kind situation can appear, when the UDP packet will be fragmented
by the stack in the ip_fragment() function.

Submitted by: Michal Krawczyk <mk@semihalf.com>
Reported by:  Krishna Yenduri <kyenduri@brkt.com>
Obtained from: Semihalf
Sponsored by: Amazon, Inc.

6 years agoarm64: Add ALT_BREAK_TO_DEBUGGER to GENERIC
manu [Thu, 10 May 2018 09:37:50 +0000 (09:37 +0000)]
arm64: Add ALT_BREAK_TO_DEBUGGER to GENERIC

It is useful to enter kdb with an escape sequence.
While here move the USB_DEBUG with the others debug options and define
nooptions USB_DEBUG for GENERIC-NODEBUG

6 years agoSkip setting the MTU for ENA if it is not changing
mw [Thu, 10 May 2018 09:32:59 +0000 (09:32 +0000)]
Skip setting the MTU for ENA if it is not changing

On AWS, a network interface can get reinitialized every 30 minutes due
to the MTU being (re)set when a new DHCP lease is obtained. This can
cause packet drop, along with annoying syslog messages.

Skip setting the MTU in the ena driver if the new MTU is the same as the
old MTU. Note this fix is already in the netfront driver.

Testing: Verified ena up/down messages do not appear every 30 min in
/var/log/messages with the fix in place.

Submitted by:   Krishna Yenduri <kyenduri@brkt.com>
Reviewed by: Michal Krawczyk <mk@semihalf.com>

6 years agoApply fixes in ena-com
mw [Thu, 10 May 2018 09:25:51 +0000 (09:25 +0000)]
Apply fixes in ena-com

* Change ena-com BIT macro to work on unsigned value.
  To make the shifting operations safer, they should be working on
  unsigned values.

* Fix a mutex not owned ASSERT panic in ENA control path.
  A thread calling cv_broadcast()/cv_signal() must hold the mutex used for
  cv_wait(). Fix the ENA control path code that has this problem.

Submitted by:   Krishna Yenduri <kyenduri@brkt.com>
Reviewed by:    Michal Krawczyk <mk@semihalf.com>
Tested by:      Michal Krawczyk <mk@semihalf.com>

6 years agoUpgrade ENA version to v0.8.1
mw [Thu, 10 May 2018 09:06:21 +0000 (09:06 +0000)]
Upgrade ENA version to v0.8.1

Submitted by: Michal Krawczyk <mk@semihalf.com>
Obtained from: Semihalf
Sponsored by: Amazon, Inc.

6 years agoRemove "All rights reserved" from my files.
delphij [Thu, 10 May 2018 06:41:08 +0000 (06:41 +0000)]
Remove "All rights reserved" from my files.

See r333391 for the rationale.

MFC after: 1 week

6 years agocxgbe(4): Disable write-combined doorbells by default.
np [Thu, 10 May 2018 06:33:54 +0000 (06:33 +0000)]
cxgbe(4): Disable write-combined doorbells by default.

This had been the default behavior but was changed accidentally as part
of the recent iw_cxgbe+OFED overhaul.  Fix another bug in that change
while here: the global knob affects all the adapters in the system and
should be left alone by per-adapter code.

MFC after: 3 days
Sponsored by: Chelsio Communications

6 years agoFix PPC symbol resolution
jhibbits [Thu, 10 May 2018 03:59:48 +0000 (03:59 +0000)]
Fix PPC symbol resolution

Summary:
There were 2 issues that were preventing correct symbol resolution
on PowerPC/pseries:

1- memory corruption at chrp_attach() - this caused the inital
   part of the symbol table to become zeroed, which would cause
   the kernel linker to fail to parse it.
   (this was probably zeroing out other memory parts as well)

2- DDB symbol resolution wasn't working because symtab contained
   not relocated addresses but it was given relocated offsets.
   Although relocating the symbol table fixed this, it broke the
   linker, that already handled this case.
   Thus, the fix for this consists in adding a new DDB macro:
   DB_STOFFS(offs) that converts a (potentially) relocated offset
   into one that can be compared with symbol table values.

PR: 227093
Submitted by: Leandro Lupori <leandro.lupori_gmail.com>
Differential Revision: https://reviews.freebsd.org/D15372

6 years agoRework CTL frontend & backend options to use nv(3), allow creating multiple
araujo [Thu, 10 May 2018 03:50:20 +0000 (03:50 +0000)]
Rework CTL frontend & backend options to use nv(3), allow creating multiple
ioctl frontend ports.

This revision introduces two changes to CTL:
- Changes the way options are passed to CTL_LUN_REQ and CTL_PORT_REQ ioctls.
  Removes ctl_be_arg structure and associated logic and replaces it with
  nv(3)-based logic for passing in and out arguments.
- Allows creating multiple ioctl frontend ports using either ctladm(8) or
  ctld(8).
  New frontend ports are represented by /dev/cam/ctl<pp>.<vp> nodes, eg /dev/cam/ctl5.3.
  Those device nodes respond only to CTL_IO ioctl.

New command-line options for ctladm:
# creates new ioctl frontend port with using free pp and vp=0
ctladm port -c
# creates new ioctl frontend port with pp=10 and vp=0
ctladm port -c -O pp=10
# creates new ioctl frontend port with pp=11 and vp=12
ctladm port -c -O pp=11 -O vp=12
# removes port with number 4 (it's a "targ_port" number, not pp number)
ctladm port -r -p 4

New syntax for ctl.conf:
target ... {
    port ioctl/<pp>
    ...
}

target ... {
    port ioctl/<pp>/<vp>
    ...

Note: Most of this work was made by jceel@, thank you.

Submitted by: jceel
Reworked by: myself
Reviewed by: mav (earlier versions and recently during the rework)
Obtained from:  FreeNAS and TrueOS
Relnotes: Yes
Sponsored by: iXsystems Inc.
Differential Revision: https://reviews.freebsd.org/D9299

6 years agoRemove unused bcopyb.
imp [Thu, 10 May 2018 02:31:54 +0000 (02:31 +0000)]
Remove unused bcopyb.

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

6 years agoSimplify things a little
imp [Thu, 10 May 2018 02:31:48 +0000 (02:31 +0000)]
Simplify things a little

Rather than include a copy for memmove to call bcopy to call memcpy
(which handles overlapping copies), make memmove a strong reference to
memcpy to save the two calls.

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

6 years agoMove MI-ish bcopy routine to libkern
imp [Thu, 10 May 2018 02:31:38 +0000 (02:31 +0000)]
Move MI-ish bcopy routine to libkern

riscv and powerpc have nearly identical bcopy.c that's
supposed to be mostly MI. Move it to the MI libkern.

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

6 years agocxgbe(4): Determine whether the firmware supports the FILTER2 work
np [Thu, 10 May 2018 00:04:14 +0000 (00:04 +0000)]
cxgbe(4): Determine whether the firmware supports the FILTER2 work
request, which can be used to configure hardware NAT and swapmac.

All firmwares released after Jan 2017 support this work request.

Sponsored by: Chelsio Communications

6 years agoRemove "All rights reserved" from my files.
markj [Wed, 9 May 2018 20:57:18 +0000 (20:57 +0000)]
Remove "All rights reserved" from my files.

See r333391 for the rationale.

MFC after: 1 week

6 years agoIntroduce the 'n' flag for the geli attach command.
oshogbo [Wed, 9 May 2018 20:53:38 +0000 (20:53 +0000)]
Introduce the 'n' flag for the geli attach command.

If the 'n' flag is provided the provided key number will be used to
decrypt device. This can be used combined with dryrun to verify if the key
is set correctly. This can be also used to determine which key slot we want to
change on already attached device.

Reviewed by: allanjude
Differential Revision: https://reviews.freebsd.org/D15309

6 years agoChange option dry-run from 'n' to 'C' in geli attach command.
oshogbo [Wed, 9 May 2018 20:51:16 +0000 (20:51 +0000)]
Change option dry-run from 'n' to 'C' in geli attach command.

'n' is used in other commands to define the key index.
We should be consistent with that.
'C' option is used by patch(1) to perform dryrun so lets use that.

Reviewed by: allanjude
Differential Revision: https://reviews.freebsd.org/D15308

6 years agoFor video consoles, only launch a getty if the device exists.
imp [Wed, 9 May 2018 20:49:00 +0000 (20:49 +0000)]
For video consoles, only launch a getty if the device exists.

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

6 years agoRemove 'All Rights Reserved'
imp [Wed, 9 May 2018 20:41:03 +0000 (20:41 +0000)]
Remove 'All Rights Reserved'

Remove this from some of the iXsystems stuff I did. OK'd by kmoore
at iXsystems

6 years agoRemove the 'All Rights Reserved' clause from some of the stuff I've
imp [Wed, 9 May 2018 20:32:23 +0000 (20:32 +0000)]
Remove the 'All Rights Reserved' clause from some of the stuff I've
done for Netflix, since I'm in the neighborhood.

6 years agoUse the full year, for real this time.
imp [Wed, 9 May 2018 20:26:37 +0000 (20:26 +0000)]
Use the full year, for real this time.

6 years agoRemove 'All rights reserved' from my files
vangyzen [Wed, 9 May 2018 20:12:59 +0000 (20:12 +0000)]
Remove 'All rights reserved' from my files

See r333391 for the rationale.

Approved by: emaste (for the Foundation copyright)
Sponsored by: Dell EMC

6 years agoFix bxe(4) netdump rx polling.
markj [Wed, 9 May 2018 19:54:34 +0000 (19:54 +0000)]
Fix bxe(4) netdump rx polling.

Reviewed by: cem, rstone
X-MFC with: r333287
Sponsored by: Dell EMC Isilon

6 years agoFix style error introduced in r333393.
cy [Wed, 9 May 2018 19:05:27 +0000 (19:05 +0000)]
Fix style error introduced in r333393.

Reported by: jhb, imp, phk
MFC after: 6 days
X-MFC with: r333393

6 years agoAdd taskqgroup_config_gtask_deinit to support teardown after
mmacy [Wed, 9 May 2018 18:51:35 +0000 (18:51 +0000)]
Add taskqgroup_config_gtask_deinit to support teardown after
taskqgroup_config_gtask_init.

Approved by: sbruno

6 years agoEliminate the overhead of gratuitous repeated reinitialization of cap_rights
mmacy [Wed, 9 May 2018 18:47:24 +0000 (18:47 +0000)]
Eliminate the overhead of gratuitous repeated reinitialization of cap_rights

- Add macros to allow preinitialization of cap_rights_t.

- Convert most commonly used code paths to use preinitialized cap_rights_t.
  A 3.6% speedup in fstat was measured with this change.

Reported by: mjg
Reviewed by: oshogbo
Approved by: sbruno
MFC after: 1 month