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

6 years agoindent(1): add --version option
pstef [Mon, 4 Jun 2018 21:05:56 +0000 (21:05 +0000)]
indent(1): add --version option

There exist multi-platform programs that check indent's version in order to
know what they can expect from it. GNU indent provides that via --version,
so implement the same option here.

6 years agoindent(1): remove the STACKSIZE macro and all of its use
pstef [Mon, 4 Jun 2018 20:39:58 +0000 (20:39 +0000)]
indent(1): remove the STACKSIZE macro and all of its use

It conflicts with a system-provided macro of the same name on another OS.

6 years agoindent(1): remove static const char copyright[]
pstef [Mon, 4 Jun 2018 20:24:31 +0000 (20:24 +0000)]
indent(1): remove static const char copyright[]

It repeats what is already said in the heading comment and it's optimized out
so serves no purpose.

6 years agoindent(1): replace BSD bcopy() with C memmove()
pstef [Mon, 4 Jun 2018 19:47:24 +0000 (19:47 +0000)]
indent(1): replace BSD bcopy() with C memmove()

6 years agoRegen after r334626.
markj [Mon, 4 Jun 2018 19:36:47 +0000 (19:36 +0000)]
Regen after r334626.

6 years agoReimplement brk() and sbrk() to avoid the use of _end.
markj [Mon, 4 Jun 2018 19:35:15 +0000 (19:35 +0000)]
Reimplement brk() and sbrk() to avoid the use of _end.

Previously, libc.so would initialize its notion of the break address
using _end, a special symbol emitted by the static linker following
the bss section.  Compatibility issues between lld and ld.bfd could
cause the wrong definition of _end (libc.so's definition rather than
that of the executable) to be used, breaking the brk()/sbrk()
interface.

Avoid this problem and future interoperability issues by simply not
relying on _end.  Instead, modify the break() system call to return
the kernel's view of the current break address, and have libc
initialize its state using an extra syscall upon the first use of the
interface.  As a side effect, this appears to fix brk()/sbrk() usage
in executables run with rtld direct exec, since the kernel and libc.so
no longer maintain separate views of the process' break address.

PR: 228574
Reviewed by: kib (previous version)
MFC after: 2 months
Differential Revision: https://reviews.freebsd.org/D15663

6 years agoCorrectly handle the padding for IPv6-AH, as specified by RFC4302
cem [Mon, 4 Jun 2018 18:51:06 +0000 (18:51 +0000)]
Correctly handle the padding for IPv6-AH, as specified by RFC4302

The RFC specifies that under IPv6 the complete AH header must be 64 bit
aligned, and under IPv4, 32 bit aligned. Prior to this change, we (along
with other BSDs and MacOS) had violated this requirement.

This makes it possible to set up IPv6-AH between Linux and BSD, and also
probably between Windows and BSD.

PR: 222684
Reported and tested by: Jason Mader <jasonmader AT gmail.com>
Obtained from: NetBSD xform_ah.c 1.105
(b939fe2483972eb43d71bf990cfb7f26dece7839 NetBSD/src on GH)
by Maxime Villard
MFC after: 35.2731 hours
Relnotes: probably (breaks ipv6 compat with older FreeBSD/NetBSD/MacOS)
Sponsored by: Dell EMC Isilon

6 years agostr(r)chr: Replace union abuse with __DECONST
cem [Mon, 4 Jun 2018 18:47:14 +0000 (18:47 +0000)]
str(r)chr: Replace union abuse with __DECONST

Writing one union member and reading another is technically illegal C,
although we do it in many places in the tree.  Use the __DECONST macro
instead, which is (technically) a valid C construct.

Trivial style(9) cleanups to touched lines while here.

Sponsored by: Dell EMC Isilon

6 years agohwpmc: remove gratuitous curthread checks
mmacy [Mon, 4 Jun 2018 17:49:34 +0000 (17:49 +0000)]
hwpmc: remove gratuitous curthread checks

6 years agoCorrect the description of vm_pageout_scan_inactive() after r334508.
markj [Mon, 4 Jun 2018 16:46:36 +0000 (16:46 +0000)]
Correct the description of vm_pageout_scan_inactive() after r334508.

Reported by: alc

6 years agoUse a single, consistent approach to returning success versus failure in
alc [Mon, 4 Jun 2018 16:28:06 +0000 (16:28 +0000)]
Use a single, consistent approach to returning success versus failure in
vm_map_madvise().  Previously, vm_map_madvise() used a traditional Unix-
style "return (0);" to indicate success in the common case, but Mach-
style return values in the edge cases.  Since KERN_SUCCESS equals zero,
the only problem with this inconsistency was stylistic.  vm_map_madvise()
has exactly two callers in the entire source tree, and only one of them
cares about the return value.  That caller, kern_madvise(), can be
simplified if vm_map_madvise() consistently uses Unix-style return
values.

Since vm_map_madvise() uses the variable modify_map as a Boolean, make it
one.

Eliminate a redundant error check from kern_madvise().  Add a comment
explaining where the check is performed.

Explicitly note that exec_release_args_kva() doesn't care about
vm_map_madvise()'s return value.  Since MADV_FREE is passed as the
behavior, the return value will always be zero.

Reviewed by: kib, markj
MFC after: 7 days

6 years agoSort GCC warning flags and remove duplicates.
br [Mon, 4 Jun 2018 16:21:18 +0000 (16:21 +0000)]
Sort GCC warning flags and remove duplicates.

Sponsored by: DARPA, AFRL

6 years agoFix build: ignore a GCC 7.2.0 warning which says that third argument of
br [Mon, 4 Jun 2018 16:20:22 +0000 (16:20 +0000)]
Fix build: ignore a GCC 7.2.0 warning which says that third argument of
memset(3) should contain the number of elements multiplied by the element
size.

Sponsored by: DARPA, AFRL

6 years agoAlign UMA data to 128 byte cacheline size
jhibbits [Mon, 4 Jun 2018 15:44:17 +0000 (15:44 +0000)]
Align UMA data to 128 byte cacheline size

Suggested by: mjg

6 years agoMove /sys symlink creating out of etc/Makefile.
brd [Mon, 4 Jun 2018 15:17:24 +0000 (15:17 +0000)]
Move /sys symlink creating out of etc/Makefile.

This is prep for etc/Makefile going away.

Approved by: bapt (mentor)

6 years agoFix the NUMA build for non-x86 platforms.
markj [Mon, 4 Jun 2018 14:56:02 +0000 (14:56 +0000)]
Fix the NUMA build for non-x86 platforms.

acpi_map_pxm_to_vm_domainid() is currently implemented only on x86.

MFC after: 1 week

6 years agoSet kernelname in bootconfig to the kernel file
jhibbits [Mon, 4 Jun 2018 14:42:13 +0000 (14:42 +0000)]
Set kernelname in bootconfig to the kernel file

Summary:
The kernel reads 'kernelname' to set the kern.bootfile sysctl.  By setting this,
'make installkernel' will backup the running kernel as appropriate.

Reviewed by: nwhitehorn
Differential Revision: https://reviews.freebsd.org/D15660

6 years agoRevert r334586 since I now think __unused is the better way to handle this.
rmacklem [Mon, 4 Jun 2018 11:35:04 +0000 (11:35 +0000)]
Revert r334586 since I now think __unused is the better way to handle this.

6 years agopmc filter: avoid spurious gcc uninitialized warning
mmacy [Mon, 4 Jun 2018 06:30:35 +0000 (06:30 +0000)]
pmc filter: avoid spurious gcc uninitialized warning

6 years agotop(1): some nitpicks
eadler [Mon, 4 Jun 2018 05:27:00 +0000 (05:27 +0000)]
top(1): some nitpicks

- prefer fully spelled names to "u_long"
- fix speeling

6 years agoupdate pmc_pmu_idx_get_by_event signature for !x86
mmacy [Mon, 4 Jun 2018 05:04:40 +0000 (05:04 +0000)]
update pmc_pmu_idx_get_by_event signature for !x86

6 years agopmc: add filter command
mmacy [Mon, 4 Jun 2018 04:59:48 +0000 (04:59 +0000)]
pmc: add filter command

pmc filter allows the user to select event types, threads, and processes from
a sample.

% pmcstat -S unhalted_core_cycles -S llc-misses -S -S  resource_stalls.any -O pmc.log
% pmc filter -e llc-misses pmc.log pmc-llc-misses.log
% pmc filter -e unhalted_core_cycles -t 100339  pmc.log pmc-core-cycles.log
etc...
% pmcstat -R pmc-core-cycles.log -G pmc-core-cycles.stacks

6 years agotop(1): include what you use
eadler [Mon, 4 Jun 2018 04:59:32 +0000 (04:59 +0000)]
top(1): include what you use

- Change headers to more closely match what we use
- use more standard functions instead of bzero, bcmp, bcopy
- Add myself to authors.

Tested with: base clang (amd64), gcc 9 (amd64), base clang (i386), base
gcc (mips)

6 years agotop(1): Prefer memcpy over bcopy
eadler [Mon, 4 Jun 2018 04:59:24 +0000 (04:59 +0000)]
top(1): Prefer memcpy over bcopy

6 years agohwpmc: fix fixed counters checks
mmacy [Mon, 4 Jun 2018 04:49:06 +0000 (04:49 +0000)]
hwpmc: fix fixed counters checks

6 years agotop(1): Use strsep instead of homegrown alternative
eadler [Mon, 4 Jun 2018 03:16:24 +0000 (03:16 +0000)]
top(1): Use strsep instead of homegrown alternative

This replaces some complex, and not quite correct logic, with a more
common strsep pattern.

Reviewed by: mmacy (older version)

6 years agohwpmc: ABI fixes
mmacy [Mon, 4 Jun 2018 02:05:48 +0000 (02:05 +0000)]
hwpmc: ABI fixes
- increase pmc cpuid field from 8 to 12 bits
- add cpuid version string to initialize entry in the log
  so that filter can identify which counter index an
  event name maps to
- GC unused config flags
- make fixed counter assignment more robust as well as the
  changes needed to be properly identified for filter

6 years agohwpmc: support sampling both kernel and user stacks when interrupted in kernel
mmacy [Mon, 4 Jun 2018 01:10:23 +0000 (01:10 +0000)]
hwpmc: support sampling both kernel and user stacks when interrupted in kernel

This adds the -U options to pmcstat which will attribute in-kernel samples
back to the user stack that invoked the system call. It is not the default,
because when looking at kernel profiles it is generally more desirable to
merge all instances of a given system call together.

Although heavily revised, this change is directly derived from D7350 by
Jonathan T. Looney.

Obtained from: jtl
Sponsored by: Juniper Networks, Limelight Networks