]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agoFix build issue with const and volatile and the
rrs [Thu, 7 Jun 2018 19:57:55 +0000 (19:57 +0000)]
Fix build issue with const and volatile and the
myriad ways that the various compliers treat this. The
only safe prefetch appears to be for AMD. The other
compilers either are not volatile or are not const :(

Reported by: Michael Tuexen

6 years agoUse simpler sed invocation.
bdrewery [Thu, 7 Jun 2018 19:39:11 +0000 (19:39 +0000)]
Use simpler sed invocation.

X-MFC-With: r334791
MFC after: 1 week
Submitted by: danfe

6 years agoBreak recursion involving getnewvnode and zfs_rmnode.
benno [Thu, 7 Jun 2018 18:59:32 +0000 (18:59 +0000)]
Break recursion involving getnewvnode and zfs_rmnode.

When we're at our vnode limit, getnewvnode will call into the vnode LRU
cache to free up vnodes. If the vnode we try to recycle is a ZFS vnode we
end up, eventually, in zfs_rmnode. If the ZFS vnode we're recycling
represents something with extended attributes, zfs_rmnode will call
zfs_zget which will attempt to allocate another vnode. If the next vnode we
try to recycle is also a ZFS vnode representing something with extended
attributes we can recurse further. This ends up being unbounded and can end
up overflowing the stack.

In order to avoid this, restructure zfs_rmnode to simply add the extended
attribute directory's object ID to the unlinked set, thus not requiring the
allocation of a vnode. We then schedule a task that calls zfs_unlinked_drain
which will do the work of properly marking the vnodes for unlinking.
zfs_unlinked_drain is also called on mount so these will be cleaned up
there.

Reviewed by: avg, mav
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D15342

6 years agonetbsd-tests: bsdgrep(1): Add a test for -m, too
kevans [Thu, 7 Jun 2018 18:53:39 +0000 (18:53 +0000)]
netbsd-tests: bsdgrep(1): Add a test for -m, too

6 years agobsdgrep(1): Don't initialize fts_flags twice
kevans [Thu, 7 Jun 2018 18:38:48 +0000 (18:38 +0000)]
bsdgrep(1): Don't initialize fts_flags twice

Admittedly, this is a clang-scan complaint... but it wasn't wrong. fts_flags
is initialized by all cases in the switch(), which should be fairly obvious.
Annotate this anyways.

6 years agobsdgrep(1): whoops, garbage collect the now write-only variable
kevans [Thu, 7 Jun 2018 18:36:12 +0000 (18:36 +0000)]
bsdgrep(1): whoops, garbage collect the now write-only variable

6 years agobsdgrep(1): Do some less dirty things with return types
kevans [Thu, 7 Jun 2018 18:27:58 +0000 (18:27 +0000)]
bsdgrep(1): Do some less dirty things with return types

Neither procfile nor grep_tree return anything meaningful to their callers.
None of the callers actually care about how many lines were matched in all
of the files they processed; it's all about "did anything match?"

This is generally just a light refactoring to remind me of what actually
matters as I'm rewriting these bits to care less about 'stuff'.

6 years ago- Once we have shifted arguments up to thrice, base-bits-dir is $1 rather
marius [Thu, 7 Jun 2018 18:24:25 +0000 (18:24 +0000)]
- Once we have shifted arguments up to thrice, base-bits-dir is $1 rather
  than $4. Introduce $BASEBITSDIR for clarity and to avoid repeating this
  mistake in the future. Fixing this ensures that we pick up newly built
  boot bits native to the target rather for/from the host.
- Apply some of the argument quoting fixes done in r287635 but missing in
  later revisions.

6 years agoThis commit brings in a new refactored TCP stack called Rack.
rrs [Thu, 7 Jun 2018 18:18:13 +0000 (18:18 +0000)]
This commit brings in a new refactored TCP stack called Rack.
Rack includes the following features:
 - A different SACK processing scheme (the old sack structures are not used).
 - RACK (Recent acknowledgment) where counting dup-acks is no longer done
        instead time is used to knwo when to retransmit. (see the I-D)
 - TLP (Tail Loss Probe) where we will probe for tail-losses to attempt
        to try not to take a retransmit time-out. (see the I-D)
 - Burst mitigation using TCPHTPS
 - PRR (partial rate reduction) see the RFC.

Once built into your kernel, you can select this stack by either
socket option with the name of the stack is "rack" or by setting
the global sysctl so the default is rack.

Note that any connection that does not support SACK will be kicked
back to the "default" base  FreeBSD stack (currently known as "default").

To build this into your kernel you will need to enable in your
kernel:
   makeoptions WITH_EXTRA_TCP_STACKS=1
   options TCPHPTS

Sponsored by: Netflix Inc.
Differential Revision: https://reviews.freebsd.org/D15525

6 years agonetbsd-tests: grep(1): Add test for -c flag
kevans [Thu, 7 Jun 2018 18:06:01 +0000 (18:06 +0000)]
netbsd-tests: grep(1): Add test for -c flag

Someone might be inclined to accidentally break this. someone might have
written said test because they broke it locally.

6 years agoAccount for dmap limit when selecting the pages for the bootstrap
kib [Thu, 7 Jun 2018 17:04:34 +0000 (17:04 +0000)]
Account for dmap limit when selecting the pages for the bootstrap
pagetables.

physmap[] can be inconsistent with the physical memory limit due to
buggy bios, or to the hw.physmem tunable. Since bootstrap pagetables
are initialized by accesses through the DMAP, we must ensure that DMAP
really cover the selected pages. This is only relevant when machine
has less than 4G RAM and buggy BIOS, which is the combination on Acer
Chromebook 720.

The call to mp_bootaddress() is moved later to have Maxmem initialized.

An alternative could be to always cover 4G for DMAP, but this change
seems to be simpler.

Reported and tested by: grembo
Reviewed by: royger
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D15675

6 years agoStop using head(1) which is not available in installworld.
bdrewery [Thu, 7 Jun 2018 16:16:22 +0000 (16:16 +0000)]
Stop using head(1) which is not available in installworld.

installworld should not be executing this anyhow but there is some
obscure case doing it still.  The head(1) binary is not part of
ITOOLS and there's no need to add it.

MFC after: 1 week
Sponsored by: Dell EMC

6 years agodev/ofw: Fix ofw_fdt_getprop() return values to match documentation
leitao [Thu, 7 Jun 2018 15:59:08 +0000 (15:59 +0000)]
dev/ofw: Fix ofw_fdt_getprop() return values to match documentation

Fix the behavior of ofw_fdt_getprop() and ofw_fdt_getprop() functions to match
the documentation as the non-fdt code.

Submitted by: Luis Pires <lffpires@ruabrasil.org>
Reviewed by: manu, jhibbits
Approved by: jhibbits (mentor)
Differential Revision: https://reviews.freebsd.org/D15680

6 years agoUnbreak dtrace runtime for udp after svn r334719 SO_REUSEPORT commit.
sbruno [Thu, 7 Jun 2018 15:27:07 +0000 (15:27 +0000)]
Unbreak dtrace runtime for udp after svn r334719 SO_REUSEPORT commit.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Limeligght Networks

6 years agox86: reorganize code that deals with unexpected NMI-s
avg [Thu, 7 Jun 2018 14:46:52 +0000 (14:46 +0000)]
x86: reorganize code that deals with unexpected NMI-s

Expected NMI-s are those than are either generated by the software (such
as a CPU sending NMI to other CPU) or generated by the hardware after
the software configured it to do so (such as NMI-s on PMC events).

Some unexpected NMI-s can be caused by hardware failures and it is
possible to inquire the hardware about them (somewhat like MCA but much
more primitive) using an EISA mechanism.  In some cases the origin of
the NMI can remain truly unknown.

This commit should not change any functionality.  It just reorganizes
the code, so that it is easier to extend with new checks for the origin
of the NMI.  Also, it frees the code that has nothing to do with ISA
from DEV_ISA.

MFC after: 3 weeks

6 years agoexpand descriptions of x86 panic_on_nmi and kdb_on_nmi sysctls
avg [Thu, 7 Jun 2018 14:23:31 +0000 (14:23 +0000)]
expand descriptions of x86 panic_on_nmi and kdb_on_nmi sysctls

The descriptions were as terse as the variable names and they did not
explain additional conditions for knobs.

MFC after: 1 week

6 years agomd: use prestaged mfs_root
leitao [Thu, 7 Jun 2018 13:57:34 +0000 (13:57 +0000)]
md: use prestaged mfs_root

On PowerNV systems, the rootfs is passed through kexec, which loads the rootfs
into memory and set two fdt entries to describe where the file is located in
the memory;

I need to pass this memory region to the md device as a mfs_root, but, current
md driver does not support two things:

 * Just getting a pointer from an external (bootloader) memory. If I need to
workaround it, I would need to declare a static array and memcopy from this
external memory to this static variable.

 * The size of the image. The usage of mfs_root_end, which is not a pointer,
seems to be not possible for this prestaged scenario.

This patch simply adds a new way to load mfs_root from memory.

Differential Revision: https://reviews.freebsd.org/D15625
Approved by: kib, jhibbits (mentor)

6 years agoFix a typo in vm_domain_set(). When a domain crosses into the severe range,
jtl [Thu, 7 Jun 2018 13:29:54 +0000 (13:29 +0000)]
Fix a typo in vm_domain_set().  When a domain crosses into the severe range,
we need to set the domain bit from the vm_severe_domains bitset (instead
of clearing it).

Reviewed by: jeff, markj
Sponsored by: Netflix, Inc.

6 years agoipfw: fix status if ipfw.ko is not loaded
kp [Thu, 7 Jun 2018 13:16:53 +0000 (13:16 +0000)]
ipfw: fix status if ipfw.ko is not loaded

If the ipfw module is not loaded the net.inet.ip.fw.enable OID does not exist,
which leads the script to report errors and incorrectly report that ipfw is
enabled.

6 years agoipfw: fix whitespace
kp [Thu, 7 Jun 2018 13:14:09 +0000 (13:14 +0000)]
ipfw: fix whitespace

No functional changes.

6 years agoiflib: Record TCP checksum info in iflib when TCP checksum is requested
erj [Thu, 7 Jun 2018 13:03:07 +0000 (13:03 +0000)]
iflib: Record TCP checksum info in iflib when TCP checksum is requested

ixl(4) (when it switches over to using iflib) devices need the TCP header
length in order to do TCP checksum offload.

Reviewed by: gallatin@, shurd@
MFC after: 1 week
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D15558

6 years agoDefine ARCH_KMALLOC_MINALIGN in the LinuxKPI.
hselasky [Thu, 7 Jun 2018 11:44:11 +0000 (11:44 +0000)]
Define ARCH_KMALLOC_MINALIGN in the LinuxKPI.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
MFC after: 1 week
Sponsored by: Mellanox Technologies
Sponsored by: Limelight Networks

6 years agoWrap timespec64 into timespec in the LinuxKPI.
hselasky [Thu, 7 Jun 2018 11:41:42 +0000 (11:41 +0000)]
Wrap timespec64 into timespec in the LinuxKPI.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
MFC after: 1 week
Sponsored by: Mellanox Technologies
Sponsored by: Limelight Networks

6 years agoMove the EXPORT_SYMBOL_XXX() function macros into own header file.
hselasky [Thu, 7 Jun 2018 11:34:59 +0000 (11:34 +0000)]
Move the EXPORT_SYMBOL_XXX() function macros into own header file.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
MFC after: 1 week
Sponsored by: Mellanox Technologies
Sponsored by: Limelight Networks

6 years agoImplement the dev_pm_set_driver_flags() function macro in the LinuxKPI.
hselasky [Thu, 7 Jun 2018 11:29:07 +0000 (11:29 +0000)]
Implement the dev_pm_set_driver_flags() function macro in the LinuxKPI.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
MFC after: 1 week
Sponsored by: Mellanox Technologies
Sponsored by: Limelight Networks

6 years agoBuild nvme modules for powerpc, and install man pages
jhibbits [Thu, 7 Jun 2018 11:25:36 +0000 (11:25 +0000)]
Build nvme modules for powerpc, and install man pages

NVMe builds for powerpc now, so just build modules for all powerpc targets,
and install NVMe man pages for all powerpc targets.

6 years agoWhen pidctrl_daemon() is called multiple times within an interval, it
alc [Thu, 7 Jun 2018 07:48:50 +0000 (07:48 +0000)]
When pidctrl_daemon() is called multiple times within an interval, it
should use the cumulative error to calculate the output.

6 years agoAF_UNIX: check for unp == unp2 on disconnect
mmacy [Thu, 7 Jun 2018 04:57:40 +0000 (04:57 +0000)]
AF_UNIX: check for unp == unp2 on disconnect

6 years agoBuild nvmecontrol on powerpc64
jhibbits [Thu, 7 Jun 2018 04:03:19 +0000 (04:03 +0000)]
Build nvmecontrol on powerpc64

The nvme driver is compiled for powerpc64 already, and the one fix required
to build nvmecontrol on powerpc64 was fixed in r334754.

6 years agoPrint Maximum Data Transfer Size as a long rather than int
jhibbits [Thu, 7 Jun 2018 04:02:09 +0000 (04:02 +0000)]
Print Maximum Data Transfer Size as a long rather than int

PowerPC has PAGE_SIZE as a long, not an int.  This causes the compiler to throw
a format mismatch warning on this print.  To work around the difference, print
it as a long instead of an int, and force the argument to a long.

Reviewed By: imp
Differential Revision: https://reviews.freebsd.org/D15653

6 years agolibpmc: add missed (uintmax_t) casts
mmacy [Thu, 7 Jun 2018 03:19:21 +0000 (03:19 +0000)]
libpmc: add missed (uintmax_t) casts

6 years agopidctrl_daemon() implements a variation on the classical, discrete PID
alc [Thu, 7 Jun 2018 02:54:11 +0000 (02:54 +0000)]
pidctrl_daemon() implements a variation on the classical, discrete PID
controller that tries to handle early invocations of the controller,
in other words, invocations before the expected end of the interval.
However, there were some calculation errors in this early invocation
case.  Notably, if an early invocation occurred while the error was
negative, the derivative term was off by a large amount.  One visible
effect of this error was that processes were being killed by the
virtual memory system's OOM killer when in fact there was plentiful
free memory.

Correct a couple minor errors in the sysctl descriptions, and apply
some style fixes.

Reviewed by: jeff, markj

6 years agohwpmc: don't do EMIT64 on constant
mmacy [Thu, 7 Jun 2018 02:20:27 +0000 (02:20 +0000)]
hwpmc: don't do EMIT64 on constant

6 years agopmc: convert native to jsonl and track TSC value of samples
mmacy [Thu, 7 Jun 2018 02:03:22 +0000 (02:03 +0000)]
pmc: convert native to jsonl and track TSC value of samples

- add '-j' options to filter to enable converting native pmc
  log format to json lines format to enable the use of scripts
  and external tooling

% pmc filter -j pmc.log pmc.jsonl

- Record the tsc value in sampling interrupts as opposed to
  recording nanotime when the sample is copied to a global log
  in hardclock - potentially many milliseconds later.

- At initialize record the tsc_freq and the time of day to give
  us an offset for translating the tsc values in callchain records

6 years agolibpmc: simplify lookup by idx
mmacy [Thu, 7 Jun 2018 00:55:17 +0000 (00:55 +0000)]
libpmc: simplify lookup by idx

6 years agohwpmc: don't log pid->name more than once
mmacy [Thu, 7 Jun 2018 00:54:43 +0000 (00:54 +0000)]
hwpmc: don't log pid->name more than once

6 years agocpufunc: add rdtscp for x86
mmacy [Thu, 7 Jun 2018 00:54:11 +0000 (00:54 +0000)]
cpufunc: add rdtscp for x86

6 years agoAdd partition scheme for mpc85xx devices
jhibbits [Thu, 7 Jun 2018 00:24:10 +0000 (00:24 +0000)]
Add partition scheme for mpc85xx devices

Some mpc85xx devices with u-boot need MBR partitioning with a FAT boot
partition.  Since the infrastructure is already in place to have a dedicated
boot partition, this adds the necessary bits to use that infrastructure with
mpc85xx boards.

Reviewed By: nwhitehorn
Differential Revision: https://reviews.freebsd.org/D15664

6 years agoRemove NLS support from BSD grep
bapt [Wed, 6 Jun 2018 23:12:35 +0000 (23:12 +0000)]
Remove NLS support from BSD grep

GNU grep as in actually in base does not have any translations support
compiled in, so no functionnality loss.

We do support 193 locales in base, we will never catch up on that number of
translation with bsd grep.

Removing NLS support make bsd grep consistent with the other binaries in base
which are not translated, and also reduce a little bit the code.

Reviewed by: kevans
Approved by: kevans
Discussed with: kevans @BSDCan
Differential Revision: https://reviews.freebsd.org/D15682

6 years agostrdup.3: Document standardization in POSIX
cem [Wed, 6 Jun 2018 21:32:49 +0000 (21:32 +0000)]
strdup.3: Document standardization in POSIX

Sponsored by: Dell EMC Isilon

6 years agostrcpy.3: Improve legibility and clarity
cem [Wed, 6 Jun 2018 20:09:21 +0000 (20:09 +0000)]
strcpy.3: Improve legibility and clarity

In the DESCRIPTION, put the more commonly used functions first in the
corresponding sentence, to help catch the eye.

Pull out the note about overlapping buffers to its own paragraph, as it
applies to all routines documented by this page.

Emphasize the potentially surprising strncpy(3) behavior of zero-filling the
remainder of a buffer larger than the source string.

Encourage strlcpy use; remove portability note about strlcpy(3).  Adapting a
strlcpy-using code base to a platform that does not provide strlcpy in libc
is so trivial as to not be worth mentioning.  (Just copy strlcpy.c out of
any BSD libc, or include and link the pre-packaged libbsd library on non-BSD
platforms.)

Likewise, expand the page's warning about ease of potential misuse to cover
all functions documented herein, and explicitly suggest using strlcpy most
of the time.  The text was mostly cribbed from a similar suggestion in
gets(3).

Finally, document the remaining valid use of strncpy -- the rare
fixed-length record with no expectation of nul-termination.

Sponsored by: Dell EMC Isilon

6 years agopf: Return non-zero from 'status' if pf is not enabled
kp [Wed, 6 Jun 2018 19:36:37 +0000 (19:36 +0000)]
pf: Return non-zero from 'status' if pf is not enabled

In the pf rc.d script the output of `/etc/rc.d/pf status` or `/etc/rc.d/pf
onestatus` always provided an exit status of zero. This made it fiddly to
programmatically determine if pf was running or not.

Return a non-zero status if the pf module is not loaded, extend pfctl to have
an option to return an error status if pf is not enabled.

PR: 228632
Submitted by: James Park-Watt <jimmypw AT gmail.com>
MFC after: 1 week

6 years agoImprove compliance with RFC 4895 and RFC 6458.
tuexen [Wed, 6 Jun 2018 19:27:06 +0000 (19:27 +0000)]
Improve compliance with RFC 4895 and RFC 6458.

Silently dicard SCTP chunks which have been requested to be
authenticated but are received unauthenticated no matter if support
for SCTP authentication has been negotiated. This improves compliance
with RFC 4895.

When the application uses the SCTP_AUTH_CHUNK socket option to
request a chunk to be received in an authenticated way, enable
the SCTP authentication extension for the end-point. This improves
compliance with RFC 6458.

Discussed with: Peter Lei
MFC after: 3 days

6 years agogpioctl.8: Fix man page section
romain [Wed, 6 Jun 2018 18:52:33 +0000 (18:52 +0000)]
gpioctl.8: Fix man page section

Reviewed by: manu
Approved by: manu

6 years agolualoader: Add a loaded hook for others to execute upon config load
kevans [Wed, 6 Jun 2018 18:28:17 +0000 (18:28 +0000)]
lualoader: Add a loaded hook for others to execute upon config load

This will not be executed on reload, though later work could allow for that.
It's intended/expected that later work won't generally need to happen on
every config load, just once (for, e.g., menu initialization) or just when
config is reloaded but not upon the initial load.

6 years agopuc(4): Add provisional support for Exar XR17V352
cem [Wed, 6 Jun 2018 16:47:33 +0000 (16:47 +0000)]
puc(4): Add provisional support for Exar XR17V352

Reportedly, this is sufficient for 4800bps use, but maybe not any better.

PR: 228781
Submitted by: peo AT nethead.se

6 years agoclog.3, complex.3: Fix typos and igor style issues
cem [Wed, 6 Jun 2018 16:25:00 +0000 (16:25 +0000)]
clog.3, complex.3: Fix typos and igor style issues

PR: 228783
Reported by: Karsten <freebsd-bugzilla AT kkoenig.net>

6 years agoMake some list functions RCU safe in the LinuxKPI.
hselasky [Wed, 6 Jun 2018 15:49:01 +0000 (15:49 +0000)]
Make some list functions RCU safe in the LinuxKPI.
While at it rename hlist_add_after() into hlist_add_behind().

Submitted by: Johannes Lundberg <johalun0@gmail.com>
MFC after: 1 week
Sponsored by: Mellanox Technologies
Sponsored by: Limelight Networks

6 years agoLoad balance sockets with new SO_REUSEPORT_LB option.
sbruno [Wed, 6 Jun 2018 15:45:57 +0000 (15:45 +0000)]
Load balance sockets with new SO_REUSEPORT_LB option.

This patch adds a new socket option, SO_REUSEPORT_LB, which allow multiple
programs or threads to bind to the same port and incoming connections will be
load balanced using a hash function.

Most of the code was copied from a similar patch for DragonflyBSD.

However, in DragonflyBSD, load balancing is a global on/off setting and can not
be set per socket. This patch allows for simultaneous use of both the current
SO_REUSEPORT and the new SO_REUSEPORT_LB options on the same system.

Required changes to structures:
Globally change so_options from 16 to 32 bit value to allow for more options.
Add hashtable in pcbinfo to hold all SO_REUSEPORT_LB sockets.

Limitations:
As DragonflyBSD, a load balance group is limited to 256 pcbs (256 programs or
threads sharing the same socket).

This is a substantially different contribution as compared to its original
incarnation at svn r332894 and reverted at svn r332967.  Thanks to rwatson@
for the substantive feedback that is included in this commit.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
Obtained from: DragonflyBSD
Relnotes: Yes
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D11003

6 years agoRewrite code using atomic_fcmpset_int() in the LinuxKPI.
hselasky [Wed, 6 Jun 2018 15:31:47 +0000 (15:31 +0000)]
Rewrite code using atomic_fcmpset_int() in the LinuxKPI.

Suggested by: mjg@
MFC after: 1 week
Sponsored by: Mellanox Technologies
Sponsored by: Limelight Networks

6 years agoImplement the __add_wait_queue_entry_tail() function in the LinuxKPI.
hselasky [Wed, 6 Jun 2018 15:19:30 +0000 (15:19 +0000)]
Implement the __add_wait_queue_entry_tail() function in the LinuxKPI.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
MFC after: 1 week
Sponsored by: Mellanox Technologies
Sponsored by: Limelight Networks

6 years agoRevert r334708
jhibbits [Wed, 6 Jun 2018 15:12:19 +0000 (15:12 +0000)]
Revert r334708

This is the wrong place to put the barrier.
Requested by: kib,mjg

6 years agoImplement the might_sleep_if() function macro in the LinuxKPI.
hselasky [Wed, 6 Jun 2018 15:10:11 +0000 (15:10 +0000)]
Implement the might_sleep_if() function macro in the LinuxKPI.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
MFC after: 1 week
Sponsored by: Mellanox Technologies
Sponsored by: Limelight Networks

6 years agoRename two structure field members while keeping backwards compatibility in
hselasky [Wed, 6 Jun 2018 15:06:21 +0000 (15:06 +0000)]
Rename two structure field members while keeping backwards compatibility in
the LinuxKPI. Add a comment saying in which Linux version this change was made.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
MFC after: 1 week
Sponsored by: Mellanox Technologies
Sponsored by: Limelight Networks

6 years agoImplement the init_wait_entry() function macro in the LinuxKPI.
hselasky [Wed, 6 Jun 2018 14:59:23 +0000 (14:59 +0000)]
Implement the init_wait_entry() function macro in the LinuxKPI.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
MFC after: 1 week
Sponsored by: Mellanox Technologies
Sponsored by: Limelight Networks

6 years agoImplement the atomic_dec_if_positive() function in the LinuxKPI.
hselasky [Wed, 6 Jun 2018 13:59:51 +0000 (13:59 +0000)]
Implement the atomic_dec_if_positive() function in the LinuxKPI.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
MFC after: 1 week
Sponsored by: Mellanox Technologies
Sponsored by: Limelight Networks

6 years agoImplement the ktime_compare() and ktime_after() functions in the LinuxKPI.
hselasky [Wed, 6 Jun 2018 13:37:31 +0000 (13:37 +0000)]
Implement the ktime_compare() and ktime_after() functions in the LinuxKPI.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
MFC after: 1 week
Sponsored by: Mellanox Technologies
Sponsored by: Limelight Networks

6 years agoImplement the rdmsrl_safe() function macro in the LinuxKPI.
hselasky [Wed, 6 Jun 2018 13:29:52 +0000 (13:29 +0000)]
Implement the rdmsrl_safe() function macro in the LinuxKPI.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
MFC after: 1 week
Sponsored by: Mellanox Technologies
Sponsored by: Limelight Networks

6 years agoMake in_delayed_cksum() be similar to IPv6 implementation.
ae [Wed, 6 Jun 2018 13:01:53 +0000 (13:01 +0000)]
Make in_delayed_cksum() be similar to IPv6 implementation.

Use m_copyback() function to write checksum when it isn't located
in the first mbuf of the chain. Handmade analog doesn't handle the
case when parts of checksum are located in different mbufs.
Also in case when mbuf is too short, m_copyback() will allocate new
mbuf in the chain instead of making out of bounds write.

Also wrap long line and remove now useless KASSERTs.

X-MFC after: r334705

6 years agoAdd a memory barrier after taking a reference on the vnode holdcnt in _vhold
jhibbits [Wed, 6 Jun 2018 12:57:11 +0000 (12:57 +0000)]
Add a memory barrier after taking a reference on the vnode holdcnt in _vhold

This is needed to avoid a race between the VNASSERT() below, and another
thread updating the VI_FREE flag, on weakly-ordered architectures.

On a 72-thread POWER9, without this barrier a 'make -j72 buildworld' would
panic on the assert regularly.

It may be possible to use a weaker barrier, and I'll investigate that once
all stability issues are worked out on POWER9.

6 years agoUse m_copyback() function to write delayed checksum when it isn't located
ae [Wed, 6 Jun 2018 10:46:24 +0000 (10:46 +0000)]
Use m_copyback() function to write delayed checksum when it isn't located
in the first mbuf of the chain.

MFC after: 1 week

6 years agotop(1): fix err again
eadler [Wed, 6 Jun 2018 07:13:27 +0000 (07:13 +0000)]
top(1): fix err again

I am amazed at my ability to get a one-line error reporting line wrong
thrice.

6 years agoUse UDP len when calculating UDP checksums
thj [Wed, 6 Jun 2018 07:04:40 +0000 (07:04 +0000)]
Use UDP len when calculating UDP checksums

The length of the IP payload is normally equal to the UDP length, UDP Options
(draft-ietf-tsvwg-udp-options-02) suggests using the difference between IP
length and UDP length to create space for trailing data.

Correct checksum length calculation to use the UDP length rather than the IP
length when not offloading UDP checksums.

Approved by: jtl (mentor)
Differential Revision: https://reviews.freebsd.org/D15222

6 years agotop(1): make error message happy
eadler [Wed, 6 Jun 2018 06:42:12 +0000 (06:42 +0000)]
top(1): make error message happy

We don't use a "size" variable, so just don't report it.

Reported by: bapt

6 years agoFix LINT-NOINET build.
ae [Wed, 6 Jun 2018 05:17:21 +0000 (05:17 +0000)]
Fix LINT-NOINET build.

Use known at build time size for min_length value. Also remove the
check from in6_gre_encapcheck(), now it is done in generic code.

6 years agomalloc: elaborate on r334545 due to frequent questions
mjg [Wed, 6 Jun 2018 05:08:05 +0000 (05:08 +0000)]
malloc: elaborate on r334545 due to frequent questions

While here annotate the NULL check as probably true.

6 years agohwpmc: add summary command and further metadata extensions
mmacy [Wed, 6 Jun 2018 02:48:09 +0000 (02:48 +0000)]
hwpmc: add summary command and further metadata extensions

metadata changes:
- log pmc sample rate with pmcallocate
- log proc flags with thread / process logging
  to identify user vs kernel threads

fixes:
- use log cpuid to translate event id to event name

Implement rudimentary summary command to track sample
counts by thread and process name within a pmc log.

% make -j4 buildkernel >& /dev/null &
% sudo pmcstat -S unhalted_core_cycles -S llc-misses -O foo sleep 15
% pmc summary foo
cpu_clk_unhalted.thread_p_any:
        idle: 138108207162
        clang-6.0: 105336158004
        sh: 72340108510
        make: 8642012963
        kernel: 7754011631
longest_lat_cache.miss:
        clang-6.0: 87502625
        sh: 40901227
        make: 5500165
        kernel: 3300099
        awk: 2000060

%  pmc summary -f ~/foo
idx: 278 name: cpu_clk_unhalted.thread_p_any rate: 2000003
idle: 69054
clang-6.0: 52668
sh: 36170
make: 4321
kernel: 3877
hwpmc: proc(7445): 3319
awk: 1289
xargs: 357
rand_harvestq: 181
mtree: 102
intr: 53
zfskern: 31
usb: 7
pagedaemon: 4
ntpd: 3
syslogd: 1
acpi_thermal: 1
logger: 1
syncer: 1
snmptrapd: 1
sleep: 1
idx: 17 name: longest_lat_cache.miss rate: 100003
clang-6.0: 875
sh: 409
make: 55
kernel: 33
awk: 20
hwpmc: proc(7445): 14
xargs: 9
idle: 8
intr: 3
zfskern: 2

6 years agoOnly create /var/log/sendmail.st if start sendmail.
brd [Wed, 6 Jun 2018 01:51:05 +0000 (01:51 +0000)]
Only create /var/log/sendmail.st if start sendmail.

For those of us that never use or start sendmail, it is unneeded.

Approved by: bapt (mentor)

6 years agoRemove comments and assertions that are no longer valid after r330809.
ian [Tue, 5 Jun 2018 22:13:45 +0000 (22:13 +0000)]
Remove comments and assertions that are no longer valid after r330809.

r330809 replaced duplication of devdesc struct fields with an embedded copy
of the devdesc struct, to avoid fragility.  That means all the scattered
comments indicating that structs must match are no longer valid.  Likewise
asserts that attempted to mitigate some of the old fragility.

Reviewed by: imp@

6 years agoRework if_gif(4) to use new encap_lookup_t method to speedup lookup
ae [Tue, 5 Jun 2018 21:24:59 +0000 (21:24 +0000)]
Rework if_gif(4) to use new encap_lookup_t method to speedup lookup
of needed interface when many gif interfaces are present.

Remove rmlock from gif_softc, use epoch(9) and CK_LIST instead.
Move more AF-related code into AF-related locations.
Use hash table to speedup lookup of needed softc. Interfaces
with GIF_IGNORE_SOURCE flag are stored in plain CK_LIST.
Sysctl net.link.gif.parallel_tunnels is removed. The removal was planed
16 years ago, and actually it could work only for outbound direction.
Each protocol, that can be handled by if_gif(4) interface is registered
by separate encap handler, this helps avoid invoking the handler
for unrelated protocols (GRE, PIM, etc.).

This change allows dramatically improve performance when many gif(4)
interfaces are used.

Sponsored by: Yandex LLC

6 years agoConstify argument of in6_getscope().
ae [Tue, 5 Jun 2018 20:54:29 +0000 (20:54 +0000)]
Constify argument of in6_getscope().

6 years agoRework IP encapsulation handling code.
ae [Tue, 5 Jun 2018 20:51:01 +0000 (20:51 +0000)]
Rework IP encapsulation handling code.

Currently it has several disadvantages:
- it uses single mutex to protect internal structures. It is used by
  data- and control- path, thus there are no parallelism at all.
- it uses single list to keep encap handlers for both INET and INET6
  families.
- struct encaptab keeps unneeded information (src, dst, masks, protosw),
  that isn't used by code in the source tree.
- matches are prioritized and when many tunneling interfaces are
  registered, encapcheck handler of each interface is invoked for each
  packet. The search takes O(n) for n interfaces. All this work is done
  with exclusive lock held.

What this patch includes:
- the datapath is converted to be lockless using epoch(9) KPI.
- struct encaptab now linked using CK_LIST.
- all unused fields removed from struct encaptab. Several new fields
  addedr: min_length is the minimum packet length, that encapsulation
  handler expects to see; exact_match is maximum number of bits, that
  can return an encapsulation handler, when it wants to consume a packet.
- IPv6 and IPv4 handlers are stored in separate lists;
- added new "encap_lookup_t" method, that will be used later. It is
  targeted to speedup lookup of needed interface, when gif(4)/gre(4) have
  many interfaces.
- the need to use protosw structure is eliminated. The only pr_input
  method was used from this structure, so I don't see the need to keep
  using it.
- encap_input_t method changed to avoid using mbuf tags to store softc
  pointer. Now it is passed directly trough encap_input_t method.
  encap_getarg() funtions is removed.
- all sockaddr structures and code that uses them removed. We don't have
  any code in the tree that uses them. All consumers use encap_attach_func()
  method, that relies on invoking of encapcheck() to determine the needed
  handler.
- introduced struct encap_config, it contains parameters of encap handler
  that is going to be registered by encap_attach() function.
- encap handlers are stored in lists ordered by exact_match value, thus
  handlers that need more bits to match will be checked first, and if
  encapcheck method returns exact_match value, the search will be stopped.
- all current consumers changed to use new KPI.

Reviewed by: mmacy
Sponsored by: Yandex LLC
Differential Revision: https://reviews.freebsd.org/D15617

6 years agoMake Coverity more happy with r334545
vangyzen [Tue, 5 Jun 2018 20:34:11 +0000 (20:34 +0000)]
Make Coverity more happy with r334545

Coverity complains about:

if (((flags) & M_WAITOK) || _malloc_item != NULL)

saying:

The expression
1 /* (2 | 0x100) & 2 */ || _malloc_item != NULL
is suspicious because it performs a Boolean operation
on a constant other than 0 or 1.

Although the code is correct, add "!= 0" to make it slightly
more legible and to silence hundreds(?) of Coverity warnings.

Reported by: Coverity
Discussed with: mjg
Sponsored by: Dell EMC

6 years agoaudit(4): add tests for open(2) and openat(2)
asomers [Tue, 5 Jun 2018 20:13:24 +0000 (20:13 +0000)]
audit(4): add tests for open(2) and openat(2)

These syscalls are atypical, because each one corresponds to several
different audit events, and they each pass several different audit class
filters.

Submitted by: aniketp
MFC after: 2 weeks
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15657

6 years agotcp_lro.h requires <netinet/in.h>, include it directly instead of
ae [Tue, 5 Jun 2018 19:23:23 +0000 (19:23 +0000)]
tcp_lro.h requires <netinet/in.h>, include it directly instead of
indirect inclusion trough if_gif.h

6 years agoHandle -DNO_CLEAN builds across brk/sbrk rewrite in r334626
emaste [Tue, 5 Jun 2018 18:27:09 +0000 (18:27 +0000)]
Handle -DNO_CLEAN builds across brk/sbrk rewrite in r334626

Sponsored by: The FreeBSD Foundation

6 years agoMake the v*printf() functions in libsa return int instead of void.
ian [Tue, 5 Jun 2018 17:18:10 +0000 (17:18 +0000)]
Make the v*printf() functions in libsa return int instead of void.
This makes them compatible with the C standard signatures, avoiding
spurious mismatch errors in the places where the oddball requirements
of standalone code end up putting two declarations of the same function
in play.

6 years agoDeclare and set the global "system_highpri_wq" workqueue structure pointer
hselasky [Tue, 5 Jun 2018 15:49:35 +0000 (15:49 +0000)]
Declare and set the global "system_highpri_wq" workqueue structure pointer
in the LinuxKPI.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
MFC after: 1 week
Sponsored by: Mellanox Technologies
Sponsored by: Limelight Networks

6 years agoImplement the INIT_DELAYED_WORK_ONSTACK() function macro in the LinuxKPI.
hselasky [Tue, 5 Jun 2018 15:46:16 +0000 (15:46 +0000)]
Implement the INIT_DELAYED_WORK_ONSTACK() function macro in the LinuxKPI.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
MFC after: 1 week
Sponsored by: Mellanox Technologies
Sponsored by: Limelight Networks

6 years agoDefine the __kernel_size_t type in the LinuxKPI.
hselasky [Tue, 5 Jun 2018 15:42:35 +0000 (15:42 +0000)]
Define the __kernel_size_t type in the LinuxKPI.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
MFC after: 1 week
Sponsored by: Mellanox Technologies
Sponsored by: Limelight Networks

6 years agoImplement the task_pid_vnr() function macro in the LinuxKPI.
hselasky [Tue, 5 Jun 2018 15:40:09 +0000 (15:40 +0000)]
Implement the task_pid_vnr() function macro in the LinuxKPI.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
MFC after: 1 week
Sponsored by: Mellanox Technologies
Sponsored by: Limelight Networks

6 years agoAdd "access" function pointer to the "vm_operations_struct" structure
hselasky [Tue, 5 Jun 2018 15:37:28 +0000 (15:37 +0000)]
Add "access" function pointer to the "vm_operations_struct" structure
in the LinuxKPI. While at it document when to use the "virtual_address" or
the "address" field in the "vm_fault" structure.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
MFC after: 1 week
Sponsored by: Mellanox Technologies
Sponsored by: Limelight Networks

6 years agoImplement mul_u32_u32() function in the LinuxKPI.
hselasky [Tue, 5 Jun 2018 15:30:36 +0000 (15:30 +0000)]
Implement mul_u32_u32() function in the LinuxKPI.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
MFC after: 1 week
Sponsored by: Mellanox Technologies
Sponsored by: Limelight Networks

6 years agoImplement timer_setup() and from_timer() function macros in the LinuxKPI.
hselasky [Tue, 5 Jun 2018 15:20:20 +0000 (15:20 +0000)]
Implement timer_setup() and from_timer() function macros in the LinuxKPI.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
MFC after: 1 week
Sponsored by: Mellanox Technologies
Sponsored by: Limelight Networks

6 years agoIssue:
ram [Tue, 5 Jun 2018 15:05:26 +0000 (15:05 +0000)]
Issue:
   Utility hangs when  OCS_IOCTL_CMD_MGMT_GET_ALL called in parallel on port 0 and port 1.

Fix: Using static structure for results is corrupting the second ioctl request. Removed static for results structure.
Approved by: ken
MFC after: 3 days

6 years agoAdd vsnprintf() to libsa. Alpha-sort the printf prototypes in stand.h.
ian [Tue, 5 Jun 2018 14:47:13 +0000 (14:47 +0000)]
Add vsnprintf() to libsa.  Alpha-sort the printf prototypes in stand.h.

I'm not sure why the v*printf() functions in libsa return void instead of
int, but this maintains that convention for the new function.

6 years agoDon't build brk_test on platforms that don't support brk().
markj [Tue, 5 Jun 2018 13:06:06 +0000 (13:06 +0000)]
Don't build brk_test on platforms that don't support brk().

X-MFC with: r334626

6 years agoEnable high-speed on the card before increasing frequency on the controller
kibab [Tue, 5 Jun 2018 11:03:24 +0000 (11:03 +0000)]
Enable high-speed on the card before increasing frequency on the controller

Increasing operating frequency without telling card to switch
to high-speed mode first upsets some cards and generates CRC errors.

While here, deselect / reselect cards after CMD6 and SCR fetch, as in original code.

Approved by: imp (mentor)
Differential Revision: https://reviews.freebsd.org/D15568

6 years agousbdevs: sync from NetBSD
eadler [Tue, 5 Jun 2018 09:52:38 +0000 (09:52 +0000)]
usbdevs: sync from NetBSD

This adds several vendors from NetBSD's copy of the same file (r1.749).
Prefer longer more "canonical" names where the names differed.

Sort while here.

6 years agoSince we don't enable BUF_TRACKING and FULL_BUF_TRACKING buffer debugging
kevlo [Tue, 5 Jun 2018 05:24:42 +0000 (05:24 +0000)]
Since we don't enable BUF_TRACKING and FULL_BUF_TRACKING buffer debugging
options in GENERIC kernels on arm and arm64, there's no need to disable
them.

Sponsored by: MSI/FUNTORO

6 years agoAdd support for SIMCom SIM7600E.
kevlo [Tue, 5 Jun 2018 05:19:04 +0000 (05:19 +0000)]
Add support for SIMCom SIM7600E.

Sponsored by: MSI/FUNTORO

6 years agohwpmc: log name->pid, name->tid mappings
mmacy [Tue, 5 Jun 2018 04:26:40 +0000 (04:26 +0000)]
hwpmc: log name->pid, name->tid mappings

By logging all threads and processes 'pmc filter'
can now filter on process or thread name, relieving
the user of the burden of determining which tid or
pid was which when the sample was taken.

% pmc filter -T if_io_tqg -P nginx pmc.log pmc-iflib.log

% pmc filter -x -T idle pmc.log pmc-noidle.log

6 years agocxgbetool: Disallow negative values for numeric parameters.
np [Mon, 4 Jun 2018 23:17:18 +0000 (23:17 +0000)]
cxgbetool: Disallow negative values for numeric parameters.

Sponsored by: Chelsio Communications

6 years agopmc stat: add debug option for intermediate state
mmacy [Mon, 4 Jun 2018 22:39:22 +0000 (22:39 +0000)]
pmc stat: add debug option for intermediate state

6 years agoMFV: r334448
jkim [Mon, 4 Jun 2018 22:26:47 +0000 (22:26 +0000)]
MFV: r334448

Import ACPICA 20180531.

6 years agopmc stat: fix offset of specified counter
mmacy [Mon, 4 Jun 2018 21:42:21 +0000 (21:42 +0000)]
pmc stat: fix offset of specified counter

6 years agoindent(1): fix buildworld after r334632
pstef [Mon, 4 Jun 2018 21:21:55 +0000 (21:21 +0000)]
indent(1): fix buildworld after r334632

Fix
error: comparison of integers of different signs: 'int' and 'unsigned long'
by casting nitems() to int.

Reported by: mjg

6 years agolibpmc: improve arg checking
mmacy [Mon, 4 Jun 2018 21:17:46 +0000 (21:17 +0000)]
libpmc: improve arg checking

6 years agolibpmc / stat: use westmere supported counter
mmacy [Mon, 4 Jun 2018 21:17:42 +0000 (21:17 +0000)]
libpmc / stat: use westmere supported counter

6 years agohwpmc: don't defer user callchain capture completion to ast
mmacy [Mon, 4 Jun 2018 21:17:30 +0000 (21:17 +0000)]
hwpmc: don't defer user callchain capture completion to ast