]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agoUpgrade our copies of clang, llvm, lld, lldb, compiler-rt and libc++ to
dim [Tue, 11 Dec 2018 19:05:28 +0000 (19:05 +0000)]
Upgrade our copies of clang, llvm, lld, lldb, compiler-rt and libc++ to
the upstream release_70 branch r348686 (effectively, 7.0.1 rc3).  The
release will follow very soon, but no more functional changes are
expected.

Release notes for llvm, clang and lld 7.0.0 are available here:
<http://releases.llvm.org/7.0.0/docs/ReleaseNotes.html>
<http://releases.llvm.org/7.0.0/tools/clang/docs/ReleaseNotes.html>
<http://releases.llvm.org/7.0.0/tools/lld/docs/ReleaseNotes.html>

PR: 230240, 230355
Relnotes: yes
MFC after: 2 months

5 years agoFix !tx_abdicate error from r336560
shurd [Tue, 11 Dec 2018 17:46:01 +0000 (17:46 +0000)]
Fix !tx_abdicate error from r336560

r336560 was supposed to restore pre-r323954 behaviour when tx_abdicate is
not set (the default case). However, it appears that rather than the drainage
check being made conditional on tx_abdicate being set, it was duplicated
so it occured twice if tx_abdicate was set and once if it was not.

Now when !tx_abdicate, drainage is only checked if the doorbell isn't
pending.

Reported by:    lev
MFC after:      1 week
Sponsored by:   Limelight Networks

5 years agoSet tentative merge date, and add UPDATING note.
dim [Tue, 11 Dec 2018 17:39:49 +0000 (17:39 +0000)]
Set tentative merge date, and add UPDATING note.

5 years agoaudi: replace open-coded TDP_AUDITREC checks with the macro
mjg [Tue, 11 Dec 2018 17:14:12 +0000 (17:14 +0000)]
audi: replace open-coded TDP_AUDITREC checks with the macro

Sponsored by: The FreeBSD Foundation

5 years agoFix the PAE kernel gcc build.
markj [Tue, 11 Dec 2018 16:49:01 +0000 (16:49 +0000)]
Fix the PAE kernel gcc build.

The error was caused by map_ucode() casting a vm_paddr_t to a void *.
Use a uintptr_t instead to match the caller.  Fix some style bugs while
here.

Reported by: bde
Reviewed by: bde
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

5 years agoasmc: Add Support for MacBookAir 7,1 and 7,2
dab [Tue, 11 Dec 2018 16:35:59 +0000 (16:35 +0000)]
asmc: Add Support for MacBookAir 7,1 and 7,2

PR: 226172
Submitted by: James Wright <james.wright@jigsawdezign.com>
Reported by: James Wright <james.wright@jigsawdezign.com>
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D18396

5 years agofd: dedup code in sys_getdtablesize
mjg [Tue, 11 Dec 2018 12:08:18 +0000 (12:08 +0000)]
fd: dedup code in sys_getdtablesize

Sponsored by: The FreeBSD Foundation

5 years agoMake lim_cur inline if possible.
mjg [Tue, 11 Dec 2018 12:01:46 +0000 (12:01 +0000)]
Make lim_cur inline if possible.

It is a function call only to accomodate *some* ABIs which install a hook.
They only care for 3 types of limits: DATA, STACK, VMEM

Instead of always calling the func, see at compilation time if the requested
limit is something else and just do the read if so.

Sponsored by: The FreeBSD Foundation

5 years agofd: tidy up closing a fd
mjg [Tue, 11 Dec 2018 11:58:44 +0000 (11:58 +0000)]
fd: tidy up closing a fd

- avoid a call to knote_close in the common case
- annotate mqueue as unlikely

Sponsored by: The FreeBSD Foundation

5 years agofd: stop looking for exact freefile after allocation
mjg [Tue, 11 Dec 2018 11:57:12 +0000 (11:57 +0000)]
fd: stop looking for exact freefile after allocation

If a lower fd is closed later, the lookup goes to waste. Allocation
always performs the lookup anyway.

Sponsored by: The FreeBSD Foundation

5 years agoOnly read the ACPI proximity tabled on arm64 when we are booting from
andrew [Tue, 11 Dec 2018 11:13:11 +0000 (11:13 +0000)]
Only read the ACPI proximity tabled on arm64 when we are booting from
ACPI.

Sponsored by: DARPA, AFRL

5 years agoMerge ^/head r341764 through r341812.
dim [Tue, 11 Dec 2018 06:47:04 +0000 (06:47 +0000)]
Merge ^/head r341764 through r341812.

5 years agoFor arm and armv6, only enable LLVM target support for arm by default,
dim [Tue, 11 Dec 2018 06:45:53 +0000 (06:45 +0000)]
For arm and armv6, only enable LLVM target support for arm by default,
to shrink libllvm.a.

This is a workaround for "relocation truncated to fit" errors with BFD
ld 2.17.50 on arm and armv6, when linking executables against it.

The required range extensions are not yet supported by this very old
version of BFD ld.  When arm and armv6 userland can be successfully
linked by lld, this workaround can be removed.

5 years agoRemove questionable initialization for ICH8M, rely on BIOS to properly
delphij [Tue, 11 Dec 2018 05:10:22 +0000 (05:10 +0000)]
Remove questionable initialization for ICH8M, rely on BIOS to properly
initialize the controller.

According to the datasheet, the old code checks if port 2 (P2E, 0x4) was
the only enabled port (except port 0, which was ignored by mask 0xfe),
and issue a write to the PCS register to disable all but port 0, right
before ahci_ctlr_reset.

Some other operating systems would issue a port enable to all ports, but
since the current code only does the special initialization for ICH8M,
it entirely and rely on BIOS to do the right thing (the alternative
would be https://reviews.freebsd.org/D18300?id=50922 , should we see
reports that we really need to do it).

Reviewed by: mav
MFC after: 3 months
Differential Revision: https://reviews.freebsd.org/D18300

5 years agoFree bootstacks after AP startup.
kib [Tue, 11 Dec 2018 02:54:36 +0000 (02:54 +0000)]
Free bootstacks after AP startup.

Bootstacks are unused after APs executed sched_throw() in
init_secondary_tail() and started executing on proper idle thread
stack.  Add sysinit that detects that the idle thread for each CPU was
scheduled at least once, and free corresponding bootstack.

Slight addition of the code (~200 bytes) is compensated by the saving,
because even on typical small modern desktop CPU we leak 128K of
memory otherwise (4 pages x 8 threads).

Reviewed by: jhb
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D18486

5 years agoRemove special case handling for getfhat(fd, NULL, handle).
kib [Tue, 11 Dec 2018 02:48:49 +0000 (02:48 +0000)]
Remove special case handling for getfhat(fd, NULL, handle).

There is no reason for it to behave differently from openat(fd, NULL).
Also the handling did not worked because the substituted path was from
the system address space, causing EFAULT.

Submitted by: Jack Halford <jack@gandi.net>
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D18501

5 years agoRemove an unused malloc(9) type.
markj [Tue, 11 Dec 2018 02:16:27 +0000 (02:16 +0000)]
Remove an unused malloc(9) type.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

5 years agoUse inline tests for individual PTE bits in the RISC-V pmap.
markj [Tue, 11 Dec 2018 02:15:56 +0000 (02:15 +0000)]
Use inline tests for individual PTE bits in the RISC-V pmap.

Inline tests for PTE_* bits are easy to read and don't really require a
predicate function, and predicates which operate on a pt_entry_t are
inconvenient when working with L1 and L2 page table entries.

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

5 years agoAdd uk.macbook.kbd keymap (vt)
dab [Tue, 11 Dec 2018 02:14:40 +0000 (02:14 +0000)]
Add uk.macbook.kbd keymap (vt)

PR: 215185
Submitted by: James Wright <james.wright@jigsawdezign.com>
Reported by: James Wright <james.wright@jigsawdezign.com>
Reviewed by: emaste (earlier version)
MFC after: 1 week
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D18395

5 years agopowerpc/booke: Don't get and use the load offset for TOC on APs
jhibbits [Tue, 11 Dec 2018 02:03:00 +0000 (02:03 +0000)]
powerpc/booke: Don't get and use the load offset for TOC on APs

The code was a near exact copy of the code in startup, but it doesn't need
the complexity since the kernel is already relocated.  With
VM_MIN_KERNEL_ADDRESS as currently set to KERNBASE, this doesn't cause a
problem, because it's a zero offset.  However, when KERNBASE is changed to a
physical load address, it then has a non-zero offset, and ends up with an
invalid stack pointer, causing the AP to hang.

5 years agorc.subr: Implement list_vars without using 'read'
cem [Tue, 11 Dec 2018 01:38:50 +0000 (01:38 +0000)]
rc.subr: Implement list_vars without using 'read'

'read' pessimistically read(2)s one byte at a time, which can be quite
silly for large environments in slow emulators.

In my boring user environment, truss shows that the number of read()
syscalls to source rc.subr and invoke list_vars is reduced by something like
3400 to 60.  ministat(1) shows a significant time difference of about -71%
for my environment.

Suggested by: jilles
Discussed with: dteske, jhb, jilles
Differential Revision: https://reviews.freebsd.org/D18481

5 years agoValidate the string size parameter passed to -s.
jhb [Mon, 10 Dec 2018 21:47:19 +0000 (21:47 +0000)]
Validate the string size parameter passed to -s.

Use strtonum() to reject negative sizes instead of core dumping.

PR: 232206
Submitted by: David Carlier <devnexen@gmail.com>
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D17537

5 years agoRemove stray hints files.
imp [Mon, 10 Dec 2018 21:33:01 +0000 (21:33 +0000)]
Remove stray hints files.

5 years agoDon't report stale signal information for non-signal events in ptrace_lwpinfo.
jhb [Mon, 10 Dec 2018 19:39:24 +0000 (19:39 +0000)]
Don't report stale signal information for non-signal events in ptrace_lwpinfo.

Once a signal's siginfo was copied to 'td_si' as part of the signal
exchange in issignal(), it was never cleared.  This caused future
thread events that are reported as SIGTRAP events without signal
information to report the stale siginfo in 'td_si'.  For example, if a
debugger created a new process and used SIGSTOP to stop it after
PT_ATTACH, future system call entry / exit events would set PL_FLAG_SI
with the SIGSTOP siginfo in pl_siginfo.  This broke 'catch syscall' in
current versions of gdb as it assumed PL_FLAG_SI with SIGTRAP
indicates a breakpoint or single step trap.

Reviewed by: kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D18487

5 years agoRework how protocol number is tracked in rule. Save it when O_PROTO
ae [Mon, 10 Dec 2018 16:23:11 +0000 (16:23 +0000)]
Rework how protocol number is tracked in rule. Save it when O_PROTO
opcode will be printed. This should solve the problem, when protocol
name is not printed in `ipfw -N show`.

Reported by: Claudio Eichenberger <cei at yourshop.com>
MFC after: 1 week

5 years agoUse correct size for IPv4 address in gethostbyaddr().
ae [Mon, 10 Dec 2018 15:42:13 +0000 (15:42 +0000)]
Use correct size for IPv4 address in gethostbyaddr().

When u_long is 8 bytes, it returns EINVAL and 'ipfw -N show' doesn't work.

Reported by: Claudio Eichenberger <cei at yourshop.com>
MFC after: 1 week

5 years agoppc64: handle exception 0x1500 (soft patch)
luporl [Mon, 10 Dec 2018 14:54:28 +0000 (14:54 +0000)]
ppc64: handle exception 0x1500 (soft patch)

This change adds a hypervisor trap handler for exception 0x1500 (soft patch),
normalizing all VSX registers and returning.
This avoids a kernel panic due to unknown exception.

Change made with the collaboration of leonardo.bianconi_eldorado.org.br,
that found out that this is a hypervisor exception and not a supervisor one,
and fixed this in the code.

Reviewed by: jhibbits, sbruno
Differential Revision: https://reviews.freebsd.org/D17806

5 years agoClean stale wpa dependencies and objects after r341759
emaste [Mon, 10 Dec 2018 14:50:11 +0000 (14:50 +0000)]
Clean stale wpa dependencies and objects after r341759

The wpa update added some source files with the same name as a file in
another directory (found via .PATH in the previous version).  Having a
stale entry in a .depend file means the new file won't be built, so test
for this case and if found remove all of wpa's dependency files.

MFC with: r341759
Sponsored by: The FreeBSD Foundation

5 years agoping(8): add space after "<=" as per style(9).
eugen [Mon, 10 Dec 2018 14:39:21 +0000 (14:39 +0000)]
ping(8): add space after "<=" as per style(9).

MFC after: 1 week
X-MFC-with: r341768

5 years agoRemove no longer needed ifdefs in the LinuxKPI, after r341787.
hselasky [Mon, 10 Dec 2018 13:41:33 +0000 (13:41 +0000)]
Remove no longer needed ifdefs in the LinuxKPI, after r341787.

Differential Revision: https://reviews.freebsd.org/D18450
Reviewed by: kib@
MFC after: 3 days
Sponsored by: Mellanox Technologies

5 years agoImplement atomic_swap_xxx() for all platforms.
hselasky [Mon, 10 Dec 2018 13:38:13 +0000 (13:38 +0000)]
Implement atomic_swap_xxx() for all platforms.

Differential Revision: https://reviews.freebsd.org/D18450
Reviewed by: kib@
MFC after: 3 days
Sponsored by: Mellanox Technologies

5 years agortwn, rsu: add more USB ids.
avos [Mon, 10 Dec 2018 09:45:57 +0000 (09:45 +0000)]
rtwn, rsu: add more USB ids.

PR: 233638
Submitted by: cezary.sliwa@gmail.com
MFC after: 3 days

5 years agosfxge(4): use n Tx queues instead of n + 2 on EF10 HW
arybchik [Mon, 10 Dec 2018 09:36:05 +0000 (09:36 +0000)]
sfxge(4): use n Tx queues instead of n + 2 on EF10 HW

On EF10 HW we can avoid sending packets without checksum offload
or with IP-only checksum offload to dedicated queues. Instead, we
can use option descriptors to change offload policy on any queue
during runtime. Thus, we don't need to create two dedicated queues.

Submitted by:   Ivan Malov <Ivan.Malov at oktetlabs.ru>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D18390

5 years agosfxge(4): prepare the number of Tx queues on event queue 0 to become variable
arybchik [Mon, 10 Dec 2018 09:35:53 +0000 (09:35 +0000)]
sfxge(4): prepare the number of Tx queues on event queue 0 to become variable

The number of Tx queues on event queue 0 can depend on the NIC family type,
and this property will be leveraged by future patches.
This patch prepares the code for this change.

Submitted by:   Ivan Malov <Ivan.Malov at oktetlabs.ru>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D18389

5 years agosfxge(4): report support for Tx checksum op descriptors
arybchik [Mon, 10 Dec 2018 09:35:45 +0000 (09:35 +0000)]
sfxge(4): report support for Tx checksum op descriptors

FreeBSD driver needs a patch to provide a means for packets
which do not need checksum offload but have flow ID set
to avoid hitting only the first Tx queue (which has been used
for packets not needing checksum offload).

This should be possible on Huntington, Medford or Medford2 chips
since these support toggling checksum offload on any given queue
dynamically by means of pushing option descriptors.

The patch for FreeBSD driver will then need a means to figure out
whether the feature can be used, and testing adapter family might
not be a good solution.

This patch adds a feature bit specifically to indicate support
for checksum option descriptors. The new feature bits may have
more users in future, apart from the mentioned FreeBSD patch.

Submitted by:   Ivan Malov <Ivan.Malov at oktetlabs.ru>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D18388

5 years agosfxge(4): populate per-event queue stats in sysctl
arybchik [Mon, 10 Dec 2018 09:35:33 +0000 (09:35 +0000)]
sfxge(4): populate per-event queue stats in sysctl

In order to find out why the first event queue and corresponding
interrupt is triggered more frequent, it is useful to know which
events go to each event queue.

Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D18418

5 years agopowerpc/booke: Replace a logical equivalent of pmap_kextract() with a real call
jhibbits [Mon, 10 Dec 2018 04:16:40 +0000 (04:16 +0000)]
powerpc/booke: Replace a logical equivalent of pmap_kextract() with a real call

No sense in reinventing the wheel here.  AP bringup is not a time-critical
point.

5 years agopowerpc/ubldr: Teach powerpc's ubldr to boot 64-bit kernels
jhibbits [Mon, 10 Dec 2018 01:52:39 +0000 (01:52 +0000)]
powerpc/ubldr: Teach powerpc's ubldr to boot 64-bit kernels

This is just a copy of powerpc/ofw's ppc64_elf_freebsd.c modified to fit
ubldr's boot format.

MFC after: 1 week

5 years agoFix typo in powerpcspe name.
imp [Sun, 9 Dec 2018 21:53:45 +0000 (21:53 +0000)]
Fix typo in powerpcspe name.

5 years agoSend a START UNIT command when a disk responds with an ASC of 04/1C.
imp [Sun, 9 Dec 2018 21:37:34 +0000 (21:37 +0000)]
Send a START UNIT command when a disk responds with an ASC of 04/1C.
This will hopefully spin up a disk that's in low-power mode.

Sponsored by: Netflix
Submitted by: scottl@

5 years agoping(8): remove needless comparision with LONG_MAX
eugen [Sun, 9 Dec 2018 21:11:15 +0000 (21:11 +0000)]
ping(8): remove needless comparision with LONG_MAX
after unsigned long ultmp changed to long ltmp in r340245.

MFC after: 1 week

5 years agoblst_leaf_alloc updates bighint for a leaf when an allocation is successful
alc [Sun, 9 Dec 2018 17:55:10 +0000 (17:55 +0000)]
blst_leaf_alloc updates bighint for a leaf when an allocation is successful
and includes the last block represented by the leaf.  The reasoning is that,
if the last block is included, then there must be no solution before that
one in the leaf, so the leaf cannot provide an allocation that big again;
indeed, the leaf cannot provide a solution bigger than range1.

Which is all correct, except that if the value of blk passed in did not
represent the first block of the leaf, because the cursor was pointing to
the middle of the leaf, then a possible solution before the cursor may have
been ignored, and bighint cannot be updated.

Consider the sequence allocate 63 (returning address 0), free 0,63 (freeing
that same block, and allocate 1 (returning 63).  The result is that one
block is allocated from the first leaf, and the value of bighint is 0, so
that nothing can be allocated from that leaf until the only block allocated
from that leaf is freed.  This change detects that skipped-over solution,
and when there is one it makes sure that the value of bighint is not changed
when the last block is allocated.

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

5 years agoFix devstat on md devices.
bde [Sun, 9 Dec 2018 15:34:20 +0000 (15:34 +0000)]
Fix devstat on md devices.

devstat_end_transaction() was called before the i/o was actually ended
(by delivering it to GEOM), so at least the i/o length was messed up.
It was always recorded as 0, so the average transaction size and the
average transfer rate was always displayed as 0.

devstat_end_transaction() was not called at all for the error case, so
there were sometimes multiple starts per end.  I didn't observe this in
practice and don't know if it did much damage.  I think it extended the
length of the i/o to the next transaction.

Reviewed by: kib

5 years agoMerge ^/head r340918 through r341763.
dim [Sun, 9 Dec 2018 11:39:45 +0000 (11:39 +0000)]
Merge ^/head r340918 through r341763.

5 years agoMerge llvm, clang, lld, lldb, compiler-rt and libc++ release_70 branch
dim [Sun, 9 Dec 2018 11:36:04 +0000 (11:36 +0000)]
Merge llvm, clang, lld, lldb, compiler-rt and libc++ release_70 branch
r348686 (effectively 7.0.1 rc3), resolve conflicts, and bump version
numbers.

PR: 230240, 230355

5 years agoI missed powerpcspe in the previous commit for excluding mps and mpr.
scottl [Sun, 9 Dec 2018 06:52:25 +0000 (06:52 +0000)]
I missed powerpcspe in the previous commit for excluding mps and mpr.
I also learned that 'mips' is overly broad and covers 64bit architectures
too.  However, it's not worth the fight right now, so any refinements
will have to come another day.

5 years agoMFV r341618:
cy [Sun, 9 Dec 2018 06:45:49 +0000 (06:45 +0000)]
MFV r341618:

Update wpa 2.6 --> 2.7.

5 years agoDon't allocate the config_intrhook separately from the softc, it's small
scottl [Sun, 9 Dec 2018 06:16:54 +0000 (06:16 +0000)]
Don't allocate the config_intrhook separately from the softc, it's small
enough that it costs more code to handle the malloc/free than it saves.

5 years agoCopy and clear the reply descriptor atomically. This prevents concurrency
scottl [Sun, 9 Dec 2018 06:10:11 +0000 (06:10 +0000)]
Copy and clear the reply descriptor atomically.  This prevents concurrency
in the interrupt handlers (usually due to timeout/error recovery) from
seeing and processing the same descriptor twice.

5 years agoRemove the mps driver from powerpc 32bit GENERIC, and don't build it and
scottl [Sun, 9 Dec 2018 06:06:06 +0000 (06:06 +0000)]
Remove the mps driver from powerpc 32bit GENERIC, and don't build it and
mpr as a module for powerpc or mips.  An upcoming commit will cause these
drivers to rely on the presence of 64bit atomic operations.  Discussed
with jhibbits.

5 years agopowerpc/SPE: Copy lower part of source register to target for efdabs/efdnabs/efdneg
jhibbits [Sun, 9 Dec 2018 04:54:55 +0000 (04:54 +0000)]
powerpc/SPE: Copy lower part of source register to target for efdabs/efdnabs/efdneg

MFC after: 1 week
MFC With: r341751

5 years agopowerpc/SPE: Reload vector registers after efdabs/efdnabs/efdneg
jhibbits [Sun, 9 Dec 2018 04:13:14 +0000 (04:13 +0000)]
powerpc/SPE: Reload vector registers after efdabs/efdnabs/efdneg

While here, also style(9)-adjust indents around this code.

5 years agoHook up ng_checksum(4) module and appropriate manpage to the build. The module
sobomax [Sun, 9 Dec 2018 02:58:53 +0000 (02:58 +0000)]
Hook up ng_checksum(4) module and appropriate manpage to the build. The module
was added back in 2016, but has never been connected.

MFC after: 1 week

5 years agoFix PAE boot.
kib [Sat, 8 Dec 2018 22:12:57 +0000 (22:12 +0000)]
Fix PAE boot.

With the introduction of M_EXEC support for kmem_malloc(), some kernel
mappings start having NX bit set in the paging structures early, for
PAE kernels on machines with NX support, i.e. practically on all
machines.  In particular, AP trampoline and initialization needs to
access pages which translations has NX bit set, before initializecpu()
is called.

Check for CPUID NX feature and enable EFER.NXE before we enable paging
in mp boot trampoline.  This allows the CPU to use the kernel page
table instead of generating page fault due to reserved bit set.

PR: 233819
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

5 years agoarm64: add ACPI based NUMA support
jchandra [Sat, 8 Dec 2018 19:42:01 +0000 (19:42 +0000)]
arm64: add ACPI based NUMA support

Use the newly defined SRAT/SLIT parsing APIs in arm64 to support
ACPI based NUMA.

Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D17943

5 years agoacpica: support parsing of arm64 affinity in acpi_pxm.c
jchandra [Sat, 8 Dec 2018 19:32:23 +0000 (19:32 +0000)]
acpica: support parsing of arm64 affinity in acpi_pxm.c

ACPI SRAT table on arm64 uses GICC entries to provide CPU locality
information. These entries use an AcpiProcessorUid to identify the
CPU (unlike on x86 where the entries have an APIC ID).

Update acpi_pxm.c to extend the cpu_add/cpu_find/cpu_get_info
functions to handle AcpiProcessorUid. Use the updated functions
while parsing ACPI_SRAT_GICC_AFFINITY entry for arm64.

Also update sys/conf/files.arm64 to build acpi_pxm.c when ACPI is
enabled.

Reviewed by: markj (previous version)
Differential Revision: https://reviews.freebsd.org/D17942

5 years agoacpica : move SRAT/SLIT parsing to sys/dev/acpica
jchandra [Sat, 8 Dec 2018 19:10:58 +0000 (19:10 +0000)]
acpica : move SRAT/SLIT parsing to sys/dev/acpica

This moves the architecture independent parts of sys/x86/acpica/srat.c
to sys/dev/acpica/acpi_pxm.c, to be used later on arm64. The function
declarations are moved to sys/dev/acpica/acpivar.h

We also need to update sys/conf/files.{i386,amd64} to use the new file.
No functional changes.

Reviewed by: markj, imp
Differential Revision: https://reviews.freebsd.org/D17941

5 years agox86/acpica/srat.c: Add API for parsing proximity tables
jchandra [Sat, 8 Dec 2018 18:34:05 +0000 (18:34 +0000)]
x86/acpica/srat.c: Add API for parsing proximity tables

The SLIT and SRAT ACPI tables needs to be parsed on arm64 as well, on
systems that use UEFI/ACPI firmware and support NUMA. To do this, we
need to move most of the logic of x86/acpica/srat.c to dev/acpica and
provide an API that architectures can use to parse and configure ACPI
NUMA information.

This commit adds the API in srat.c as a first step, without making any
functional changes. We will move the common code to sys/dev/acpica
as the next step.

The functions added are:
  * int acpi_pxm_init(int ncpus, vm_paddr_t maxphys) - to allocate and
    initialize data structures used
  * void acpi_pxm_parse_tables(void) - parse SRAT/SLIT, save the cpu and
    memory proximity information
  * void acpi_pxm_set_mem_locality(void) - use the saved data to set
    memory locality
  * void acpi_pxm_set_cpu_locality(void) - use the saved data to set cpu
    locality
  * void acpi_pxm_free(void) - free data structures allocated by init

On arm64, we do not have an cpu APIC id that can be used as index to
store CPU data, we need to use the Processor Uid. To help with this,
define internal functions cpu_add, cpu_find, cpu_get_info to store
and get CPU proximity information.

Reviewed by: markj, jhb (previous version)
Differential Revision: https://reviews.freebsd.org/D17940

5 years agoImplement R_AARCH64_TLS_DTPMOD64 and A_AARCH64_TLS_DTPREL64 relocations.
mmel [Sat, 8 Dec 2018 14:58:17 +0000 (14:58 +0000)]
Implement R_AARCH64_TLS_DTPMOD64 and A_AARCH64_TLS_DTPREL64 relocations.
Although these are slightly obsolete in favor of R_AARCH64_TLSDESC,
gcc -mtls-dialect=trad still use them.

Please note that definition of TLS_DTPMOD64 and TLS_DTPREL64 are incorrectly
exchanged in GNU binutils. TLS_DTPREL64 should be encoded to 1028 (as is
defined in ARM ELF ABI) but binutils encode it to 1029. And vice versa,
TLS_DTPMOD64 should be encoded to 1029 but binutils encode it to 1028.

While I'm in, add also R_AARCH64_NONE. It can be produced as result of linker
relaxation.

MFC after: 1 week

5 years agoumtx: avoid umtxshm locking on object termination if possible
mjg [Sat, 8 Dec 2018 14:04:57 +0000 (14:04 +0000)]
umtx: avoid umtxshm locking on object termination if possible

Sample build world result on tmpfs:
kern.ipc.umtx_terminate_notempty: 0
kern.ipc.umtx_terminate_empty: 2891815

Sponsored by: The FreeBSD Foundation

5 years agotools: netmap: pkt-gen: check packet length against interface MTU
vmaffione [Sat, 8 Dec 2018 12:52:09 +0000 (12:52 +0000)]
tools: netmap: pkt-gen: check packet length against interface MTU

Validate the value of the -l argument (packet length) against the MTU of the netmap port.
In case the netmap port does not refer to a physical interface (e.g. VALE port or pipe), then
the netmap buffer size is used as MTU.
This change also sets a better default value for the -M option, so that pkt-gen uses
the largest possible fragments in case of multi-slot packets.

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

5 years agosh(1): Remove -c string from set builtin documentation
jilles [Sat, 8 Dec 2018 12:49:19 +0000 (12:49 +0000)]
sh(1): Remove -c string from set builtin documentation

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

MFC after: 1 week

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

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

Sponsored by: The FreeBSD Foundation

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

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

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

Sponsored by: The FreeBSD Foundation

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

kqueue would always relock immediately afterwards.

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

Sponsored by: The FreeBSD Foundation

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

Sponsored by: The FreeBSD Foundation

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

Sponsored by: The FreeBSD Foundation

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

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

Sponsored by: The FreeBSD Foundation

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

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

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

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

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

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

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

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

Sponsored by: Netflix

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

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

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

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

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

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

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

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

MFC after: 1 week

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

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

Sponsored by: The FreeBSD Foundation

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

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

Sponsored by: The FreeBSD Foundation

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

Sponsored by: The FreeBSD Foundation

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

Sponsored by: The FreeBSD Foundation

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

Sponsored by: The FreeBSD Foundation

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

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

Sponsored by: The FreeBSD Foundation

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

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

MFC after: 4 days
X-MFC with: r339754

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

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

MFC after: 4 days
X-MFC with: r339754

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

This adds more detail and fixes some inaccuracies.

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

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

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

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

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

Otherwise cap_openlog(LOG_PERROR) doesn't work.

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

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

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

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

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

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

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

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

Sponsored by: The FreeBSD Foundation

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

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

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

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

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

Reviewed by: kib
Sponsored by: The FreeBSD Foundation

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

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

Sponsored by: The FreeBSD Foundation

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

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

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

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

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

MFC after: 2 weeks

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

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

MFC after: 1 week

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

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

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

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

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

Re-apply r341665 with format strings fixed.

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

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

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

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

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

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

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

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

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

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

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