]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 years agoSmall tweak to the default behavior of shutdown -c
Warner Losh [Fri, 17 Jan 2020 01:20:48 +0000 (01:20 +0000)]
Small tweak to the default behavior of shutdown -c

'shutdown -c' is supposed to power cycle the system rather than doing a normal
reboot. However, when that fails, it halts the system. This is not quite right
since the intent isn't to halt the system but to restart. Make the default init
behavior be to restart the system. The halt(8) interface can be used if you'd
like to powercycle or halt.

MFC After: 1 week
Differential Revision: https://reviews.freebsd.org/D23129

4 years agoWe only want to send the speedup to the lower layers when there's a shortage.
Warner Losh [Fri, 17 Jan 2020 01:16:23 +0000 (01:16 +0000)]
We only want to send the speedup to the lower layers when there's a shortage.

Only send a speedup when there's a shortage. While this is a little racy, lost
races aren't a big deal for this function. If there's a shorage just popping up
after we check these values, then we'll catch it next time. If there's a
shortage that's just clearing up, we may do some work at the lower layers a
little sooner than we otherwise would have. Sicne shortages are relatively rare
events, both races are acceptable.

Reviewed by: chs
Differential Revision: https://reviews.freebsd.org/D23182

4 years agoUse buf to send speedup
Warner Losh [Fri, 17 Jan 2020 01:16:19 +0000 (01:16 +0000)]
Use buf to send speedup

It turns out there's a problem with using g_io to send the speedup. It leads to
a race when there's a resource shortage when a disk fails.

Instead, send BIO_SPEEDUP via struct buf. This is pretty straight forward,
except we need to transfer the bio_flags from b_ioflags for BIO_SPEEDUP commands
in g_vfs_strategy.

Reviewed by: kirk, chs
Differential Revision: https://reviews.freebsd.org/D23117

4 years agoPass BIO_SPEEDUP through all the geom layers
Warner Losh [Fri, 17 Jan 2020 01:15:55 +0000 (01:15 +0000)]
Pass BIO_SPEEDUP through all the geom layers

While some geom layers pass unknown commands down, not all do. For the ones that
don't, pass BIO_SPEEDUP down to the providers that constittue the geom, as
applicable. No changes to vinum or virstor because I was unsure how to add this
support, and I'm also unsure how to test these. gvinum doesn't implement
BIO_FLUSH either, so it may just be poorly maintained. gvirstor is for testing
and not supportig BIO_SPEEDUP is fine.

Reviewed by: chs
Differential Revision: https://reviews.freebsd.org/D23183

4 years agounionfs: use MNTK_NOMSYNC
Mateusz Guzik [Thu, 16 Jan 2020 22:45:08 +0000 (22:45 +0000)]
unionfs: use MNTK_NOMSYNC

4 years agoFix pfdenied not returning any results
Kristof Provost [Thu, 16 Jan 2020 22:08:05 +0000 (22:08 +0000)]
Fix pfdenied not returning any results

When _a is empty we end up with an invalid invocation of pfctl, and no output.
We must add quotes to make it clear to pfctl that we're passing an empty anchor
name.

PR: 224415
Submitted by: sigsys AT gmail.com
MFC after: 2 weeks

4 years agodwmmc: Remove max_hz from the softc
Emmanuel Vadot [Thu, 16 Jan 2020 21:50:53 +0000 (21:50 +0000)]
dwmmc: Remove max_hz from the softc

We never use it so directly set the value to the mmc host structure.

4 years agovfs: increment numvnodes without the vnode list lock unless under pressure
Mateusz Guzik [Thu, 16 Jan 2020 21:45:21 +0000 (21:45 +0000)]
vfs: increment numvnodes without the vnode list lock unless under pressure

The vnode list lock is only needed to reclaim free vnodes or kick the vnlru
thread (or to block and not miss a wake up (but note the sleep has a timeout so
this would not be a correctness issue)). Try to get away without the lock by
just doing an atomic increment.

The lock is contended e.g., during poudriere -j 104 where about half of all
acquires come from vnode allocation code.

Note the entire scheme needs a rewrite, the above just reduces it's SMP impact.

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

4 years agovfs: refcator vnode allocation
Mateusz Guzik [Thu, 16 Jan 2020 21:43:13 +0000 (21:43 +0000)]
vfs: refcator vnode allocation

Semantics are almost identical. Some code is deduplicated and there are
fewer memory accesses.

Reviewed by: kib, jeff
Differential Revision: https://reviews.freebsd.org/D23158

4 years agorandom(6): Fix off-by-one
Conrad Meyer [Thu, 16 Jan 2020 21:38:44 +0000 (21:38 +0000)]
random(6): Fix off-by-one

After r355693, random(6) -f sometimes fail to output all the lines of the
input file.  This is because the range from which random indices are chosen
is too big, so occasionally the random selection doesn't correspond to any
line and nothing gets printed.

(Ed. note: Mea culpa.  Working on r355693, I was confused by the sometime
use of 1-indexing, sometimes 0-indexing in randomize_fd().)

Submitted by: Ryan Moeller <ryan AT freqlabs.com>
X-MFC-With: r355693
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D23199

4 years agosetextattr: Increase stdin buffer size to 4096
Alan Somers [Thu, 16 Jan 2020 21:31:56 +0000 (21:31 +0000)]
setextattr: Increase stdin buffer size to 4096

Extended attribute values can potentially be quite large. One test for ZFS
is supposed to set a 200MB xattr. However, the buffer size for reading
values from stdin with setextattr -i is so small that the test times out
waiting for tiny chunks of data to be buffered and appended to an sbuf.

Increasing the buffer size should help alleviate some of the burden of
reallocating larger sbufs when writing large extended attributes.

Submitted by: Ryan Moeller <ryan@freqlabs.com>
MFC after: 2 weeks
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D23211

4 years agoarm64: rockchip: Add RK3399 PWM driver
Emmanuel Vadot [Thu, 16 Jan 2020 21:25:13 +0000 (21:25 +0000)]
arm64: rockchip: Add RK3399 PWM driver

Add a driver for the pwm controller in the RK3399 SoC

Submitted by: bdragon (original version)
Reviewed by: ganbold (previous version)
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D19046

4 years agoarm64: rockchip: Add new interface for rk_pinctrl
Emmanuel Vadot [Thu, 16 Jan 2020 21:21:20 +0000 (21:21 +0000)]
arm64: rockchip: Add new interface for rk_pinctrl

The gpio controller in rockchips SoC in a child of the pinctrl driver
and cannot control pullups and pulldowns.
Use the new fdt_pinctrl interface for accessing pin capabilities and
setting them.
We can now report that every pins is capable of being IN or OUT function
and PULLUP PULLDOWN.
If the pin isn't in gpio mode no changes will be allowed.

Reviewed by: ganbold (previous version)
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D22849

4 years agofdt_pinctrl: Add new methods for gpios
Emmanuel Vadot [Thu, 16 Jan 2020 21:19:27 +0000 (21:19 +0000)]
fdt_pinctrl: Add new methods for gpios

Most of the gpio controller cannot configure or get the configuration
of the pin muxing as it's usually handled in the pinctrl driver.
But they can know what is the pinmuxing driver either because they are
child of it or via the gpio-range property.
Add some new methods to fdt_pinctrl that a pin controller can implement.
Some methods are :
fdt_pinctrl_is_gpio: Use to know if the pin in the gpio mode
fdt_pinctrl_set_flags: Set the flags of the pin (pullup/pulldown etc ...)
fdt_pinctrl_get_flags: Get the flags of the pin (pullup/pulldown etc ...)

The defaults method returns EOPNOTSUPP.

Reviewed by: ian, bcr (manpages)
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D23093

4 years agoregulator_fixed: Add a get_voltage method
Emmanuel Vadot [Thu, 16 Jan 2020 20:52:26 +0000 (20:52 +0000)]
regulator_fixed: Add a get_voltage method

Some consumer cannot know the voltage of the regulator without it.
While here, refuse to attach is min_voltage != max_voltage, it
shouldn't happens anyway.

Reviewed by: mmel
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D23003

4 years agoarm: allwinner: ahci: target-supply is optional
Emmanuel Vadot [Thu, 16 Jan 2020 20:19:20 +0000 (20:19 +0000)]
arm: allwinner: ahci: target-supply is optional

The target-supply regulator is optional so don't fail if it's not present.
While here disable the clock on detach.

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

4 years agoGenerate MAC address from the FreeBSD OUI range.
Kirill Ponomarev [Thu, 16 Jan 2020 20:12:15 +0000 (20:12 +0000)]
Generate MAC address from the FreeBSD OUI range.

Submitted by: aleksandr.fedorov_vstack_com
Approved by: kevans
Differential Revision: https://reviews.freebsd.org/D23168

4 years agoarm: allwinner: Add support for bank supply
Emmanuel Vadot [Thu, 16 Jan 2020 20:02:41 +0000 (20:02 +0000)]
arm: allwinner: Add support for bank supply

Each GPIO bank is powered by a different pin and so can be powered at different
voltage from different regulators.
Add a new config that now hold the pinmux data and the banks available on each
SoCs.
Since the aw_gpio driver being also the pinmux one it's attached before the PMIC
so add a config_intrhook_oneshot function that will enable the needed regulators
when the system is fully functional.

MFC after: 2 weeks

4 years agoaxp8xx: Add a regnode_init method
Emmanuel Vadot [Thu, 16 Jan 2020 19:59:00 +0000 (19:59 +0000)]
axp8xx: Add a regnode_init method

This method will set the desired voltaged based on values in the DTS.
It will not enable the regulator, this is the job of either a consumer
or regnode_set_constraint SYSINIT if the regulator is boot_on or always_on.

MFC after: 2 weeks

4 years agoaxp8xx: Add missing voltage regulators offset
Emmanuel Vadot [Thu, 16 Jan 2020 19:57:38 +0000 (19:57 +0000)]
axp8xx: Add missing voltage regulators offset

This lead to writing the desired voltage value to the wrong register.

MFC after: 2 weeks

4 years agopkgbase: move profiling _p.a libs into -development packages
Ed Maste [Thu, 16 Jan 2020 17:27:08 +0000 (17:27 +0000)]
pkgbase: move profiling _p.a libs into -development packages

Profiling library archives are part of the development environment; they
don't need to be in separate -profile packages.

(In fact we can probably just eliminate the _p.a archives assuming that
profiling will be done using hwpmc etc., but that is a change for later.)

Discussed with: bapt, manu
Sponsored by: The FreeBSD Foundation

4 years agoRemove debug code not needed anymore.
Michael Tuexen [Thu, 16 Jan 2020 17:15:06 +0000 (17:15 +0000)]
Remove debug code not needed anymore.

Submitted by: Richard Scheffenegger
Reviewed by: tuexen@
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D23208

4 years agoUpdate release(7) to note OSRELEASE is only relevant when the
Glen Barber [Thu, 16 Jan 2020 15:07:52 +0000 (15:07 +0000)]
Update release(7) to note OSRELEASE is only relevant when the
'install' target is invoked.

While here, bump the sample output version name, and explicitly
add the 'obj' target to avoid polluting the src checkout.

Submitted by: Trond Endrestol
PR: 243287 (related)
MFC after: 3 days
Sponsored by: Rubicon Communications, LLC (netgate.com)

4 years agoAllow building bin/cat on non-FreeBSD systems
Alex Richardson [Thu, 16 Jan 2020 14:15:00 +0000 (14:15 +0000)]
Allow building bin/cat on non-FreeBSD systems

`cat -l` is needed during the installworld phase and other system's cat
don't support that flag. To avoid portability issues when compiling on
Linux/macOS (such as the the direct access to &fp->_mbstate), we
disable the entire multibyte support when building as a boostrap tool.

Reviewed By: brooks, emaste
Differential Revision: https://reviews.freebsd.org/D13939

4 years agoAllow bootstrapping mkimg on macOS/Linux
Alex Richardson [Thu, 16 Jan 2020 14:14:55 +0000 (14:14 +0000)]
Allow bootstrapping mkimg on macOS/Linux

On these systems the (u)int64_t typedefs will not be implicitly defined by the
previous includes, so include <stdint.h> in the header that uses uint64_t.

Reviewed By: brooks
Differential Revision: https://reviews.freebsd.org/D23202

4 years agoMerge commit 894f742acb from llvm git (by me):
Alex Richardson [Thu, 16 Jan 2020 14:14:50 +0000 (14:14 +0000)]
Merge commit 894f742acb from llvm git (by me):

  [MIPS][ELF] Use PC-relative relocations in .eh_frame when possible

  When compiling position-independent executables, we now use
  DW_EH_PE_pcrel | DW_EH_PE_sdata4. However, the MIPS ABI does not define a
  64-bit PC-relative ELF relocation so we cannot use sdata8 for the large
  code model case. When using the large code model, we fall back to the
  previous behaviour of generating absolute relocations.

  With this change clang-generated .o files can be linked by LLD without
  having to pass -Wl,-z,notext (which creates text relocations).
  This is simpler than the approach used by ld.bfd, which rewrites the
  .eh_frame section to convert absolute relocations into relative references.

  I saw in D13104 that apparently ld.bfd did not accept pc-relative relocations
  for MIPS ouput at some point. However, I also checked that recent ld.bfd
  can process the clang-generated .o files so this no longer seems true.

  Reviewed By: atanasyan
  Differential Revision: https://reviews.llvm.org/D72228

Merge commit 8e8ccf47 from llvm git (by me)

  [MIPS] Don't emit R_(MICRO)MIPS_JALR relocations against data symbols

  The R_(MICRO)MIPS_JALR optimization only works when used against functions.
  Using the relocation against a data symbol (e.g. function pointer) will
  cause some linkers that don't ignore the hint in this case (e.g. LLD prior
  to commit 5bab291) to generate a relative branch to the data symbol
  which crashes at run time. Before this patch, LLVM was erroneously emitting
  these relocations against local-dynamic TLS function pointers and global
  function pointers with internal visibility.

  Reviewers: atanasyan, jrtc27, vstefanovic
  Reviewed By: atanasyan
  Differential Revision: https://reviews.llvm.org/D72571

These two changes should allow using lld for MIPS64 (and maybe also MIPS32)
by default.
The second commit is not strictly necessary for clang+lld since LLD9 will
not perform the R_MIPS_JALR optimization (it was only added for 10) but it
is probably required in order to use recent ld.bfd.

Reviewed By: dim, emaste
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D23203

4 years ago[PowerPC64] Enable virtio drivers
Leandro Lupori [Thu, 16 Jan 2020 11:33:15 +0000 (11:33 +0000)]
[PowerPC64] Enable virtio drivers

This enables virtio modules on PowerPC* target.
On PowerPC64, drivers are also kernel builtin.

QEMU currently needs to be patched to in order to work on LE hosts due to known
issue affecting pre-1.0 (legacy) virtio drivers.

The patch was submitted to QEMU mail list by @afscoelho_gmail.com, available at
https://lists.nongnu.org/archive/html/qemu-devel/2020-01/msg01496.html

Submitted by: Alfredo Dal'Ava Junior <alfredo.junior@eldorado.org.br>
Reviewed by: luporl
Differential Revision: https://reviews.freebsd.org/D22833

4 years agovfs: reimplement vlrureclaim to actually use LRU
Mateusz Guzik [Thu, 16 Jan 2020 10:44:02 +0000 (10:44 +0000)]
vfs: reimplement vlrureclaim to actually use LRU

Take advantage of global ordering introduced in r356672.

Reviewed by: mckusick (previous version)
Differential Revision: https://reviews.freebsd.org/D23067

4 years agoSimplify VM and UMA startup by eliminating boot pages. Instead use careful
Jeff Roberson [Thu, 16 Jan 2020 05:01:21 +0000 (05:01 +0000)]
Simplify VM and UMA startup by eliminating boot pages.  Instead use careful
ordering to allocate early pages in the same way boot pages were but only
as needed.  After the KVA allocator has started up we allocate the KVA that
we consumed during boot.  This also makes the boot pages freeable since they
have vm_page structures allocated with the rest of memory.

Parts of this patch were written and tested by markj.

Reviewed by: glebius, markj
Differential Revision: https://reviews.freebsd.org/D23102

4 years ago[PPC64] memcpy/memmove/bcopy optimization
Leandro Lupori [Wed, 15 Jan 2020 20:25:52 +0000 (20:25 +0000)]
[PPC64] memcpy/memmove/bcopy optimization

For copies shorter than 512 bytes, the data is copied using plain
ld/std instructions.
For 512 bytes or more, the copy is done in 3 phases:

Phase 1: copy from the src buffer until it's aligned at a 16-byte boundary
Phase 2: copy as many aligned 64-byte blocks from the src buffer as possible
Phase 3: copy the remaining data, if any

In phase 2, this code uses VSX instructions when available. Otherwise,
it uses ldx/stdx.

Submitted by: Luis Pires <lffpires_ruabrasil.org> (original version)
Reviewed by: jhibbits
Differential Revision: https://reviews.freebsd.org/D15118

4 years ago[PPC64] strncpy optimization
Leandro Lupori [Wed, 15 Jan 2020 19:53:03 +0000 (19:53 +0000)]
[PPC64] strncpy optimization

Assembly optimization of strncpy for PowerPC64, using double words
instead of bytes to copy strings.

Submitted by: Leonardo Bianconi <leonardo.bianconi_eldorado.org.br> (original version)
Reviewed by: jhibbits
Differential Revision: https://reviews.freebsd.org/D15369

4 years ago[PPC64] strcpy optimization
Leandro Lupori [Wed, 15 Jan 2020 19:46:01 +0000 (19:46 +0000)]
[PPC64] strcpy optimization

Assembly optimization of strcpy for PowerPC64, using double words
instead of bytes to copy strings.

Submitted by: Leonardo Bianconi <leonardo.bianconi_eldorado.org.br> (original version)
Reviewed by: jhibbits
Differential Revision: https://reviews.freebsd.org/D15368

4 years agoacpi_ibm: reference ThinkPad instead of IBM
Ed Maste [Wed, 15 Jan 2020 19:43:45 +0000 (19:43 +0000)]
acpi_ibm: reference ThinkPad instead of IBM

These are now Lenovo ThinkPads, not IBM ThinkPads.

PR: 234403
Submitted by: Kevin Zheng <kevinz5000@gmail.com> (original)

4 years agoPeter Holm reports that his test that does an umount(8) on an active
Kirk McKusick [Wed, 15 Jan 2020 18:53:32 +0000 (18:53 +0000)]
Peter Holm reports that his test that does an umount(8) on an active
mount point while numerous tests are running that are writing to
files on that mount point cause the unmount(8) to hang forever.

The unmount(8) system call is handled in the kernel by the dounmount()
function. The cause of the hang is that prior to dounmount() calling
VFS_UNMOUNT() it is calling VFS_SYNC(mp, MNT_WAIT). The MNT_WAIT
flag indicates that VFS_SYNC() should not return until all the dirty
buffers associated with the mount point have been written to disk.
Because user processes are allowed to continue writing and can do
so faster than the data can be written to disk, the call to VFS_SYNC()
can never finish.

Unlike VFS_SYNC(), the VFS_UNMOUNT() routine can suspend all processes
when they request to do a write thus having a finite number of dirty
buffers to write that cannot be expanded. There is no need to call
VFS_SYNC() before calling VFS_UNMOUNT(), because VFS_UNMOUNT() needs
to flush everything again anyway after suspending writes, to catch
anything that was dirtied between the VFS_SYNC() and writes being
suspended.

The fix is to simply remove the unnecessary call to VFS_SYNC() from
dounmount().

Reported by:  Peter Holm
Analysis by:  Chuck Silvers
Tested by:    Peter Holm
MFC after:    7 days
Sponsored by: Netflix

4 years agoFix a spacing error from the previous commit for -ll mode. Add a little
Scott Long [Wed, 15 Jan 2020 16:47:44 +0000 (16:47 +0000)]
Fix a spacing error from the previous commit for -ll mode.  Add a little
more space padding to that mode to give the columns a consistent offset.

4 years agomips trampoline: don't bother with unwind tables
Kyle Evans [Wed, 15 Jan 2020 15:59:32 +0000 (15:59 +0000)]
mips trampoline: don't bother with unwind tables

The utility here seems somewhat limited, but clang will attempt to generate
.eh_frame and actively fail in doing so. It is perhaps worth investigating
why it's being generated in the first place (GCC doesn't do so), but this
isn't a high priority.

4 years agoHandle a NULL thread pointer in linux_close_file().
Mark Johnston [Wed, 15 Jan 2020 15:31:35 +0000 (15:31 +0000)]
Handle a NULL thread pointer in linux_close_file().

This can happen if a file is closed during unix socket GC.  The same bug
was fixed for devfs descriptors in r228361.

PR: 242913
Reported and tested by: iz-rpi03@hs-karlsruhe.de
Reviewed by: hselasky, kib
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D23178

4 years agoUpdate WITHOUT_BINUTILS* descriptions
Ed Maste [Wed, 15 Jan 2020 13:52:13 +0000 (13:52 +0000)]
Update WITHOUT_BINUTILS* descriptions

In the WITHOUT_ descriptions we don't need to mention that ld.bfd is
limited to powerpc. When WITHOUT_BINUTILS is specified ld.bfd is not
installed on any CPU architecture.

4 years agobsdinstall: Change "default" (first) Partitioning method to ZFS
Ben Woods [Wed, 15 Jan 2020 07:47:52 +0000 (07:47 +0000)]
bsdinstall: Change "default" (first) Partitioning method to ZFS

Reported by: Ruben Schade (during his talk at linux.conf.au)
Approved by: philip
Differential Revision: https://reviews.freebsd.org/D23173

4 years agogif_transmit() must always be called in the network epoch.
Gleb Smirnoff [Wed, 15 Jan 2020 06:18:32 +0000 (06:18 +0000)]
gif_transmit() must always be called in the network epoch.

4 years agoA miss from r356754.
Gleb Smirnoff [Wed, 15 Jan 2020 06:12:39 +0000 (06:12 +0000)]
A miss from r356754.

4 years agoIntroduce NET_EPOCH_CALL() macro and use it everywhere where we free
Gleb Smirnoff [Wed, 15 Jan 2020 06:05:20 +0000 (06:05 +0000)]
Introduce NET_EPOCH_CALL() macro and use it everywhere where we free
data based on the network epoch.   The macro reverses the argument
order of epoch_call(9) - first function, then its argument. NFC

4 years agoUse official macro to enter/exit the network epoch. NFC
Gleb Smirnoff [Wed, 15 Jan 2020 05:48:36 +0000 (05:48 +0000)]
Use official macro to enter/exit the network epoch. NFC

4 years agoMechanically substitute assertion of in_epoch(net_epoch_preempt) to
Gleb Smirnoff [Wed, 15 Jan 2020 05:45:27 +0000 (05:45 +0000)]
Mechanically substitute assertion of in_epoch(net_epoch_preempt) to
NET_EPOCH_ASSERT(). NFC

4 years agoStop header pollution and don't include if_var.h via in_pcb.h.
Gleb Smirnoff [Wed, 15 Jan 2020 03:41:15 +0000 (03:41 +0000)]
Stop header pollution and don't include if_var.h via in_pcb.h.

4 years agoSince this code dereferences struct ifnet, it must include if_var.h
Gleb Smirnoff [Wed, 15 Jan 2020 03:40:32 +0000 (03:40 +0000)]
Since this code dereferences struct ifnet, it must include if_var.h
explicitly, not via header pollution.  While here move TCPSTATES
declaration right above the include that is going to make use of it.

4 years agoSince this code uses if_ref()/if_rele() it must include if_var.h
Gleb Smirnoff [Wed, 15 Jan 2020 03:39:11 +0000 (03:39 +0000)]
Since this code uses if_ref()/if_rele() it must include if_var.h
explicitly, not via header pollution.

4 years agoNetgraph queue processing thread must process all its items
Gleb Smirnoff [Wed, 15 Jan 2020 03:35:57 +0000 (03:35 +0000)]
Netgraph queue processing thread must process all its items
in the network epoch.

Reported by: Michael Zhilin <mizhka@ >

4 years ago- Move global network epoch definition to epoch.h, as more different
Gleb Smirnoff [Wed, 15 Jan 2020 03:34:21 +0000 (03:34 +0000)]
- Move global network epoch definition to epoch.h, as more different
  subsystems tend to need to know about it, and including if_var.h is
  huge header pollution for them.  Polluting possible non-network
  users with single symbol seems much lesser evil.
- Remove non-preemptible network epoch.  Not used yet, and unlikely
  to get used in close future.

4 years agoThe non-preemptible network epoch identified by net_epoch isn't used.
Gleb Smirnoff [Wed, 15 Jan 2020 03:30:33 +0000 (03:30 +0000)]
The non-preemptible network epoch identified by net_epoch isn't used.
This code definitely meant net_epoch_preempt.

4 years agovfs: in vop_stdadd_writecount only vlazy vnodes on mounts using msync
Mateusz Guzik [Wed, 15 Jan 2020 01:34:05 +0000 (01:34 +0000)]
vfs: in vop_stdadd_writecount only vlazy vnodes on mounts using msync

The only reason to vlazy there is to (overzealously) ensure all vnodes
which need to be visited by msync scan can be found there.

In particluar this is of no use zfs and tmpfs.

While here depessimize the check.

4 years agotmpfs: add missing CLTFLAG_MPSAFE annotation
Mateusz Guzik [Wed, 15 Jan 2020 01:32:11 +0000 (01:32 +0000)]
tmpfs: add missing CLTFLAG_MPSAFE annotation

4 years agonfs: add missing CLTFLAG_MPSAFE annotations
Mateusz Guzik [Wed, 15 Jan 2020 01:31:57 +0000 (01:31 +0000)]
nfs: add missing CLTFLAG_MPSAFE annotations

4 years agofusefs: add missing CLTFLAG_MPSAFE annotation
Mateusz Guzik [Wed, 15 Jan 2020 01:31:28 +0000 (01:31 +0000)]
fusefs: add missing CLTFLAG_MPSAFE annotation

4 years agortld: remove hand rolled memset and bzero
Mateusz Guzik [Wed, 15 Jan 2020 01:30:32 +0000 (01:30 +0000)]
rtld: remove hand rolled memset and bzero

They were introduced to take care of ifunc, but right now no architecture
provides ifunc'ed variants. Since rtld uses memset extensively this results in
a pessmization. Should someone want to use ifunc here they should provide a
mandatory symbol (e.g., rtld_memset).

See the review for profiling data.

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

4 years agobsdinstall: Use TMPDIR if set
Rebecca Cran [Wed, 15 Jan 2020 00:45:05 +0000 (00:45 +0000)]
bsdinstall: Use TMPDIR if set

Submitted by: Ryan Moeller <ryan@freqlabs.com>
Reviewed by: bcran, Nick Wolff <darkfiberiru@gmail.com>
Differential Revision: https://reviews.freebsd.org/D22979/

4 years agoWhen sync'ing a mount point, the mount point's vnodes were scanned
Kirk McKusick [Tue, 14 Jan 2020 22:27:46 +0000 (22:27 +0000)]
When sync'ing a mount point, the mount point's vnodes were scanned
twice. Once to update the changed inodes, and a second time to update
changed quota information. This change merges these two scans into a
single scan which does both inode and quota updates.

MFC after: 7 days

4 years agosrc.conf.5: regen after r356736, limiting ld.bfd to powerpc
Ed Maste [Tue, 14 Jan 2020 18:06:09 +0000 (18:06 +0000)]
src.conf.5: regen after r356736, limiting ld.bfd to powerpc

4 years agoPreserve the inherited value of the status register in cpu_set_upcall().
John Baldwin [Tue, 14 Jan 2020 18:00:04 +0000 (18:00 +0000)]
Preserve the inherited value of the status register in cpu_set_upcall().

Instead of re-deriving the value of SR using logic similar to
exec_set_regs(), just inherit the value from the existing thread
similar to fork().

Reviewed by: brooks
Obtained from: CheriBSD
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D23059

4 years agolimit ld.bfd to powerpc
Ed Maste [Tue, 14 Jan 2020 17:56:54 +0000 (17:56 +0000)]
limit ld.bfd to powerpc

All archs except powerpc either use lld or require external toolchain.
powerpc still needs binutils ld to link 32-bit binaries.

Reviewed by: jhibbits
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D23107

4 years agoRevert r353140: Re-add ALLOW_MIPS_SHARED_TEXTREL, sprinkle it around
Kyle Evans [Tue, 14 Jan 2020 17:50:13 +0000 (17:50 +0000)]
Revert r353140: Re-add ALLOW_MIPS_SHARED_TEXTREL, sprinkle it around

arichardson has an actual fix for the same issue that this was working
around; given that we don't build with llvm today, go ahead and revert the
workaround in advance.

4 years agosrc.conf.5: regen after option description updates
Ed Maste [Tue, 14 Jan 2020 17:38:34 +0000 (17:38 +0000)]
src.conf.5: regen after option description updates

4 years agoUpdate WITH_/WITHOUT_CLANG_IS_CC descriptions
Ed Maste [Tue, 14 Jan 2020 17:35:34 +0000 (17:35 +0000)]
Update WITH_/WITHOUT_CLANG_IS_CC descriptions

Describe /usr/bin/cc etc. as links to the compiler, and don't conflate
WITHOUT_CLANG_IS_CC with installing GCC.  Leave a reference to WITH_GCC
and WITHOUT_CLANG_IS_CC installing links to GCC, although this will be
removed in ~1.5 months when GCC 4.2.1 is removed from the tree.

Sponsored by: The FreeBSD Foundation

4 years agoUpdate WITH_AMD description reflecting upcoming removal
Ed Maste [Tue, 14 Jan 2020 16:59:21 +0000 (16:59 +0000)]
Update WITH_AMD description reflecting upcoming removal

In-tree amd(8) is deprecated; update WITH_AMD's description to make
this more clear.

Sponsored by: The FreeBSD Foundation

4 years agoDo not skip line-by-line comparison if -q and -I are specified.
Mark Johnston [Tue, 14 Jan 2020 15:35:03 +0000 (15:35 +0000)]
Do not skip line-by-line comparison if -q and -I are specified.

This fixes a regression from r356695.

Submitted by: kevans
Reported by: Jenkins via lwhsu
MFC after: 6 days

4 years agostorvsc: port a Linux patch, properly set residual data length on errors
Andriy Gapon [Tue, 14 Jan 2020 13:20:16 +0000 (13:20 +0000)]
storvsc: port a Linux patch, properly set residual data length on errors

This change is based on Linux commit 40630f462824ee.  csio.resid should
account for transfer_len only for success and SRB_STATUS_DATA_OVERRUN
condition.

I am not sure how exactly this change works, but I have a report from a
user that they see lots of checksum errors when running a pool scrub
concurrently with iozone -l 1 -s 100G.  After applying this patch the
problem cannot be reproduced.

Reviewed by: nobody
Sponsored by: CyberSecure
Differential Revision: https://reviews.freebsd.org/D22312

4 years agoMake linux(4) use kern_setsockopt(9) instead of going through
Edward Tomasz Napierala [Tue, 14 Jan 2020 11:33:07 +0000 (11:33 +0000)]
Make linux(4) use kern_setsockopt(9) instead of going through
sys_setsockopt.  Just a cleanup; no functional changes.

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

4 years agoMake linux(4) use kern_getsockopt(9) instead of going through
Edward Tomasz Napierala [Tue, 14 Jan 2020 11:30:30 +0000 (11:30 +0000)]
Make linux(4) use kern_getsockopt(9) instead of going through
sys_getsockopt().  It's a cleanup; no functional changes.

Reviewed by: kib (earlier version)
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D22813

4 years agoMake linux getcpu(2) report the domain.
Edward Tomasz Napierala [Tue, 14 Jan 2020 11:24:06 +0000 (11:24 +0000)]
Make linux getcpu(2) report the domain.

Submitted by: markj
Reviewed by: markj
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D23144

4 years agoWhen system calls indicate an error they return -1, not some arbitrary
Baptiste Daroussin [Tue, 14 Jan 2020 08:22:28 +0000 (08:22 +0000)]
When system calls indicate an error they return -1, not some arbitrary
value < 0.  errno is only updated in this case.

Obtained from: OpenBSD
MFC after: 3 days

4 years agoasprintf returns -1, not an arbitrary value < 0. Also upon error the
Baptiste Daroussin [Tue, 14 Jan 2020 08:18:04 +0000 (08:18 +0000)]
asprintf returns -1, not an arbitrary value < 0. Also upon error the
(very sloppy specification) leaves an undefined value in *ret, so it is
wrong to inspect it, the error condition is enough.

Obtained from: OpenBSD
MFC after: 3 days

4 years agomkstemp returns -1
Baptiste Daroussin [Tue, 14 Jan 2020 08:16:15 +0000 (08:16 +0000)]
mkstemp returns -1

Obtained from: OpenBSD
MFC after: 3 days

4 years agoRestore loop break in vm_pageout_lowmem().
Alexander Motin [Tue, 14 Jan 2020 03:27:57 +0000 (03:27 +0000)]
Restore loop break in vm_pageout_lowmem().

r355004 removed return statement from this loop with intention to also
call uma_reclaim_wakeup().  But in case of vm.lowmem_period=0 it causes
infinite loop.

Reviewed by: markj
Sponsored by: iXsystems, Inc.

4 years agouma: split slabzone into two sizes
Ryan Libby [Tue, 14 Jan 2020 02:14:15 +0000 (02:14 +0000)]
uma: split slabzone into two sizes

By allowing more items per slab, we can improve memory efficiency for
small allocs.  If we were just to increase the bitmap size of the
slabzone, we would then waste slabzone memory.  So, split slabzone into
two zones, one especially for 8-byte allocs (512 per slab).  The
practical effect should be reduced memory usage for counter(9).

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

4 years agomalloc: remove assumptions about MINALLOCSIZE
Ryan Libby [Tue, 14 Jan 2020 02:14:02 +0000 (02:14 +0000)]
malloc: remove assumptions about MINALLOCSIZE

Remove assumptions about the minimum MINALLOCSIZE, in order to allow
testing of smaller MINALLOCSIZE.  A following patch will lower the
MINALLOCSIZE, but not so much that the present patch is required for
correctness at these sites.

Reviewed by: jeff, markj
Sponsored by: Dell EMC Isilon

4 years agouma: fixup some ktr messages
Ryan Libby [Tue, 14 Jan 2020 02:13:46 +0000 (02:13 +0000)]
uma: fixup some ktr messages

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

4 years agoFix a long standing bug in journaled soft-updates. The dirrem structure
Jeff Roberson [Tue, 14 Jan 2020 02:00:24 +0000 (02:00 +0000)]
Fix a long standing bug in journaled soft-updates.  The dirrem structure
needs to handle file removal, directory removal, file move, directory move,
etc.  The code in handle_workitem_remove() needs to propagate any completed
journal entries to the write that will render the change stable.  In the
case of a moved directory this means the new parent.  However, for an
overwrite that frees a directory (DIRCHG) we must move the jsegdep to the
removed inode to be released when it is stable in the cg bitmap or the
unlinked inode list.  This case was previously unhandled and caused a
panic.

Reported by: mckusick, pho
Reviewed by: mckusick
Tested by: pho

4 years agocxgbe/iw_cxgbe: Do not allow memory registrations with page size greater
Navdeep Parhar [Tue, 14 Jan 2020 01:43:04 +0000 (01:43 +0000)]
cxgbe/iw_cxgbe: Do not allow memory registrations with page size greater
than 128MB, which is the maximum supported by the hardware in RDMA mode.

Obtained from: Chelsio Communications
MFC after: 3 days
Sponsored by: Chelsio Communications

4 years agopowerpc/mpc85xx: Partially revert r356640
Justin Hibbits [Mon, 13 Jan 2020 23:09:00 +0000 (23:09 +0000)]
powerpc/mpc85xx: Partially revert r356640

The count block was correct before.  r356640 caused a read past the end of
the tuple.

4 years agofstyp hammer2: remove dead code
Eric van Gyzen [Mon, 13 Jan 2020 22:36:29 +0000 (22:36 +0000)]
fstyp hammer2: remove dead code

best_i will always be >= 0, so remove code to test otherwise.

Reported by: Coverity
CID: 1412244
MFC after: 2 weeks
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D23159

4 years agofstyp hammer: use strlcpy
Eric van Gyzen [Mon, 13 Jan 2020 22:33:48 +0000 (22:33 +0000)]
fstyp hammer: use strlcpy

Use strlcpy to guarantee NUL termination.  Due to this, there is
no need for strncmp; simply use strcmp.

Reported by: Coverity
CID: 1412242
MFC after: 2 weeks
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D23159

4 years agoMap ECKSUM and EFRAGS from ZFS onto real errnos.
Alexander Motin [Mon, 13 Jan 2020 22:06:16 +0000 (22:06 +0000)]
Map ECKSUM and EFRAGS from ZFS onto real errnos.

Make it less confusing when, for example, stat sets errno to 122 because a
checksum failed in ZFS:

Before: getfacl: /foo/bar: stat() failed: Unknown error: 122
After: getfacl: /foo/bar: stat() failed: Integrity check failed

Submitted by: Ryan Moeller <ryan@ixsystems.com>
Reviewed by: mckusick, mav
MFC after: 2 weeks
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D22973

4 years agosavecore: include time zone in info.N file
Eric van Gyzen [Mon, 13 Jan 2020 22:01:37 +0000 (22:01 +0000)]
savecore: include time zone in info.N file

This helps with event correlation when machines are distributed
across multiple time zones.

Format the time with relaxed ISO 8601 for all the usual reasons.

MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

4 years agoAdd missing comma in nfsv4_errstr
Eric van Gyzen [Mon, 13 Jan 2020 21:49:27 +0000 (21:49 +0000)]
Add missing comma in nfsv4_errstr

Reported by: Coverity
CID: 1412243
Sponsored by: Dell EMC Isilon

4 years agonetmap: disable passthrough with no hypervisor support
Vincenzo Maffione [Mon, 13 Jan 2020 21:47:23 +0000 (21:47 +0000)]
netmap: disable passthrough with no hypervisor support

The netmap passthrough subsystem requires proper support in the
hypervisor. In particular, two PCI device ids (from the Red Hat
PCI vendor id 0x1b36) need to be assigned to the two netmap
virtual devices. We then disable these devices until the ids have
not been assigned, in order to avoid conflicts with other
virtual devices emulated by upstream QEMU.

PR: 241774
MFC after: 3 days

4 years agovmx: fix initialization of TSO related descriptor fields
Vincenzo Maffione [Mon, 13 Jan 2020 21:26:17 +0000 (21:26 +0000)]
vmx: fix initialization of TSO related descriptor fields

Fix a mistake introduced by r343291, which ported the vmx(4)
driver to iflib.
In case of TSO, the hlen field of the (first) tx descriptor must
be initialized to the cumulative length of Ethernet, IP and TCP
headers. The length of the TCP header was missing.

PR: 236999
Reported by: pkelsey
Reviewed by: avg
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D22967

4 years agoFix yet another regression from r354484. Error code from cr_cansee()
Gleb Smirnoff [Mon, 13 Jan 2020 21:12:10 +0000 (21:12 +0000)]
Fix yet another regression from r354484. Error code from cr_cansee()
aliases with hard error from other operations.

Reported by: flo

4 years agoMerge commit f46ba4f07 from llvm git (by Simon Atanasyan):
Dimitry Andric [Mon, 13 Jan 2020 20:31:10 +0000 (20:31 +0000)]
Merge commit f46ba4f07 from llvm git (by Simon Atanasyan):

  [mips] Use less registers to load address of TargetExternalSymbol

  There is no pattern matched `add hi, (MipsLo texternalsym)`. As a
  result, loading an address of 32-bit symbol requires two registers
  and one more additional instruction:
  ```
  addiu $1, $zero, %lo(foo)
  lui   $2, %hi(foo)
  addu  $25, $2, $1
  ```

  This patch adds the missed pattern and enables generation more
  effective set of instructions:
  ```
  lui   $1, %hi(foo)
  addiu $25, $1, %lo(foo)
  ```

  Differential Revision: https://reviews.llvm.org/D66771

  llvm-svn: 370196

Merge commit 59bb3609f from llvm git (by Simon Atanasyan):

  [mips] Fix 64-bit address loading in case of applying 32-bit mask to
  the result

  If result of 64-bit address loading combines with 32-bit mask, LLVM
  tries to optimize the code and remove "redundant" loading of upper
  32-bits of the address. It leads to incorrect code on MIPS64 targets.

  MIPS backend creates the following chain of commands to load 64-bit
  address in the `MipsTargetLowering::getAddrNonPICSym64` method:
  ```
  (add (shl (add (shl (add %highest(sym), %higher(sym)),
      16),
 %hi(sym)),
    16),
       %lo(%sym))
  ```

  If the mask presents, LLVM decides to optimize the chain of commands.
  It really does not make sense to load upper 32-bits because the
  0x0fffffff mask anyway clears them. After removing redundant commands
  we get this chain:
  ```
  (add (shl (%hi(sym), 16), %lo(%sym))
  ```

  There is no patterns matched `(MipsHi (i64 symbol))`. Due a bug in
  `SYM_32` predicate definition, backend incorrectly selects a pattern
  for a 32-bit symbols and uses the `lui` instruction for loading
  `%hi(sym)`.

  As a result we get incorrect set of instructions with unnecessary
  16-bit left shifting:
  ```
  lui     at,0x0
      R_MIPS_HI16     foo
  dsll    at,at,0x10
  daddiu  at,at,0
      R_MIPS_LO16     foo
  ```

  This patch resolves two problems:
  - Fix `SYM_32/SYM_64` predicates to prevent selection of patterns
    dedicated to 32-bit symbols in case of using N64 ABI.
  - Add missed patterns for 64-bit symbols for `%hi/%lo`.

  Fix PR42736.

  Differential Revision: https://reviews.llvm.org/D66228

  llvm-svn: 370268

These two commits fix a miscompilation of the kernel for mips64, and
should allow clang to be used as the default compiler for mips64.

Requested by: arichards
MFC after: 3 days

4 years agoBackout 356693. The libsa malloc does provide necessary alignment and
Toomas Soome [Mon, 13 Jan 2020 20:02:27 +0000 (20:02 +0000)]
Backout 356693. The libsa malloc does provide necessary alignment and
memalign by 4 will reduce alignment for some platforms. Thanks for Ian for
pointing this out.

4 years agoOptimize diff -q.
Mark Johnston [Mon, 13 Jan 2020 18:29:47 +0000 (18:29 +0000)]
Optimize diff -q.

Once we know whether the files differ, we don't need to do any further
work.

PR: 242828
Submitted by: fehmi noyan isi <fnoyanisi@yahoo.com> (original version)
Reviewed by: bapt, kevans
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D23152

4 years agotap(4): also note that we drop configured addresses
Kyle Evans [Mon, 13 Jan 2020 18:26:27 +0000 (18:26 +0000)]
tap(4): also note that we drop configured addresses

This provides a specific pointer for users of tap(4) to understand why their
interfaces are losing their addresses, and specifically how to workaround
this if they need different behavior.

This manpage received a .Dd bump earlier today in r35688, so no bump occurs
this time.

Submitted by: sigsys@gmail.com (via IRC)

4 years agoloader: allocate properly aligned buffer for network packet
Toomas Soome [Mon, 13 Jan 2020 18:22:54 +0000 (18:22 +0000)]
loader: allocate properly aligned buffer for network packet

Use memalign(4, size) to ensure we have properly aligned buffer.

MFC after: 2 weeks

4 years agoInstall tap(4) manpage as vmnet(4) as well
Kyle Evans [Mon, 13 Jan 2020 17:02:42 +0000 (17:02 +0000)]
Install tap(4) manpage as vmnet(4) as well

If one comes across a vmnet interface, this is a useful pointer to have
towards what it actually is if they're otherwise unfamiliar.

MFC after: 3 days

4 years agogprof: Enable riscv
Kristof Provost [Mon, 13 Jan 2020 16:52:26 +0000 (16:52 +0000)]
gprof: Enable riscv

Add a missing riscv.h header file, and fix the check for riscv (must test
MACHINE_CPUARCH, not MACHINE_ARCH, if we want to use 'riscv').

Sponsored by: Axiado

4 years agoFix a typo.
Glen Barber [Mon, 13 Jan 2020 16:31:58 +0000 (16:31 +0000)]
Fix a typo.

MFC after: 3 days
Sponsored by: Rubicon Communications, LLC (netgate.com)

4 years agoEnsure the TYPE, BRANCH, and REVISION variables are set in
Glen Barber [Mon, 13 Jan 2020 16:31:00 +0000 (16:31 +0000)]
Ensure the TYPE, BRANCH, and REVISION variables are set in
cloudware targets when OSRELEASE is overridden.

Submitted by: Trond Endrestol
PR: 243287
MFC after: 3 days
Sponsored by: Rubicon Communications, LLC (netgate.com)

4 years agosrc.conf.5: regen after r356615, KERBEROS_SUPPORT dep on KERBEROS
Ed Maste [Mon, 13 Jan 2020 14:50:22 +0000 (14:50 +0000)]
src.conf.5: regen after r356615, KERBEROS_SUPPORT dep on KERBEROS

4 years agoufs: relax an overzealous assert added in r356671
Mateusz Guzik [Mon, 13 Jan 2020 14:33:51 +0000 (14:33 +0000)]
ufs: relax an overzealous assert added in r356671

Part of i_flag can persist across a drop to hold count of 0, at which
point the vnode is taken off the lazy list. Then whoever locks and unlocks
the vnode can trip on the assert.

This trips over kyua running a test untarring character devices to ufs.

Reported by: lwhsu

4 years agoCode must not unlock a mutex while owning the thread lock.
Konstantin Belousov [Mon, 13 Jan 2020 14:30:19 +0000 (14:30 +0000)]
Code must not unlock a mutex while owning the thread lock.

Reviewed by: hselasky, markj
Sponsored by: Mellanox Technologies
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D23150

4 years agoSync with r356645. desiredvnodes is now maxvnodes.
Cy Schubert [Mon, 13 Jan 2020 06:55:38 +0000 (06:55 +0000)]
Sync with r356645. desiredvnodes is now maxvnodes.