]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
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

6 years agomakefs: ANSIfy
emaste [Wed, 16 May 2018 02:58:05 +0000 (02:58 +0000)]
makefs: ANSIfy

6 years agoSort mlx5tool correctly in usr.sbin/Makefile
emaste [Wed, 16 May 2018 02:51:30 +0000 (02:51 +0000)]
Sort mlx5tool correctly in usr.sbin/Makefile

6 years agoClarify that boot_mute / boot -m mutes kernel console only
emaste [Wed, 16 May 2018 02:15:18 +0000 (02:15 +0000)]
Clarify that boot_mute / boot -m mutes kernel console only

Perhaps RB_MUTE could mute user startup (rc) output as well, but right
now it mutes only kernel console output, so make the documentation match
reality.

PR: 228193
Sponsored by: The FreeBSD Foundation

6 years agointel-ucode-split: list platform ids based on processor_flags
emaste [Wed, 16 May 2018 01:55:52 +0000 (01:55 +0000)]
intel-ucode-split: list platform ids based on processor_flags

The Intel CPU "Platform Id" is a 3-bit integer reported by a given MSR.
Intel microcode updates have an 8-bit field to indicate Platform Id
compatibility - one bit in the mask for each of the possible Platform Id
values.  To simplify interpretation, report the Platform Id mask also as
a list.

6 years agointel-ucode-split: exit on unknown ucode header version
emaste [Wed, 16 May 2018 01:41:36 +0000 (01:41 +0000)]
intel-ucode-split: exit on unknown ucode header version

6 years agoRegen src.conf.5 after r333658
emaste [Wed, 16 May 2018 01:34:36 +0000 (01:34 +0000)]
Regen src.conf.5 after r333658

6 years agoForce WITHOUT_FREEBSD_UPDATE when WITHOUT_PORTSNAP is set
emaste [Wed, 16 May 2018 01:33:48 +0000 (01:33 +0000)]
Force WITHOUT_FREEBSD_UPDATE when WITHOUT_PORTSNAP is set

freebsd-update depends on phttpget from portsnap. We could move phttpget
out of portsnap and build it as long as WITHOUT_FREEBSD_UPDATE and
WITHOUT_PORTSNAP are not both set, but for now just make the dependency
explicit.

PR: 228220
Reported by: Dries Michiels
Sponsored by: The FreeBSD Foundation

6 years agointel-ucode-split: add a -v verbose flag
emaste [Wed, 16 May 2018 01:08:11 +0000 (01:08 +0000)]
intel-ucode-split: add a -v verbose flag

And be quiet by default.

Sponsored by: The FreeBSD Foundation

6 years agoUnhook DEBUG_BUFRING from INVARIANTS
gallatin [Tue, 15 May 2018 23:55:38 +0000 (23:55 +0000)]
Unhook DEBUG_BUFRING from INVARIANTS

Some of the DEBUG_BUFRING checks are racy, and can lead to
spurious assertions when run under high load.  Unhook these
from INVARIANTS until the author can fix or remove them.

Reviewed by: mmacy
Sponsored by: Netflix

6 years agoFix stale dependencies on libcasper libraries.
bdrewery [Tue, 15 May 2018 23:46:49 +0000 (23:46 +0000)]
Fix stale dependencies on libcasper libraries.

Libcasper and its modules have no static libraries so don't define
paths to them.  This fixes LIBADD automatically adding DPADD
entries for casper.

Reported by: sbruno
Sponsored by: Dell EMC Isilon

6 years agocxgbe(4): Add support for two more flash parts.
np [Tue, 15 May 2018 22:26:09 +0000 (22:26 +0000)]
cxgbe(4): Add support for two more flash parts.

Obtained from: Chelsio Communications
MFC after: 2 days
Sponsored by: Chelsio Communications

6 years agoHold the reference count until the CCB is released
imp [Tue, 15 May 2018 22:22:10 +0000 (22:22 +0000)]
Hold the reference count until the CCB is released

When a disk disappears and the periph is invalidated, any I/Os that
are pending with the controller can cause a crash when they
complete. Move to holding the softc reference count taken in dastart()
until the I/O is complete rather than only until xpt_action()
returns. (This approach was suggested by Ken Merry.) This extends
the method used in da to ada, nda, and mda.

Sponsored by: Netflix
Submitted by: Chuck Silvers

6 years agocxgbe(4): Claim some more T5 and T6 boards.
np [Tue, 15 May 2018 21:54:59 +0000 (21:54 +0000)]
cxgbe(4): Claim some more T5 and T6 boards.

MFC after: 2 days
Sponsored by: Chelsio Communications

6 years agoAdd a tool to split Intel microcode into one file per Platform Id
emaste [Tue, 15 May 2018 21:51:29 +0000 (21:51 +0000)]
Add a tool to split Intel microcode into one file per Platform Id

Intel now releases microcode updates in files named after
<family>-<model>-<stepping>.  In some cases a single file may include
microcode for multiple Platform Ids for the same family, model, and
stepping.  Our current microcode update tooling (/usr/sbin/cpucontrol)
only processes the first microcode update in the file.

This tool splits combined files into individual files with one microcode
update each, named as
<family>-<model>-<stepping>.<platform_id_mask>.

Adding this to tools/ for experimentation and testing.  In the future
we'll want to have cpucontrol or other tooling work directly with the
Intel-provided microcode files.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D15433

6 years agoHold the reference count until the CCB is released
imp [Tue, 15 May 2018 21:25:35 +0000 (21:25 +0000)]
Hold the reference count until the CCB is released

When a disk disappears and the periph is invalidated, any I/Os that
are pending with the controller can cause a crash when they
complete. Move to holding the softc reference count taken in dastart()
until the I/O is complete rather than only until xpt_action()
returns. (This approach was suggested by Ken Merry.)

Sponsored by: Netflix
Submitted by: Chuck Silvers
Differential Revision: https://reviews.freebsd.org/D15435

6 years ago- If present, take advantage of the R/W cache of eMMC revision 1.5 and
marius [Tue, 15 May 2018 21:15:09 +0000 (21:15 +0000)]
- If present, take advantage of the R/W cache of eMMC revision 1.5 and
  later devices. These caches work akin to the ones found in HDDs/SSDs
  that ada(4)/da(4) also enable if existent, but likewise increase the
  likelihood of data loss in case of a sudden power outage etc. On the
  other hand, write performance is up to twice as high for e. g. 1 GiB
  files depending on the actual chip and transfer mode employed.
  For maximum data integrity, the usage of eMMC caches can be disabled
  via the hw.mmcsd.cache tunable.
- Get rid of the NOP mmcsd_open().

6 years agoRestore style(9) conformance after r320844 (actually requested pre-
marius [Tue, 15 May 2018 21:07:11 +0000 (21:07 +0000)]
Restore style(9) conformance after r320844 (actually requested pre-
commit) and bring the r320844 additions in line with existing bits.

6 years agoEnd grace for the NFSv4 server if all mounts do ReclaimComplete.
rmacklem [Tue, 15 May 2018 20:28:50 +0000 (20:28 +0000)]
End grace for the NFSv4 server if all mounts do ReclaimComplete.

The NFSv4 protocol requires that the server only allow reclaim of state
and not issue any new open/lock state for a grace period after booting.
The NFSv4.0 protocol required this grace period to be greater than the
lease duration (over 2minutes). For NFSv4.1, the client tells the server
that it has done reclaiming state by doing a ReclaimComplete operation.
If all NFSv4 clients are NFSv4.1, the grace period can end once all the
clients have done ReclaimComplete, shortening the time period considerably.
This patch does this. If there are any NFSv4.0 mounts, the grace period
will still be over 2minutes.
This change is only an optimization and does not affect correct operation.

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

6 years agoUnwrap a line that no longer requires wrapping.
brooks [Tue, 15 May 2018 20:14:38 +0000 (20:14 +0000)]
Unwrap a line that no longer requires wrapping.

6 years agoRemove stray tabs from in_lltable_dump_entry().
brooks [Tue, 15 May 2018 20:13:00 +0000 (20:13 +0000)]
Remove stray tabs from in_lltable_dump_entry().

6 years agoUnwrap some not-so-long lines now that extra tabs been removed.
brooks [Tue, 15 May 2018 17:59:46 +0000 (17:59 +0000)]
Unwrap some not-so-long lines now that extra tabs been removed.

6 years agoRemove stray tabs in in6_lltable_dump_entry(). NFC.
brooks [Tue, 15 May 2018 17:57:46 +0000 (17:57 +0000)]
Remove stray tabs in in6_lltable_dump_entry().  NFC.

6 years agovmmdev: return EFAULT when trying to read beyond VM system memory max address
antoine [Tue, 15 May 2018 17:20:58 +0000 (17:20 +0000)]
vmmdev: return EFAULT when trying to read beyond VM system memory max address

Currently, when using dd(1) to take a VM memory image, the capture never ends,
reading zeroes when it's beyond VM system memory max address.
Return EFAULT when trying to read beyond VM system memory max address.

Reviewed by: imp, grehan, anish
Approved by: grehan
Differential Revision: https://reviews.freebsd.org/D15156

6 years agocalibrate lapic timer in native_lapic_setup
avg [Tue, 15 May 2018 16:56:30 +0000 (16:56 +0000)]
calibrate lapic timer in native_lapic_setup

The idea is to calibrate the LAPIC timer just once and only on boot,
given that [at present] the timer constants are global and shared
between all processors.

My primary motivation is to fix a panic that can happen when dynamically
switching to lapic timer.  The panic is caused by a recursion on
et_hw_mtx when printing the calibration results to console.  See the
review for the details of the panic.

Also, the code should become slightly simpler and easier to read.  The
previous code was racy too.  Multiple processors could start calibrating
the global constants concurrently, although that seems to have been
benign.

Reviewed by: kib, mav, jhb
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D15422

6 years agoCheck that ifma_protospec != NULL in inm_lookup
shurd [Tue, 15 May 2018 16:54:41 +0000 (16:54 +0000)]
Check that ifma_protospec != NULL in inm_lookup

If ifma_protospec is NULL when inm_lookup() is called, there
is a dereference in a NULL struct pointer. This ensures that struct is
not NULL before comparing the address.

Reported by: dumbbell
Reviewed by: sbruno
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D15440

6 years agoIncrease the number of pages we allocate in the arm64 early boot. We are
andrew [Tue, 15 May 2018 16:44:35 +0000 (16:44 +0000)]
Increase the number of pages we allocate in the arm64 early boot. We are
already close to the limit so increasing the kernel size may cause it to
fail to boot when it runs past the end of allocated memory.

Reported by: manu
Sponsored by: DARPA, AFRL

6 years agoAllow freebsd32 __sysctl(2) to return ENOMEM.
brooks [Tue, 15 May 2018 16:24:58 +0000 (16:24 +0000)]
Allow freebsd32 __sysctl(2) to return ENOMEM.

This is required by programs like sockstat that read variably sized
sysctls such as kern.file.  The normal path has no such restriction and
the restriction was added without comment along with initial support for
freebsd32 in 2002 (r100384).

Reviewed by: kib
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D15438

6 years agoAdd new USB HID driver for Super Nintendo gamepads.
hselasky [Tue, 15 May 2018 15:36:34 +0000 (15:36 +0000)]
Add new USB HID driver for Super Nintendo gamepads.

Differential Revision: https://reviews.freebsd.org/D15385
Submitted by: johalun@gmail.com (Johannes Lundberg)
Sponsored by: Mellanox Technologies

6 years agoFix sysctl description.
trasz [Tue, 15 May 2018 15:11:52 +0000 (15:11 +0000)]
Fix sysctl description.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

6 years agoigb(4):
sbruno [Tue, 15 May 2018 13:30:59 +0000 (13:30 +0000)]
igb(4):
I210 restore functionality if pxeboot rom is enabled on this device.

r333345 attempted to determine if this code was needed or it was some kind
of work around for a problem.  Turns out, its definitely a work around for
hardware locking and synchronization that manifests itself if the option
Rom is enabled and is selected as a boot device (there was a PXE attempt).

Reviewed by: mmacy
Differential Revision: https://reviews.freebsd.org/D15439

6 years agoFix 'zpool create -t <tempname>'
avg [Tue, 15 May 2018 13:27:29 +0000 (13:27 +0000)]
Fix 'zpool create -t <tempname>'

Creating a pool with a temporary name fails when we also specify custom
dataset properties: this is because we mistakenly call
zfs_set_prop_nvlist() on the "real" pool name which, as expected,
cannot be found because the SPA is present in the namespace with the
temporary name.

Fix this by specifying the correct pool name when setting the dataset
properties.

Author: loli10K <ezomori.nozomu@gmail.com>
Reviewed-by: Prakash Surya <prakash.surya@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Obtained from: ZFS on Linux, zfsonlinux/zfs@4ceb8dd6fdfdde
MFC after: 1 week