]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
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 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

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

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

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

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

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

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

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

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

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

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

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

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

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

Sponsored by: Netflix

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

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

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

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

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

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

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

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

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

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

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

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

fold

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

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

Sponsored by: DARPA

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

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

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

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

MFC after: 1 month
Sponsored by: Chelsio Communicatons

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

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

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

Cleanup of stats cache
and new :q modifier.

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

Reported by: sjg@
Pointy hat: ian@

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

MFC after: 1 week

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

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

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

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

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

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

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

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

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

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

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

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

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

Submitted by: kib

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

Obtained from: OpenBSD