]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agosa.4: fix spelling of 'suppresses'
emaste [Sat, 19 Aug 2017 00:37:33 +0000 (00:37 +0000)]
sa.4: fix spelling of 'suppresses'

PR: 221302
Submitted by: Fabian Keil
Obtained from: ElectroBSD
MFC after: 1 week

6 years agopw useradd: Validate the user name before creating the entry
emaste [Sat, 19 Aug 2017 00:32:26 +0000 (00:32 +0000)]
pw useradd: Validate the user name before creating the entry

Previouly it was possible to create users with spaces in the name with:
pw useradd -u 1234 -g 1234 -n 'test user'

The "-g 1234" is relevant, without it the name was already rejected
as expected:

[fk@test ~]$ sudo pw useradd -u 1234 -n 'test user'
pw: invalid character ` ' at position 4 in userid/group name

Bug unintentionally found with a salt config without explicit name entry:

test user:
  user.present:
    - uid: 1234
    - gid: 1234
    - fullname: Test user
    - shell: /usr/local/bin/bash
    - home: /home/test
    - groups:
      - wheel
      - salt

"Luckily" salt modules rarely bother with input validation either ...

PR: 221416
Submitted by: Fabian Keil
Obtained from: ElectroBSD
MFC after: 1 week

6 years agopw usermod: Properly deal with empty secondary group lists (-G '')
emaste [Sat, 19 Aug 2017 00:19:23 +0000 (00:19 +0000)]
pw usermod: Properly deal with empty secondary group lists (-G '')

"pw usermod someuser -G ''" is supposed make sure that someuser
doesn't have any secondary group memberships.

Previouly it was a nop because split_groups() only intitialised
"groups" if at least one group was specified. As a result the
existing secondary group memberships were kept.

PR: 221417
Submitted by: Fabian Keil
Obtained from: ElectroBSD
MFC after: 1 week
Relnotes: yes

6 years agogas: add parens to clarify expression and eliminate clang warning
emaste [Fri, 18 Aug 2017 21:20:38 +0000 (21:20 +0000)]
gas: add parens to clarify expression and eliminate clang warning

Building mips64 w/ Clang failed with -Werror,-Wshift-negative-value
error: shifting a negative signed value is undefined

6 years agoAdd Thunderbolt Apple interfaces to the bge(4) supported list.
sevan [Fri, 18 Aug 2017 20:35:35 +0000 (20:35 +0000)]
Add Thunderbolt Apple interfaces to the bge(4) supported list.
Document message reported by kernel upon removal in DIAGNOSTIC section.
Document shortcomings in BUGS section.

Approved by: bcr (mentor)
MFC after: 5 days
Differential Revision: https://reviews.freebsd.org/D11771

6 years agoMove some other SI_SUB_INIT_IF initializations to SI_SUB_TASKQ
cem [Fri, 18 Aug 2017 18:55:07 +0000 (18:55 +0000)]
Move some other SI_SUB_INIT_IF initializations to SI_SUB_TASKQ

Drop the EARLY_AP_STARTUP gtaskqueue code, as gtaskqueues are now
initialized before APs are started.

Reviewed by: hselasky@, jhb@
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D12054

6 years agogas: fix "format string is not a string literal" errors on mips
emaste [Fri, 18 Aug 2017 18:26:30 +0000 (18:26 +0000)]
gas: fix "format string is not a string literal" errors on mips

Sponsored by: The FreeBSD Foundation

6 years agobfd: cast BFD_ALIGN to fix clang error on mips
emaste [Fri, 18 Aug 2017 18:20:51 +0000 (18:20 +0000)]
bfd: cast BFD_ALIGN to fix clang error on mips

error: implicit conversion from 'bfd_vma' (aka 'unsigned long long')
to 'int' changes value from 18446744073709551615 to -1
  return BFD_ALIGN (ret, 16);
  ~~~~~~ ^~~~~~~~~~~~~~~~~~~
note: expanded from macro 'BFD_ALIGN'
   : ~ (bfd_vma) 0)
     ^~~~~~~~~~~~~

Sponsored by: The FreeBSD Foundation

6 years agoIn fetch_resolve(), if the port number or service name is included in
des [Fri, 18 Aug 2017 18:20:36 +0000 (18:20 +0000)]
In fetch_resolve(), if the port number or service name is included in
the host argument (e.g. "www.freebsd.org:443"), the service pointer,
which is supposed to point to the port or service part, instead points
to the separator, causing getaddrinfo() to fail.

Note that I have not been able to trigger this bug with fetch(1), nor
do I believe it is possible, as libfetch always parses the host:port
specification itself.  I discovered it when I copied fetch_resolve()
into an unrelated project.

MFC after: 3 days

6 years agoFreeBSD 11.1 release added.
maxim [Fri, 18 Aug 2017 17:32:14 +0000 (17:32 +0000)]
FreeBSD 11.1 release added.

6 years agoWhen checking that #UD comes from kernel mode, check that the
kib [Fri, 18 Aug 2017 17:11:15 +0000 (17:11 +0000)]
When checking that #UD comes from kernel mode, check that the
exception did not happen in vm86 mode.  A vm86 userland process could
have a %cs that matches GSEL_KPL, while dtrace cannot hook it.

Submitted by: Maxime Villard <max@m00nbsd.net>
MFC after: 3 days

6 years agoAdd caveat to kinfo_getvmmap(3) explaining high CPU utilisation.
sevan [Fri, 18 Aug 2017 16:42:58 +0000 (16:42 +0000)]
Add caveat to kinfo_getvmmap(3) explaining high CPU utilisation.
Based on kib's reply on https://lists.freebsd.org/pipermail/freebsd-hackers/2016-July/049710.html

PR: 210904
Submitted by: Yuri Victorovich <yuri AT rawbw DOT com>
Reviewed by: jilles
Approved by: bcr (mentor)
MFC after: 5 days
Differential Revision: https://reviews.freebsd.org/D12004

6 years agocam iosched: fix typos in comments
emaste [Fri, 18 Aug 2017 16:38:33 +0000 (16:38 +0000)]
cam iosched: fix typos in comments

PR: 220947
Submitted by: Fabian Keil
Obtained from: ElectroBSD

6 years agoCorrect multicast address used in pfsync(4)
sevan [Fri, 18 Aug 2017 16:14:41 +0000 (16:14 +0000)]
Correct multicast address used in pfsync(4)
As stated in src/sys/netinet/in.h L395, address used is 224.0.0.240.

PR: 216885
Submitted by: Matthias Ordner <matthias.ordner AT noris DOT net>
Reviewed by: kp
Approved by: bcr (mentor)
MFC after: 5 days
Differential Revision: https://reviews.freebsd.org/D12011

6 years agoFix syscons escape sequence for setting the local cursor type. This sequence
bde [Fri, 18 Aug 2017 15:40:40 +0000 (15:40 +0000)]
Fix syscons escape sequence for setting the local cursor type.  This sequence
was aliased to a vt sequence, causing and fixing various bugs.

For syscons, this restores support for arg 2 which sets blinking block
too forcefully, and restores bugs for arg 0 and 1.  Arg 2 is used for
vs in the cons25 entry in termcap, but I've never noticed an application
that uses this.  The bugs involve replacing local settings by global
ones and need better handling of defaults to fix.

For vt, this requires moving the aliasing code from teken to vt where
it belongs.  This sequences is very important for cons25 compatibility
in vt since it is used by the cons25 termcap entries for ve, vi and
vs.  vt can't properly support vs for either cons25 or xterm since it
doesn't support blinking.  For xterm, the termcap entry for vs asks
for something different using 12;25h instead of 25h.

Rename C25CURS for this to C25LCT and change its description to be closer
to echoing the old comment about it.  CURS is too generic.

Fix missing syscons escape sequence for setting the global cursor shape
(and type).  Only support this in syscons since vt can't emulate anything
in it.

6 years agoFix module unload when SGX support is not present in CPU.
br [Fri, 18 Aug 2017 14:47:06 +0000 (14:47 +0000)]
Fix module unload when SGX support is not present in CPU.

Sponsored by: DARPA, AFRL

6 years agoFix cut and paste typo that prevented T5 firmware to be compiled in.
glebius [Fri, 18 Aug 2017 14:30:12 +0000 (14:30 +0000)]
Fix cut and paste typo that prevented T5 firmware to be compiled in.

Reviewed by: np

6 years agotypo
sevan [Fri, 18 Aug 2017 14:17:12 +0000 (14:17 +0000)]
typo

PR: 211160
Submitted by: Dan Robertson <dan.robertson AT anidata DOT org>
Reviewed by: oshogbo
MFC after: 7 days
Differential Revision: https://reviews.freebsd.org/D12005

6 years agoImprove names for cons25 sequences.
bde [Fri, 18 Aug 2017 14:04:14 +0000 (14:04 +0000)]
Improve names for cons25 sequences.

In a recent commit, I forgot to expand an X to an abbreviation of "BORDER".
Fix this and some nearby bad names.

The descriptions were copied from comments in scterm-sc.c, but some
of these are bad.  The border [color] was inconsistently described as
a property of the "display", but I had changed this to "adapter" to
match the descriptions for other color settings.  All colors supported
by the cons25 sequences are actually properties of the current vty and
that should not be described.  But the other colors are defaults.
Change "adapter" to "default" for them and remove "adapter" for the
border.  Reduce the verbosity of the abbreviation from AD to D.

6 years agoFix vt100 escape sequence for showing and hiding the cursor in syscons.
bde [Fri, 18 Aug 2017 12:45:00 +0000 (12:45 +0000)]
Fix vt100 escape sequence for showing and hiding the cursor in syscons.
It should toggle between 2 states, but it used a cut-down version of
support for a related 3-state syscons escape sequence and inherited
bugs from that.  The usual misbehaviour was that hiding and showing
the cursor reset it to a global default.

Support for the 3-state sequence remains broken by aliasing to the 2-state
sequence.  This works better but incompatibly for the 2 cases that it
supports.

6 years agoRemove example from zstd sources, their license does not allow redistribution
bapt [Fri, 18 Aug 2017 11:33:10 +0000 (11:33 +0000)]
Remove example from zstd sources, their license does not allow redistribution

Reported by: joerg@NetBSD

6 years agoFix missing syscons escape sequence for setting the border color.
bde [Fri, 18 Aug 2017 10:38:49 +0000 (10:38 +0000)]
Fix missing syscons escape sequence for setting the border color.

6 years agosafe: quiet -Wtautological-compare
rlibby [Fri, 18 Aug 2017 08:05:33 +0000 (08:05 +0000)]
safe: quiet -Wtautological-compare

Code was testing that an unsigned type was >= 0.

Reviewed by: markj
Approved by: markj (mentor)
Sponsored by: Dell EMC Isilon

6 years agoClarify the fact that Andrey (ache) passed away in Moscow
ngie [Fri, 18 Aug 2017 07:34:34 +0000 (07:34 +0000)]
Clarify the fact that Andrey (ache) passed away in Moscow

Take care friend <3.

6 years agoEnsure inp_vflag is consistently set for TCP endpoints.
tuexen [Fri, 18 Aug 2017 07:27:15 +0000 (07:27 +0000)]
Ensure inp_vflag is consistently set for TCP endpoints.

Make sure that the flags INP_IPV4 and INP_IPV6 are consistently set
for inpcbs used for TCP sockets, no matter if the setting is derived
from the net.inet6.ip6.v6only sysctl or the IPV6_V6ONLY socket option.
For UDP this was already done right.

PR: 221385
MFC after: 1 week

6 years agoRemove some unneeded subroutines for padding writes to dump devices.
markj [Fri, 18 Aug 2017 04:07:25 +0000 (04:07 +0000)]
Remove some unneeded subroutines for padding writes to dump devices.

Right now we only need to pad when writing kernel dump headers, so
flatten three related subroutines into one. The encrypted kernel dump
code already writes out its key in a dumper.blocksize-sized block.

No functional change intended.

Reviewed by: cem, def
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D11647

6 years agoRename mkdumpheader() and group EKCD functions in kern_shutdown.c.
markj [Fri, 18 Aug 2017 04:04:09 +0000 (04:04 +0000)]
Rename mkdumpheader() and group EKCD functions in kern_shutdown.c.

This helps simplify the code in kern_shutdown.c and reduces the number
of globally visible functions.

No functional change intended.

Reviewed by: cem, def
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D11603

6 years agoFactor out duplicated kernel dump code into dump_{start,finish}().
markj [Fri, 18 Aug 2017 03:52:35 +0000 (03:52 +0000)]
Factor out duplicated kernel dump code into dump_{start,finish}().

dump_start() and dump_finish() are responsible for writing kernel dump
headers, optionally writing the key when encryption is enabled, and
initializing the initial offset into the dump device.

Also remove the unused dump_pad(), and make some functions static now that
they're only called from kern_shutdown.c.

No functional change intended.

Reviewed by: cem, def
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D11584

6 years agoAn off-by-one error exists in sbuf_vprintf()'s use of SBUF_HASROOM() when an
lstewart [Fri, 18 Aug 2017 02:06:28 +0000 (02:06 +0000)]
An off-by-one error exists in sbuf_vprintf()'s use of SBUF_HASROOM() when an
sbuf is filled to capacity by vsnprintf(), the loop exits without error, and
the sbuf is not marked as auto-extendable.

SBUF_HASROOM() evaluates true if there is room for one or more non-NULL
characters, but in the case that the sbuf was filled exactly to capacity,
SBUF_HASROOM() evaluates false. Consequently, sbuf_vprintf() incorrectly
assigns an ENOMEM error to the sbuf when in fact everything is fine, in turn
poisoning the buffer for all subsequent operations.

Correct by moving the ENOMEM assignment into the loop where it can be made
unambiguously.

As a related safety net change, explicitly check for the zero bytes drained
case in sbuf_drain() and set EDEADLK as the error. This avoids an infinite loop
in sbuf_vprintf() if a drain function were to inadvertently return a value of
zero to sbuf_drain().

Reviewed by: cem, jtl, gallatin
MFC after: 2 weeks
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D8535

6 years agoGoodbye, ache.
grog [Fri, 18 Aug 2017 00:25:27 +0000 (00:25 +0000)]
Goodbye, ache.

6 years agoDon't leak bpf on early return when YP isn't defined (NIS support)
ngie [Thu, 17 Aug 2017 20:41:28 +0000 (20:41 +0000)]
Don't leak bpf on early return when YP isn't defined (NIS support)

MFC after: 1 week
Reported by: cppcheck

6 years agoFix WARNS
ngie [Thu, 17 Aug 2017 20:37:01 +0000 (20:37 +0000)]
Fix WARNS

- Remove ad hoc inet_ntoa prototype declaration; it's already handled
  by the included headers.
- De-K&Rify the function prototypes for eachres_whoami(..),
  eachres_getfile(..), and main(..).

MFC after: 1 week
PR: 71667
Tested with: clang (5.0), gcc (4.2.1, 5)

6 years agoI misplaced a newline in the previous commit. Fix this, and move line
bde [Thu, 17 Aug 2017 20:25:50 +0000 (20:25 +0000)]
I misplaced a newline in the previous commit.  Fix this, and move line
breaks in the vt case to the same places that the man(1) puts then in
the SYNOPSIS.  This was already done for the syscons case.  Man pages
can't depend on the driver, and the SYNOPSIS is hard-coded for syscons
except for -f where it is hard-coded for vt.  The usage message reverses
this for sc.  The only other differences are whitespace and removing
-[dL] and -l for vt.

6 years agoHonor NO_RTLD for rtld-elf, similar to what's done in libexec/Makefile, with
ngie [Thu, 17 Aug 2017 20:15:20 +0000 (20:15 +0000)]
Honor NO_RTLD for rtld-elf, similar to what's done in libexec/Makefile, with
libexec/rtld-elf/... for MK_{LIB32,LIBSOFT}.

MFC after: 1 week

6 years agoFix BSD label partition end sector calculation.
oleg [Thu, 17 Aug 2017 19:39:42 +0000 (19:39 +0000)]
Fix BSD label partition end sector calculation.

Reviewed by: ae
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D12066

6 years agoarm64: return error instead of panic in unimplemented ptrace ops
emaste [Thu, 17 Aug 2017 19:16:23 +0000 (19:16 +0000)]
arm64: return error instead of panic in unimplemented ptrace ops

We don't need a panic as a reminder that these need to be implemented.

Reported by: Shawn Webb
MFC after: 3 week
Sponsored by: The FreeBSD Foundation

6 years agoUpdate vidcontrol -c to support all cursor appearance setting
bde [Thu, 17 Aug 2017 18:08:45 +0000 (18:08 +0000)]
Update vidcontrol -c to support all cursor appearance setting
capabilities.

Most of the capabilities (all of the arcane ones) were in FreeBSD-2.0.5,
but were harder to use then, and vidcontrol didn't try.  FreeBSD-4.1.0
added per-vty support, fixed the destructivness of the "destructive"
cursor, and improved APIs.  Start using the new APIs, support all of
their capabilities, and document all of the capabilities and some of
the historical mistakes.

vt doesn't support any of this before or after the change.

Fix minor unrelated bitrot in the usage message for the syscons case.

6 years agoDiscover CPU topology on multi-die AMD Zen systems
cem [Thu, 17 Aug 2017 16:54:37 +0000 (16:54 +0000)]
Discover CPU topology on multi-die AMD Zen systems

The Nodes per Processor topology information determines how many bits of the
APIC ID represent the Node (Zeppelin die, on Zen systems) ID.  Documented in
Ryzen and Epyc Processor Programming Reference (PPR).

Correct topology information enables the scheduler to make better decisions
on this hardware.

Reviewed by: kib@
Tested by: jeff@ (earlier version)
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D11801

6 years agobsdgrep: cast pmatch.rm_so to fix build when linking against libgnuregex
kevans [Thu, 17 Aug 2017 13:40:45 +0000 (13:40 +0000)]
bsdgrep: cast pmatch.rm_so to fix build when linking against libgnuregex

Reported by: many
Approved by: emaste (mentor)
MFC after: immediate

6 years agoImplement simple record boundary tracking in sbuf(9) to avoid record splitting
lstewart [Thu, 17 Aug 2017 07:20:09 +0000 (07:20 +0000)]
Implement simple record boundary tracking in sbuf(9) to avoid record splitting
during drain operations. When an sbuf is configured to use this feature by way
of the SBUF_DRAINTOEOR sbuf_new() flag, top-level sections started with
sbuf_start_section() create a record boundary marker that is used to avoid
flushing partial records.

Reviewed by: cem,imp,wblock
MFC after: 2 weeks
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D8536

6 years agoThe r322210 change to pgrep's PID delimiting behaviour causes pgrep's default
lstewart [Thu, 17 Aug 2017 06:36:21 +0000 (06:36 +0000)]
The r322210 change to pgrep's PID delimiting behaviour causes pgrep's default
output to not include a trailing new line, which is a potential POLA violation
for existing consumers. Change pgrep to always emit a trailing new line on
completion of its output, regardless of the delimeter in use (which technically
is also a potential POLA violation for existing consumers that rely on the
pre-r322210 buggy behaviour, but a line has to be drawn somewhere).

PR: 221534
Submitted by: kdrakehp zoho com
Reported by: kdrakehp zoho com
MFC after: 1 week
X-MFC-with: r322210

6 years agoFix unused varable warning in !SMP case
cem [Thu, 17 Aug 2017 04:37:27 +0000 (04:37 +0000)]
Fix unused varable warning in !SMP case

Fallout from r322588.  I'm not sure why !SMP is a knob we have, but, we have
it.

Reported by: Michael Butler <imb AT protected-networks.net>
Sponsored by: Dell EMC Isilon

6 years agoMark ZFS ABD inline functions static.
jhb [Wed, 16 Aug 2017 23:40:32 +0000 (23:40 +0000)]
Mark ZFS ABD inline functions static.

When built with -fno-inline-functions zfs.ko contains undefined references
to these functions if they are only marked inline.

Reviewed by: avg (earlier version)
MFC after: 1 week
Sponsored by: Chelsio Communications

6 years agoaesni: quiet -Wcast-qual
rlibby [Wed, 16 Aug 2017 22:54:35 +0000 (22:54 +0000)]
aesni: quiet -Wcast-qual

Reviewed by: delphij
Approved by: markj (mentor)
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D12021

6 years agoAdd SI_SUB_TASKQ after SI_SUB_INTR and move taskqueue initialization there for EARLY_...
cem [Wed, 16 Aug 2017 21:42:27 +0000 (21:42 +0000)]
Add SI_SUB_TASKQ after SI_SUB_INTR and move taskqueue initialization there for EARLY_AP_STARTUP

This fixes a regression accidentally introduced in r322588, due to an
interaction with EARLY_AP_STARTUP.

Reviewed by: bdrewery@, jhb@
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D12053

6 years agoDefine proposed GUID for FreeBSD boot loader variables.
imp [Wed, 16 Aug 2017 20:09:39 +0000 (20:09 +0000)]
Define proposed GUID for FreeBSD boot loader variables.

6 years agoRemove unused defines.
imp [Wed, 16 Aug 2017 20:06:38 +0000 (20:06 +0000)]
Remove unused defines.

6 years agobpf: Fix incorrect cleanup
kp [Wed, 16 Aug 2017 19:40:07 +0000 (19:40 +0000)]
bpf: Fix incorrect cleanup

Cleaning up a bpf_if is a two stage process. We first move it to the
bpf_freelist (in bpfdetach()) and only later do we actually free it (in
bpf_ifdetach()).

We cannot set the ifp->if_bpf to NULL from bpf_ifdetach() because it's
possible that the ifnet has already gone away, or that it has been assigned
a new bpf_if.
This can lead to a struct ifnet which is up, but has if_bpf set to NULL,
which will panic when we try to send the next packet.

Keep track of the pointer to the bpf_if (because it's not always
ifp->if_bpf), and NULL it immediately in bpfdetach().

PR: 213896
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D11782

6 years agoforce use of ld.bfd for linking i386 libc, even when using lld
emaste [Wed, 16 Aug 2017 18:55:39 +0000 (18:55 +0000)]
force use of ld.bfd for linking i386 libc, even when using lld

lld can successfully link most of a working i386 userland and kernel,
but produces a broken libc. For now if we're otherwise using lld, and
ld.bfd is available, explicitly use it for libc.

Sponsored by: The FreeBSD Foundation

6 years agox86: Add dynamic interrupt rebalancing
cem [Wed, 16 Aug 2017 18:48:53 +0000 (18:48 +0000)]
x86: Add dynamic interrupt rebalancing

Add an option to dynamically rebalance interrupts across cores
(hw.intrbalance); off by default.

The goal is to minimize preemption. By placing interrupt sources on distinct
CPUs, ithreads get preferentially scheduled on distinct CPUs.  Overall
preemption is reduced and latency is reduced. In our workflow it reduced
"fighting" between two high-frequency interrupt sources.  Reduced latency
was proven by, e.g., SPEC2008.

Submitted by: jeff@ (earlier version)
Reviewed by: kib@
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D10435

6 years agoQuote ${MAKE} when passing in env in case it contains spaces.
bdrewery [Wed, 16 Aug 2017 17:54:24 +0000 (17:54 +0000)]
Quote ${MAKE} when passing in env in case it contains spaces.

Downstream we are wrapping MAKE with a limits(1) call which
interferes with these non-quoted cases.

Sponsored by: Dell EMC Isilon

6 years agoremove debug files in delete-old* when WITHOUT_DEBUG_FILES
emaste [Wed, 16 Aug 2017 17:22:42 +0000 (17:22 +0000)]
remove debug files in delete-old* when WITHOUT_DEBUG_FILES

Reported by: brd
Reviewed by: bdrewery, brd
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D12044

6 years agoFix compile error with option DEBUG. This is fallout from some long-ago
ian [Wed, 16 Aug 2017 16:51:55 +0000 (16:51 +0000)]
Fix compile error with option DEBUG.  This is fallout from some long-ago
INTRNG refactoring that didn't get caught at the time because code in a
debugf() statement isn't compiled unless DEBUG is defined.

PR: 221557

6 years agoFix setting of the border color. Teken doesn't support syscons' escape
bde [Wed, 16 Aug 2017 15:14:46 +0000 (15:14 +0000)]
Fix setting of the border color.  Teken doesn't support syscons' escape
sequence "ESC [ %d A" for this although that was used here.  I will fix
teken later, but use the more portable ioctl KDSBORDER here.

The ioctl is also much easier to use if you check that it works.  For
-b, check it and complain and exit if it failed, so that it is more
obvious that that vt doesn't support border colors.  Don't check it
when restoring the border color in revert(), since revert() is used
on vt for handling other errors.

Fix nearby error handling and style.  For the error of an invalid
color, revert() and print a specific error message using err() instead
of not revert()ing and printing spam using usage().

6 years agoRename macro DEBUG to SGX_DEBUG.
br [Wed, 16 Aug 2017 13:44:46 +0000 (13:44 +0000)]
Rename macro DEBUG to SGX_DEBUG.

This fixes LINT kernel build.

Reported by: lwhsu
Sponsored by: DARPA, AFRL

6 years agoUndeprecate the CONS_CURSORTYPE ioctl. It was "deprecated" in 2001,
bde [Wed, 16 Aug 2017 10:59:37 +0000 (10:59 +0000)]
Undeprecate the CONS_CURSORTYPE ioctl.  It was "deprecated" in 2001,
but it was actually extended then and it is still used (just once) in
/usr/src by its primary user (vidcontrol), while its replacement is
still not used in /usr/src.

yokota became inactive soon after deprecating CONS_CURSORTYPE (this
was part of a large change to make cursor attributes per-vty).

vidcontrol has incomplete support even for the old ioctl.  I will
update it soon.  Then there are many broken escape sequences to fix.
This is just to prepare for setting cursor colors using vidcontrol.

6 years agoAdd support for Intel Software Guard Extensions (Intel SGX).
br [Wed, 16 Aug 2017 10:38:06 +0000 (10:38 +0000)]
Add support for Intel Software Guard Extensions (Intel SGX).

Intel SGX allows to manage isolated compartments "Enclaves" in user VA
space. Enclaves memory is part of processor reserved memory (PRM) and
always encrypted. This allows to protect user application code and data
from upper privilege levels including OS kernel.

This includes SGX driver and optional linux ioctl compatibility layer.
Intel SGX SDK for FreeBSD is also available.

Note this requires support from hardware (available since late Intel
Skylake CPUs).

Many thanks to Robert Watson for support and Konstantin Belousov
for code review.

Project wiki: https://wiki.freebsd.org/Intel_SGX.

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

6 years agoAdd OBJ_PG_DTOR flag to VM object.
br [Wed, 16 Aug 2017 08:49:11 +0000 (08:49 +0000)]
Add OBJ_PG_DTOR flag to VM object.

Setting this flag allows us to skip pages removal from VM object queue
during object termination and to leave that for cdev_pg_dtor function.

Move pages removal code to separate function vm_object_terminate_pages()
as comments does not survive indentation.

This will be required for Intel SGX support where we will have to remove
pages from VM object manually.

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

6 years agoAdd device resource management fields to struct device.
markj [Wed, 16 Aug 2017 06:33:48 +0000 (06:33 +0000)]
Add device resource management fields to struct device.

MFC after: 1 week

6 years agoUse -S for library installations except for -DNO_ROOT builds.
bdrewery [Wed, 16 Aug 2017 05:02:31 +0000 (05:02 +0000)]
Use -S for library installations except for -DNO_ROOT builds.

Also disable this if NO_SAFE_LIBINSTALL is defined.

There is little harm in always using -S and it fixes several issues:
- A race during 'make libraries' where, for example, libgcc_s is being
  installed while another library is trying to link against it.  This is
  possible because libgcc_s is connected in both _prereq_libs and
  _startup_libs.  The first build (_prereq_libs) sets MK_PROFILE=no
  while the 2nd pass (_startup_libs) enables MK_PROFILE.  Thus the
  libgcc_s library *is* present in WORLDTMP for other libraries to
  link to, so serializing further items in _startup_libs is not
  required.  Just ensuring that libgcc_s is installed atomically (via
  rename(2)) is enough. [1]
- Installation to a running system where some library that cannot be
  detected, copied and used from the temporary INSTALLTMP with LD_LIBRARY_PATH
  that the build itself uses for installation.  Such an example is having the
  install an NSS module for user lookups that install(1) uses while
  concurrently installing the module in another process.  This is not
  a problem for the FreeBSD base build but can be for downstream
  vendors.  While this is a very specific case, installation to a
  running system with non-atomic library installation is prone to many
  problems.  A further step still is to install in proper dependency
  ordering.

Reported by: dhw many times [1]
Sponsored by: Dell EMC Isilon
MFC after: 2 weeks

6 years agoUnconditionally install rwhod support scripts.
jhb [Tue, 15 Aug 2017 22:16:15 +0000 (22:16 +0000)]
Unconditionally install rwhod support scripts.

r322277 moved rwho* and ruptime out of the MK_RCMDS conditional including
updating the obsolete files entries to not remove these scripts due to
WITHOUT_RCMDS=yes.  However, the initial installation was still conditional
on MK_RCMDS, so new installs did not include these scripts and upgrades via
mergemaster or etcupdate removed them.

PR: 220953
MFC after: 1 month

6 years agoTypo, the '-6' option selects inet6.
kib [Tue, 15 Aug 2017 19:29:10 +0000 (19:29 +0000)]
Typo, the '-6' option selects inet6.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

6 years agocxgbe/t4_tom: Use correct name for the ISS-valid bit in options2.
np [Tue, 15 Aug 2017 19:21:27 +0000 (19:21 +0000)]
cxgbe/t4_tom: Use correct name for the ISS-valid bit in options2.

MFC after: 3 days
Sponsored by: Chelsio Communications

6 years agoRework vlan(4) locking.
mjoras [Tue, 15 Aug 2017 17:52:37 +0000 (17:52 +0000)]
Rework vlan(4) locking.

Previously the locking of vlan(4) interfaces was not very comprehensive.
Particularly there was very little protection against the destruction of
active vlan(4) interfaces or concurrent modification of a vlan(4)
interface. The former readily produced several different panics.

The changes can be summarized as using two global vlan locks (an
rmlock(9) and an sx(9)) to protect accesses to the if_vlantrunk field of
struct ifnet, in addition to other places where global exclusive access
is required. vlan(4) should now be much more resilient to the destruction
of active interfaces and concurrent calls into the configuration path.

PR: 220980
Reviewed by: ae, markj, mav, rstone
Approved by: rstone (mentor)
MFC after: 4 weeks
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D11370

6 years agoAdd vm_page_alloc_after().
markj [Tue, 15 Aug 2017 16:39:49 +0000 (16:39 +0000)]
Add vm_page_alloc_after().

This is a variant of vm_page_alloc() which accepts an additional parameter:
the page in the object with largest index that is smaller than the requested
index. vm_page_alloc() finds this page using a lookup in the object's radix
tree, but in some cases its identity is already known, allowing the lookup
to be elided.

Modify kmem_back() and vm_page_grab_pages() to use vm_page_alloc_after().
vm_page_alloc() is converted into a trivial wrapper of
vm_page_alloc_after().

Suggested by: alc
Reviewed by: alc, kib
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D11984

6 years agoFix some ZFS debugging messages
asomers [Tue, 15 Aug 2017 15:20:04 +0000 (15:20 +0000)]
Fix some ZFS debugging messages

sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
Be more careful about the use of provider names vs vdev names in
ZFS_LOG statements.

MFC after: 3 weeks
Sponsored by: Spectra Logic Corp

6 years agoRevert r322327, r322352, r322358:
gjb [Tue, 15 Aug 2017 15:13:33 +0000 (15:13 +0000)]
Revert r322327, r322352, r322358:

Disconnect the dependency on the kernel package from the runtime
package.  There are a number of problems here:

 1) The runtime package installed into a chroot or a jail would
    include the kernel package, changing the behavior of how jails
    work now [1];

 2) As result of (1), it is possible a binary may incorrectly
    resolve kernel symbols [2]; in addition, it is possible there
    will be unexpected fallout with 32-bit jails on a 64-bit host
    kernel [2].

Noticed by: brd [1]
Discussed with: kib [2]
MFC after: 3 days
MFC note: record-only to wipe from the merge tracker
Sponsored by: The FreeBSD Foundation

6 years agoAlways expand the full path to the configuration file specified
gjb [Tue, 15 Aug 2017 15:08:19 +0000 (15:08 +0000)]
Always expand the full path to the configuration file specified
with the '-c' flag.

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

6 years agoloader.efi: repace XXX with real comments in trap.c
tsoome [Tue, 15 Aug 2017 14:03:26 +0000 (14:03 +0000)]
loader.efi: repace XXX with real comments in trap.c

There are two missing comments marked as XXX in trap.c, fix this.

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

6 years agoAdd new USB quirk.
hselasky [Tue, 15 Aug 2017 08:44:36 +0000 (08:44 +0000)]
Add new USB quirk.

Submitted by: devel@stasyan.com
PR: 221328
MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoPlug memory leak in arge_encap().
delphij [Tue, 15 Aug 2017 06:01:36 +0000 (06:01 +0000)]
Plug memory leak in arge_encap().

Reported by: Ilja Van Sprundel <ivansprundel ioactive.com>
Submitted by: Domagoj Stolfa <domagoj.stolfa gmail.com>
Reviewed by: adrian
MFC after: 3 days

6 years agoFix a couple of comment typos
cem [Tue, 15 Aug 2017 02:21:02 +0000 (02:21 +0000)]
Fix a couple of comment typos

No functional change.

Submitted by: Anton Rang <anton.rang AT isilon.com>
Sponsored by: Dell EMC Isilon

6 years agoThere is no MACHINE_CPUARCH == armv6, remove redunant check.
imp [Mon, 14 Aug 2017 22:38:54 +0000 (22:38 +0000)]
There is no MACHINE_CPUARCH == armv6, remove redunant check.

6 years agoConvert all the arm big endian tests into a regexp rather than a list.
imp [Mon, 14 Aug 2017 22:25:20 +0000 (22:25 +0000)]
Convert all the arm big endian tests into a regexp rather than a list.

Suggested by: emaste@

6 years agoAdd supporting changes for `Add limited sandbox capability to "make check"`
ngie [Mon, 14 Aug 2017 19:21:37 +0000 (19:21 +0000)]
Add supporting changes for `Add limited sandbox capability to "make check"`

Non-tests/... changes:
- Add HAS_TESTS= to Makefiles with libraries and programs to enable iteration
  and propagate the appropriate environment down to *.test.mk.

tests/... changes:
- Add appropriate support Makefile.inc's to set HAS_TESTS in a minimal manner,
  since tests/... is a special subdirectory tree compared to the others.

MFC after: 2 months
MFC with: r322511
Reviewed by: arch (silence), testing (silence)
Differential Revision: D12014

6 years agoAdd an UPDATING entry for r322511.
ngie [Mon, 14 Aug 2017 19:18:50 +0000 (19:18 +0000)]
Add an UPDATING entry for r322511.

MFC after: 2 months

6 years agoRegenerate src.conf(5) after change made in r322511 to "make check" behavior
ngie [Mon, 14 Aug 2017 19:03:55 +0000 (19:03 +0000)]
Regenerate src.conf(5) after change made in r322511 to "make check" behavior

6 years agoAdd limited sandbox capability to "make check"
ngie [Mon, 14 Aug 2017 19:03:05 +0000 (19:03 +0000)]
Add limited sandbox capability to "make check"

== Rationale ==

r295380 introduced "make check" and consolidated means for running
test code in an attempt to simplify running tests. One could either
install files/libraries/programs and run "make check", or run "make check"
with an explicit CHECKDIR, e.g., `make check CHECKDIR=$(make -V.OBJDIR)``.

One criticism that was received is that "make check" should be run with
the intent of making dev->test->commit easier, which means that the target
audience's workflow should be developers. One developer pattern available
in other opensource projects is to run test code from a developer sandbox,
instead of installing to a system.

== Method ==

This approach is slightly different from the standard approach, in the sense
that it builds and installs into a deterministic directory under .OBJDIR (as I call it,
the "sandbox"), then runs "make check" against that. In the event the test
run is successful, the deterministic directory is removed to save space.

== Approach ==

bsd.lib.mk, bsd.prog.mk:

To support this functionality, a new variable `HAS_TESTS` is being added.

HAS_TESTS enables appropriate behavior with bsd.lib.mk and bsd.prog.mk, as
follows:
- Add "make check" as an available target from the directory.
- Pass down appropriate variables via ${TESTS_ENV}, i.e.,
  ${TESTS_LD_LIBRARY_PATH} and ${TESTS_PATH}.

One should add "HAS_TESTS" to directories containing tests in them, e.g. from
bin/sh/Makefile,

  HAS_TESTS=
  SUBDIR.${MK_TESTS}+= tests

HAS_TESTS doesn't automatically add the tests subdirectory for flexibility
reasons.

bsd.opts.mk, src.opts.mk:
- The knob ${MK_MAKE_CHECK_USE_SANDBOX} has been added, both to explicitly
  direct (internally) when to set a deterministic ${DESTDIR} and to also allow
  users to disable this behavior globally, i.e., via src.conf.
- MK_TESTS has been promoted from src.opts.mk to bsd.opts.mk to leverage
  syntactic sugar for having MK_TESTS be a dependency for
  MK_MAKE_CHECK_USE_SANDBOX, but to also ensure that src.opts.mk isn't required
  to use suite.test.mk (which is a dependency of bsd.test.mk).

suite.test.mk:
- beforecheck behavior (when MK_MAKE_CHECK_USE_SANDBOX is enabled) is modified
  from a no-op to:
-- Build.
-- Run "make hierarchy" on the sandbox dir.
-- Install the tests/files to the sandbox dir.
- aftercheck behavior (when MK_MAKE_CHECK_USE_SANDBOX is enabled) is modified
  from a no-op to:
-- Remove the sandbox dir.

Again, because the dependency order set in bsd.test.mk is
beforecheck -> check -> aftercheck, "make check" will not be run unless
"beforecheck" completes successfully, and "aftercheck" will not be run unless
"beforecheck" and "check" complete successfully.

== Caveats ==

- This target must either be run with MK_INSTALL_AS_USER or as root. Otherwise
  it will fail when running "make install" as the default user/group for many
  makefiles when calling INSTALL is root/wheel.
- This target must be run from a suitable top-level directory. For example,
  running tests from `tests/sys/fs/tmpfs` won't work, but `tests/sys/fs` will,
  because `tests/sys/fs/tmpfs` relies on files installed by `tests/sys/fs`.
- Running MK_INSTALL_AS_USER may introduce determinism issues. However, using
  it could identify deficiences in tests in terms of needing to be run as
  root, which are not properly articulated in the test requirements.
- The doesn't negate the need for running "make installworld" and
  "make checkworld", etc. Again, this just is intended to simplify the
  dev->test->commit workflow.

== Cleanup done ==
- CHECKDIR is removed; one can use "MK_MAKE_CHECK_USE_SANDBOX=no" to enable
  "legacy" (r295380) behavior.

MFC after: 2 months
Relnotes: yes (CHECKDIR removed; "make check" behavior changed)
Requested by: jhb
Reviewed by: arch (silence), testing (silence)
Differential Revision: D11905

6 years agoRegenerate src.conf(5) per LLDB default change made in r322415
ngie [Mon, 14 Aug 2017 18:49:46 +0000 (18:49 +0000)]
Regenerate src.conf(5) per LLDB default change made in r322415

6 years agoRename RISC-V GCC config directory: riscv64 -> riscv
br [Mon, 14 Aug 2017 14:16:56 +0000 (14:16 +0000)]
Rename RISC-V GCC config directory: riscv64 -> riscv
(to match official RISC-V target for GCC 7.1).

This is only a minimal config required to build c start up (csu).

This fixes build after r322429 ("Make _TO_CPUARCH macro for
ARCH to CPUARCH conversions")

Reported by: lwhsu
Sponsored by: DARPA, AFRL

6 years agoPrint whole machine state on double fault.
kib [Mon, 14 Aug 2017 11:23:07 +0000 (11:23 +0000)]
Print whole machine state on double fault.

It is quite useful when double fault is not caused by a stack overflow.

Tested by: pho (as part of the larger patch)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

6 years agoAdd {rd,wr}{fs,gs}base C wrappers for instructions.
kib [Mon, 14 Aug 2017 11:20:54 +0000 (11:20 +0000)]
Add {rd,wr}{fs,gs}base C wrappers for instructions.

Tested by: pho (as part of the larger patch)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

6 years agoStyle.
kib [Mon, 14 Aug 2017 11:20:10 +0000 (11:20 +0000)]
Style.

Tested by: pho (as part of the larger patch)
Sponsored by: The FreeBSD Foundation
MFC after: 3 days

6 years agoRemove confusion in the line explaining syntax of the msr read.
kib [Mon, 14 Aug 2017 11:19:31 +0000 (11:19 +0000)]
Remove confusion in the line explaining syntax of the msr read.
Specify words order in the display.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

6 years agohyperv: Update copyright for the files changed in 2017
sephe [Mon, 14 Aug 2017 06:00:50 +0000 (06:00 +0000)]
hyperv: Update copyright for the files changed in 2017

MFC after: 3 days
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D11982

6 years agohyperv/hn: Re-set datapath after synthetic parts reattached.
sephe [Mon, 14 Aug 2017 05:55:16 +0000 (05:55 +0000)]
hyperv/hn: Re-set datapath after synthetic parts reattached.

Do this even for non-transparent mode VF. Better safe than sorry.

MFC after: 3 days
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D11981

6 years agohyperv/hn: Minor cleanup
sephe [Mon, 14 Aug 2017 05:46:50 +0000 (05:46 +0000)]
hyperv/hn: Minor cleanup

MFC after: 3 days
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D11979

6 years agohyperv/hn: Fix/enhance receiving path when VF is activated.
sephe [Mon, 14 Aug 2017 05:40:52 +0000 (05:40 +0000)]
hyperv/hn: Fix/enhance receiving path when VF is activated.

- Update hn(4)'s stats properly for non-transparent mode VF.
- Allow BPF tapping to hn(4) for non-transparent mode VF.
- Don't setup mbuf hash, if 'options RSS' is set.
  In Azure, when VF is activated, TCP SYN and SYN|ACK go through hn(4)
  while the rest of segments and ACKs belonging to the same TCP 4-tuple
  go through the VF.  So don't setup mbuf hash, if a VF is activated
  and 'options RSS' is not enabled.  hn(4) and the VF may use neither
  the same RSS hash key nor the same RSS hash function, so the hash
  value for packets belonging to the same flow could be different!
- Disable LRO.
  hn(4) will only receive broadcast packets, multicast packets, TCP
  SYN and SYN|ACK (in Azure), LRO is useless for these packet types.
  For non-transparent, we definitely _cannot_ enable LRO at all, since
  the LRO flush will use hn(4) as the receiving interface; i.e.
  hn_ifp->if_input(hn_ifp, m).

While I'm here, remove unapplied comment and minor style change.

MFC after: 3 days
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D11978

6 years agoAdd myself
bhughes [Mon, 14 Aug 2017 05:31:51 +0000 (05:31 +0000)]
Add myself

Reported by: mckusick

6 years agohyperv/hn: Update VF's ibytes properly under transparent VF mode.
sephe [Mon, 14 Aug 2017 05:30:02 +0000 (05:30 +0000)]
hyperv/hn: Update VF's ibytes properly under transparent VF mode.

While, I'm here add comment about why updating VF's imcast stat is
not necessary.

MFC after: 3 days
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D11948

6 years agoAdd hinted attachment for non-FDT systems. Also, print a message if
ian [Mon, 14 Aug 2017 02:23:10 +0000 (02:23 +0000)]
Add hinted attachment for non-FDT systems.  Also, print a message if
setting up the timer fails, because on some types of chips that's the
first attempt to access the device.  If the chip is missing/non-responsive
then you'd get a driver that attached and didn't register the rtc, with
no clue about why.  On other chip types there are inits that come before
timer setup, and they already print messages about errors.

6 years agoAdd back the drivers for Dallas/Maxim ds13xx and Seiko S35390x now that
ian [Mon, 14 Aug 2017 00:12:14 +0000 (00:12 +0000)]
Add back the drivers for Dallas/Maxim ds13xx and Seiko S35390x now that
they've been rewritten/fixed to not cause panics by doing i2c transfers
before interrupts are available.

PR: 221227

6 years agoMinor fixes and enhancements for the s35390a i2c RTC driver...
ian [Mon, 14 Aug 2017 00:00:24 +0000 (00:00 +0000)]
Minor fixes and enhancements for the s35390a i2c RTC driver...

- Add FDT probe code.
- Do i2c transfers with exclusive bus ownership.
- Use config_intrhook_oneshot() to defer chip setup because some i2c
  busses can't do transfers without interrupts.
- Add a detach() routine.
- Add to module build.

6 years agoRemove the old ds1374 driver and use the ds13rtc driver instead. Adjust
ian [Sun, 13 Aug 2017 22:07:42 +0000 (22:07 +0000)]
Remove the old ds1374 driver and use the ds13rtc driver instead.  Adjust
several mips config files accordingly.

6 years agoChange "chiptype" to "compatible". Making the hint name the same as the FDT
ian [Sun, 13 Aug 2017 21:45:46 +0000 (21:45 +0000)]
Change "chiptype" to "compatible".  Making the hint name the same as the FDT
property name should make it easier to document the list of names accepted
by both configuration mechanisms.

6 years agolld: Add `-z muldefs` option.
emaste [Sun, 13 Aug 2017 21:11:48 +0000 (21:11 +0000)]
lld: Add `-z muldefs` option.

Obtained from: LLVM r310757

6 years agoAdd a new driver, ds13rtc, that handles all DS13xx series i2c RTC chips.
ian [Sun, 13 Aug 2017 21:02:40 +0000 (21:02 +0000)]
Add a new driver, ds13rtc, that handles all DS13xx series i2c RTC chips.

This driver supports only basic timekeeping functionality.  It completely
replaces the ds133x driver.  It can also replace the ds1374 driver, but that
will take a few other changes in MIPS code and config, and will be committed
separately.  It does NOT replace the existing ds1307 driver, which provides
access to some of the extended features on the 1307 chip, such as controlling
the square wave output signal.  If both ds1307 and ds13rtc drivers are
present, the ds1307 driver will outbid and win control of the device.

This driver can be configured with FDT data, or by using hints on non-FDT
systems.  In addition to the standard hints for i2c devices, it requires
a "chiptype" string of the form "dallas,ds13xx" where 'xx' is the chip id
(i.e., the same format as FDT compat strings).

6 years ago- Add myswlf
ohauer [Sun, 13 Aug 2017 18:59:19 +0000 (18:59 +0000)]
- Add myswlf

Reported by: mckusick

6 years agoAdd support for multiple GICv3 ITS devices. For this we add sc_irq_base
andrew [Sun, 13 Aug 2017 18:54:51 +0000 (18:54 +0000)]
Add support for multiple GICv3 ITS devices. For this we add sc_irq_base
and sc_irq_length to the softc to handle the base number of IRQs available,
make gicv3_get_nirqs return the number of available interrupt IDs, and
limit which CPUs we send interrupts to based on the numa domain.

The last point is only strictly needed on a dual socket ThunderX where we
are unable to send MSI/MSI-X interrupts between sockets.

Sponsored by: DARPA, AFRL

6 years agoAdd config_intrhook_oneshot(): schedule an intrhook function and unregister
ian [Sun, 13 Aug 2017 18:10:24 +0000 (18:10 +0000)]
Add config_intrhook_oneshot(): schedule an intrhook function and unregister
it automatically after it runs.

The config_intrhook mechanism allows a driver to stall the boot process
until device(s) required for booting are available, by not allowing system
inits to proceed until all intrhook functions have been unregistered.
Virtually all existing code simply unregisters from within the hook function
when it gets called.

This new function makes that common usage more convenient. Instead of
allocating and filling in a struct, passing it to a function that might (in
theory) fail, and checking the return code, now a driver can simply call
this cannot-fail routine, passing just the intrhook function and its arg.

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