freebsd.git
6 years agoMerge bmake-20180512
sjg [Sat, 19 May 2018 00:26:00 +0000 (00:26 +0000)]
Merge bmake-20180512

Skip polling job token pipe,
better handle sysV style includes with variables.

6 years agoSilence non-actionable warnings in vendor code
mmacy [Sat, 19 May 2018 00:04:01 +0000 (00:04 +0000)]
Silence non-actionable warnings in vendor code

We can't modify vendor code so there's no signal in warnings from it.
Similarly -Waddress-of-packed-member is not useful on networking code
as access to packed structures is fundamental to its operation.

6 years agoAnnotate td_pre_epoch_prio in struct thread
mmacy [Fri, 18 May 2018 23:17:49 +0000 (23:17 +0000)]
Annotate td_pre_epoch_prio in struct thread

Reported by: jhb

6 years agolockmgr: avoid atomic on unlock in the slow path
mjg [Fri, 18 May 2018 22:57:52 +0000 (22:57 +0000)]
lockmgr: avoid atomic on unlock in the slow path

The code is pretty much guaranteed not to be able to unlock.

This is a minor nit. The code still performs way too many reads.
The altered exclusive-locked condition is supposed to be always
true as well, to be cleaned up at a later date.

6 years agoStop claiming the device-side USB serial interfaces talk Hayes AT.
trasz [Fri, 18 May 2018 20:24:19 +0000 (20:24 +0000)]
Stop claiming the device-side USB serial interfaces talk Hayes AT.

There should be no functional difference.

Reviewed by: hselasky@
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

6 years agoifnet: Replace if_addr_lock rwlock with epoch + mutex
mmacy [Fri, 18 May 2018 20:13:34 +0000 (20:13 +0000)]
ifnet: Replace if_addr_lock rwlock with epoch + mutex

Run on LLNW canaries and tested by pho@

gallatin:
Using a 14-core, 28-HTT single socket E5-2697 v3 with a 40GbE MLX5
based ConnectX 4-LX NIC, I see an almost 12% improvement in received
packet rate, and a larger improvement in bytes delivered all the way
to userspace.

When the host receiving 64 streams of netperf -H $DUT -t UDP_STREAM -- -m 1,
I see, using nstat -I mce0 1 before the patch:

InMpps OMpps  InGbs  OGbs err TCP Est %CPU syscalls csw     irq GBfree
4.98   0.00   4.42   0.00 4235592     33   83.80 4720653 2149771   1235 247.32
4.73   0.00   4.20   0.00 4025260     33   82.99 4724900 2139833   1204 247.32
4.72   0.00   4.20   0.00 4035252     33   82.14 4719162 2132023   1264 247.32
4.71   0.00   4.21   0.00 4073206     33   83.68 4744973 2123317   1347 247.32
4.72   0.00   4.21   0.00 4061118     33   80.82 4713615 2188091   1490 247.32
4.72   0.00   4.21   0.00 4051675     33   85.29 4727399 2109011   1205 247.32
4.73   0.00   4.21   0.00 4039056     33   84.65 4724735 2102603   1053 247.32

After the patch

InMpps OMpps  InGbs  OGbs err TCP Est %CPU syscalls csw     irq GBfree
5.43   0.00   4.20   0.00 3313143     33   84.96 5434214 1900162   2656 245.51
5.43   0.00   4.20   0.00 3308527     33   85.24 5439695 1809382   2521 245.51
5.42   0.00   4.19   0.00 3316778     33   87.54 5416028 1805835   2256 245.51
5.42   0.00   4.19   0.00 3317673     33   90.44 5426044 1763056   2332 245.51
5.42   0.00   4.19   0.00 3314839     33   88.11 5435732 1792218   2499 245.52
5.44   0.00   4.19   0.00 3293228     33   91.84 5426301 1668597   2121 245.52

Similarly, netperf reports 230Mb/s before the patch, and 270Mb/s after the patch

Reviewed by: gallatin
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D15366

6 years agotag bmake-20180512
sjg [Fri, 18 May 2018 19:50:22 +0000 (19:50 +0000)]
tag bmake-20180512

6 years agoImport bmake-20180512
sjg [Fri, 18 May 2018 19:49:54 +0000 (19:49 +0000)]
Import bmake-20180512

Of relevance:

  o job.c: skip polling job token pipe
  o parse.c: be more cautious about detecting depenency line
    rather than sysV style include.

also in mk:

* dirdeps.mk: include local.dirdeps-build.mk when .MAKE.LEVEL > 0
  ie. we are building something.
* FILES: add dirdeps-options.mk to deal with optional DIRDEPS.
* ldorder.mk: describe how to use LDORDER_EXTERN_BARRIER
  if needed.

6 years agoBe more robust against garbage input on a TOE TLS TX socket.
jhb [Fri, 18 May 2018 19:09:11 +0000 (19:09 +0000)]
Be more robust against garbage input on a TOE TLS TX socket.

If a socket is closed or shutdown and a partial record (or what
appears to be a partial record) is waiting in the socket buffer,
discard the partial record and close the connection rather than
waiting forever for the rest of the record.

Reported by: Harsh Jain @ Chelsio
Sponsored by: Chelsio Communications

6 years agoepoch(9): allocate net epochs earlier in boot
mmacy [Fri, 18 May 2018 18:48:00 +0000 (18:48 +0000)]
epoch(9): allocate net epochs earlier in boot

6 years agoepoch(9): assert that epoch is allocated post-configure
mmacy [Fri, 18 May 2018 18:27:17 +0000 (18:27 +0000)]
epoch(9): assert that epoch is allocated post-configure

6 years agoepoch: move epoch variables to read mostly section
mmacy [Fri, 18 May 2018 17:58:15 +0000 (17:58 +0000)]
epoch: move epoch variables to read mostly section

6 years agoUse NULL for SYSINIT's last arg, which is a pointer type
emaste [Fri, 18 May 2018 17:58:09 +0000 (17:58 +0000)]
Use NULL for SYSINIT's last arg, which is a pointer type

Sponsored by: The FreeBSD Foundation

6 years agoamd64 GENERIC: correct whitespace on smartpqi entry
emaste [Fri, 18 May 2018 17:51:42 +0000 (17:51 +0000)]
amd64 GENERIC: correct whitespace on smartpqi entry

6 years agoUse sysrc(8) in the documentation rather than echoing things to rc.conf
nwhitehorn [Fri, 18 May 2018 17:46:40 +0000 (17:46 +0000)]
Use sysrc(8) in the documentation rather than echoing things to rc.conf
in order to encourage good habits.

PR: 228325
Submitted by: Mateusz Piotrowski
MFC after: 2 weeks

6 years agoFix math error in the computation of the free space after the last partition
nwhitehorn [Fri, 18 May 2018 17:43:15 +0000 (17:43 +0000)]
Fix math error in the computation of the free space after the last partition
on a disk. This resulted in one sector always remaining free at the end.

PR: bin/228322
Submitted by: Rikiya Yonemoto
MFC after: 2 weeks

6 years agoepoch(9): Make epochs non-preemptible by default
mmacy [Fri, 18 May 2018 17:29:43 +0000 (17:29 +0000)]
epoch(9): Make epochs non-preemptible by default

There are risks associated with waiting on a preemptible epoch section.
Change the name to make them not be the default and document the issue
under CAVEATS.

Reported by: markj

6 years agoQuiesce a couple pages of clang warnings with a cast. Duplicates
sbruno [Fri, 18 May 2018 17:23:23 +0000 (17:23 +0000)]
Quiesce a couple pages of clang warnings with a cast.  Duplicates
linux maintainer commit:

https://github.com/torvalds/linux/commit/627871b71c89a6ec12fbed75063f238e0c7127b2#diff-8c6ddb4c3ad69a6fb9f289475821db56

ar9300template_aphrodite.h:575:40: warning: implicit conversion from 'int'
  to 'u_int8_t' (aka 'unsigned char') changes value from 3495 to 167
  [-Wconstant-conversion]
            /* Data[8].ctl_edges[7].bChannel*/FREQ2FBIN(5795, 0)}
                                              ^~~~~~~~~~~~~~~~~~
ar9300eep.h:142:41: note: expanded from macro 'FREQ2FBIN'
    (((y) == HAL_FREQ_BAND_2GHZ) ? ((x) - 2300) : (((x) - 4800) / 5))

Reviewed by: imp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D15476

6 years agomuge(4): style and comment cleanup
emaste [Fri, 18 May 2018 17:07:59 +0000 (17:07 +0000)]
muge(4): style and comment cleanup

And tag some spots to revisit with XXX.

Sponsored by: The FreeBSD Foundation

6 years agoDon't increment addl_page_shortage for wired pages.
markj [Fri, 18 May 2018 16:59:58 +0000 (16:59 +0000)]
Don't increment addl_page_shortage for wired pages.

Such pages are dequeued as they're encountered during the inactive queue
scan, so by the time we get to the active queue scan, they should have
already been subtracted from the inactive queue length.

Reviewed by: alc
Differential Revision: https://reviews.freebsd.org/D15479

6 years agoBased on multiple sources including the State Gazette the last day of
imp [Fri, 18 May 2018 16:19:45 +0000 (16:19 +0000)]
Based on multiple sources including the State Gazette the last day of
Julian calendar in Bulgaria was 31.03.1916.

Submitted by: Konstantin Terziev
Pull Request: https://github.com/freebsd/freebsd/pull/142

(I independently confirmed the date and this was the right date to use for ncal)

6 years agomuge(4): sync register names with Microchip's lan7800.h
emaste [Fri, 18 May 2018 14:30:45 +0000 (14:30 +0000)]
muge(4): sync register names with Microchip's lan7800.h

Microchip provided a permissively-licensed lan78xx header, which has
an 'ETH_' prefix on most definitions.  Follow suit in our driver.

Sponsored by: The FreeBSD Foundation

6 years agoTeach pmcannotate about $TMPDIR and _PATH_TMP
gallatin [Fri, 18 May 2018 14:14:04 +0000 (14:14 +0000)]
Teach pmcannotate about $TMPDIR and _PATH_TMP

Convert pmcannotate to using $TMPDIR and _PATH_TMP rather than hard
coding /tmp for temporary files.  Pmcannotate sometimes needs quite a
lot of space to store the output from objdump, and will fail in odd
ways if that output is truncated due to lack of space in /tmp.

Reviewed by: jtl
Sponsored by: Netflix

6 years agobnxt(4)
sbruno [Fri, 18 May 2018 13:49:12 +0000 (13:49 +0000)]
bnxt(4)
- Fix HWRM warning message during HW LRO configuration.

Submitted by: bhargava.marreddy@broadcom.com
MFC after: 1 week
Sponsored by: Broadcom Limited
Differential Revision: https://reviews.freebsd.org/D15466

6 years agoInstead of ignoring the VFP registers, set the dumppcb's pcb_fpusaved
cognet [Fri, 18 May 2018 13:28:02 +0000 (13:28 +0000)]
Instead of ignoring the VFP registers, set the dumppcb's pcb_fpusaved
field, so that they are saved, as they may be used in the kernel, in the
EFI and the crypto code.

Reviewed by: andrew

6 years agoMake the name of option that toggles IFCAP_HWRXTSTMP capability to
ae [Fri, 18 May 2018 12:12:24 +0000 (12:12 +0000)]
Make the name of option that toggles IFCAP_HWRXTSTMP capability to
match the name of this capability. It was added recently and is not merged
to stable branch, so I hope it is not too late to change the name.

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

6 years agoEnable the Qualcomm MSM UART driver. This is needed for some Qualcomm
andrew [Fri, 18 May 2018 11:32:48 +0000 (11:32 +0000)]
Enable the Qualcomm MSM UART driver. This is needed for some Qualcomm
Snapdragon SoCs.

Obtained from: ABT Systems Ltd
Sponsored by: Turing Robotic Industries

6 years agoamd64: tweak the read_frequently section
mjg [Fri, 18 May 2018 07:31:26 +0000 (07:31 +0000)]
amd64: tweak the read_frequently section

1. align to 128 bytes to avoid possible waste from the preceeding section
2. sort entries by alignment SORT_BY_ALIGNMENT, plugging the holes (most
entries are one byte in size, but they got interleaved with bigger ones)

Interestingly I was looking for a feature of the sort earlier and failed
to find it. It turns out the script was already utilizing sorting in other
places, so shame on me.

Thanks for Travis Geiselbrecht for pointing me at the feature.

6 years agoMFV r333779: xz 5.2.4.
delphij [Fri, 18 May 2018 06:10:16 +0000 (06:10 +0000)]
MFV r333779: xz 5.2.4.

MFC after: 2 weeks

6 years agocxgbe(4): Implement ifnet callbacks that deal with send tags.
np [Fri, 18 May 2018 06:09:15 +0000 (06:09 +0000)]
cxgbe(4): Implement ifnet callbacks that deal with send tags.

An etid (ethoffload tid) is allocated for a send tag and it acquires a
reference on the traffic class that matches the send parameters
associated with the tag.

Sponsored by: Chelsio Communications

6 years agoepoch(9): fix error in example and update API reference
mmacy [Fri, 18 May 2018 04:13:58 +0000 (04:13 +0000)]
epoch(9): fix error in example and update API reference

Submitted by: hps
Approved by: sbruno

6 years agonetmap: pull fix for 32-bit support from upstream
mmacy [Fri, 18 May 2018 03:38:17 +0000 (03:38 +0000)]
netmap: pull fix for 32-bit support from upstream

Approved by: sbruno

6 years agovt: add more cp437 mappings for vga textmode
emaste [Fri, 18 May 2018 02:58:26 +0000 (02:58 +0000)]
vt: add more cp437 mappings for vga textmode

In UTF-8 locales mandoc uses a number of characters outside of the Basic
Latin group, e.g. from general punctuation or miscellaneous mathematical
symbols, and these rendered as ? in text mode.

This change adds (char, replacement, code point, description):

    ¦ | U+00A6 Broken bar
    ✓ √ U+2713 Checkmark

Sponsored by:   The FreeBSD Foundation

6 years agoepoch: actually allocate the counters we've assigned sysctls too
mmacy [Fri, 18 May 2018 02:57:39 +0000 (02:57 +0000)]
epoch: actually allocate the counters we've assigned sysctls too

Approved by: sbruno

6 years agoepoch: add non-preemptible "critical" variant
mmacy [Fri, 18 May 2018 01:52:51 +0000 (01:52 +0000)]
epoch: add non-preemptible "critical" variant

adds:
- epoch_enter_critical() - can be called inside a different epoch,
  starts a section that will acquire any MTX_DEF mutexes or do
  anything that might sleep.
- epoch_exit_critical() - corresponding exit call
- epoch_wait_critical() - wait variant that is guaranteed that any
  threads in a section are running.
- epoch_global_critical - an epoch_wait_critical safe epoch instance

Requested by:   markj
Approved by: sbruno

6 years agoUse strsep() to parse init_path in start_init().
brooks [Thu, 17 May 2018 23:07:51 +0000 (23:07 +0000)]
Use strsep() to parse init_path in start_init().

This simplifies the use of the path variable by making it NUL
terminated.  This is a prerequisite for further cleanups.

Reviewed by: imp
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D15467

6 years agoIn pmap_get_tables(), check that the L2 is indeed a table before attempting
cognet [Thu, 17 May 2018 22:40:22 +0000 (22:40 +0000)]
In pmap_get_tables(), check that the L2 is indeed a table before attempting
to get the l3.

6 years agoIn vfp_save_state(), don't bother trying to save the VFP registers if the
cognet [Thu, 17 May 2018 22:38:16 +0000 (22:38 +0000)]
In vfp_save_state(), don't bother trying to save the VFP registers if the
provided PCB doesn't have a pcb_fpusaved. All PCBs associated to a thread
should have one, but the dumppcb used when panic'ing doesn't.

6 years agoepoch: skip poll function call in hardclock unless there are callbacks pending
mmacy [Thu, 17 May 2018 21:39:15 +0000 (21:39 +0000)]
epoch: skip poll function call in hardclock unless there are callbacks pending

Reported by: mjg
Approved by: sbruno

6 years agoAdd a missing nfsrv_freesession() call for an unlikely failure case.
rmacklem [Thu, 17 May 2018 21:17:20 +0000 (21:17 +0000)]
Add a missing nfsrv_freesession() call for an unlikely failure case.

Since NFSv4.1 clients normally create a single session which supports
both fore and back channels, it is unlikely that a callback will fail
due to a lack of a back channel.
However, if this failure occurred, the session wasn't being dereferenced
and would never be free'd.
Found by inspection during pNFS server development.

Tested by: andreas.nagy@frequentis.com
MFC after: 2 months

6 years agopowerpc: fix LINT build
mmacy [Thu, 17 May 2018 21:04:19 +0000 (21:04 +0000)]
powerpc: fix LINT build

netmap currently doesn't build, take it out of LINT to prevent
hiding regressions in universe

Reviewed by: jhibbits
Approved by: sbruno

6 years agoepoch(9): schedule pcpu callback task in hardclock if there are callbacks pending
mmacy [Thu, 17 May 2018 19:57:07 +0000 (19:57 +0000)]
epoch(9): schedule pcpu callback task in hardclock if there are callbacks pending

Approved by: sbruno

6 years agoAdd a "multifunction" device side USB template, which provides mass
trasz [Thu, 17 May 2018 19:54:11 +0000 (19:54 +0000)]
Add a "multifunction" device side USB template, which provides mass
storage, CDC ACM (serial), and CDC ECM (ethernet) at the same time.
It's quite similar in function to Linux' "g_multi" gadget.

Reviewed by: hselasky@
MFC after: 2 weeks
Relnotes: yes
Sponsored by: The FreeBSD Foundation

6 years agoepoch(9): eliminate the need to wait when polling for callbacks to run
mmacy [Thu, 17 May 2018 19:50:55 +0000 (19:50 +0000)]
epoch(9): eliminate the need to wait when polling for callbacks to run

by using ck's own callback handling mechanism we can simply check which
callbacks have had a grace period elapse

Approved by: sbruno

6 years agoepoch(9): fix potential deadlock
mmacy [Thu, 17 May 2018 19:41:58 +0000 (19:41 +0000)]
epoch(9): fix potential deadlock

Don't acquire a waiting thread's lock while holding our own

Approved by: sbruno

6 years agoepoch(9): missed add from r333755
mmacy [Thu, 17 May 2018 19:30:57 +0000 (19:30 +0000)]
epoch(9): missed add from r333755

Reported by: flo
Approved by: sbruno

6 years agorelease: rpi3: Copy the special rpi3 config.txt
manu [Thu, 17 May 2018 19:10:13 +0000 (19:10 +0000)]
release: rpi3: Copy the special rpi3 config.txt

RPI* 32bits and RPI* 64bits have a different config.txt
Copy to correct config.txt to the fat partition of the release image.
Also copy pwm.dtbo as some people want to use it.

Reviewed by: gjb

6 years agoepoch(9): restore thread priority on exit if it was changed by a waiter
mmacy [Thu, 17 May 2018 19:08:28 +0000 (19:08 +0000)]
epoch(9): restore thread priority on exit if it was changed by a waiter

Reported by: markj
Approved by: sbruno

6 years agoRemove a reference to NETDUMP_DEBUG, and document sysctls.
markj [Thu, 17 May 2018 19:06:44 +0000 (19:06 +0000)]
Remove a reference to NETDUMP_DEBUG, and document sysctls.

NETDUMP_DEBUG was removed and replaced with a sysctl which enables
debug output without requiring a recompile.

6 years agock: add support for executing callbacks outside of main poll loop
mmacy [Thu, 17 May 2018 18:14:10 +0000 (18:14 +0000)]
ck: add support for executing callbacks outside of main poll loop

Pull in change from upstream deca119d14bfffd440770eb67cbdbeaf7b57eb7b

|    ck_epoch: introduce ck_epoch_deferred
|
|    Allow for deferral to occur outside epoch poll critical loop (which may access per-CPU structures).
|

Approved by: sbruno

6 years agoAF_UNIX: make unix socket locking finer grained
mmacy [Thu, 17 May 2018 17:59:35 +0000 (17:59 +0000)]
AF_UNIX: make unix socket locking finer grained

This change moves to using a reference count across lock drop / reacquire
to guarantee liveness.

Currently sends on unix sockets contend heavily on read locking the list lock.
unix1_processes in will-it-scale peaks at 6 processes and then declines.

With this change I get a substantial improvement in number of operations per second
with 96 processes:

x before
+ after
    N           Min           Max        Median           Avg        Stddev
x  11       1688420       1696389       1693578     1692766.3     2971.1702
+  10      63417955      71030114      70662504      69576423     2374684.6
Difference at 95.0% confidence
        6.78837e+07 +/- 1.49463e+06
        4010.22% +/- 88.4246%
        (Student's t, pooled s = 1.63437e+06)

And even for 2 processes shows a ~18% improvement.
"Small" iron changes (1, 2, and 4 processes):

x before1
+ after1.2
+------------------------------------------------------------------------+
|                                                                  +     |
|                                                           x      +     |
|                                                           x      +     |
|                                                           x      +     |
|                                                           x     ++     |
|                                                          xx     ++     |
|x                                                       x xx     ++     |
|                                  |__________________A_____M_____AM____||
+------------------------------------------------------------------------+
    N           Min           Max        Median           Avg        Stddev
x  10       1131648       1197750     1197138.5     1190369.3     20651.839
+  10       1203840       1205056       1204919     1204827.9     353.27404
Difference at 95.0% confidence
        14458.6 +/- 13723
        1.21463% +/- 1.16683%
        (Student's t, pooled s = 14605.2)

x before2
+ after2.2
+------------------------------------------------------------------------+
|                                                                       +|
|                                                                       +|
|                                                                       +|
|                                                                       +|
|                                                                       +|
|                                                                       +|
|           x                                                           +|
|           x                                                           +|
|         x xx                                                          +|
|x        xxxx                                                          +|
|      |___AM_|                                                         A|
+------------------------------------------------------------------------+
    N           Min           Max        Median           Avg        Stddev
x  10       1972843       2045866     2038186.5     2030443.8     21367.694
+  10       2400853       2402196     2401043.5     2401172.7     385.40024
Difference at 95.0% confidence
        370729 +/- 14198.9
        18.2585% +/- 0.826943%
        (Student's t, pooled s = 15111.7)

x before4
+ after4.2
    N           Min           Max        Median           Avg        Stddev
x  10       3986994       3991728     3990137.5     3989985.2     1300.0164
+  10       4799990       4806664     4806116.5       4805194     1990.6625
Difference at 95.0% confidence
        815209 +/- 1579.64
        20.4314% +/- 0.0421713%
        (Student's t, pooled s = 1681.19)

Tested by: pho
Reported by: mjg
Approved by: sbruno
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D15430

6 years agoFix build if USB_DEBUG is defined.
andreast [Thu, 17 May 2018 17:57:41 +0000 (17:57 +0000)]
Fix build if USB_DEBUG is defined.

6 years agointel-ucode-split: incorporate review feedback, using asprintf
emaste [Thu, 17 May 2018 17:45:47 +0000 (17:45 +0000)]
intel-ucode-split: incorporate review feedback, using asprintf

As reported by delphij in review D15443 asprintf cleans this up a little
by avoiding hardcoded buffer sizes.

Reported by: delphij

6 years agorelease: arm: Format FAT partition as FAT16
manu [Thu, 17 May 2018 16:21:12 +0000 (16:21 +0000)]
release: arm: Format FAT partition as FAT16

r332674 raised the size of the FAT partition from 2MB to 41MB for some
boards. But we format them in FAT12 and this size appears to be to big
for FAT12 and some SoC bootrom cannot cope with that.
Format the msdosfs partition as FAT16,

PR: 228285
MFC after: soon

6 years agoMark usfs(4) as obsolete; users are advised to use cfumass(4) instead.
trasz [Thu, 17 May 2018 15:21:19 +0000 (15:21 +0000)]
Mark usfs(4) as obsolete; users are advised to use cfumass(4) instead.

Reviewed by: hselasky@
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

6 years agoFix off-by-one in usb_decode_str_desc(). Previously it would decode
trasz [Thu, 17 May 2018 15:19:29 +0000 (15:19 +0000)]
Fix off-by-one in usb_decode_str_desc().  Previously it would decode
one character too many.  Note that this function is only used to decode
string descriptors generated by the kernel itself.

Reviewed by: hselasky@
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

6 years agoRetire vxge(4).
sbruno [Thu, 17 May 2018 14:55:41 +0000 (14:55 +0000)]
Retire vxge(4).

This driver was merged to HEAD one week prior to Exar publicly announcing they
had left the Ethernet market. It is not known to be used and has various code
quality issues spotted by Brooks and Hiren. Retire it in preparation for
FreeBSD 12.0.

Submitted by: kbowling
Reviewed by: brooks imp
Relnotes: yes
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D15442

6 years agoaw_spi: Fix some silly clock mistake
manu [Thu, 17 May 2018 14:51:22 +0000 (14:51 +0000)]
aw_spi: Fix some silly clock mistake

The module uses the mod clock and not the ahb one.
We need to set the mod clock to twice the speed requested as the smallest
divider in the controller is 2.
The clock test function weren't calculating the register value best on the
best div but on the max one.
The cdr2 test function was using the cdr1 formula.

Pointy Hat: manu

6 years agoPull in r322325 from upstream llvm trunk (by Matthias Braun):
dim [Thu, 17 May 2018 14:38:58 +0000 (14:38 +0000)]
Pull in r322325 from upstream llvm trunk (by Matthias Braun):

  PeepholeOpt cleanup/refactor; NFC

  - Less unnecessary use of `auto`
  - Add early `using RegSubRegPair(AndIdx) =` to avoid countless
    `TargetInstrInfo::` qualifications.
  - Use references instead of pointers where possible.
  - Remove unused parameters.
  - Rewrite the CopyRewriter class hierarchy:
     - Pull out uncoalescable copy rewriting functionality into
       PeepholeOptimizer class.
     - Use an abstract base class to make it clear that rewriters are
       independent.
  - Remove unnecessary \brief in doxygen comments.
  - Remove unused constructor and method from ValueTracker.
  - Replace UseAdvancedTracking of ValueTracker with DisableAdvCopyOpt
    use.

Even though upstream marked this as "No Functional Change", it does
contain some functional changes, and these fix a compiler hang for one
particular source file in the devel/godot port.

PR: 228261
MFC after: 3 days

6 years agoAdd initial man page for Microchip USB 3 Gigabit Ethernet controller
emaste [Thu, 17 May 2018 14:26:12 +0000 (14:26 +0000)]
Add initial man page for Microchip USB 3 Gigabit Ethernet controller

Sponsored by: The FreeBSD Foundation

6 years agoAdd driver for Microchip LAN78xx USB3-GigE controller
emaste [Thu, 17 May 2018 14:04:59 +0000 (14:04 +0000)]
Add driver for Microchip LAN78xx USB3-GigE controller

This driver supports two Microchip USB-Ethernet controllers:

LAN7800 USB 3.1 to 10/100/1000 Mbps Ethernet
LAN7515 USB 2 to 10/100/1000 Mbps Ethernet with built-in USB hub

The LAN7515 is the Ethernet controller on the Raspberry Pi 3B+.
At present there is no datasheet for the LAN7515, but it is effectively
a USB 2 hub combined with a LAN7800 controller.  A comprehensive LAN7800
datasheet is at http://www.microchip.com/wwwproducts/en/LAN7800.

This driver is based on the structure of the smsc(4) driver which
supports Microchip/SMSC's LAN95xx family.  (Microchip acquired SMSC
in May 2012.)  The Linux lan78xx driver served as a reference for some
functionality and registers.

The 'muge' driver name comes from "Microchip USB Gigabit Ethernet".
I made some style adjustments and minor edits to Arshan's submission.
It will be connected to the build after additional review and testing.

Thanks to Microchip for providing a number of Evaluation Boards (EVBs)
for development and testing.

Submitted by: Arshan Khanifar
Reviewed by: hselasky (earlier)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D15168

6 years agoAdd missing newline to end of -c usage string .
rgrimes [Thu, 17 May 2018 12:18:41 +0000 (12:18 +0000)]
Add missing newline to end of -c usage string .

Pointy hat: me
Submitted by: novel
Approved by: bde(mentor), grehan (maintainer)
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D15421

6 years agoaw_spi: Fix manpages
manu [Thu, 17 May 2018 11:53:04 +0000 (11:53 +0000)]
aw_spi: Fix manpages

Somehow two copies of the man was in the file, remove one.
Replace an occurence of 'SD/MMC' that was left from copy/paste.
Remove space before ':'

Reported by: 0mp

6 years agoaw_spi: Add manpage for this driver
manu [Thu, 17 May 2018 10:25:49 +0000 (10:25 +0000)]
aw_spi: Add manpage for this driver

6 years agoalwinner: Add missing files in r333708
manu [Thu, 17 May 2018 10:25:01 +0000 (10:25 +0000)]
alwinner: Add missing files in r333708

6 years agoallwinner: Add h3 spi driver
manu [Thu, 17 May 2018 10:19:52 +0000 (10:19 +0000)]
allwinner: Add h3 spi driver

This driver is compatible with H3/H5/A64.
Test was done on the OrangePi-PC2 board (H5 based), which have a mx25l1606e
spi flash on it, by writing u-boot image, reading it and booting from the spi.
There is still room for improvement especially on reading using the controller
automatic burst which will avoid us to write dummy data to the TX FIFO.
DMA is also not supported as we currently don't support the DMA controller on
those SoCs
Only add a kernel module for it.

6 years agofix a problem with bad performance after wakeup caused by r333321
avg [Thu, 17 May 2018 10:16:20 +0000 (10:16 +0000)]
fix a problem with bad performance after wakeup caused by r333321

This change reverts a "while here" part of r333321 that moved clearing
of suspended_cpus to an earlier place.

Apparently, there can be a problem when modifying (shared) memory before
restoring proper cache attributes.  So, to be safe, move the clearing to
the old place.

Many thanks to Johannes Lundberg for bisecting the changes to that
particular commit and then bisecting the commit to the particular
change.

Reported by: many
Debugged by: Johannes Lundberg <johalun0@gmail.com>
MFC after: 1 week
X-MFC with: r333321

6 years agomx25l: Add mx25l1606e
manu [Thu, 17 May 2018 10:13:18 +0000 (10:13 +0000)]
mx25l: Add mx25l1606e

This is a 16Mbits spi flash arranged in 32x64k blocks or 512x4k
sectors.

6 years agocxgbe(4): Fix s->neq miscalculation in r333698.
np [Thu, 17 May 2018 06:04:50 +0000 (06:04 +0000)]
cxgbe(4): Fix s->neq miscalculation in r333698.

6 years agoFix a race in vm_page_pagequeue_lockptr().
markj [Thu, 17 May 2018 04:27:08 +0000 (04:27 +0000)]
Fix a race in vm_page_pagequeue_lockptr().

The value of m->queue must be cached after comparing it with PQ_NONE,
since it may be concurrently changing.

Reported by: glebius
Reviewed by: jeff
Differential Revision: https://reviews.freebsd.org/D15462

6 years agoFix netdump configuration when VIMAGE is enabled.
markj [Thu, 17 May 2018 04:08:57 +0000 (04:08 +0000)]
Fix netdump configuration when VIMAGE is enabled.

We need to set the current vnet before iterating over the global
interface list. Because the dump device may only be set from the host,
only proceed with configuration if the thread belongs to the default
vnet. [1]

Also fix a resource leak that occurs if the priv_check() in set_dumper()
fails.

Reported by: mmacy, sbruno [1]
Reviewed by: sbruno
X-MFC with: r333283
Differential Revision: https://reviews.freebsd.org/D15449

6 years agoFix powerpc64 LINT
mmacy [Thu, 17 May 2018 03:19:31 +0000 (03:19 +0000)]
Fix powerpc64 LINT

vm_object_reserve() == true is impossible on power. Make conditional
on VM_LEVEL_0_ORDER being defined.

Reviewed by: jeff
Approved by: sbruno

6 years agoFix i386 build
mmacy [Thu, 17 May 2018 02:54:30 +0000 (02:54 +0000)]
Fix i386 build

Move epoch_section to after td_emuldata, but note the 3 surrounding LP64 holes
while I'm here.

Approved by: sbruno

6 years agoPlug a memory leak and potential NULL-pointer dereference introduced in r331214.
lstewart [Thu, 17 May 2018 02:46:27 +0000 (02:46 +0000)]
Plug a memory leak and potential NULL-pointer dereference introduced in r331214.

Each TCP connection that uses the system default cc_newreno(4) congestion
control algorithm module leaks a "struct newreno" (8 bytes of memory) at
connection initialisation time. The NULL-pointer dereference is only germane
when using the ABE feature, which is disabled by default.

While at it:

- Defer the allocation of memory until it is actually needed given that ABE is
  optional and disabled by default.

- Document the ENOMEM errno in getsockopt(2)/setsockopt(2).

- Document ENOMEM and ENOBUFS in tcp(4) as being synonymous given that they are
  used interchangeably throughout the code.

- Fix a few other nits also accidentally omitted from the original patch.

Reported by: Harsh Jain on freebsd-net@
Tested by: tjh@
Differential Revision: https://reviews.freebsd.org/D15358

6 years agocxgbe(4): Allocate offload Tx queues when a card has resources
np [Thu, 17 May 2018 01:42:18 +0000 (01:42 +0000)]
cxgbe(4): Allocate offload Tx queues when a card has resources
provisioned for NIC_ETHOFLD and the kernel has option RATELIMIT.

It is possible to use the chip's offload queues for normal NIC Tx and
not just TOE Tx.  The difference is that these queues support out of
order processing of work requests and have a per-"flowid" mechanism for
tracking credits between the driver and hardware.  This allows Tx for
any number of flows bound to different rate limits to be submitted to a
single Tx queue and the work requests for slow flows won't cause HOL
blocking for the rest.

Sponsored by: Chelsio Communications

6 years agoepoch(9): make recursion lighter weight
mmacy [Thu, 17 May 2018 01:13:40 +0000 (01:13 +0000)]
epoch(9): make recursion lighter weight

There isn't any real work to do except bump td_epochnest when recursing.
Skip the additional work in this case.

Approved by: sbruno

6 years agocxgbe(4): Add NIC_ETHOFLD to the NIC capabilities allowed by the driver
np [Thu, 17 May 2018 00:52:48 +0000 (00:52 +0000)]
cxgbe(4): Add NIC_ETHOFLD to the NIC capabilities allowed by the driver
by default.

This is the first of a series of commits that will add support for
RATELIMIT kernel option to the base if_cxgbe driver, for use with
ordinary NIC traffic "flows".  RATELIMIT is already supported by t4_tom
for the fully-offloaded TCP connections that it handles.

Sponsored by: Chelsio Communications

6 years agoepoch(9): Guarantee forward progress on busy sections
mmacy [Thu, 17 May 2018 00:45:35 +0000 (00:45 +0000)]
epoch(9): Guarantee forward progress on busy sections

Add epoch section to struct thread. We can use this to
ennable epoch counter to advance even if a section is
perpetually occupied by a thread.

Approved by: sbruno

6 years agoFix warning found by Coverity.
mckusick [Wed, 16 May 2018 23:42:02 +0000 (23:42 +0000)]
Fix warning found by Coverity.

CID 1009353:  Error handling issues  (CHECKED_RETURN)

6 years agoRevert change made in base r171522
mckusick [Wed, 16 May 2018 23:30:03 +0000 (23:30 +0000)]
Revert change made in base r171522
(https://svnweb.freebsd.org/base?view=revision&revision=304232)
converting clrbuf() (which clears the entire buffer) to vfs_bio_clrbuf()
(which clears only the new pages that have been added to the buffer).

Failure to properly remove pages from the buffer cache can make
pages that appear not to need clearing to actually have bad random
data in them. See for example base r304232
(https://svnweb.freebsd.org/base?view=revision&revision=304232)
which noted the need to set B_INVAL and B_NOCACHE as well as clear
the B_CACHE flag before calling brelse() to release the buffer.

Rather than trying to find all the incomplete brelse() calls, it
is simpler, though more slightly expensive, to simply clear the
entire buffer when it is newly allocated.

PR: 213507
Submitted by: Damjan Jovanovic
Reviewed by:  kib

6 years agohwpmc: Implement per-thread counters for PMC sampling
mmacy [Wed, 16 May 2018 22:29:20 +0000 (22:29 +0000)]
hwpmc: Implement per-thread counters for PMC sampling

This implements per-thread counters for PMC sampling. The thread
descriptors are stored in a list attached to the process descriptor.
These thread descriptors can store any per-thread information necessary
for current or future features. For the moment, they just store the counters
for sampling.

The thread descriptors are created when the process descriptor is created.
Additionally, thread descriptors are created or freed when threads
are started or stopped. Because the thread exit function is called in a
critical section, we can't directly free the thread descriptors. Hence,
they are freed to a cache, which is also used as a source of allocations
when needed for new threads.

Approved by: sbruno
Obtained from: jtl
Sponsored by: Juniper Networks, Limelight Networks
Differential Revision: https://reviews.freebsd.org/D15335

6 years agoFix !netmap build post r333686
mmacy [Wed, 16 May 2018 22:25:47 +0000 (22:25 +0000)]
Fix !netmap build post r333686

Approved by: sbruno

6 years ago2018 this time.
imp [Wed, 16 May 2018 21:07:12 +0000 (21:07 +0000)]
2018 this time.

6 years agoWork around lack of TX IRQs in iflib for netmap
shurd [Wed, 16 May 2018 21:03:22 +0000 (21:03 +0000)]
Work around lack of TX IRQs in iflib for netmap

When poll() is called via netmap, txsync is initially called,
and if there are no available buffers to reclaim, it waits for the driver
to notify of new buffers. Since the TX IRQ is generally not used in iflib
drivers, this ends up causing a timeout.

Work around this by having the reclaim DELAY(1) if it's initially unable
to reclaim anything, then schedule the tx task, which will spin by
continuously rescheduling itself until some buffers are reclaimed. In
general, the delay is enough to allow some buffers to be reclaimed, so
spinning is minimized.

Reported by: Johannes Lundberg <johalun0@gmail.com>
Reviewed by: sbruno
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D15455

6 years agoSet label when setting up USB LUNs, it looks nicer this way.
trasz [Wed, 16 May 2018 20:44:08 +0000 (20:44 +0000)]
Set label when setting up USB LUNs, it looks nicer this way.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

6 years agoChange the cfumass rc script to stop pretending the USB LUN is a virtual
trasz [Wed, 16 May 2018 20:39:15 +0000 (20:39 +0000)]
Change the cfumass rc script to stop pretending the USB LUN is a virtual
CD; for some reason OSX can't deal with it.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

6 years agoteken: Unbreak syscons' use of teken
cem [Wed, 16 May 2018 18:12:49 +0000 (18:12 +0000)]
teken: Unbreak syscons' use of teken

Only vt(4) initializes these callbacks non-NULL at this time, so invoke the
function pointers conditionally.

Broken in r333669.

Submitted by: bde@

6 years agocxgbe(4): Fall back to a failsafe configuration built into the firmware
np [Wed, 16 May 2018 17:55:16 +0000 (17:55 +0000)]
cxgbe(4): Fall back to a failsafe configuration built into the firmware
if an error is reported while pre-processing the configuration file that
the driver attempted to use.

Also, allow the user to explicitly use the built-in configuration with
hw.cxgbe.config_file="built-in"

MFC after: 2 days
Sponsored by: Chelsio Communications

6 years agoInclude kernel modules for MALTA kernels.
jhb [Wed, 16 May 2018 17:54:40 +0000 (17:54 +0000)]
Include kernel modules for MALTA kernels.

Sponsored by: DARPA / AFRL

6 years agoA belated note crediting the FreeBSD Foundation for sponsoring
zec [Wed, 16 May 2018 16:57:11 +0000 (16:57 +0000)]
A belated note crediting the FreeBSD Foundation for sponsoring
technical work circa ten years ago...

MFC after: 3 days

6 years agoExport a breakpoint() function to userland for riscv.
jhb [Wed, 16 May 2018 16:56:35 +0000 (16:56 +0000)]
Export a breakpoint() function to userland for riscv.

As a result, enable tests using breakpoint() on riscv.

Reviewed by: br
Differential Revision: https://reviews.freebsd.org/D15191

6 years agoMerge upstream patch to unbreak tunnel forwarding.
des [Wed, 16 May 2018 14:04:39 +0000 (14:04 +0000)]
Merge upstream patch to unbreak tunnel forwarding.

Reported by: cy@

6 years agoAdd note about LD=ld.lld being a temporary requirement when building
imp [Wed, 16 May 2018 13:52:24 +0000 (13:52 +0000)]
Add note about LD=ld.lld being a temporary requirement when building
the kernel the traditional way.

6 years agoForward Reply-Message attributes to the user, unless suppressed by the
des [Wed, 16 May 2018 13:47:30 +0000 (13:47 +0000)]
Forward Reply-Message attributes to the user, unless suppressed by the
new no_reply_message option.

MFC after: 1 week
Sponsored by: The University of Oslo

6 years agoClean up vt source whitespace issues
emaste [Wed, 16 May 2018 11:19:03 +0000 (11:19 +0000)]
Clean up vt source whitespace issues

6 years agovt(4): Resume vt_timer() in vtterm_post_input() only
dumbbell [Wed, 16 May 2018 10:08:50 +0000 (10:08 +0000)]
vt(4): Resume vt_timer() in vtterm_post_input() only

There is no need to try to resume it after each smaller operations
(putchar, cursor_position, copy, fill).

The resume function already checks if the timer is armed before doing
anything, but it uses an atomic cmpset which is expensive. And resuming
the timer at the end of input processing is enough.

While here, we also skip timer resume if the input is for another
windows than the currently displayed one. I.e. if `ttyv0` is currently
displayed, any changes to `ttyv1` shouldn't resume the timer (which
would refresh `ttyv0`).

By doing the same benchmark as r333669, I get:
  * vt(4), before r333669:  1500 ms
  * vt(4), with this patch:  760 ms
  * syscons(4):              700 ms

6 years agoteken, vt(4): New callbacks to lock the terminal once
dumbbell [Wed, 16 May 2018 09:01:02 +0000 (09:01 +0000)]
teken, vt(4): New callbacks to lock the terminal once

... to process input, instead of inside each smaller operations such as
appending a character or moving the cursor forward.

In other words, before we were doing (oversimplified):

  teken_input()
    <for each input character>
      vtterm_putchar()
        VTBUF_LOCK()
        VTBUF_UNLOCK()
      vtterm_cursor_position()
        VTBUF_LOCK()
        VTBUF_UNLOCK()

Now, we are doing:

  vtterm_pre_input()
    VTBUF_LOCK()
  teken_input()
    <for each input character>
      vtterm_putchar()
      vtterm_cursor_position()
  vtterm_post_input()
    VTBUF_UNLOCK()

The situation was even worse when the vtterm_copy() and vtterm_fill()
callbacks were involved.

The new callbacks are:
  * struct terminal_class->tc_pre_input()
  * struct terminal_class->tc_post_input()

They are called in teken_input(), surrounding the while() loop.

The goal is to improve input processing speed of vt(4). As a benchmark,
here is the time taken to write a text file of 360 000 lines (26 MiB) on
`ttyv0`:

  * vt(4), unmodified:      1500 ms
  * vt(4), with this patch: 1200 ms
  * syscons(4):              700 ms

This is on a Haswell laptop with a GENERIC-NODEBUG kernel.

At the same time, the locking is changed in the vt_flush() function
which is responsible to draw the text on screen. So instead of
(indirectly) using VTBUF_LOCK() just to read and reset the dirty area
of the internal buffer, the lock is held for about the entire function,
including the drawing part.

The change is mostly visible while content is scrolling fast: before,
lines could appear garbled while scrolling because the internal buffer
was accessed without locks (once the scrolling was finished, the output
was correct). Now, the scrolling appears correct.

In the end, the locking model is closer to what syscons(4) does.

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

6 years agofollowup to r332730/r332752: set kdb_why to "trap" for fatal traps
avg [Wed, 16 May 2018 06:52:08 +0000 (06:52 +0000)]
followup to r332730/r332752: set kdb_why to "trap" for fatal traps

This change updates arm, arm64 and mips achitectures.  Additionally, it
removes redundant checks for kdb_active where it already results in
kdb_reenter() and adds kdb_reenter() calls where they were missing.

Some architectures check the return value of kdb_trap(), but some don't.
I haven't changed any of that.

Some trap handling routines have a return code.  I am not sure if I
provided correct ones for returns after kdb_reenter().  kdb_reenter
should never return unless kdb_jmpbufp is NULL for some reason.

Only compile tested for all affected architectures.  There can be bugs
resulting from my poor understanding of architecture specific details.

Reported by: jhb
Reviewed by: jhb, eadler
MFC after: 4 weeks
Differential Revision: https://reviews.freebsd.org/D15431

6 years agoAttempt to fix build by removing EOF backslash-newline
emaste [Wed, 16 May 2018 03:17:37 +0000 (03:17 +0000)]
Attempt to fix build by removing EOF backslash-newline

GCC complains:
In file included from .../sys/dev/usb/input/uhid.c:77:
.../usb_rdesc.h:280:37: error: backslash-newline at end of file

6 years agoAdd intel-ucode-split to tools README
emaste [Wed, 16 May 2018 03:08:06 +0000 (03:08 +0000)]
Add intel-ucode-split to tools README