]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 years agocaroot: use bsd.obj.mk, not bsd.prog.mk
kevans [Fri, 24 Jan 2020 16:43:02 +0000 (16:43 +0000)]
caroot: use bsd.obj.mk, not bsd.prog.mk

This directory stages certdata into .OBJDIR and processes it, but does not
actually build a prog-shaped object; bsd.obj.mk provides the minimal support
that we actually need, an .OBJDIR and descent into subdirs. This is
admittedly the nittiest of nits.

4 years agoMove the ECAM macroses to the header file.
br [Fri, 24 Jan 2020 16:08:06 +0000 (16:08 +0000)]
Move the ECAM macroses to the header file.

These will be used by other PCI root complex drivers.

Sponsored by: DARPA, AFRL

4 years agoRevert r357050.
markj [Fri, 24 Jan 2020 14:58:02 +0000 (14:58 +0000)]
Revert r357050.

It seems to have introduced a couple of regressions.

Reported by: cy, pho

4 years agoTag NLS aliases with pkgbase package
emaste [Fri, 24 Jan 2020 14:41:51 +0000 (14:41 +0000)]
Tag NLS aliases with pkgbase package

POSIX and en_US.US_ASCII are aliases (symlinks) to the C locale.  They were
not previously tagged with a pkgbase pacakge.  Add the tag so that they are
handled correctly on pkgbase-installed/updated systems.

[This is r356990 reapplied with a corrected commit message.]

Discussed with: manu

4 years agorevert r356990 to reapply with correct commit message
emaste [Fri, 24 Jan 2020 14:40:37 +0000 (14:40 +0000)]
revert r356990 to reapply with correct commit message

Requested by: rgrimes

4 years agoImplement mmget_not_zero() in the LinuxKPI.
hselasky [Fri, 24 Jan 2020 13:05:53 +0000 (13:05 +0000)]
Implement mmget_not_zero() in the LinuxKPI.

Submitted by: Austin Shafer <ashafer@badland.io>
MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoMake linux(4) handle MAP_32BIT.
trasz [Fri, 24 Jan 2020 12:08:23 +0000 (12:08 +0000)]
Make linux(4) handle MAP_32BIT.

This unbreaks Mono (mono-devel-4.6.2.7+dfsg-1ubuntu1 from Ubuntu Bionic);
previously would crash on "amd64_is_imm32" assert.

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

4 years agoAdd kern_unmount() and use in Linuxulator. No functional changes.
trasz [Fri, 24 Jan 2020 11:57:55 +0000 (11:57 +0000)]
Add kern_unmount() and use in Linuxulator.  No functional changes.

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

4 years agoFix a few spacing issues to make the page more readable.
n_hibma [Fri, 24 Jan 2020 11:22:33 +0000 (11:22 +0000)]
Fix a few spacing issues to make the page more readable.

4 years agoMost uses of vm_map_clip_start follow a call to vm_map_lookup. Define
dougm [Fri, 24 Jan 2020 07:48:11 +0000 (07:48 +0000)]
Most uses of vm_map_clip_start follow a call to vm_map_lookup. Define
an inline function vm_map_lookup_clip_start that invokes them both and
use it in places that invoke both. Drop a couple of local variables
made unnecessary by this function.

Reviewed by: markj
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D22987

4 years agovfs: allow v_usecount to transition 0->1 without the interlock
mjg [Fri, 24 Jan 2020 07:47:44 +0000 (07:47 +0000)]
vfs: allow v_usecount to transition 0->1 without the interlock

There is nothing to do but to bump the count even during said transition.
There are 2 places which can do it:
- vget only does this after locking the vnode, meaning there is no change in
  contract versus inactive or reclamantion
- vref only ever did it with the interlock held which did not protect against
  either (that is, it would always succeed)

VCHR vnodes retain special casing due to the need to maintain dev use count.

Reviewed by: jeff, kib
Tested by: pho (previous version)
Differential Revision: https://reviews.freebsd.org/D23185

4 years agovfs: stop handling VI_OWEINACT in vget
mjg [Fri, 24 Jan 2020 07:45:59 +0000 (07:45 +0000)]
vfs: stop handling VI_OWEINACT in vget

vget is almost always called with LK_SHARED, meaning the flag (if present) is
almost guaranteed to get cleared. Stop handling it in the first place and
instead let the thread which wanted to do inactive handle the bumepd usecount.

Reviewed by: jeff
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D23184

4 years agovfs: stop unlocking the vnode upfront in vput
mjg [Fri, 24 Jan 2020 07:44:25 +0000 (07:44 +0000)]
vfs: stop unlocking the vnode upfront in vput

Doing so runs into races with filesystems which make half-constructed vnodes
visible to other users, while depending on the chain vput -> vinactive ->
vrecycle to be executed without dropping the vnode lock.

Impediments for making this work got cleared up (notably vop_unlock_post now
does not do anything and lockmgr stops touching the lock after the final
write). Stacked filesystems keep vhold/vdrop across unlock, which arguably can
now be eliminated.

Reviewed by: jeff
Differential Revision: https://reviews.freebsd.org/D23344

4 years agolockmgr: don't touch the lock past unlock
mjg [Fri, 24 Jan 2020 07:42:57 +0000 (07:42 +0000)]
lockmgr: don't touch the lock past unlock

This evens it up with other locking primitives.

Note lock profiling still touches the lock, which again is in line with the
rest.

Reviewed by: jeff
Differential Revision: https://reviews.freebsd.org/D23343

4 years ago[ntp] Don't compile in the ssl routines into libevent if MK_OPENSSL is no
adrian [Fri, 24 Jan 2020 06:24:40 +0000 (06:24 +0000)]
[ntp] Don't compile in the ssl routines into libevent if MK_OPENSSL is no

Most of ntpd still handles MK_OPENSSL ok, but the libevent import brought
in the SSL bufferevent routines without checking MK_OPENSSL.

This doesn't completely fix WITHOUT_CRYPTO=YES building, but hey, it's one
less broken thing.

4 years agoDrop "All Rights Reserved" from all libbe/bectl files
kevans [Fri, 24 Jan 2020 02:18:09 +0000 (02:18 +0000)]
Drop "All Rights Reserved" from all libbe/bectl files

I sent out an e-mail on 2020/01/21 with a plan to do this to Kyle, Rob, and
Wes; all parties have responded in the affirmative that it's OK to drop it
from these files.

4 years agorandom(3): Abstract routines into _r versions on explicit state
cem [Fri, 24 Jan 2020 01:39:29 +0000 (01:39 +0000)]
random(3): Abstract routines into _r versions on explicit state

The existing APIs simply pass the implicit global state to the _r variants.

No functional change.

Note that these routines are not exported from libc and are not intended to be
exported.  If someone wished to export them from libc (which I would
discourage), they should first be modified to match the inconsistent parameter
type / order of the glibc public interfaces of the same names.

I know Ravi will ask, so: the eventual goal of this series is to replace
rand(3) with the implementation from random(3) (D23290).  However, I'd like to
wait a bit longer on that one to see if more feedback emerges.

Reviewed by: kevans, markm
Differential Revision: https://reviews.freebsd.org/D23289

4 years agorandom(3): Abstract state into a single context object
cem [Fri, 24 Jan 2020 01:32:16 +0000 (01:32 +0000)]
random(3): Abstract state into a single context object

No functional change.

Reviewed by: kevans, markm
Differential Revision: https://reviews.freebsd.org/D23288

4 years agocpufreq(4): Fix missing MODULE_DEPEND on hwpstate_intel
cem [Thu, 23 Jan 2020 23:52:57 +0000 (23:52 +0000)]
cpufreq(4): Fix missing MODULE_DEPEND on hwpstate_intel

DRIVER_MODULE does not actually define a MODULE_VERSION, which is required
to satisfy a MODULE_DEPENDency.  Declare one explicitly in
hwpstate_intel(4).

Reported by: flo
X-MFC-With: r357002

4 years agoCorrect the return types of fueword*().
jhb [Thu, 23 Jan 2020 23:36:58 +0000 (23:36 +0000)]
Correct the return types of fueword*().

MFC after: 1 week
Sponsored by: DARPA

4 years agopf: Apply kif flags to new group members
kp [Thu, 23 Jan 2020 22:13:41 +0000 (22:13 +0000)]
pf: Apply kif flags to new group members

If we have a 'set skip on <ifgroup>' rule this flag it set on the group
kif, but must also be set on all members. pfctl does this when the rules
are set, but if groups are added afterwards we must also apply the flags
to the new member. If not, new group members will not be skipped until
the rules are reloaded.

Reported by: dvl@
Reviewed by: glebius@
Differential Revision: https://reviews.freebsd.org/D23254

4 years agoadd MIPS-specific PT header ELF definitions
emaste [Thu, 23 Jan 2020 17:38:17 +0000 (17:38 +0000)]
add MIPS-specific PT header ELF definitions

Submitted by: David Carlier
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D19428

4 years agosparc64: Busy the TSB page before freeing it in pmap_release().
markj [Thu, 23 Jan 2020 17:18:58 +0000 (17:18 +0000)]
sparc64: Busy the TSB page before freeing it in pmap_release().

This is now required by vm_page_free().

PR: 243534
Reported and tested by: Michael Reim <kraileth@elderlinux.org>

4 years agoFix r356919.
kib [Thu, 23 Jan 2020 17:08:33 +0000 (17:08 +0000)]
Fix r356919.

Instead of waiting for pc_curthread which is overwritten by
init_secondary_tail(), wait for non-NULL pc_curpcb, to be set by the
first context switch.
Assert that pc_curpcb is not set too early.

Reported and tested by: rlibby
Reviewed by: markj, rlibby
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D23330

4 years agong_nat: Pass IPv6 packets through.
markj [Thu, 23 Jan 2020 16:45:48 +0000 (16:45 +0000)]
ng_nat: Pass IPv6 packets through.

ng_nat implements NAT for IPv4 traffic only.  When connected to an
ng_ether node it erroneously handled IPv6 packets as well.

This change is not sufficient: ng_nat does not do any validation of IP
packets in this mode, even though they have not yet passed through
ip_input().

PR: 243096
Reported by: Robert James Hernandez <rob@sarcasticadmin.com>
Reviewed by: julian
Differential Revision: https://reviews.freebsd.org/D23080

4 years agovm_map_submap(): Avoid unnecessary clipping.
markj [Thu, 23 Jan 2020 16:45:10 +0000 (16:45 +0000)]
vm_map_submap(): Avoid unnecessary clipping.

A submap can only be created from an entry spanning the entire request
range.  In particular, if vm_map_lookup_entry() returns false or the
returned entry contains "end".

Since the only use of submaps in FreeBSD is for the static pipe and
execve argument KVA maps, this has no functional effect.

Github PR: https://github.com/freebsd/freebsd/pull/420
Submitted by: Wuyang Chung <wuyang.chung1@gmail.com> (original)
Reviewed by: dougm, kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D23299

4 years agoWith MSI interrupts bge(4) just schedules taskqueue. Enter the network
glebius [Thu, 23 Jan 2020 16:36:58 +0000 (16:36 +0000)]
With MSI interrupts bge(4) just schedules taskqueue.  Enter the network
epoch in the taskqueue handler.

Reported by: kib

4 years agoSet td_oncpu before dropping the thread lock during a switch.
markj [Thu, 23 Jan 2020 16:24:51 +0000 (16:24 +0000)]
Set td_oncpu before dropping the thread lock during a switch.

After r355784 we no longer hold a thread's thread lock when switching it
out.  Preserve the previous synchronization protocol for td_oncpu by
setting it together with td_state, before dropping the thread lock
during a switch.

Reported and tested by: pho
Reviewed by: kib
Discussed with: jeff
Differential Revision: https://reviews.freebsd.org/D23270

4 years agoPrint missing ID_AA64PFR{0,1}_EL1 register fields.
markj [Thu, 23 Jan 2020 16:10:38 +0000 (16:10 +0000)]
Print missing ID_AA64PFR{0,1}_EL1 register fields.

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

4 years agoarm64: Don't enable interrupts in init_secondary().
markj [Thu, 23 Jan 2020 16:07:27 +0000 (16:07 +0000)]
arm64: Don't enable interrupts in init_secondary().

Doing so can cause deadlocks or panics during boot, if an interrupt
handler accesses uninitialized per-CPU scheduler structures.  This seems
to occur frequently when running under QEMU or AWS.  The idle threads
are set up to release a spinlock section and enable interrupts in
fork_exit(), so there is no need to enable interrupts earlier.

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

4 years agoTag /usr/tests/local symlink with package=tests
emaste [Thu, 23 Jan 2020 15:59:30 +0000 (15:59 +0000)]
Tag /usr/tests/local symlink with package=tests

As with the rest of /usr/tests, so that it is handled correctly on
pkgbase-installed/updated systems.

Sponsored by: The FreeBSD Foundation

4 years agoApply r355819 to sparc64 - fix assertion failure after r355784
emaste [Thu, 23 Jan 2020 14:11:02 +0000 (14:11 +0000)]
Apply r355819 to sparc64 - fix assertion failure after r355784

From r355819:
Repeat the spinlock_enter/exit pattern from amd64 on other architectures
to fix an assert violation introduced in r355784.  Without this
spinlock_exit() may see owepreempt and switch before reducing the
spinlock count.  amd64 had been optimized to do a single critical
enter/exit regardless of the number of spinlocks which avoided the
problem and this optimization had not been applied elsewhere.

This is completely untested - I have no obsolete Sparc hardware - but
someone did try testing recent changes on sparc64 (PR 243534).

PR: 243534

4 years agoFix kernel-tags target.
nyan [Thu, 23 Jan 2020 13:56:12 +0000 (13:56 +0000)]
Fix kernel-tags target.
  - A depend-file is broken up into .depend.*.o files. [1]
  - Fix an assembly file support.

PR: 241746
Submitted by: leres [1]
MFC after: 1 week

4 years agovmxnet3: add support for RSS kernel option
avg [Thu, 23 Jan 2020 11:05:03 +0000 (11:05 +0000)]
vmxnet3: add support for RSS kernel option

We observe at least one problem: if a UDP socket is connect(2)-ed, then a
received packet that matches the connection cannot be matched to the
corresponding PCB because of an incorrect flow ID.  That was oberved for DNS
requests from the libc resolver.  We got this problem because FreeBSD
r343291 enabled code that can set rsstype of received packets to values
other than M_HASHTYPE_OPAQUE_HASH.  Earlier that code was under 'ifdef
notyet'.

The essence of this change is to use the system-wide RSS key instead of
some historic hardcoded key when the software RSS is enabled and it is
configured to use Toeplitz algorithm (the default).
In all other cases, the driver reports the opaque hash type for received
packets while still using Toeplitz algorithm with the internal key.

PR: 242890
Reviewed by: pkelsey
Sponsored by: Panzura
Differential Revision: https://reviews.freebsd.org/D23147

4 years agoFix build of stand/usb .
hselasky [Thu, 23 Jan 2020 10:40:34 +0000 (10:40 +0000)]
Fix build of stand/usb .

MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agovirtio_scsi: use max target ID plus one as the initiator ID
avg [Thu, 23 Jan 2020 10:13:56 +0000 (10:13 +0000)]
virtio_scsi: use max target ID plus one as the initiator ID

This bus does not really have a concept of the initiator ID, so use
a guaranteed dummy one that won't conflict with any real target.

This change fixes a problem with virtio_scsi on GCE where disks get
sequential target IDs starting from one.  If there are seven or more
disks, then a disk with the target ID of seven would not be discovered
by FreeBSD as that ID was reserved as the initiator ID -- see
scsi_scan_bus().

Discussed with: bryanv
MFC after: 2 weeks
Sponsored by: Panzura

4 years agoBring indentation back to normal after r357038.
melifaro [Thu, 23 Jan 2020 09:46:45 +0000 (09:46 +0000)]
Bring indentation back to normal after r357038.
No functional changes.

MFC after: 3 weeks

4 years agoFix epoch-related panic in ipdivert, ensuring in_broadcast() is called
melifaro [Thu, 23 Jan 2020 09:14:28 +0000 (09:14 +0000)]
Fix epoch-related panic in ipdivert, ensuring in_broadcast() is called
 within epoch.

Simplify gigantic div_output() by splitting it into 3 functions,
 handling preliminary setup, remote "ip[6]_output" case and
 local "netisr" case. Leave original indenting in most parts to ease
 diff comparison.  Indentation will be fixed by a followup commit.

Reported by: Nick Hibma <nick at van-laarhoven.org>
Reviewed by: glebius
Differential Revision: https://reviews.freebsd.org/D23317

4 years ago(fault 9/9) Move zero fill into a dedicated function to make the object lock
jeff [Thu, 23 Jan 2020 05:23:37 +0000 (05:23 +0000)]
(fault 9/9) Move zero fill into a dedicated function to make the object lock
state more clear.

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

4 years ago(fault 8/9) Restructure some code to reduce duplication and simplify flow
jeff [Thu, 23 Jan 2020 05:22:02 +0000 (05:22 +0000)]
(fault 8/9) Restructure some code to reduce duplication and simplify flow
control.

Reviewed by: dougm, kib, markj
Differential Revision: https://reviews.freebsd.org/D23321

4 years ago(fault 7/9) Move fault population and allocation into a dedicated function
jeff [Thu, 23 Jan 2020 05:19:39 +0000 (05:19 +0000)]
(fault 7/9) Move fault population and allocation into a dedicated function

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

4 years ago(fault 6/9) Move getpages and associated logic into a dedicated function.
jeff [Thu, 23 Jan 2020 05:18:00 +0000 (05:18 +0000)]
(fault 6/9) Move getpages and associated logic into a dedicated function.

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

4 years ago(fault 5/9) Move the backing_object traversal into a dedicated function.
jeff [Thu, 23 Jan 2020 05:14:41 +0000 (05:14 +0000)]
(fault 5/9)  Move the backing_object traversal into a dedicated function.

Reviewed by: dougm, kib, markj
Differential Revision: https://reviews.freebsd.org/D23310

4 years ago(fault 4/9) Move copy-on-write into a dedicated function.
jeff [Thu, 23 Jan 2020 05:11:01 +0000 (05:11 +0000)]
(fault 4/9) Move copy-on-write into a dedicated function.

Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D23304

4 years ago(fault 3/9) Move map relookup into a dedicated function.
jeff [Thu, 23 Jan 2020 05:07:01 +0000 (05:07 +0000)]
(fault 3/9) Move map relookup into a dedicated function.

Add a new VM return code KERN_RESTART which means, deallocate and restart in
fault.

Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D23303

4 years ago(fault 2/9) Move map lookup into a dedicated function.
jeff [Thu, 23 Jan 2020 05:05:39 +0000 (05:05 +0000)]
(fault 2/9) Move map lookup into a dedicated function.

Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D23302

4 years ago(fault 1/9) Move a handful of stack variables into the faultstate.
jeff [Thu, 23 Jan 2020 05:03:34 +0000 (05:03 +0000)]
(fault 1/9) Move a handful of stack variables into the faultstate.

This additionally fixes a potential bug/pessimization where we could fail to
reload the original fault_type on restart.

Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D23301

4 years agouma: fix zone domain overlaying pcpu cache with disabled cpus
rlibby [Thu, 23 Jan 2020 04:56:38 +0000 (04:56 +0000)]
uma: fix zone domain overlaying pcpu cache with disabled cpus

UMA zone structures have two arrays at the end which are sized according
to the machine: an array of CPU count length, and an array of NUMA
domain count length.  The CPU counting was wrong in the case where some
CPUs are disabled (when mp_ncpus != mp_maxid + 1), and this caused the
second array to be overlaid with the first.

Reported by: olivier
Reviewed by: jeff, markj
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D23318

4 years agouma: report leaks more accurately
rlibby [Thu, 23 Jan 2020 04:56:34 +0000 (04:56 +0000)]
uma: report leaks more accurately

Previously UMA had some false negatives in the leak report at keg
destruction time, where it only reported leaks if there were free items
in the slab layer (rather than allocated items), which notably would not
be true for single-item slabs (large items).  Now, report a leak if
there are any allocated pages, and calculate and report the number of
allocated items rather than free items.

Reviewed by: jeff, markj
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D23275

4 years agoConsistently use busy and vm_page_valid() rather than touching page bits
jeff [Thu, 23 Jan 2020 04:54:49 +0000 (04:54 +0000)]
Consistently use busy and vm_page_valid() rather than touching page bits
directly.  This improves API compliance, asserts, etc.

Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D23283

4 years agoFix 32-bit build post r357002.
cy [Thu, 23 Jan 2020 03:38:41 +0000 (03:38 +0000)]
Fix 32-bit build post r357002.

4 years agoSome architectures with DMAP still consume boot kva. Simplify the test for
jeff [Thu, 23 Jan 2020 03:37:35 +0000 (03:37 +0000)]
Some architectures with DMAP still consume boot kva.  Simplify the test for
claiming kva in uma_startup2() to handle this.

Reported by: bdragon

4 years agoBlock the thread lock in sched_throw() and use cpu_switch() to unblock
jeff [Thu, 23 Jan 2020 03:36:50 +0000 (03:36 +0000)]
Block the thread lock in sched_throw() and use cpu_switch() to unblock
it.  The introduction of lockless switch in r355784 created a race to
re-use the exiting thread that was only possible to hit on a hypervisor.

Reported/Tested by: rlibby
Discussed with: rlibby, jhb

4 years agoSince now drivers that support pfil run their interrupts in the network
glebius [Thu, 23 Jan 2020 01:49:22 +0000 (01:49 +0000)]
Since now drivers that support pfil run their interrupts in the network
epoch, stop entering it in pfil_run_hooks().  Assert the epoch there.

4 years agoStop entering the network epoch in ether_input(), unless driver
glebius [Thu, 23 Jan 2020 01:47:43 +0000 (01:47 +0000)]
Stop entering the network epoch in ether_input(), unless driver
is marked with IFF_NEEDSEPOCH.

4 years agoThis is Ethernet driver so mark the interrupt appropriately.
glebius [Thu, 23 Jan 2020 01:46:05 +0000 (01:46 +0000)]
This is Ethernet driver so mark the interrupt appropriately.

4 years agoIntroduce flag IFF_NEEDSEPOCH that marks Ethernet interfaces that
glebius [Thu, 23 Jan 2020 01:41:09 +0000 (01:41 +0000)]
Introduce flag IFF_NEEDSEPOCH that marks Ethernet interfaces that
supposedly may call into ether_input() without network epoch.

They all need to be reviewed before 13.0-RELEASE.  Some may need
be fixed.  The flag is not planned to be used in the kernel for
a long time.

4 years agotap(4) calls ether_input() in context of write(2). Enter network
glebius [Thu, 23 Jan 2020 01:38:51 +0000 (01:38 +0000)]
tap(4) calls ether_input() in context of write(2).  Enter network
epoch here.

The tun(4) side doesn't need this, as netisr code will take care.

4 years agoIn netmap() call ether_input() within the network epoch.
glebius [Thu, 23 Jan 2020 01:35:02 +0000 (01:35 +0000)]
In netmap() call ether_input() within the network epoch.

4 years agoDEVICE_POLLING is an alternative to network interrupts and also
glebius [Thu, 23 Jan 2020 01:30:50 +0000 (01:30 +0000)]
DEVICE_POLLING is an alternative to network interrupts and also
needs to enter epoch.  Assert that in the netisr_poll() and do
the work for the idle poll routine.

4 years agoEnter network epoch in iflib rxeof task.
glebius [Thu, 23 Jan 2020 01:27:58 +0000 (01:27 +0000)]
Enter network epoch in iflib rxeof task.

In upcoming changes ether_input() is going to be changed not
to enter the network epoch.  It is going to be responsibility
of network interrupt.  In case of iflib - its taskqueue.

4 years agoMark swi_net() as INTR_TYPE_NET and stop entering epoch there.
glebius [Thu, 23 Jan 2020 01:25:32 +0000 (01:25 +0000)]
Mark swi_net() as INTR_TYPE_NET and stop entering epoch there.

4 years agoEnter the network epoch for interrupt handlers of INTR_TYPE_NET.
glebius [Thu, 23 Jan 2020 01:24:47 +0000 (01:24 +0000)]
Enter the network epoch for interrupt handlers of INTR_TYPE_NET.

Provide tunable to limit how many times handlers may be executed
without reentering epoch.

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

4 years agoAdd ie_hflags to struct intr_event, which accumulates flags from all
glebius [Thu, 23 Jan 2020 01:20:59 +0000 (01:20 +0000)]
Add ie_hflags to struct intr_event, which accumulates flags from all
handlers on this event.  For now handle only IH_ENTROPY in that manner.

4 years agocpufreq(4): Add support for Intel Speed Shift
cem [Wed, 22 Jan 2020 23:28:42 +0000 (23:28 +0000)]
cpufreq(4): Add support for Intel Speed Shift

Intel Speed Shift is Intel's technology to control frequency in hardware,
with hints from software.

Let's get a working version of this in the tree and we can refine it from
here.

Submitted by: bwidawsk, scottph
Reviewed by: bcr (manpages), myself
Discussed with: jhb, kib (earlier versions)
With feedback from: Greg V, gallatin, freebsdnewbie AT freenet.de
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D18028

4 years agoRemove support for auto-selecting an external binutils.
jhb [Wed, 22 Jan 2020 21:21:24 +0000 (21:21 +0000)]
Remove support for auto-selecting an external binutils.

All of the in-tree architectures not supported by in-tree binutils are
supported by lld, so the condition is now always false.  It also
didn't fully work since the external binutils are installed into a
directory that uses the host's OS version, not the target OS version.

Reviewed by: emaste, imp
Differential Revision: https://reviews.freebsd.org/D23294

4 years agopfsync: Ensure we enter network epoch before calling ip_output
kp [Wed, 22 Jan 2020 21:01:19 +0000 (21:01 +0000)]
pfsync: Ensure we enter network epoch before calling ip_output

As of r356974 calls to ip_output() require us to be in the network epoch.
That wasn't the case for the calls done from pfsyncintr() and
pfsync_defer_tmo().

4 years agoMark rfork(2) as __returns_twice
kevans [Wed, 22 Jan 2020 20:53:25 +0000 (20:53 +0000)]
Mark rfork(2) as __returns_twice

rfork is not generally a built-in that would be recognized as behaving like
vfork/fork; provide the hint.

4 years agoUpdate route MTUs for bridge, lagg and vlan interfaces.
mav [Wed, 22 Jan 2020 20:36:45 +0000 (20:36 +0000)]
Update route MTUs for bridge, lagg and vlan interfaces.

Those interfaces may implicitly change their MTU on addition of parent
interface in addition to normal SIOCSIFMTU ioctl path, where the route
MTUs are updated normally.

MFC after: 2 weeks
Sponsored by: iXsystems, Inc.

4 years agoTag etc/termcap with package=runtime
emaste [Wed, 22 Jan 2020 18:55:36 +0000 (18:55 +0000)]
Tag etc/termcap with package=runtime

/etc/termcap is a symlink to /usr/share/misc/termcap, which is in the
runtime package.  Tag the symlink with the same package so that it is
handled correctly on pkgbase-installed/updated systems.

Sponsored by: The FreeBSD Foundation

4 years agoTag NLS aliases with package=runtime
emaste [Wed, 22 Jan 2020 18:40:19 +0000 (18:40 +0000)]
Tag NLS aliases with package=runtime

POSIX and en_US.US_ASCII are aliases (symlinks) to the C locale.  They were
not previously tagged with a pkgbase pacakge.  Add the tag so that they are
handled correctly on pkgbase-installed/updated systems.

Discussed with: manu

4 years agoPlug possible calls into ip6?_output() without network epoch from SCTP
glebius [Wed, 22 Jan 2020 17:19:53 +0000 (17:19 +0000)]
Plug possible calls into ip6?_output() without network epoch from SCTP
bluntly adding epoch entrance into the macro that SCTP uses to call
ip6?_output().  This definitely will introduce several epoch recursions.

Reported by: https://syzkaller.appspot.com/bug?id=79f03f574594a5be464997310896765c458ed80a
Reported by: https://syzkaller.appspot.com/bug?id=07c6f52106cddbe356cc2b2f3664a1c51cc0dadf

4 years agoEnter network epoch when calling in_pcbconnect() for IPv6 mapped to IPv4
glebius [Wed, 22 Jan 2020 17:06:55 +0000 (17:06 +0000)]
Enter network epoch when calling in_pcbconnect() for IPv6 mapped to IPv4
UDP sockets.  This is miss from r356983.

Reported by: https://syzkaller.appspot.com/bug?id=73c7a2e3f0783f9947459065e5c2f25fe8f82f54

4 years agoFix NOINET kernels after r356983.
bz [Wed, 22 Jan 2020 15:06:59 +0000 (15:06 +0000)]
Fix NOINET kernels after r356983.

All gotos to the label are within the #ifdef INET section, which leaves
us with an unused label.  Cover the label under #ifdef INET as well to
avoid the warning and compile time error.

4 years agoTag os-release symlink with package=runtime
kevans [Wed, 22 Jan 2020 14:07:27 +0000 (14:07 +0000)]
Tag os-release symlink with package=runtime

This ensures it gets into pkgbase-(installed/updated) systems.

4 years agoBring back redirect route expiration.
melifaro [Wed, 22 Jan 2020 13:53:18 +0000 (13:53 +0000)]
Bring back redirect route expiration.

Redirect (and temporal) route expiration was broken a while ago.
This change brings route expiration back, with unified IPv4/IPv6 handling code.

It introduces net.inet.icmp.redirtimeout sysctl, allowing to set
 an expiration time for redirected routes. It defaults to 10 minutes,
 analogues with net.inet6.icmp6.redirtimeout.

Implementation uses separate file, route_temporal.c, as route.c is already
 bloated with tons of different functions.
Internally, expiration is implemented as an per-rnh callout scheduled when
 route with non-zero rt_expire time is added or rt_expire is changed.
 It does not add any overhead when no temporal routes are present.

Callout traverses entire routing tree under wlock, scheduling expired routes
 for deletion and calculating the next time it needs to be run. The rationale
 for such implemention is the following: typically workloads requiring large
 amount of routes have redirects turned off already, while the systems with
 small amount of routes will not inhibit large overhead during tree traversal.

This changes also fixes netstat -rn display of route expiration time, which
 has been broken since the conversion from kread() to sysctl.

Reviewed by: bz
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D23075

4 years agoMake in_pcbladdr() require network epoch entered by its callers. Together
glebius [Wed, 22 Jan 2020 06:10:41 +0000 (06:10 +0000)]
Make in_pcbladdr() require network epoch entered by its callers.  Together
with this widen network epoch coverage up to tcp_connect() and udp_connect().

Revisions from r356974 and up to this revision cover D23187.

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

4 years agoRemove extraneous NET_EPOCH_ASSERT - the full function is covered.
glebius [Wed, 22 Jan 2020 06:07:27 +0000 (06:07 +0000)]
Remove extraneous NET_EPOCH_ASSERT - the full function is covered.

4 years agoRe-absorb tcp_detach() back into tcp_usr_detach() as the comment suggests.
glebius [Wed, 22 Jan 2020 06:06:27 +0000 (06:06 +0000)]
Re-absorb tcp_detach() back into tcp_usr_detach() as the comment suggests.
Not a functional change.

4 years agoDon't enter network epoch in tcp_usr_detach. A PCB removal doesn't
glebius [Wed, 22 Jan 2020 06:04:56 +0000 (06:04 +0000)]
Don't enter network epoch in tcp_usr_detach. A PCB removal doesn't
require that.

4 years agoThe network epoch changes in the TCP stack combined with old r286227,
glebius [Wed, 22 Jan 2020 06:03:45 +0000 (06:03 +0000)]
The network epoch changes in the TCP stack combined with old r286227,
actually make removal of a PCB not needing ipi_lock in any form.  The
ipi_list_lock is sufficient.

4 years agotcp_usr_attach() doesn't need network epoch. in_pcbfree() and
glebius [Wed, 22 Jan 2020 06:01:26 +0000 (06:01 +0000)]
tcp_usr_attach() doesn't need network epoch.  in_pcbfree() and
in_pcbdetach() perform all necessary synchronization themselves.

4 years agoRelax locking requirements for in_pcballoc(). All pcbinfo fields
glebius [Wed, 22 Jan 2020 05:58:29 +0000 (05:58 +0000)]
Relax locking requirements for in_pcballoc().  All pcbinfo fields
modified by this function are protected by the PCB list lock that is
acquired inside the function.

This could have been done even before epoch changes, after r286227.

4 years agoInline tcp_attach() into tcp_usr_attach(). Not a functional change.
glebius [Wed, 22 Jan 2020 05:54:58 +0000 (05:54 +0000)]
Inline tcp_attach() into tcp_usr_attach().  Not a functional change.

4 years agoMake tcp_output() require network epoch.
glebius [Wed, 22 Jan 2020 05:53:16 +0000 (05:53 +0000)]
Make tcp_output() require network epoch.

Enter the epoch before calling into tcp_output() from those
functions, that didn't do that before.

This eliminates a bunch of epoch recursions in TCP.

4 years agoMake ip6_output() and ip_output() require network epoch.
glebius [Wed, 22 Jan 2020 05:51:22 +0000 (05:51 +0000)]
Make ip6_output() and ip_output() require network epoch.

All callers that before may called into these functions
without network epoch now must enter it.

4 years agoRemove struct callout_handle. Should have gone with r355732.
glebius [Wed, 22 Jan 2020 05:47:59 +0000 (05:47 +0000)]
Remove struct callout_handle.  Should have gone with r355732.

4 years agoRemove comment that no longer describe reality.
glebius [Wed, 22 Jan 2020 05:32:23 +0000 (05:32 +0000)]
Remove comment that no longer describe reality.

4 years agoIn compatibility structure substitute 'struct callout_handle'
glebius [Wed, 22 Jan 2020 05:31:37 +0000 (05:31 +0000)]
In compatibility structure substitute 'struct callout_handle'
to 'struct callout *' pointer of the same size.

4 years agoAdd documenting NET_EPOCH_ASSERT() to tcp_drop().
glebius [Wed, 22 Jan 2020 02:38:46 +0000 (02:38 +0000)]
Add documenting NET_EPOCH_ASSERT() to tcp_drop().

4 years agoAdd some documenting NET_EPOCH_ASSERTs.
glebius [Wed, 22 Jan 2020 02:37:47 +0000 (02:37 +0000)]
Add some documenting NET_EPOCH_ASSERTs.

4 years agoUnroll macro that is used just once. Not a functional change.
glebius [Wed, 22 Jan 2020 02:35:39 +0000 (02:35 +0000)]
Unroll macro that is used just once.  Not a functional change.

4 years agoChange argument order of epoch_call() to more natural, first function,
glebius [Wed, 22 Jan 2020 02:28:39 +0000 (02:28 +0000)]
Change argument order of epoch_call() to more natural, first function,
then its argument.

A miss from r356826.

4 years ago[PowerPC] libc backwards compatibility shim for auxv change
bdragon [Wed, 22 Jan 2020 02:06:34 +0000 (02:06 +0000)]
[PowerPC] libc backwards compatibility shim for auxv change

As part of the FreeBSD powerpc* flag day (1300070), the auxv numbering was
changed to match every other platform.

See D20799 for more details on that change.

While the kernel and rtld were adapted, libc was not, so old dynamic
binaries broke for reasons other than the ABI change on powerpc64.

Since it's possible to support nearly everything regarding old binaries by
adding compatibility code to libc (as besides rtld, it is the main point
where auxv is digested), we might as well provide compatibility code.

The only unhandled case remaining should be "new format libraries that call
elf_aux_info() which are dynamically linked to by old-format binaries",
which should be quite rare.

Reviewed by: jhibbits
Sponsored by: Tag1 Consulting, Inc.
Differential Revision: https://reviews.freebsd.org/D23096

4 years agoInstall man5 and man7 for OpenSSL.
jkim [Wed, 22 Jan 2020 01:15:57 +0000 (01:15 +0000)]
Install man5 and man7 for OpenSSL.

Note config.5 and crypto.7 are not installed because we have conflicts.

Requested by: phk
MFC after: 1 month

4 years agoAdd new USB ID to uslcom(4).
hselasky [Tue, 21 Jan 2020 22:28:16 +0000 (22:28 +0000)]
Add new USB ID to uslcom(4).

Submitted by: Oleg Sharoyko <osharoiko@gmail.com>
PR: 243494
MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoposix_spawn: mark error as volatile
kevans [Tue, 21 Jan 2020 22:02:53 +0000 (22:02 +0000)]
posix_spawn: mark error as volatile

In the case of an error, the RFSPAWN'd thread will write back to psa->error
with the correct exit code. Mark this as volatile as the return value is
being actively dorked up for erroneous exits on !x86.

This fixes the following tests, tested on aarch64 (only under qemu, at the
moment):

- posix_spawn/spawn_test:t_spawn_missing
- posix_spawn/spawn_test:t_spawn_nonexec
- posix_spawn/spawn_test:t_spawn_zero

Reported by: mikael
MFC after: 3 days

4 years agoRevert r356948; breaks build somehow.
trasz [Tue, 21 Jan 2020 20:32:49 +0000 (20:32 +0000)]
Revert r356948; breaks build somehow.

4 years agoFix build when WITHOUT_WPA_SUPPLICANT_EAPOL option used.
cy [Tue, 21 Jan 2020 20:21:52 +0000 (20:21 +0000)]
Fix build when WITHOUT_WPA_SUPPLICANT_EAPOL option used.

The build failure was discoved by Michael Dexter's recent Build Options
Survey run, at https://callfortesting.org/results/bos-2020-01-16/\
WITHOUT_WPA_SUPPLICANT_EAPOL-small.txt.

Reported by: Michael Dexter <editor@callfortesting.org> via emaste
MFC after: 2 weeks

4 years agoMake linux(4) handle MAP_32BIT.
trasz [Tue, 21 Jan 2020 19:19:02 +0000 (19:19 +0000)]
Make linux(4) handle MAP_32BIT.

This unbreaks Mono (mono-devel-4.6.2.7+dfsg-1ubuntu1 from Ubuntu Bionic);
previously would crash on "amd64_is_imm32" assert.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation