]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agobhyve: Use MAP_GUARD when mapping guest memory ranges.
jhb [Thu, 6 Sep 2018 20:29:40 +0000 (20:29 +0000)]
bhyve: Use MAP_GUARD when mapping guest memory ranges.

Instead of relying on PROT_NONE mappings with MAP_ANON, use MAP_GUARD
to reserve address space around guest memory ranges including the
guard ranges of address space around mappings.

Submitted by: Shawn Webb
Reviewed by: araujo
Approved by: re (rgrimes)
MFC after: 1 month
Sponsored by: HardendBSD and G2, Inc
Differential Revision: https://reviews.freebsd.org/D16822

5 years agoUse the correct terminology.
markj [Thu, 6 Sep 2018 20:02:19 +0000 (20:02 +0000)]
Use the correct terminology.

Reported by:    kib
Approved by: re (gjb)
Differential revision:  https://reviews.freebsd.org/D16191

5 years agoThe inp_lle field to struct inpcb, along with two "valid" flags
bz [Thu, 6 Sep 2018 19:55:40 +0000 (19:55 +0000)]
The inp_lle field to struct inpcb, along with two "valid" flags
for the rt and lle cache were added in r191129 (2009).
To my best knowledge they have never been used and route caching
has converted the inp_rt field from that commit to inp_route
rendering this field and these flags obsolete.

Convert the pointer into a spare pointer to not change the size of
the structure anymore (and to have a spare pointer) and mark the
two fields as unused.

Reviewed by: markj, karels
Approved by: re (gjb)
Differential Revision: https://reviews.freebsd.org/D17062

5 years agoamd64: depessimize copyinstr_smap
mjg [Thu, 6 Sep 2018 19:42:40 +0000 (19:42 +0000)]
amd64: depessimize copyinstr_smap

The stac/clac combo around each byte copy is causing a measurable
slowdown in benchmarks. Do it only before and after all data is
copied. While here reorder the code to avoid a forward branch in
the common case.

Note the copying loop (originating from copyinstr) is avoidably slow
and will be fixed later.

Reviewed by: kib
Approved by: re (gjb)
Differential Revision: https://reviews.freebsd.org/D17063

5 years agoAvoid resource deadlocks when one domain has exhausted its memory. Attempt
markj [Thu, 6 Sep 2018 19:28:52 +0000 (19:28 +0000)]
Avoid resource deadlocks when one domain has exhausted its memory. Attempt
other allowed domains if the requested domain is below the minimum paging
threshold.  Block in fork only if all domains available to the forking
thread are below the severe threshold rather than any.

Submitted by: jeff
Reported by: mjg
Reviewed by: alc, kib, markj
Approved by: re (rgrimes)
Differential Revision: https://reviews.freebsd.org/D16191

5 years agoRe-enable kernel modules for the MALTA64EL kernel configuration.
jhb [Thu, 6 Sep 2018 19:21:31 +0000 (19:21 +0000)]
Re-enable kernel modules for the MALTA64EL kernel configuration.

Update the BOOTSTRAPPING check for libelf to require the fix for
mips64el object files committed in r338478 and re-enable kernel
modules in the MALTA64EL config file.

Reviewed by: emaste
Approved by: re (gjb)
Differential Revision: https://reviews.freebsd.org/D17054

5 years agoClean up iflib sysctls
shurd [Thu, 6 Sep 2018 18:51:52 +0000 (18:51 +0000)]
Clean up iflib sysctls

Remove sysctls:
txq_drain_encapfail - now a duplicate of encap_txd_encap_fail
intr_link - was never incremented
intr_msix - was never incremented
rx_zero_len - was never incremented

The following were not incremented in all code-paths that apply:
m_pullups, mbuf_defrag, rxd_flush, tx_encap, rx_intr_enables, tx_frees,
encap_txd_encap_fail.

Fixes:
Replace the broken collapse_pkthdr() implementation with an MPASS().
fl_refills and fl_refills_large were not incremented when using netmap.

Reviewed by: gallatin
Approved by: re (marius)
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D16733

5 years agoAdd device_attach and device_detach events to man page.
bwidawsk [Thu, 6 Sep 2018 18:45:31 +0000 (18:45 +0000)]
Add device_attach and device_detach events to man page.

Approved by: bcr, emaste (mentor), imp, jhb
Approved by: re (gjb)
Differential Revision: https://reviews.freebsd.org/D17052

5 years agoAdd MPLS LSP-echo (RFC8029, March 2017) port.
obrien [Thu, 6 Sep 2018 18:34:11 +0000 (18:34 +0000)]
Add MPLS LSP-echo (RFC8029, March 2017) port.

Reviewed by: stevek
Approved by: re(gjb)
Obtained from: Juniper Networks

5 years agoFix the GIC ACPI cross reference value.
andrew [Thu, 6 Sep 2018 17:25:50 +0000 (17:25 +0000)]
Fix the GIC ACPI cross reference value.

To support INTRNG with ACPI we need to set a non-zero cross reference value
for the interrupt controller. The GICv3 driver already had this value set,
however it was missed in the GICv2 driver. Fix this by setting xref to the
correct value.

Approved by: re (gjb)

5 years agoRemove the check that the Arm generic interrupt controller variant is
andrew [Thu, 6 Sep 2018 17:25:01 +0000 (17:25 +0000)]
Remove the check that the Arm generic interrupt controller variant is
non-zero. This is the case on qemu, so remove it to allow us to boot there.
This change is needed to boot on qemu with ACPI.

Approved by: re (gjb)

5 years agopowerpc64: Add initial support for HTM (kABI)
leitao [Thu, 6 Sep 2018 17:07:21 +0000 (17:07 +0000)]
powerpc64: Add initial support for HTM (kABI)

This patch adds the very initial support for HTM that might come at FreeBSD
version 12.1. This basic support defines a new kABI, so, we do not need to change
it later during 12.1 time frame, when the full implementation will come.

Reviewed by: jhibbits
Approved by: re(marius), jhibbits (mentor)
Differential Revision: https://reviews.freebsd.org/D16889

5 years agoRemove vm_page_remque().
markj [Thu, 6 Sep 2018 16:17:45 +0000 (16:17 +0000)]
Remove vm_page_remque().

Testing m->queue != PQ_NONE is not sufficient; see the commit log
message for r338276.  As of r332974 vm_page_dequeue() handles
already-dequeued pages, so just replace vm_page_remque() calls with
vm_page_dequeue() calls.

Reviewed by: kib
Tested by: pho
Approved by: re (marius)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D17025

5 years agoMake tcp_hpts.c compile a LINT kernel with options RSS and PCBGROUPS added by
bz [Thu, 6 Sep 2018 16:11:24 +0000 (16:11 +0000)]
Make tcp_hpts.c compile a LINT kernel with options RSS and PCBGROUPS added by
adding the missing include files and changing a the type of cpuid which
would otherwise cause a false comparison with NETISR_CPUID_NONE.

Reviewed by: rrs
Approved by: re (marius)
Differential Revision: https://reviews.freebsd.org/D16891

5 years agoMove etc/crontab to usr.sbin/cron/cron/
brd [Thu, 6 Sep 2018 14:55:54 +0000 (14:55 +0000)]
Move etc/crontab to usr.sbin/cron/cron/

Approved by: re (gjb), will (mentor)
Differential Revision: https://reviews.freebsd.org/D16786

5 years agoDefine sctp probes only when SCTP is configured.
markj [Thu, 6 Sep 2018 14:15:03 +0000 (14:15 +0000)]
Define sctp probes only when SCTP is configured.

Otherwise the "depends_on provider" guard in sctp.d does not work as
intended.

Reported by: mjg
Reviewed by: tuexen
Approved by: re (gjb)
Differential Revision: https://reviews.freebsd.org/D17057

5 years agoAdd proper support for VIMAGE to krping.
hselasky [Thu, 6 Sep 2018 14:03:11 +0000 (14:03 +0000)]
Add proper support for VIMAGE to krping.

Make sure we pass the correct VNET when allocating the RDMA ID.

MFC after: 3 days
Approved by: re (gjb)
Sponsored by: Mellanox Technologies

5 years agoAdd missing copyin() to access LUN and port ioctl arguments.
mav [Thu, 6 Sep 2018 14:03:10 +0000 (14:03 +0000)]
Add missing copyin() to access LUN and port ioctl arguments.

Somehow this was working even after PTI in, at least on amd64, and got
broken by something only very recently.

Reviewed by: araujo
Approved by: re (gjb)

5 years agoMake the MSIX module parameter limit per device, in mlx5en(4).
hselasky [Thu, 6 Sep 2018 12:41:09 +0000 (12:41 +0000)]
Make the MSIX module parameter limit per device, in mlx5en(4).

MFC after: 3 days
Approved by: re (marius)
Sponsored by: Mellanox Technologies

5 years agoAdd support for receive side scaling stride, RSSS, in mlx5en(4).
hselasky [Thu, 6 Sep 2018 12:28:06 +0000 (12:28 +0000)]
Add support for receive side scaling stride, RSSS, in mlx5en(4).

The receive side scaling stride parameter is a value which define the interval
between active receive side queues. The traffic for the inactive queues is
redirected to the nearest active queue by use of modulus. The default value
of this parameter is one, which means all receive side queues are used.

The point of this feature is to redirect more traffic to fewer receive side
queues in order to take more advantage of sorted large receive offload,
sorted LRO. The sorted LRO works better when more packets are accumulated
per service interval.

MFC after: 3 days
Approved by: re (marius)
Sponsored by: Mellanox Technologies

5 years agoibcore: Fix endless loop in searching for matching VLAN device
slavash [Thu, 6 Sep 2018 12:26:57 +0000 (12:26 +0000)]
ibcore: Fix endless loop in searching for matching VLAN device

In r337943 ifnet's if_pcp was set to the PCP value in use
instead of IFNET_PCP_NONE.
Current ibcore code assumes that if_pcp is IFNET_PCP_NONE with
VLAN interfaces so it can identify prio-tagged traffic.
Fix that by explicitly verifying that that the if_type is IFT_ETHER
and not IFT_L2VLAN.

MFC after:      3 days
Approved by:    re (Marius), hselasky (mentor), kib (mentor)
Sponsored by:   Mellanox Technologies

5 years agoDon't stall transmit queue on drops in mlx5en(4).
hselasky [Thu, 6 Sep 2018 12:19:36 +0000 (12:19 +0000)]
Don't stall transmit queue on drops in mlx5en(4).

When a transmitted packet is dropped don't stall the transmit queue.

MFC after: 3 days
Approved by: re (marius)
Sponsored by: Mellanox Technologies

5 years agoMaximum number of mbuf frags is off-by-one for worst case scenario in mlx5en(4).
hselasky [Thu, 6 Sep 2018 11:06:07 +0000 (11:06 +0000)]
Maximum number of mbuf frags is off-by-one for worst case scenario in mlx5en(4).

Inspecting the PRM no more than 0x3F data segments, DS, of size 16 bytes is
allowed.

Worst case scenario summary of DS usage:
Header is fixed: 2 DS
Maximum inlining: 98 => (98 - 2) / 16 = 6 DS
Remainder: 0x3F - 2 - 6 = 55 DS (mbuf frags)

Previously a value of 56 DS was used and this would work in the
normal case because not all inline data area was used up.

MFC after: 3 days
Approved by: re (marius)
Sponsored by: Mellanox Technologies

5 years agoRename hardclock_cnt() to hardclock() and remove the old implementation.
markj [Thu, 6 Sep 2018 02:10:59 +0000 (02:10 +0000)]
Rename hardclock_cnt() to hardclock() and remove the old implementation.

Also remove some related and unused subroutines.  They have long been
replaced by variants that handle multiple coalesced events with a single
call.

No functional change intended.

Reviewed by: cem, kib
Approved by: re (gjb)
Differential Revision: https://reviews.freebsd.org/D17029

5 years agoRework rtld's TLS Variant I implementation to match r326794
brooks [Wed, 5 Sep 2018 23:23:16 +0000 (23:23 +0000)]
Rework rtld's TLS Variant I implementation to match r326794

The above commit fixed handling overaligned TLS segments in libc's
TLS Variant I implementation, but rtld provides its own implementation
for dynamically-linked executables which lacks these fixes.  Thus,
port these changes to rtld.

This was previously commited as r337978 and reverted in r338149 due to
exposing a bug the ARM rtld.  This bug was fixed in r338317 by mmel.

Submitted by: James Clarke
Approved by: re (kib)
Reviewed by: kbowling
Testing by: kbowling (powerpc64), br (riscv), kevans (armv7)
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D16510

5 years agoAdd gelf_mips64el.c to the list of files to include in libelf.
jhb [Wed, 5 Sep 2018 21:47:22 +0000 (21:47 +0000)]
Add gelf_mips64el.c to the list of files to include in libelf.

Missed in r338478.

Pointy hat to: jhb
Approved by: re (rgrimes)
MFC after: 1 month

5 years agoFix objcopy for little-endian MIPS64 objects.
jhb [Wed, 5 Sep 2018 20:51:53 +0000 (20:51 +0000)]
Fix objcopy for little-endian MIPS64 objects.

MIPS64 does not store the 'r_info' field of a relocation table entry as
a 64-bit value consisting of a 32-bit symbol index in the high 32 bits
and a 32-bit type in the low 32 bits as on other architectures.  Instead,
the 64-bit 'r_info' field is really a 32-bit symbol index followed by four
individual byte type fields.  For big-endian MIPS64, treating this as a
64-bit integer happens to be compatible with the layout expected by other
architectures (symbol index in upper 32-bits of resulting "native" 64-bit
integer).  However, for little-endian MIPS64 the parsed 64-bit integer
contains the symbol index in the low 32 bits and the 4 individual byte
type fields in the upper 32-bits (but as if the upper 32-bits were
byte-swapped).

To cope, add two helper routines in gelf_getrel.c to translate between the
correct native 'r_info' value and the value obtained after the normal
byte-swap translation.  Use these routines in gelf_getrel(), gelf_getrela(),
gelf_update_rel(), and gelf_update_rela().  This fixes 'readelf -r' on
little-endian MIPS64 objects which was previously decoding incorrect
relocations as well as 'objcopy: invalid symbox index' warnings from
objcopy when extracting debug symbols from kernel modules.

Even with this fixed, objcopy was still crashing when trying to extract
debug symbols from little-endian MIPS64 modules.  The workaround in
gelf_*rel*() depends on the current ELF object having a valid ELF header
so that the 'e_machine' field can be compared against EM_MIPS.  objcopy
was parsing the relocation entries to possibly rewrite the 'r_info' fields
in the update_relocs() function before writing the initial ELF header to
the destination object file.  Move the initial write of the ELF header
earlier before copy_contents() so that update_relocs() uses the correct
symbol index values.

Note that this change should really go upstream.  The binutils readelf
source has a similar hack for MIPS64EL though I implemented this version
from scratch using the MIPS64 ABI PDF as a reference.

Discussed with: jkoshy
Reviewed by: emaste, imp
Approved by: re (gjb, kib)
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D15734

5 years agoBe a little conservative about when to force size optimizations.
imp [Wed, 5 Sep 2018 20:02:23 +0000 (20:02 +0000)]
Be a little conservative about when to force size optimizations.

Reports have come in that there's issue with powerpc and sparc64 since
we've switched to using -Oz / -Os. We don't strictly need them for
!x86, so be conservative about when we enable them.

Approved by: re@ (gjb)
Differential Revision: https://reviews.freebsd.org/D17016

5 years agosh: Fix formal overflow in pointer arithmetic
jilles [Wed, 5 Sep 2018 19:16:09 +0000 (19:16 +0000)]
sh: Fix formal overflow in pointer arithmetic

The intention is to lower the value of the pointer, which according to ubsan
cannot be done by adding an unsigned quantity.

Reported by: kevans
Approved by: re (kib)
MFC after: 1 week

5 years agoCorrect the condition under which we allocate a terminator node.
markj [Wed, 5 Sep 2018 19:05:30 +0000 (19:05 +0000)]
Correct the condition under which we allocate a terminator node.

We will have last_block < blocks if the block count is divisible
by BLIST_BMAP_RADIX, but a terminator node is still needed if the
tree isn't balanced.  In this case we were overruning the blist
array by 16 bytes during initialization.

While here, add a check for the invalid blocks == 0 case.

PR: 231116
Reviewed by: alc, kib (previous version), Doug Moore <dougm@rice.edu>
Approved by: re (gjb)
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D17020

5 years agoMove gettytab to libexec/getty/
brd [Wed, 5 Sep 2018 15:25:23 +0000 (15:25 +0000)]
Move gettytab to libexec/getty/

Approved by: re (gjb), will (mentor)
Differential Revision: https://reviews.freebsd.org/D16953

5 years agoFix style bugs in in_pcblookup_lbgroup().
markj [Wed, 5 Sep 2018 15:04:11 +0000 (15:04 +0000)]
Fix style bugs in in_pcblookup_lbgroup().

No functional change intended.

Reviewed by: bz, Johannes Lundberg <johalun0@gmail.com>
Approved by: re (rgrimes)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D17030

5 years agoFix "ipfw fwd" to work for incoming IPv4 packets when ip_tryforward() chooses
eugen [Wed, 5 Sep 2018 13:59:36 +0000 (13:59 +0000)]
Fix "ipfw fwd" to work for incoming IPv4 packets when ip_tryforward() chooses
fast forwarding path, as it already works for IPv6 and for both of them
on old slow path.

PR: 231143
Reviewed by: ae
Approved by: re (gjb)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D17039

5 years agoPermit supervisor to access user VA space for certain functions only.
br [Wed, 5 Sep 2018 11:34:58 +0000 (11:34 +0000)]
Permit supervisor to access user VA space for certain functions only.

This is done by setting SUM (permit Supervisor User Memory access)
bit in sstatus register.

The functions we allow access for are routines in assembly that
explicitly handle crossing the user kernel boundary.

Approved by: re (kib)
Sponsored by: DARPA, AFRL

5 years agoFix bug: compare uaddr to VM_MAXUSER_ADDRESS, not to a tmp value
br [Wed, 5 Sep 2018 09:53:55 +0000 (09:53 +0000)]
Fix bug: compare uaddr to VM_MAXUSER_ADDRESS, not to a tmp value
left by SET_FAULT_HANDLER().

Approved by: re (kib)
Sponsored by: DARPA, AFRL

5 years agoAdd kbowling to ports committer list and calendar
kbowling [Wed, 5 Sep 2018 01:46:27 +0000 (01:46 +0000)]
Add kbowling to ports committer list and calendar

Approved by: re (rgrimes), timur (mentor), krion (mentor)
Differential Revision: https://reviews.freebsd.org/D17021

5 years agoAssign to correct structure members.
kib [Tue, 4 Sep 2018 19:28:46 +0000 (19:28 +0000)]
Assign to correct structure members.

Reported by: cem from Coverity
Sponsored by: The FreeBSD Foundation
MFC after: 6 days
Approved by: re (gjb)

5 years agoamd64: Properly re-merge r334537 into SMAP-ified copyin(9) and copyout(9).
kib [Tue, 4 Sep 2018 19:27:53 +0000 (19:27 +0000)]
amd64: Properly re-merge r334537 into SMAP-ified copyin(9) and copyout(9).

Also this fixes the eflags.ac leak from copyin_smap() when the copied
data length is multiple of eight bytes.

Sponsored by: The FreeBSD Foundation
Approved by: re (gjb)

5 years agoamd64: For non-PTI mode, do not initialize PCPU kcr3 to KPML4phys.
kib [Tue, 4 Sep 2018 19:26:54 +0000 (19:26 +0000)]
amd64: For non-PTI mode, do not initialize PCPU kcr3 to KPML4phys.

Non-PTI mode does not switch kcr3, which means that kcr3 is almost
always stale.  This is important for the NMI handler, which reloads
%cr3 with PCPU(kcr3) if the value is different from PMAP_NO_CR3.

The end result is that curpmap in NMI handler does not match the page
table loaded into hardware.  The manifestation was copyin(9) looping
forever when a usermode access page fault cannot be resolved by
vm_fault() updating a different page table.

Reported by: mmacy
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Approved by: re (gjb)

5 years agowmt(4): Fix regression introduced in r337289
wulf [Tue, 4 Sep 2018 19:22:31 +0000 (19:22 +0000)]
wmt(4): Fix regression introduced in r337289

r337289 has a side effect of reducing usb frame 0 buffer size down to
touch report size. That broke some devices e.g. "Raydium Touch System"
which are capable of generating non-touch frames of bigger length.
Fix it with enlarging frame 0 buffer up to internal wmt(4) buffer size.

Reported by: Roberto Fernandez Cueto <roberfern@gmail.com>
Tested by: Roberto Fernandez Cueto <roberfern@gmail.com>
Approved by: re (gjb)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D16772

5 years agoregulator: Use bool values instead of 0/1
manu [Tue, 4 Sep 2018 19:18:55 +0000 (19:18 +0000)]
regulator: Use bool values instead of 0/1

While here do not attempt to disable regulators if they are meant
to be always on.

Reviewed by:    mmel
Approved by:    re (kib)

5 years agoMove etc/ttys to sbin/init/.
brd [Tue, 4 Sep 2018 15:48:13 +0000 (15:48 +0000)]
Move etc/ttys to sbin/init/.

And simplify this a little by flattening the directory structure.

Approved by: re (gjb), will (mentor)
Differential Revision: https://reviews.freebsd.org/D16955

5 years agoFor full Linux-PAM compatibility, add a trailing NUL character when
des [Tue, 4 Sep 2018 10:51:41 +0000 (10:51 +0000)]
For full Linux-PAM compatibility, add a trailing NUL character when
passing the authentication token to the external program.

Approved by: re (kib)
Submitted by: Thomas Munro <munro@ip9.org>
MFC after: 1 week
Differential Revision: D16950

5 years agoReplicate r328271 from legacy IP to IPv6 using a single macro
bz [Mon, 3 Sep 2018 22:27:27 +0000 (22:27 +0000)]
Replicate r328271 from legacy IP to IPv6 using a single macro
to clear L2 and L3 route caches.
Also mark one function argument as __unused.

Reviewed by: karels, ae
Approved by: re (rgrimes)
Differential Revision: https://reviews.freebsd.org/D17007

5 years agoReplicate r307234 from legacy IP to IPv6 code, using the RO_RTFREE()
bz [Mon, 3 Sep 2018 22:14:37 +0000 (22:14 +0000)]
Replicate r307234 from legacy IP to IPv6 code, using the RO_RTFREE()
macro rather than hand crafted code.
No functional changes.

Reviewed by: karels
Approved by: re (rgrimes)
Differential Revision: https://reviews.freebsd.org/D17006

5 years agoAs discussed in D6262 post-commit review, change inp_route to
bz [Mon, 3 Sep 2018 22:12:48 +0000 (22:12 +0000)]
As discussed in D6262 post-commit review, change inp_route to
inp_route6 for IPv6 code after r301217.
This was most likely a c&p error from the legacy IP code, which
did not matter as it is a union and both structures have the same
layout at the beginning.
No functional changes.

Reviewed by: karels, ae
Approved by: re (rgrimes)
Differential Revision: https://reviews.freebsd.org/D17005

5 years agoRather than duplicating the functionality of a macro after r322866
bz [Mon, 3 Sep 2018 22:10:49 +0000 (22:10 +0000)]
Rather than duplicating the functionality of a macro after r322866
use the already existing one.  No functional changes.

Reviewed by: karels, ae
Approved by: re (rgrimes)
Differential Revision: https://reviews.freebsd.org/D17004

5 years agoUse the correct malloc type in in_pcblbgroup_free().
markj [Mon, 3 Sep 2018 17:39:09 +0000 (17:39 +0000)]
Use the correct malloc type in in_pcblbgroup_free().

Approved by: re (kib)
Sponsored by: The FreeBSD Foundation

5 years agoEnable 'C'-compressed ISA extension.
br [Mon, 3 Sep 2018 14:43:16 +0000 (14:43 +0000)]
Enable 'C'-compressed ISA extension.

This was disabled recently due to lack of support in KDB disassembler
and DTrace FBT provider. Support for 'C'-extension to both of these was
added, so we can now enable 'C'-extension.

This reduces size of the kernel important for low-end embedded devices,
and saves cache footprint for high perfomance machines.

Approved by: re (kib)
Sponsored by: DARPA, AFRL

5 years agoAdd support for 'C'-compressed ISA extension to DTrace FBT provider.
br [Mon, 3 Sep 2018 14:34:09 +0000 (14:34 +0000)]
Add support for 'C'-compressed ISA extension to DTrace FBT provider.

Approved by: re (kib)
Sponsored by: DARPA, AFRL

5 years agoThe kernel DTrace audit provider (dtaudit) relies on auditd(8) to load
rwatson [Mon, 3 Sep 2018 14:26:43 +0000 (14:26 +0000)]
The kernel DTrace audit provider (dtaudit) relies on auditd(8) to load
/etc/security/audit_event to provide a list of audit event-number <->
name mappings.  However, this occurs too late for anonymous tracing.
With this change, adding 'audit_event_load="YES"' to /boot/loader.conf
will cause the boot loader to preload the file, and then the kernel
audit code will parse it to register an initial set of audit event-number
<-> name mappings.  Those mappings can later be updated by auditd(8) if
the configuration file changes.

Reviewed by: gnn, asomers, markj, allanjude
Discussed with: jhb
Approved by: re (kib)
MFC after: 1 week
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D16589

5 years agolualoader: Handle comma-separated kernels as well
kevans [Mon, 3 Sep 2018 03:23:09 +0000 (03:23 +0000)]
lualoader: Handle comma-separated kernels as well

The format for kernels is documented as being space-delimited, but
forthloader was more lenient on this and so people began to depend on it.

A later pass will be made to document all of the fun features that forthloader
allowed that may not be immediately obvious.

Reported by: mmacy
Approved by: re (kib)

5 years agoCatch exceptions during EFI RT calls on amd64.
kib [Sun, 2 Sep 2018 21:37:05 +0000 (21:37 +0000)]
Catch exceptions during EFI RT calls on amd64.

This appeared to be required to have EFI RT support and EFI RTC
enabled by default, because there are too many reports of faulting
calls on many different machines.  The knob is added to leave the
exceptions unhandled to allow to debug the actual bugs.

Reviewed by: kevans
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Approved by:    re (rgrimes)
Differential revision: https://reviews.freebsd.org/D16972

5 years agoAdd amd64 mdthread fields needed for the upcoming EFI RT exception
kib [Sun, 2 Sep 2018 21:16:43 +0000 (21:16 +0000)]
Add amd64 mdthread fields needed for the upcoming EFI RT exception
handling.

This is split into a separate commit from the main change to make it
easier to handle possible revert after upcoming KBI freeze.

Reviewed by: kevans
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Approved by:    re (rgrimes)
Differential revision: https://reviews.freebsd.org/D16972

5 years agoImprove error messages from clock_if.m method failures.
kib [Sun, 2 Sep 2018 20:17:51 +0000 (20:17 +0000)]
Improve error messages from clock_if.m method failures.

Print error message in verbose mode when CLOCK_SETTIME() clock_if.m
method failed.  For EFIRT RTC clock, add error code for the failure of
CLOCK_GETTIME() report.

Reviewed by: kevans
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Approved by:    re (rgrimes)
Differential revision: https://reviews.freebsd.org/D16972

5 years agoSwap order of dererencing PCPU curpmap and checking for usermode in
kib [Sun, 2 Sep 2018 20:07:36 +0000 (20:07 +0000)]
Swap order of dererencing PCPU curpmap and checking for usermode in
trap_pfault() KPTI violation check.

EFI RT may set curpmap to NULL for the duration of the call for some
machines (PCID but no INVPCID).  Since apparently EFI RT code must be
ready for exceptions from the calls, avoid dereferencing curpmap until
we know that this call does not come from usermode.

Reviewed by: kevans
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Approved by:    re (rgrimes)
Differential revision: https://reviews.freebsd.org/D16972

5 years agoNormalize use of semicolon with EFI_TIME_LOCK macros.
kib [Sun, 2 Sep 2018 19:48:41 +0000 (19:48 +0000)]
Normalize use of semicolon with EFI_TIME_LOCK macros.

Reviewed by: kevans
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Approved by:    re (rgrimes)
Differential revision: https://reviews.freebsd.org/D16972

5 years agoMake -a (to make the entry active) apply to creation of a new boot
imp [Sun, 2 Sep 2018 18:40:18 +0000 (18:40 +0000)]
Make -a (to make the entry active) apply to creation of a new boot
variable.

Approved by: re@ (rgrimes)
PR: 231013
Differential Revision:  https://reviews.freebsd.org/D16977

5 years agoRecent changes have created, for the first time, physical memory segments
alc [Sun, 2 Sep 2018 18:29:38 +0000 (18:29 +0000)]
Recent changes have created, for the first time, physical memory segments
that can be coalesced.  To be clear, fragmentation of phys_avail[] is not
the cause.  This fragmentation of vm_phys_segs[] arises from the "special"
calls to vm_phys_add_seg(), in other words, not those that derive directly
from phys_avail[], but those that we create for the initial kernel page
table pages and now for the kernel and modules loaded at boot time.  Since
we sometimes iterate over the physical memory segments, coalescing these
segments at initialization time is a worthwhile change.

Reviewed by: kib, markj
Approved by: re (rgrimes)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D16976

5 years agoFix the hash table lookup in fbt_destroy().
markj [Sun, 2 Sep 2018 17:02:13 +0000 (17:02 +0000)]
Fix the hash table lookup in fbt_destroy().

Reported and tested by: pho
Approved by: re (kib)
X-MFC with: r338359

5 years agoMove defaults/periodic.conf back to a config file.
brd [Sun, 2 Sep 2018 15:53:56 +0000 (15:53 +0000)]
Move defaults/periodic.conf back to a config file.

Ths prevents etcupdate and mergemaster from deleting it for now.

Approved by: re (rgrimes), will (mentor)
Differential Revision: https://reviews.freebsd.org/D16975

5 years agoStyle cleanup. No functional changes.
kib [Sun, 2 Sep 2018 15:42:37 +0000 (15:42 +0000)]
Style cleanup.  No functional changes.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Approved by:    re (rgrimes)

5 years agoTry harder in cfiscsi_offline(). This is believed to be the workaround
trasz [Sat, 1 Sep 2018 16:16:40 +0000 (16:16 +0000)]
Try harder in cfiscsi_offline().  This is believed to be the workaround
for the "ctld hanging on reload" problem observed in same cases under
high load.  I'm not 100% sure it's _the_ fix, as the issue is rather hard
to reproduce, but it was tested as part of a larger path and the problem
disappeared.  It certainly shouldn't break anything.

Now, technically, it shouldn't be needed.  Quoting mav@, "After
ct->ct_online == 0 there should be no new sessions attached to the target.
And if you see some problems abbout it, it may either mean that there are
some races where single cfiscsi_session_terminate(cs) call may be lost,
or as a guess while this thread was sleeping target was reenabbled and
redisabled again".  Should such race be discovered and properly fixed
in the future, than this and the followup two commits can be backed out.

PR: 220175
Reported by: Eugene M. Zheganin <emz at norma.perm.ru>
Tested by: Eugene M. Zheganin <emz at norma.perm.ru>
Discussed with: mav
Approved by: re (gjb)
MFC after: 2 weeks
Sponsored by: playkey.net

5 years agoRevert r338423, reapplying r338422, which did get approval but
gjb [Sat, 1 Sep 2018 15:07:38 +0000 (15:07 +0000)]
Revert r338423, reapplying r338422, which did get approval but
communication lines got crossed.

Apologies to avatar@ for the confusion.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

5 years agoRevert r338422, which was did not get official approval from re@.
gjb [Sat, 1 Sep 2018 13:43:14 +0000 (13:43 +0000)]
Revert r338422, which was did not get official approval from re@.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

5 years agoAdding support for CS46xx MIDI output. With this patch, users can
avatar [Sat, 1 Sep 2018 11:26:53 +0000 (11:26 +0000)]
Adding support for CS46xx MIDI output. With this patch, users can
play the MIDI files through /dev/sequencer device with tools like
playmidi. The audio output will go through the external MIDI device
such like wavetable synthesis card.

Reviewed by: matk (a long time ago), kib
Approved by: re (kib)
Tested with:  Terratec SiXPack 5.1+ + Yamaha DB50XG
MFC after: 4 weeks

5 years agouserboot: handle guest interpreter mismatches more intelligently
kevans [Sat, 1 Sep 2018 02:23:45 +0000 (02:23 +0000)]
userboot: handle guest interpreter mismatches more intelligently

The switch to lualoader creates a problem with userboot: the host is
inclined to build userboot with Lua, but the host userboot's interpreter
must match what's available on the guest. For almost all FreeBSD guests in
the wild, Lua is not yet available and a Lua-based userboot will fail.

This revision updates userboot protocol to version 5, which adds a
swap_interpreter callback to request a different interpreter, and tries to
determine the proper interpreter to be used based on how the guest
/boot/loader is compiled. This is still a bit of a guess, but it's likely
the best possible guess we can make in order to get it right. The
interpreter is now embedded in the resulting executable, so we can open
/boot/loader on the guest and hunt that down to derive the interpreter it
was built with.

Using -l with bhyveload will not allow an intepreter swap, even if the
loader specified happens to be a userboot with the wrong interpreter. We'll
simply complain about the mismatch and bail out.

For legacy guests without the interpreter marker, we assume they're 4th.
For new guests with the interpreter marker, we'll read it and swap over
to the proper interpreter if it doesn't match what the userboot we're using
was compiled with.

Both flavors of userboot are installed by default, userboot_4th.so and
userboot_lua.so. This fixes the build WITHOUT_FORTH as a coincidence, which
was broken by userboot being forced to 4th.

Reviewed by: imp, jhb, araujo (earlier version)
Approved by: re (gjb)
Differential Revision: https://reviews.freebsd.org/D16945

5 years agolibbe(3): Fix error handling with respect to be_exists
kevans [Sat, 1 Sep 2018 02:22:26 +0000 (02:22 +0000)]
libbe(3): Fix error handling with respect to be_exists

Some paths through be_exists will set the error state, others will not
There are multiple reasons that a call can fail, so clean it up a bit: all
paths now return an appropriate error code so the caller can attempt to
distinguish between a BE legitimately not existing and just having the wrong
mountpoint. The caller is expected to bubble the error through to the
internal error handler as needed.

This fixes some unfriendliness with bectl(8)'s activate subcommand, where
it might fail due to a bad mountpoint but the only message output is a
generic "failed to activate" message.

Approved by: re (gjb)

5 years agoRe-compute the ARC size before computing the MFU target.
markj [Fri, 31 Aug 2018 21:45:05 +0000 (21:45 +0000)]
Re-compute the ARC size before computing the MFU target.

This fixes an upstream regression introduced in r331404, causing overly
aggressive reclamation of the ARC when under pressure.

Diagnosed by: Paul <devgs@ukr.net>
Approved by: re (gjb)
MFC after: 3 days

5 years agoFix build of x86 UP kernels after dynamic IRQ changes in r338360.
jhb [Fri, 31 Aug 2018 18:26:37 +0000 (18:26 +0000)]
Fix build of x86 UP kernels after dynamic IRQ changes in r338360.

Reported by: Ian FREISLICH <ian.freislich@capeaugusta.com>
Approved by: re (gjb)
MFC after: 2 weeks

5 years agoUpdate head from ALPHA3 to ALPHA4 as part of the 12.0-RELEASE
gjb [Fri, 31 Aug 2018 16:29:36 +0000 (16:29 +0000)]
Update head from ALPHA3 to ALPHA4 as part of the 12.0-RELEASE
cycle.  The i386 build failure appears to be transient, and
now becoming more difficult to reliably reproduce to identify
the cause.  I will continue to investigate this, however.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

5 years agoFix an integer overflow while setting the kernel address (MODINFO_ADDR).
br [Fri, 31 Aug 2018 16:15:46 +0000 (16:15 +0000)]
Fix an integer overflow while setting the kernel address (MODINFO_ADDR).

This eliminates build warning and makes kldstat happy.

Approved by: re (marius)

5 years agoDon't directly dereference a user pointer in the VPD ioctl.
jhb [Fri, 31 Aug 2018 16:10:01 +0000 (16:10 +0000)]
Don't directly dereference a user pointer in the VPD ioctl.

The PCIOCLISTVPD ioctl on /dev/pci is used to fetch a list of VPD
key-value pairs for a specific PCI function.  It is used by
'pciconf -l -V'.  The list is stored in a userland-supplied buffer as
an array of variable-length structures where the key and data length
are stored in a fixed-size header followed by the variable-length
value as a byte array.  To facilitate walking this array in userland,
<sys/pciio.h> provides a PVE_NEXT() helper macro to return a pointer
to the next array element by reading the the length out of the current
header and using it to compute the address of the next header.

To simplify the implementation, the ioctl handler was also using
PVE_NEXT() when on the user address of the user buffer to compute the
user address of the next array element.  However, the PVE_NEXT() macro
when used with a user address was reading the value's length by
indirecting the user pointer.  The value was ready after the current
record had been copied out to the user buffer, so it appeared to work
on architectures where user addresses are directly dereferencable from
the kernel (all but powerpc and i386 after the 4:4 split).  The recent
enablement of SMAP on amd64 caught this violation however.  To fix,
add a variant of PVE_NEXT() for use in the ioctl handler that takes an
explicit value length.

Reported by: Jeffrey Pieper @ Intel
Reviewed by: kib
Approved by: re (gjb)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D16800

5 years agolualoader: Print error messages from command failures at the prompt
kevans [Fri, 31 Aug 2018 15:02:53 +0000 (15:02 +0000)]
lualoader: Print error messages from command failures at the prompt

Previously lualoader would remain silent, rather than printing
command_errmsg or noting that a command had failed or was not found.

Approved by: re (gjb)

5 years agofrag6: Fix fragment reassembly
kp [Fri, 31 Aug 2018 08:37:15 +0000 (08:37 +0000)]
frag6: Fix fragment reassembly

r337776 started hashing the fragments into buckets for faster lookup.

The hashkey is larger than intended. This results in random stack data being
included in the hashed data, which in turn means that fragments of the same
packet might end up in different buckets, causing the reassembly to fail.

Set the correct size for hashkey.

PR: 231045
Approved by: re (kib)
MFC after: 3 days

5 years agoRevert r338401, as the i386 build is broken.
gjb [Fri, 31 Aug 2018 02:22:33 +0000 (02:22 +0000)]
Revert r338401, as the i386 build is broken.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

5 years agoDon't load ccp automatically with devmatch
imp [Fri, 31 Aug 2018 01:01:16 +0000 (01:01 +0000)]
Don't load ccp automatically with devmatch

Remove the PNP info for the moment from the driver. It's an
experimental driver (as noted in r328150). It's performance is about
1/10th that of aesni. It will often panic when used with GELI (PR
2279820).  It's not in our best interest to have such a driver be
autoloaded by default.

Approved by: re@ (rgrimes)
Reviewed By: cem@
Differential Review: https://reviews.freebsd.org/D16959

5 years agoUpdate head from ALPHA3 to ALPHA4 as part of the 12.0-RELEASE
gjb [Fri, 31 Aug 2018 00:05:38 +0000 (00:05 +0000)]
Update head from ALPHA3 to ALPHA4 as part of the 12.0-RELEASE
cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

5 years agorelease.sh: disable colors and the beastie menu for ARM/ARM64 targets
kevans [Thu, 30 Aug 2018 18:00:28 +0000 (18:00 +0000)]
release.sh: disable colors and the beastie menu for ARM/ARM64 targets

lualoader has moved to a model where the user is expected to disable color
as desired, rather than disabling it automatically for serial boots, due to
more wide-spread support for color sequences.

In a similar vain, though also to reduce special cases, lualoader no
longer disables the beastie menu automatically for !x86. This was done in
Forth land with a different loader.rc that simply didn't invoke the menu
routines, thus wasn't necessary.

This set of changes puts release images back to how they would've been
experienced prior to the switch to Lua.

Approved by: re (rgrimes)

5 years agoMove fbtab, login.conf, and motd to usr.bin/login/
brd [Thu, 30 Aug 2018 15:52:03 +0000 (15:52 +0000)]
Move fbtab, login.conf, and motd to usr.bin/login/

Approved by: Approved by: re (gjb), bapt (mentor), will (mentor)
Differential Revision: https://reviews.freebsd.org/D16947

5 years agoomap4_prcm: Delay the frequencies read check
manu [Thu, 30 Aug 2018 14:32:47 +0000 (14:32 +0000)]
omap4_prcm: Delay the frequencies read check

Same as r333305, with Linux 4.17 dts the compatible for the prcm added
'simplebus', it mean that the simplebus driver will attach to it
at the BUS_PASS_BUS pass.
Change the pass for the prcm driver to be at BUS_PASS_BUS so we will win
the attach.
This introduce a problem as this driver needs the omap_scm one to be already
attached. omap_scm also attach at BUS_PASS_BUS but after the prcm one as it is
after in the dtb and the simplebus driver simpy walk the tree to attach it's
children.
Use the bus_new_pass method to defer the frequencies read at BUS_PASS_TIMER.
This fixes booting on pandaboard

Approved by: re (rgrimes)

5 years agodtb: Add LINKS for omap4 DTBs
manu [Thu, 30 Aug 2018 14:32:10 +0000 (14:32 +0000)]
dtb: Add LINKS for omap4 DTBs

We do not use the upstream name so add links so u-boot can load the dtb
for us.

Approved by: re (rgrimes)

5 years agoRe-add kstat.zfs.misc.arcstats.other_size under COMPAT_FREEBSD11.
markj [Thu, 30 Aug 2018 13:42:01 +0000 (13:42 +0000)]
Re-add kstat.zfs.misc.arcstats.other_size under COMPAT_FREEBSD11.

It is used by a number of applications, notably top(1).

Reported by: netchild
Reviewed by: allanjude
Approved by: re (delphij)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D16943

5 years agolualoader: fix color usage
kevans [Thu, 30 Aug 2018 13:29:32 +0000 (13:29 +0000)]
lualoader: fix color usage

Resetting to the default color scheme was done prior to reading the config.
This is bogus; colors may only be declined by the user with the
loader.conf(5) variable "loader_color", so such a request for no color will
not be completely honored as we reset to the default color scheme
unconditionally.

Approved by: re (rgrimes)

5 years agoTweak typos in UPDATING
imp [Wed, 29 Aug 2018 17:37:23 +0000 (17:37 +0000)]
Tweak typos in UPDATING

Approved by: re@ (gjb)

5 years agosed: Fix -i option behavior with 'q' command.
markj [Wed, 29 Aug 2018 17:09:03 +0000 (17:09 +0000)]
sed: Fix -i option behavior with 'q' command.

Don't just exit when encountering the 'q' command if we edit file
inplace, and give mf_fgets() a chance to actually handle the
inplace case.

Also add a regression test.

Submitted by: Yuri Pankov <yuripv@yuripv.net>
Approved by: re (kib)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D16798

5 years agoFinish moving dot.cshrc and dot.profile to bin/csh/ and bin/sh/.
brd [Wed, 29 Aug 2018 16:59:19 +0000 (16:59 +0000)]
Finish moving dot.cshrc and dot.profile to bin/csh/ and bin/sh/.

Approved by: re (gjb), will (mentor)
Differential Revision: https://reviews.freebsd.org/D16770

5 years agoFix compile error due to missing parenthesis in r338372
shurd [Wed, 29 Aug 2018 16:21:34 +0000 (16:21 +0000)]
Fix compile error due to missing parenthesis in r338372

Approved by: re (gjb)

5 years agoFix potential data corruption in iflib
shurd [Wed, 29 Aug 2018 15:55:25 +0000 (15:55 +0000)]
Fix potential data corruption in iflib

The MP ring may have txq pointers enqueued.  Previously, these were
passed to m_free() when IFC_QFLUSH was set.  This patch checks for
the value and doesn't call m_free().

Reviewed by: gallatin
Approved by: re (gjb)
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D16882

5 years agoarm64: GENERIC-MMCCAM: Fix build and module depend
manu [Wed, 29 Aug 2018 14:01:27 +0000 (14:01 +0000)]
arm64: GENERIC-MMCCAM: Fix build and module depend

Fix the build of the GENERIC-MMCCAM kernel config after the sdhci_xenon
driver was commited.
While here correct sdhci_fdt and tegra_sdhci, even with MMCCAM they do
need to depend on sdhci(4)

Reported by: Reshetnikov Dmitriy <genserg@hotmail.com>
Approved by: re (kib)
Sponsored by: Rubicon Communications, LLC ("NetGate")

5 years agoRemove {max/min}_offset() macros, use vm_map_{max/min}() inlines.
kib [Wed, 29 Aug 2018 12:24:19 +0000 (12:24 +0000)]
Remove {max/min}_offset() macros, use vm_map_{max/min}() inlines.

Exposing max_offset and min_offset defines in public headers is
causing clashes with variable names, for example when building QEMU.

Based on the submission by: royger
Reviewed by: alc, markj (previous version)
Sponsored by: The FreeBSD Foundation (kib)
MFC after: 1 week
Approved by: re (marius)
Differential revision: https://reviews.freebsd.org/D16881

5 years agoAvoid printing extraneous function names when searching man page
cy [Wed, 29 Aug 2018 06:04:54 +0000 (06:04 +0000)]
Avoid printing extraneous function names when searching man page
database (apropos, man -k). This commit Replaces .SS with .SH,
similar to the man page provided by original heimdal (as in port).

PR: 230573
Submitted by: yuripv@yuripv.net
Approved by: re (rgrimes@)
MFC after: 3 days

5 years agocxgbe/iw_cxgbe: Fix iWARP RDMA + VIMAGE operation by setting the VNET
np [Wed, 29 Aug 2018 04:37:53 +0000 (04:37 +0000)]
cxgbe/iw_cxgbe: Fix iWARP RDMA + VIMAGE operation by setting the VNET
properly in a couple of places in the driver.

Submitted by: Krishnamraju Eraparaju @ Chelsio
Approved by: re@ (rgrimes@)
Sponsored by: Chelsio Communications

5 years agoAdd a sysctl for the ZFS abd_scatter_enabled setting.
markj [Wed, 29 Aug 2018 02:49:18 +0000 (02:49 +0000)]
Add a sysctl for the ZFS abd_scatter_enabled setting.

Submitted by: Yamagi Burmeister <lists@yamagi.org> (original version)
Approved by: re (rgrimes)
MFC after: 3 days

5 years agoFix 'install: symlink usr/src/sys -> /sys: File exists' in distributeworld
lwhsu [Tue, 28 Aug 2018 23:56:52 +0000 (23:56 +0000)]
Fix 'install: symlink usr/src/sys -> /sys: File exists' in distributeworld

Follow r334617, specify ${DISTDIR} (by ${INSTALL_DDIR}), '/base' and add
${INSTALLFLAGS} while installing the '/sys' symbolic link.

Reviewed by: bapt (earlier version), markj
Approved by: re (gjb), markj (mentor)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D16877

5 years agoFix the install of /root/.login missed as part of r337849.
brd [Tue, 28 Aug 2018 22:51:45 +0000 (22:51 +0000)]
Fix the install of /root/.login missed as part of r337849.

Approved by: re (rgrimes)

5 years agoAdd beforeinstallconfig to bsd.confs.mk to enable running commands prior to
brd [Tue, 28 Aug 2018 22:22:06 +0000 (22:22 +0000)]
Add beforeinstallconfig to bsd.confs.mk to enable running commands prior to
the installconfig target.

Approved by: re (rgrimes), bapt (mentor)
Differential Revision: https://reviews.freebsd.org/D16874

5 years agoDynamically allocate IRQ ranges on x86.
jhb [Tue, 28 Aug 2018 21:09:19 +0000 (21:09 +0000)]
Dynamically allocate IRQ ranges on x86.

Previously, x86 used static ranges of IRQ values for different types
of I/O interrupts.  Interrupt pins on I/O APICs and 8259A PICs used
IRQ values from 0 to 254.  MSI interrupts used a compile-time-defined
range starting at 256, and Xen event channels used a
compile-time-defined range after MSI.  Some recent systems have more
than 255 I/O APIC interrupt pins which resulted in those IRQ values
overflowing into the MSI range triggering an assertion failure.

Replace statically assigned ranges with dynamic ranges.  Do a single
pass computing the sizes of the IRQ ranges (PICs, MSI, Xen) to
determine the total number of IRQs required.  Allocate the interrupt
source and interrupt count arrays dynamically once this pass has
completed.  To minimize runtime complexity these arrays are only sized
once during bootup.  The PIC range is determined by the PICs present
in the system.  The MSI and Xen ranges continue to use a fixed size,
though this does make it possible to turn the MSI range size into a
tunable in the future.

As a result, various places are updated to use dynamic limits instead
of constants.  In addition, the vmstat(8) utility has been taught to
understand that some kernels may treat 'intrcnt' and 'intrnames' as
pointers rather than arrays when extracting interrupt stats from a
crashdump.  This is determined by the presence (vs absence) of a
global 'nintrcnt' symbol.

This change reverts r189404 which worked around a buggy BIOS which
enumerated an I/O APIC twice (using the same memory mapped address for
both entries but using an IRQ base of 256 for one entry and a valid
IRQ base for the second entry).  Making the "base" of MSI IRQ values
dynamic avoids the panic that r189404 worked around, and there may now
be valid I/O APICs with an IRQ base above 256 which this workaround
would incorrectly skip.

If in the future the issue reported in PR 130483 reoccurs, we will
have to add a pass over the I/O APIC entries in the MADT to detect
duplicates using the memory mapped address and use some strategy to
choose the "correct" one.

While here, reserve room in intrcnts for the Hyper-V counters.

PR: 229429, 130483
Reviewed by: kib, royger, cem
Tested by: royger (Xen), kib (DMAR)
Approved by: re (gjb)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D16861

5 years agoAllow multiple FBT probes to share a tracepoint.
markj [Tue, 28 Aug 2018 20:21:36 +0000 (20:21 +0000)]
Allow multiple FBT probes to share a tracepoint.

With GNU ifuncs, multiple FBT probes may correspond to the same
instruction.  fbt_invop() assumed that this could not happen and
would return after the first probe found in the global FBT hash
table, which might not be the one that's enabled.  Fix the problem
on x86 by linking probes that share a tracepoint and having each
linked probe fire when the tracepoint is hit.

PR: 230846
Approved by: re (gjb)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D16921

5 years agoRegen after r338357.
kib [Tue, 28 Aug 2018 18:50:34 +0000 (18:50 +0000)]
Regen after r338357.

Approved by: re (gjb)