]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agosh(1): Remove -c string from set builtin documentation
jilles [Sat, 8 Dec 2018 12:49:19 +0000 (12:49 +0000)]
sh(1): Remove -c string from set builtin documentation

Altering the -c string at run time does not make sense and is not possible.

MFC after: 1 week

5 years agoRemove proctree acquire from note_procstat_proc
mjg [Sat, 8 Dec 2018 11:38:39 +0000 (11:38 +0000)]
Remove proctree acquire from note_procstat_proc

It is not needed since r340482 ("proc: always store parent pid in p_oppid")

Sponsored by: The FreeBSD Foundation

5 years agoFix a corner case in ID bitmap management.
mjg [Sat, 8 Dec 2018 10:22:12 +0000 (10:22 +0000)]
Fix a corner case in ID bitmap management.

If all IDs from trypid to pid_max were used as pids, the code would enter
a loop which would be infinite if none of the IDs could become free (e.g.
they all belong to processes which did not transitioned to zombie).

Fixes: r341684 ("Manage process-related IDs with bitmaps")

Sponsored by: The FreeBSD Foundation

5 years agoproc: postpone proc unlock until after reporting with kqueue
mjg [Sat, 8 Dec 2018 06:34:12 +0000 (06:34 +0000)]
proc: postpone proc unlock until after reporting with kqueue

kqueue would always relock immediately afterwards.

While here drop the NULL check for list itself. The list is
always allocated.

Sponsored by: The FreeBSD Foundation

5 years agoproc: handle sdt exit probe before taking the proc lock
mjg [Sat, 8 Dec 2018 06:31:43 +0000 (06:31 +0000)]
proc: handle sdt exit probe before taking the proc lock

Sponsored by: The FreeBSD Foundation

5 years agoProvide SDT_PROBES_ENABLED macro.
mjg [Sat, 8 Dec 2018 06:30:41 +0000 (06:30 +0000)]
Provide SDT_PROBES_ENABLED macro.

Sponsored by: The FreeBSD Foundation

5 years agoamd64: stop re-reading curpc on subyte/suword
mjg [Sat, 8 Dec 2018 04:53:08 +0000 (04:53 +0000)]
amd64: stop re-reading curpc on subyte/suword

Originally read value is still safely kept. Re-reading code was there
for previous iterations which were partially shared with i386.

Sponsored by: The FreeBSD Foundation

5 years agoSimplify kern_readlink_vp().
kib [Fri, 7 Dec 2018 23:07:51 +0000 (23:07 +0000)]
Simplify kern_readlink_vp().

When we detected that the vnode is not symlink, return immediately.
This moves the readlink code out of else branch and unindents it.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

5 years agoFix expression evaluation.
kib [Fri, 7 Dec 2018 23:05:12 +0000 (23:05 +0000)]
Fix expression evaluation.

Braces were put in the wrong place, causing failing EAGAIN check to
return zero result.  Remove the problematic assignment from the
conditional expression at all.

While there, remove used once variable vp, and wrap too long line.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

5 years agoEven though they are reserved, cdw2 and cdw3 can be set via nvme-cli
imp [Fri, 7 Dec 2018 21:58:08 +0000 (21:58 +0000)]
Even though they are reserved, cdw2 and cdw3 can be set via nvme-cli
(and soon nvmecontrol). Go ahead and copy them into rsvd2 and rsvd3.

Sponsored by: Netflix

5 years agoAdd nda(4) cross reference to nvme(4)
imp [Fri, 7 Dec 2018 21:57:39 +0000 (21:57 +0000)]
Add nda(4) cross reference to nvme(4)

5 years agoMake virtio-scsi pass SCSI Task Attributes to CTL.
mav [Fri, 7 Dec 2018 20:55:29 +0000 (20:55 +0000)]
Make virtio-scsi pass SCSI Task Attributes to CTL.

MFC after: 1 week
Sponsored by: iXsystems, Inc.

5 years agoFix several iov handling bugs in bhyve virtio-scsi backend.
mav [Fri, 7 Dec 2018 20:30:00 +0000 (20:30 +0000)]
Fix several iov handling bugs in bhyve virtio-scsi backend.

 - buf_to_iov() does not use buflen parameter, allowing out of bound read.
 - buf_to_iov() leaks memory if seek argument > 0.
 - iov_to_buf() doesn't need to reallocate buffer for every segment.
 - there is no point to use size_t for iov counts, int is more then enough.
 - some iov function arguments can be constified.
 - pci_vtscsi_request_handle() used truncate_iov() incorrectly, allowing
   getting out of buffer and possibly corrupting data.
 - pci_vtscsi_controlq_notify() written returned status at wrong offset.
 - pci_vtscsi_controlq_notify() leaked one buffer per event.

Reported by: wg
Reviewed by: araujo
MFC after: 1 week
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D18465

5 years agoFill initid explicitly on requests.
mav [Fri, 7 Dec 2018 19:10:51 +0000 (19:10 +0000)]
Fill initid explicitly on requests.

Unfortunately ctl_scsi_zero_io() wipes that field, so it was always zero.
While there, targ_port is set by kernel, so user-space should not fill it.

MFC after: 1 week

5 years agoBSD.debug.dist: add newly added nvmecontrol directory
emaste [Fri, 7 Dec 2018 16:52:52 +0000 (16:52 +0000)]
BSD.debug.dist: add newly added nvmecontrol directory

5 years agofd: use racct_set_unlocked
mjg [Fri, 7 Dec 2018 16:51:38 +0000 (16:51 +0000)]
fd: use racct_set_unlocked

Sponsored by: The FreeBSD Foundation

5 years agoracct: add RACCT_ENABLED macro and racct_set_unlocked
mjg [Fri, 7 Dec 2018 16:47:34 +0000 (16:47 +0000)]
racct: add RACCT_ENABLED macro and racct_set_unlocked

This allows to remove PROC_LOCK/UNLOCK pairs spread thorought the kernel
only used to appease racct_set.

Sponsored by: The FreeBSD Foundation

5 years agofd: try do less work with the lock in dup
mjg [Fri, 7 Dec 2018 16:44:52 +0000 (16:44 +0000)]
fd: try do less work with the lock in dup

Sponsored by: The FreeBSD Foundation

5 years agovm: use fcmpset for vmspace reference counting
mjg [Fri, 7 Dec 2018 16:22:54 +0000 (16:22 +0000)]
vm: use fcmpset for vmspace reference counting

Sponsored by: The FreeBSD Foundation

5 years agoReplace hand-rolled unrefs if > 1 with refcount_release_if_not_last
mjg [Fri, 7 Dec 2018 16:11:45 +0000 (16:11 +0000)]
Replace hand-rolled unrefs if > 1 with refcount_release_if_not_last

Sponsored by: The FreeBSD Foundation

5 years agorefcount: remove a stale comment about conditional ref/unref routines
mjg [Fri, 7 Dec 2018 16:10:13 +0000 (16:10 +0000)]
refcount: remove a stale comment about conditional ref/unref routines

It was there for vfs-specific variants and was copied over when it should not.

Sponsored by: The FreeBSD Foundation

5 years agoacpi_MatchHid: use ACPI_MATCHHID_NOMATCH instead of FALSE
avg [Fri, 7 Dec 2018 16:05:39 +0000 (16:05 +0000)]
acpi_MatchHid: use ACPI_MATCHHID_NOMATCH instead of FALSE

Binary representation of both is the same (zero), but
ACPI_MATCHHID_NOMATCH is better for consistency.

MFC after: 4 days
X-MFC with: r339754

5 years agoaibs: fix a typo in the probe method that was introduced in r339754
avg [Fri, 7 Dec 2018 16:01:51 +0000 (16:01 +0000)]
aibs: fix a typo in the probe method that was introduced in r339754

Because of that typo the driver would try to attach to every device
on acpi bus.  That disrupted acpi attachment of uart driver, at least.

MFC after: 4 days
X-MFC with: r339754

5 years agoUpdate the description of the address space layout on RISC-V.
markj [Fri, 7 Dec 2018 15:56:40 +0000 (15:56 +0000)]
Update the description of the address space layout on RISC-V.

This adds more detail and fixes some inaccuracies.

Reviewed by: jhb
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D18463

5 years agoRename sptbr to satp per v1.10 of the privileged architecture spec.
markj [Fri, 7 Dec 2018 15:55:23 +0000 (15:55 +0000)]
Rename sptbr to satp per v1.10 of the privileged architecture spec.

Add a subroutine for updating satp, for use when updating the
active pmap.  No functional change intended.

Reviewed by: jhb
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D18462

5 years agoLet the cap_syslog capability inherit stdio descriptors.
markj [Fri, 7 Dec 2018 15:52:50 +0000 (15:52 +0000)]
Let the cap_syslog capability inherit stdio descriptors.

Otherwise cap_openlog(LOG_PERROR) doesn't work.

Reviewed by: oshogbo
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D18457

5 years agoRegen.
kib [Fri, 7 Dec 2018 15:19:00 +0000 (15:19 +0000)]
Regen.

5 years agoAdd new file handle system calls.
kib [Fri, 7 Dec 2018 15:17:29 +0000 (15:17 +0000)]
Add new file handle system calls.

Namely, getfhat(2), fhlink(2), fhlinkat(2), fhreadlink(2).  The
syscalls are provided for a NFS userspace server (nfs-ganesha).

Submitted by: Jack Halford <jack@gandi.net>
Sponsored by: Gandi.net
Tested by: pho
Feedback from: brooks, markj
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D18359

5 years agoproc: when exiting move to zombproc before taking proctree
mjg [Fri, 7 Dec 2018 12:32:25 +0000 (12:32 +0000)]
proc: when exiting move to zombproc before taking proctree

The kernel was already doing this prior to r329615. It was changed
to reduce contention on allproc. However, introduction of pidhash
locks and removal of proctree -> allproc ordering from fork thanks
to bitmaps fixed things enough to make this change pessimal.

waitpid takes proctree on each call and this change (now) causes
avoidable stalls if allproc is held.

Sponsored by: The FreeBSD Foundation

5 years agoManage process-related IDs with bitmaps
mjg [Fri, 7 Dec 2018 12:22:32 +0000 (12:22 +0000)]
Manage process-related IDs with bitmaps

Currently unique pid allocation on fork often requires a full walk of
process, group, session lists to make sure it is not used by anything.
This has a side effect of requiring proctree to be held along with allproc,
which adds more contention in poudriere -j 128.

The patch below implements trivial bitmaps which gets rid of the problem.
Dedicated lock is introduced to manage IDs.

While here a bug was discovered: all processes would inherit reap id from
the first process spawned by init. This had a side effect of keeping the
ID used and when allocation rolls over to the beginning it keeps being
skipped.

The patch is loosely based on initial work by mjoras@.

Reviewed by: kib
Sponsored by: The FreeBSD Foundation

5 years agoAnnotate Giant drop/pickup macros with __predict_false
mjg [Fri, 7 Dec 2018 12:06:03 +0000 (12:06 +0000)]
Annotate Giant drop/pickup macros with __predict_false

They are used in important places of the kernel with the lock not being held
majority of the time.

Sponsored by: The FreeBSD Foundation

5 years agounr64: use locked variant if not __LP64__
mjg [Fri, 7 Dec 2018 12:05:11 +0000 (12:05 +0000)]
unr64: use locked variant if not __LP64__

The current ifdefs are not sufficient to distinguish 32- and 64- bit
variants, which results e.g. in powerpc64 not using atomics.

While some 32-bit archs provide 64-bit atomics, there is no huge advantage
of using them on these platforms.

Reported by: many
Suggested by: jhb
Sponsored by: The FreeBSD Foundation

5 years agodaprobedone: announce if a disk is write-protected
avg [Fri, 7 Dec 2018 12:02:31 +0000 (12:02 +0000)]
daprobedone: announce if a disk is write-protected

MFC after: 2 weeks

5 years agonetmap: remove dead code obsoleted by iflib
vmaffione [Fri, 7 Dec 2018 11:47:42 +0000 (11:47 +0000)]
netmap: remove dead code obsoleted by iflib

The iflib subsystem implements netmap support in a driver-independent
way (sys/net/iflib.c). We can therefore remove the headers that
used to implement netmap support for all the drivers now supported
by iflib (em, igb, ixl, ixgbe, lem).

MFC after: 1 week

5 years agoFix cut&paste typo in atomic_fetchadd_64().
mmel [Fri, 7 Dec 2018 11:10:27 +0000 (11:10 +0000)]
Fix cut&paste typo in atomic_fetchadd_64().

Reported by: Jia-Shiun Li <jiashiun@gmail.com>
MFC after: 1 week

5 years agoConsider the following situation:
pjd [Fri, 7 Dec 2018 03:13:36 +0000 (03:13 +0000)]
Consider the following situation:
The sender has .not_terminated file. It gets disconnected. The last trail
file is then terminated without adding new data (this can happen for example
when auditd is being stopped on the sender). After reconnect the .not_terminated
was not renamed on the receiver as it should.

We were already handling similar situation where the sender crashed and the
.not_terminated trail file was renamed to .crash_recovery. Extend this case to
handle the situation above.

5 years agogmirror: Evaluate mirror components against newest metadata copy
cem [Fri, 7 Dec 2018 02:44:04 +0000 (02:44 +0000)]
gmirror: Evaluate mirror components against newest metadata copy

Re-apply r341665 with format strings fixed.

If we happen to taste a stale mirror component first, don't reject valid,
newer components that have differing metadata from the stale component
(during STARTING).  Instead, update our view of the most recent metadata as
we taste components.

Like mediasize beforehand, remove some checks from g_mirror_check_metadata
which would evict valid components due to metadata that can change over a
mirror's lifetime.  g_mirror_check_metadata is invoked long before we check
genid/syncid and decide which component(s) are newest and whether or not we
have quorum.

Before checking if we can enter RUNNING (i.e., we have quorum) after a NEW
component is added, first remove any known stale or inconsistent disks from
the mirrorset, rather than removing them *after* deciding we have quorum.
Check if we have quorum after removing these components.

Additionally, add a knob, kern.geom.mirror.launch_mirror_before_timeout, to
force gmirrors to wait out the full timeout (kern.geom.mirror.timeout)
before transitioning from STARTING to RUNNING.  This is a kludge to help
ensure all eligible, boot-time available mirror components are tasted before
RUNNING a gmirror.

Add a basic test case for STARTING -> RUNNING startup behavior around stale
genids.

PR: 232671, 232835
Submitted by: Cindy Yang <cyang AT isilon.com> (previous version)
Reviewed by: markj (kernel portions)
Discussed with: asomers, Cindy Yang
Tested by: pho
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D18062

5 years agoRevert r341665 due to tinderbox breakage
cem [Fri, 7 Dec 2018 00:47:05 +0000 (00:47 +0000)]
Revert r341665 due to tinderbox breakage

I didn't notice that some format strings were non-portable.  Will fix and
re-commit later.

5 years agogeom tests: Fix cleanup of ATF tests since r341392
asomers [Fri, 7 Dec 2018 00:27:38 +0000 (00:27 +0000)]
geom tests: Fix cleanup of ATF tests since r341392

r341392 changed common test cleanup routines in a way that allowed them to
be used by TAP tests as well as ATF tests.  However, a late change made
during code review resulted in cleanup being broken for ATF tests, which
source geom_subr.sh separately during the body and cleanup phases of the
test.  The result was that md(4) devices wouldn't get cleaned up.

MFC after: 2 weeks
X-MFC-With: 341392

5 years agogmirror: Evaluate mirror components against newest metadata copy
cem [Thu, 6 Dec 2018 23:55:39 +0000 (23:55 +0000)]
gmirror: Evaluate mirror components against newest metadata copy

If we happen to taste a stale mirror component first, don't reject valid,
newer components that have differing metadata from the stale component
(during STARTING).  Instead, update our view of the most recent metadata as
we taste components.

Like mediasize beforehand, remove some checks from g_mirror_check_metadata
which would evict valid components due to metadata that can change over a
mirror's lifetime.  g_mirror_check_metadata is invoked long before we check
genid/syncid and decide which component(s) are newest and whether or not we
have quorum.

Before checking if we can enter RUNNING (i.e., we have quorum) after a NEW
component is added, first remove any known stale or inconsistent disks from
the mirrorset, rather than removing them *after* deciding we have quorum.
Check if we have quorum after removing these components.

Additionally, add a knob, kern.geom.mirror.launch_mirror_before_timeout, to
force gmirrors to wait out the full timeout (kern.geom.mirror.timeout)
before transitioning from STARTING to RUNNING.  This is a kludge to help
ensure all eligible, boot-time available mirror components are tasted before
RUNNING a gmirror.

When we are instructed to forget mirror components, bump the generation id
to avoid confusion with such stale components later.

Add a basic test case for STARTING -> RUNNING startup behavior around stale
genids.

PR: 232671, 232835
Submitted by: Cindy Yang <cyang AT isilon.com> (previous version)
Reviewed by: markj (kernel portions)
Discussed with: asomers, Cindy Yang
Tested by: pho
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D18062

5 years agoUpdate paths based on last-minute changes from libexec to lib.
imp [Thu, 6 Dec 2018 23:40:56 +0000 (23:40 +0000)]
Update paths based on last-minute changes from libexec to lib.

5 years agoDeclare global function print_intel_add_smart in header
imp [Thu, 6 Dec 2018 23:29:06 +0000 (23:29 +0000)]
Declare global function print_intel_add_smart in header

5 years agoUse proper prototypes.
imp [Thu, 6 Dec 2018 23:28:55 +0000 (23:28 +0000)]
Use proper prototypes.

5 years agoIt's useful to have this be a global function.
imp [Thu, 6 Dec 2018 22:59:18 +0000 (22:59 +0000)]
It's useful to have this be a global function.

Other vendors base their additional smart info pages on what Intel did
plus some other bits. So it's convenient to have this be global.

Sponsored by: Netflix

5 years agoThis is not a samsung standard, so remove that alias.
imp [Thu, 6 Dec 2018 22:59:08 +0000 (22:59 +0000)]
This is not a samsung standard, so remove that alias.

This was never documented, and isn't needed, so it's best removed to
avoid confusion.

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

5 years agoMove intel and wdc files to their own modules
imp [Thu, 6 Dec 2018 22:58:55 +0000 (22:58 +0000)]
Move intel and wdc files to their own modules

Move the intel and wdc vendor specific stuff to their own modules.

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

5 years agoConst poison the command interface
imp [Thu, 6 Dec 2018 22:58:42 +0000 (22:58 +0000)]
Const poison the command interface

Make the pointers we pass into the commands const, also make the
linker set mirrors const.

Suggested by: cem@
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D18459

5 years agoDynamically load .so modules to expand functionality
imp [Thu, 6 Dec 2018 22:58:26 +0000 (22:58 +0000)]
Dynamically load .so modules to expand functionality

o Dynamically load all the .so files found in /libexec/nvmecontrol and
  /usr/local/libexec/nvmecontrol.
o Link nvmecontrol -rdynamic so that its symbols are visible to the
  libraries we load.
o Create concatinated linker sets that we dynamically expand.
o Add the linked-in top and logpage linker sets to the mirrors for them
  and add those sets to the mirrors when we load a new .so.
o Add some macros to help hide the names of the linker sets.
o Update the man page.

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

fold

5 years agoRename riscv64-freebsd.c to riscv-freebsd.c.
jhb [Thu, 6 Dec 2018 22:35:07 +0000 (22:35 +0000)]
Rename riscv64-freebsd.c to riscv-freebsd.c.

This fixes truss when built as part of a riscv64sf world.  Additionally,
if FreeBSD ever supports RV32 RISC-V most of this file can be used as-is
just as a single file is used for all of the MIPS ABIs.

Sponsored by: DARPA

5 years agoFix build with option RSS, removing unused variables.
kib [Thu, 6 Dec 2018 21:52:40 +0000 (21:52 +0000)]
Fix build with option RSS, removing unused variables.

Reported by: np
Sponsored by: Mellanox Technologies
MFC after: 1 week

5 years agocxgbe(4): Get Linux cxgb4vf working in bhyve VMs with VFs passed
np [Thu, 6 Dec 2018 21:33:08 +0000 (21:33 +0000)]
cxgbe(4): Get Linux cxgb4vf working in bhyve VMs with VFs passed
through.

cxgb4vf doesn't own the buffer size list but still expects the first two
entries to be 4K and some power of 2 respectively.  The BSD cxgbe
doesn't care where its preferred buffer sizes are as long as they're in
the list somewhere, so just move its entries towards the end as a
workaround.

MFC after: 1 month
Sponsored by: Chelsio Communicatons

5 years agohier.7: add /lib/casper directory
emaste [Thu, 6 Dec 2018 21:27:36 +0000 (21:27 +0000)]
hier.7: add /lib/casper directory

Reported by: imp
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

5 years agoUpdate bmake to version 20180919
sjg [Thu, 6 Dec 2018 20:56:19 +0000 (20:56 +0000)]
Update bmake to version 20180919

Cleanup of stats cache
and new :q modifier.

5 years agoDon't reference zfs-specific variables if LOADER_ZFS_SUPPORT is undefined
ian [Thu, 6 Dec 2018 20:28:09 +0000 (20:28 +0000)]
Don't reference zfs-specific variables if LOADER_ZFS_SUPPORT is undefined
because the variables will be undefined too.

Reported by: sjg@
Pointy hat: ian@

5 years agoRemove an ugly Ultrix hack. Ultrix has been AWOL since the last ice
cy [Thu, 6 Dec 2018 20:15:54 +0000 (20:15 +0000)]
Remove an ugly Ultrix hack. Ultrix has been AWOL since the last ice
age, more to come.

MFC after: 1 week

5 years agoMinor mandoc fixes.
joel [Thu, 6 Dec 2018 20:04:01 +0000 (20:04 +0000)]
Minor mandoc fixes.

5 years agoAdd zdopen(3) to complement zopen(3).
markj [Thu, 6 Dec 2018 20:03:06 +0000 (20:03 +0000)]
Add zdopen(3) to complement zopen(3).

zdopen() can be used in capability mode.  Update zopen.3 accordingly
and fix some grammar nits while I'm here.

Reviewed by: delphij
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D18456

5 years agoSort .Xr
joel [Thu, 6 Dec 2018 19:49:08 +0000 (19:49 +0000)]
Sort .Xr

5 years agopfsync: Performance improvement
kp [Thu, 6 Dec 2018 19:27:15 +0000 (19:27 +0000)]
pfsync: Performance improvement

pfsync code is called for every new state, state update and state
deletion in pf. While pf itself can operate on multiple states at the
same time (on different cores, assuming the states hash to a different
hashrow), pfsync only had a single lock.
This greatly reduced throughput on multicore systems.

Address this by splitting the pfsync queues into buckets, based on the
state id. This ensures that updates for a given connection always end up
in the same bucket, which allows pfsync to still collapse multiple
updates into one, while allowing multiple cores to proceed at the same
time.

The number of buckets is tunable, but defaults to 2 x number of cpus.
Benchmarking has shown improvement, depending on hardware and setup, from ~30%
to ~100%.

MFC after: 1 week
Sponsored by: Orange Business Services
Differential Revision: https://reviews.freebsd.org/D18373

5 years agoAppease gcc build, remove duplicated declaration.
kib [Thu, 6 Dec 2018 19:20:00 +0000 (19:20 +0000)]
Appease gcc build, remove duplicated declaration.

Reported by: np
Sponsored by: Mellanox Technologies
MFC after: 1 week

5 years agoChange u32 to uint32_t to allow the native-xtools target to build
sbruno [Thu, 6 Dec 2018 18:59:33 +0000 (18:59 +0000)]
Change u32 to uint32_t to allow the native-xtools target to build
libsysdecode.

Submitted by: kib

5 years agopf: add a comment describing why do we call pf_map_addr again if port
kp [Thu, 6 Dec 2018 18:58:54 +0000 (18:58 +0000)]
pf: add a comment describing why do we call pf_map_addr again if port
selection process fails

Obtained from: OpenBSD

5 years agoReduce number of DNS queries in mountd.
sef [Thu, 6 Dec 2018 18:21:48 +0000 (18:21 +0000)]
Reduce number of DNS queries in mountd.

As reported by a FreeNAS user (see https://redmine.ixsystems.com/issues/55728),
mountd does more calls to getnameinfo() than it needs to; this changes it to
only call it for the RPC calls it needs the name information for.

Reported by: Dave Flowers
Reviewed by: imp, mav
Approved by: mav (mentor)
MFC after: 2 weeks
Sponsored by: iXsystems Inc
Differential Revision: https://reviews.freebsd.org/D18430

5 years agoApparently @portmgr does not feel like my current level of contribution
sobomax [Thu, 6 Dec 2018 18:12:50 +0000 (18:12 +0000)]
Apparently @portmgr does not feel like my current level of contribution
warrants me a repo access to the ports tree anymore. Move myself into alumni
at least for a time being.

5 years agosyslog(3): stdarg.h is needed only for vsyslog()
yuripv [Thu, 6 Dec 2018 18:03:18 +0000 (18:03 +0000)]
syslog(3): stdarg.h is needed only for vsyslog()

Reported by: Brian Wood <woodbrian77@gmail.com>
Reviewed by: asomers, ngie
Differential revision: https://reviews.freebsd.org/D18334

5 years agoLet kern.trap_enotcap be set as a tunable.
markj [Thu, 6 Dec 2018 17:29:37 +0000 (17:29 +0000)]
Let kern.trap_enotcap be set as a tunable.

This is handy for testing programs that are run by rc.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

5 years agoAdd examples for "make buildenv".
trasz [Thu, 6 Dec 2018 13:52:02 +0000 (13:52 +0000)]
Add examples for "make buildenv".

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agotermcap: add italics and tmux entries
yuripv [Thu, 6 Dec 2018 13:46:18 +0000 (13:46 +0000)]
termcap: add italics and tmux entries

- add "ecma+italics" cap
- use it in "xterm-basic"
- add "tmux"/"tmux-256color" caps, fixing "so" and "se" caps,
  and sourcing "ecma+italics" and "screen"/"screen-256color"

Reviewed by: bapt
Differential revision: https://reviews.freebsd.org/D18363

5 years agoacpi_{Device,Battery}IsPresent: restore pre-r330957 behaviour
avg [Thu, 6 Dec 2018 12:34:34 +0000 (12:34 +0000)]
acpi_{Device,Battery}IsPresent: restore pre-r330957 behaviour

Specifically, assume that the device is present if evaluation of _STA
method fails.

Before r330957 we ignored any _STA evaluation failure (which was
performed by AcpiGetObjectInfo in ACPICA contrib code) for the purpose
of acpi_DeviceIsPresent and acpi_BatteryIsPresent.  ACPICA 20180313
removed evaluation of _STA from AcpiGetObjectInfo.  So, we added
evaluation of _STA to acpi_DeviceIsPresent and acpi_BatteryIsPresent.
One important difference is that the new code ignored a failure only if
_STA did not exist (AE_NOT_FOUND).  Any other kind of failure was
treated as a fatal failure.  Apparently, on some systems we can get
AE_NOT_EXIST when evaluating _STA.  And that error is not an evil twin
of AE_NOT_FOUND, despite a very similar name, but a distinct error
related to a missing handler for an ACPI operation region.

It's possible that for some people the problem was already fixed by
changes in ACPICA and/or in acpi_ec driver (or even in BIOS) that fixed
the AE_NOT_EXIST failure related to EC operation region.

This work is based on a great analysis by cem and an earlier patch by
Ali Abdallah <aliovx@gmail.com>.

PR: 227191
Reported by: 0mp
MFC after: 2 weeks

5 years agonetmap: netmap_transmit should honor bpf packet tap hook
vmaffione [Thu, 6 Dec 2018 09:45:25 +0000 (09:45 +0000)]
netmap: netmap_transmit should honor bpf packet tap hook

This allows tcpdump to capture outbound kernel packets while
in netmap mode

Submitted by: Marc de la Gueronniere <mdelagueronniere@verisign.com>
Reviewed by: vmaffione
MFC after: 1 week
Sponsored by: Verisign, Inc.
Differential Revision: https://reviews.freebsd.org/D17896

5 years agoTemporarily skip flakey test cases
lwhsu [Thu, 6 Dec 2018 09:22:35 +0000 (09:22 +0000)]
Temporarily skip flakey test cases

PR: 233586, 233587, 233588
Approved by: markj (mentor)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D18362

5 years agocxgbe(4): Fall back to a basic configuration in case of any error during
np [Thu, 6 Dec 2018 06:18:21 +0000 (06:18 +0000)]
cxgbe(4): Fall back to a basic configuration in case of any error during
card initialization.  This is an expanded version of r333682.

Break up prep_firmware into simpler routines while here.  Load the
firmware/config KLD only if needed.

MFC after: 1 month
Sponsored by: Chelsio Communications

5 years agopowerpc: Set very low priority mode while waiting for AP unleash event
jhibbits [Thu, 6 Dec 2018 04:36:02 +0000 (04:36 +0000)]
powerpc: Set very low priority mode while waiting for AP unleash event

The POWER9 does not recognize 'or 27,27,27' as a thread priority NOP.  On
earlier POWER architectures, this NOP would note to the processor to give up
resources if able, to improve performance of other threads.

All processors that support the thread priority NOPs recognize the
'or 31,31,31' NOP as very low priority, so use this to perform a similar
function, and not burn cycles on POWER9.

5 years agopowerpc: Fix ELFv2 JMP_SLOT relocation fixup
jhibbits [Thu, 6 Dec 2018 04:30:24 +0000 (04:30 +0000)]
powerpc: Fix ELFv2 JMP_SLOT relocation fixup

The jump slot is a function pointer, not a descriptor pointer, in ELFv2.  Just
write the pointer itself over, not the contents of the pointer, which would be
the first instruction of the function.

5 years agopowerpc/powermac: Fix macgpio(4) child interrupt resource handling
jhibbits [Thu, 6 Dec 2018 04:25:12 +0000 (04:25 +0000)]
powerpc/powermac: Fix macgpio(4) child interrupt resource handling

The 'interrupts' property is actually 2 words, not one, on macgpio child
nodes.  Open Firmware's getprop function might be returning the value
copied, not the total size of the property, but FDT's returns the total
size.  Prior to this patch, this would cause the SYS_RES_IRQ resource list
to not be populated when running with the 'usefdt' loader variable set, to
convert the OFW device tree to a FDT.  Since the property is always 2 words,
read both words, and ignore the second.

Tested by: Dennis Clarke (previous attempt)
MFC after: 2 weeks

5 years agoIf the vfs.ffs.dotrimcons sysctl option is enabled while a file
mckusick [Thu, 6 Dec 2018 01:04:56 +0000 (01:04 +0000)]
If the vfs.ffs.dotrimcons sysctl option is enabled while a file
deletion is active, specifically after a call to ffs_blkrelease_start()
but before the call to ffs_blkrelease_finish(), ffs_blkrelease_start()
will have handed out SINGLETON_KEY rather than starting a collection
sequence. Thus if we get a SINGLETON_KEY passed to ffs_blkrelease_finish(),
we just return rather than trying to finish the nonexistent sequence.

Reported by:  Warner Losh (imp@)
Sponsored by: Netflix

5 years agotag bmake-20180919
sjg [Thu, 6 Dec 2018 00:13:51 +0000 (00:13 +0000)]
tag bmake-20180919

5 years agoImport bmake-20180919
sjg [Thu, 6 Dec 2018 00:13:35 +0000 (00:13 +0000)]
Import bmake-20180919

5 years agoNormally when an attempt is made to mount a UFS/FFS filesystem whose
mckusick [Thu, 6 Dec 2018 00:09:39 +0000 (00:09 +0000)]
Normally when an attempt is made to mount a UFS/FFS filesystem whose
superblock has a check-hash error, an error message noting the
superblock check-hash failure is printed and the mount fails. The
administrator then runs fsck to repair the filesystem and when
successful, the filesystem can once again be mounted.

This approach fails if the filesystem in question is a root filesystem
from which you are trying to boot. Here, the loader fails when trying
to access the filesystem to get the kernel to boot. So it is necessary
to allow the loader to ignore the superblock check-hash error and make
a best effort to read the kernel. The filesystem may be suffiently
corrupted that the read attempt fails, but there is no harm in trying
since the loader makes no attempt to write to the filesystem.

Once the kernel is loaded and starts to run, it attempts to mount its
root filesystem. Once again, failure means that it breaks to its prompt
to ask where to get its root filesystem. Unless you have an alternate
root filesystem, you are stuck.

Since the root filesystem is initially mounted read-only, it is
safe to make an attempt to mount the root filesystem with the failed
superblock check-hash. Thus, when asked to mount a root filesystem
with a failed superblock check-hash, the kernel prints a warning
message that the root filesystem superblock check-hash needs repair,
but notes that it is ignoring the error and proceeding. It does
mark the filesystem as needing an fsck which prevents it from being
enabled for writing until fsck has been run on it. The net effect
is that the reboot fails to single user, but at least at that point
the administrator has the tools at hand to fix the problem.

Reported by:    Rick Macklem (rmacklem@)
Discussed with: Warner Losh (imp@)
Sponsored by:   Netflix

5 years agopf tests: Add a defer mode test for pfsync
kp [Wed, 5 Dec 2018 19:53:09 +0000 (19:53 +0000)]
pf tests: Add a defer mode test for pfsync

Repeat the pfsync test, this time with the 'defer' option enabled. This
exercises slightly different code paths.

5 years agoFurther simplify arguments to init.
brooks [Wed, 5 Dec 2018 19:18:16 +0000 (19:18 +0000)]
Further simplify arguments to init.

With the removal of BOOTCDROM and fastboot support, this code always
passed "-s" or "--". The latter simply terminates getopt(3) processing
in init so we only need to pass "-s" in the single user case, or nothing
in other cases.

The passing of "--" seems to have been done to ensure that the number of
arguments passed to init was always the same and thus that argc was the
same.

Also GC the write-only variable pathlen (not in reviewed version).

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

5 years agoTerminate a blist_alloc search when a blst_meta_alloc call fails with
alc [Wed, 5 Dec 2018 18:26:40 +0000 (18:26 +0000)]
Terminate a blist_alloc search when a blst_meta_alloc call fails with
cursor == 0.

Every call to blst_meta_alloc but the one at the root is made only when the
meta-node is known to include a free block, so that either the allocation
will succeed, the node hint will be updated, or the last block of the meta-
node range is, and remains, free.  But the call at the root is made without
checking that there is a free block, so in the case that every block is
allocated, there is no hint update to prevent the current code from looping
forever.

Submitted by: Doug Moore <dougm@rice.edu>
Reported by: pho
Reviewed by: pho
Tested by: pho
X-MFC with: r340402
Differential Revision: https://reviews.freebsd.org/D17999

5 years agoixl(4) has netdump support via iflib.
markj [Wed, 5 Dec 2018 18:19:29 +0000 (18:19 +0000)]
ixl(4) has netdump support via iflib.

Reported by: kbowling
MFC after: 3 days

5 years agoRemove never enabled support for "fastboot".
brooks [Wed, 5 Dec 2018 17:35:15 +0000 (17:35 +0000)]
Remove never enabled support for "fastboot".

This has been ifdef notyet since the import of BSD 4.4 Lite Kernel
Sources in r1541.

Sponsored by: DARPA, AFRL

5 years agoRemove ifdef BOOTCDROM option to start init.
brooks [Wed, 5 Dec 2018 17:29:14 +0000 (17:29 +0000)]
Remove ifdef BOOTCDROM option to start init.

When BOOTCDROM is defined (via CFLAGS as there is no config option)
it causes -C to be passed to init, but our init and the version of
sysinstall I glanced at in 6.x don't support -C. The last plausibly
related support was removed from the tree in 1995.

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

5 years agostat(2): clarify which syscalls modify file timestamps
asomers [Wed, 5 Dec 2018 17:28:40 +0000 (17:28 +0000)]
stat(2): clarify which syscalls modify file timestamps

The list of syscalls that modify st_atim, st_mtim, and st_ctim was quite out
of date and probably not accurate to begin with.  Update it, and make it
clear that the list is open-ended.

Reviewed by: kib
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D18410

5 years agoClamp the INPCB port hash tables to IPPORT_MAX + 1 chains.
markj [Wed, 5 Dec 2018 17:06:00 +0000 (17:06 +0000)]
Clamp the INPCB port hash tables to IPPORT_MAX + 1 chains.

Memory beyond that limit was previously unused, wasting roughly 1MB per
8GB of RAM.  Also retire INP_PCBLBGROUP_PORTHASH, which was identical to
INP_PCBPORTHASH.

Reviewed by: glebius
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D17803

5 years agoNetdump support was added to mlx4en(4) in r341548.
markj [Wed, 5 Dec 2018 16:55:45 +0000 (16:55 +0000)]
Netdump support was added to mlx4en(4) in r341548.

MFC with: r341548

5 years agosx: retire SX_NOADAPTIVE
mjg [Wed, 5 Dec 2018 16:43:03 +0000 (16:43 +0000)]
sx: retire SX_NOADAPTIVE

The flag is not used by anything for years and supporting it requires an
explicit read from the lock when entering slow path.

Flag value is left unused on purpose.

Sponsored by: The FreeBSD Foundation

5 years agoRemove redundant declaration after r341517.
hselasky [Wed, 5 Dec 2018 15:56:44 +0000 (15:56 +0000)]
Remove redundant declaration after r341517.

MFC after: 1 week
Sponsored by: Mellanox Technologies

5 years agoFix some build of LinuxKPI on some platforms after r341518.
hselasky [Wed, 5 Dec 2018 15:53:34 +0000 (15:53 +0000)]
Fix some build of LinuxKPI on some platforms after r341518.

MFC after: 1 week
Sponsored by: Mellanox Technologies

5 years agoFix LINT build after r341572.
hselasky [Wed, 5 Dec 2018 15:42:31 +0000 (15:42 +0000)]
Fix LINT build after r341572.

MFC after: 1 week
Sponsored by: Mellanox Technologies

5 years agonetmap.h: include stdatomic.h
vmaffione [Wed, 5 Dec 2018 15:38:52 +0000 (15:38 +0000)]
netmap.h: include stdatomic.h

The stdatomic.h header exports atomic_thread_fence(), that
can be used to implement the nm_stst_barrier() macro needed
by netmap.

MFC after: 3 days

5 years agomlx4/mlx5: Updated driver version to 3.5.0
slavash [Wed, 5 Dec 2018 14:25:34 +0000 (14:25 +0000)]
mlx4/mlx5: Updated driver version to 3.5.0

Approved by:    hselasky (mentor)
MFC after:      1 week
Sponsored by:   Mellanox Technologies

5 years agomlx5en: Implement backpressure indication.
slavash [Wed, 5 Dec 2018 14:25:03 +0000 (14:25 +0000)]
mlx5en: Implement backpressure indication.

The backpressure indication is implemented using an unlimited rate type of
mbuf send tag. When the upper layers typically the socket layer has obtained such
a tag, it can then query the destination driver queue for the current
amount of space available in the send queue.

A single mbuf send tag may be referenced multiple times and a refcount has been added
to the mlx5e_priv structure to track its usage. Because the send tag resides
in the mlx5e_channel structure, there is no need to wait for refcounts to reach
zero until the mlx4en(4) driver is detached. The channels structure is persistant
during the lifetime of the mlx5en(4) driver it belongs to and can so be accessed
without any need of synchronization.

The mlx5e_snd_tag structure was extended to contain a type field, because there are now
two different tag types which end up in the driver which need to be distinguished.

Submitted by:   hselasky@
Approved by:    hselasky (mentor)
MFC after:      1 week
Sponsored by:   Mellanox Technologies

5 years agomlx5en: Improve configuration of HW LRO.
slavash [Wed, 5 Dec 2018 14:24:33 +0000 (14:24 +0000)]
mlx5en: Improve configuration of HW LRO.

In order to enable HW LRO, both the "hw_lro" sysctl in the mlx5en(4) config
space must be set, and the ifconfig(8) LRO capability must be set. Any other
settings will disable HW LRO.

Submitted by:   hselasky@
Approved by:    hselasky (mentor)
MFC after:      1 week
Sponsored by:   Mellanox Technologies

5 years agomlx5en: Count all transmitted and received bytes.
slavash [Wed, 5 Dec 2018 14:24:02 +0000 (14:24 +0000)]
mlx5en: Count all transmitted and received bytes.

Add counter for all transmitted and received bytes. Currently only all
transmitted and received packets were counted. Fix description of RX LRO
counters while at it.

Submitted by:   hselasky@
Approved by:    hselasky (mentor)
MFC after:      1 week
Sponsored by:   Mellanox Technologies

5 years agomlx5en: Statically allocate and free the channel structure(s).
slavash [Wed, 5 Dec 2018 14:23:31 +0000 (14:23 +0000)]
mlx5en: Statically allocate and free the channel structure(s).

By allocating the worst case size channel structure array
at attach time we can eliminate various NULL checks in the
fast path. And also reduce the chance for use-after-free
issues in the transmit fast path.

This change is also a requirement for implementing
backpressure support.

Submitted by:   hselasky@
Approved by:    hselasky (mentor)
MFC after:      1 week
Sponsored by:   Mellanox Technologies

5 years agomlx5en: Fix race in mlx5e_ethtool_debug_stats().
slavash [Wed, 5 Dec 2018 14:23:01 +0000 (14:23 +0000)]
mlx5en: Fix race in mlx5e_ethtool_debug_stats().

Writing to the debug stats variable must be locked,
else serialization will be lost which might cause
various kernel panics due to creating and destroying
sysctls out of order.

Make sure the sysctl context is initialized after freeing
the sysctl nodes, else they can be freed twice.

Submitted by:   hselasky@
Approved by:    hselasky (mentor)
MFC after:      1 week
Sponsored by:   Mellanox Technologies

5 years agomlx5en: Add support for IFM_10G_LR and IFM_40G_ER4 media types.
slavash [Wed, 5 Dec 2018 14:22:30 +0000 (14:22 +0000)]
mlx5en: Add support for IFM_10G_LR and IFM_40G_ER4 media types.

Inspect the ethernet compliance code to figure out actual cable type by reading
the PDDR module info register.

Submitted by:   hselasky@
Approved by:    hselasky (mentor)
MFC after:      1 week
Sponsored by:   Mellanox Technologies