]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agovmstat(1): various nits
eadler [Wed, 13 Jun 2018 08:52:04 +0000 (08:52 +0000)]
vmstat(1): various nits

Continue my parade on introspection tools by fixing:
- failed to check for null after reallocf
- avoid the comma operator
- mark usage as dead
- correct size of len

6 years agoFix some bugs found while fixing the representation and translation
bde [Wed, 13 Jun 2018 08:50:43 +0000 (08:50 +0000)]
Fix some bugs found while fixing the representation and translation
of 64-bit dev_t's (but not ones involving dev_t's).

st_size was supposed to be clamped in cvtstat() and linux's copy_stat(),
but the clamping code wasn't aware that st_size is signed, and also had
an obfuscated off-by-1 value for the unsigned limit, so its effect was
to produce a bizarre negative size instead of clamping.

Change freebsd32's copy_ostat() to be no worse than cvtstat().  It was
missing clamping and bzero()ing of padding.

Reviewed by: kib (except a final fix of the clamp to the signed maximum)

6 years agoFix build of liquidio with base gcc on i386
dim [Wed, 13 Jun 2018 07:55:57 +0000 (07:55 +0000)]
Fix build of liquidio with base gcc on i386

Some casts from pointers to uint64_t and back in lio_main.c cause base
gcc on i386 to warn "cast from pointer to integer of different size",
and vice versa.  Add additional casts to uintptr_t to suppress these.

Reviewed by: sbruno
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D15754

6 years agoAdd SPDX tags to vmm(4).
araujo [Wed, 13 Jun 2018 07:02:58 +0000 (07:02 +0000)]
Add SPDX tags to vmm(4).

MFC after: 4 weeks.
Sponsored by: iXsystems Inc.

6 years agoUse "$@" instead of $* to cope with parameters that have spaces in
imp [Wed, 13 Jun 2018 06:11:04 +0000 (06:11 +0000)]
Use "$@" instead of $* to cope with parameters that have spaces in
them. "$@" preserves the args with spaces properly.

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

6 years agoHandle INP_FREED when looking up an inpcb
mmacy [Wed, 13 Jun 2018 04:23:49 +0000 (04:23 +0000)]
Handle INP_FREED when looking up an inpcb

When hash table lookups are not serialized with in_pcbfree it will be
possible for callers to find an inpcb that has been marked free. We
need to check for this and return NULL.

6 years agoWhen this code was introduced at r300829 the author forgot to add
araujo [Wed, 13 Jun 2018 04:00:21 +0000 (04:00 +0000)]
When this code was introduced at r300829 the author forgot to add
the BSD license header that is the same as in its C header file.

MFC after: 4 weeks.
Sponsored by: iXsystems Inc.

6 years agostyle(9) remove unnecessary blank tabs.
araujo [Wed, 13 Jun 2018 03:35:24 +0000 (03:35 +0000)]
style(9) remove unnecessary blank tabs.

Obtained from: TrueOS
MFC after: 4 weeks.
Sponsored by: iXsystems Inc.

6 years agoAdd SPDX tags to bhyve(8).
araujo [Wed, 13 Jun 2018 03:22:08 +0000 (03:22 +0000)]
Add SPDX tags to bhyve(8).

Discussed with: rgrimes, pfg and mav.
Obtained from: TrueOS
MFC after: 4 weeks.
Sponsored by: iXsystems Inc.

6 years agotop(1): several small bugfixes and nits
eadler [Wed, 13 Jun 2018 00:45:38 +0000 (00:45 +0000)]
top(1): several small bugfixes and nits

- initialize all maybe uninitialized vars with bogus values. This shuts
up the compiler, and causes crashes if it changes later.
- mark noreturn as noreturn
- removed unused macro
- handle x_procstate as runtime rather than pre-processor
- avoid using void functions in condtionals

Tested with clang, gcc 7, gcc 9

6 years agops(1): fix some nits
eadler [Wed, 13 Jun 2018 00:45:35 +0000 (00:45 +0000)]
ps(1): fix some nits

- fracmem and mempages are double. ki_rssize should be too
- remove default case that is fully covered by all existing cases
- mark usage as dead

6 years agoThis fixes missing VNET sets in the hpts system. Basically
rrs [Tue, 12 Jun 2018 23:54:08 +0000 (23:54 +0000)]
This fixes missing VNET sets in the hpts system. Basically
without this and running vnets with a TCP stack that uses
some of the features is a recipe for panic (without this commit).

Reported by: Larry Rosenman
Sponsored by: Netflix Inc.
Differential Revision: https://reviews.freebsd.org/D15757

6 years agoDefer inpcbport free in in_pcbremlists as well
mmacy [Tue, 12 Jun 2018 23:26:25 +0000 (23:26 +0000)]
Defer inpcbport free in in_pcbremlists as well

6 years agoFix number of auxargs entries to copy out for 32-bit Linuxulator.
jkim [Tue, 12 Jun 2018 22:54:48 +0000 (22:54 +0000)]
Fix number of auxargs entries to copy out for 32-bit Linuxulator.

PR: 228790

6 years agoExplain why a __FreeBSD_version bump was done for r334930.
rmacklem [Tue, 12 Jun 2018 22:52:27 +0000 (22:52 +0000)]
Explain why a __FreeBSD_version bump was done for r334930.

6 years agoVersion bump since r334930 changed the interface between the NFS modules,
rmacklem [Tue, 12 Jun 2018 22:48:19 +0000 (22:48 +0000)]
Version bump since r334930 changed the interface between the NFS modules,
so they all need to be rebuilt.

6 years agoDefer inpcbport free until after a grace period has elapsed
mmacy [Tue, 12 Jun 2018 22:18:27 +0000 (22:18 +0000)]
Defer inpcbport free until after a grace period has elapsed

This is a dependency for inpcbinfo rlock conversion to epoch

6 years agomechanical CK macro conversion of inpcbinfo lists
mmacy [Tue, 12 Jun 2018 22:18:20 +0000 (22:18 +0000)]
mechanical CK macro conversion of inpcbinfo lists

This is a dependency for converting the inpcbinfo hash and info rlocks
to epoch.

6 years agoDefer inpcb deletion until after a grace period has elapsed
mmacy [Tue, 12 Jun 2018 22:18:15 +0000 (22:18 +0000)]
Defer inpcb deletion until after a grace period has elapsed

Deferring the actual free of the inpcb until after a grace
period has elapsed will allow us to convert the inpcbinfo
info and hash read locks to epoch.

Reviewed by: gallatin, jtl
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D15510

6 years agosimplebus pnp: Do not generate pnp info is the bus status is not okay
manu [Tue, 12 Jun 2018 20:03:00 +0000 (20:03 +0000)]
simplebus pnp: Do not generate pnp info is the bus status is not okay

Generating the pnp info have the side effect to include all nodes even
if the status isn't "okay".
That means that loading the module will load but not attach as it checks
the status in the probe function.

On pine64 before :
root@pine64-lts:~ # devmatch -u
unattached on ofwbus pnpinfo name=memory
unattached on ofwbus pnpinfo name=chosen
unattached on ofwbus pnpinfo name=sound_spdif compat=simple-audio-card
unattached on ofwbus pnpinfo name=spdif-out compat=linux,spdif-dit
unattached on simplebus pnpinfo name=dma-controller@1c02000 compat=allwinner,sun50i-a64-dma
unattached on simplebus pnpinfo name=mmc@1c10000 compat=allwinner,sun50i-a64-mmc
unattached on simplebus pnpinfo name=usb@1c19000 compat=allwinner,sun8i-a33-musb
unattached on simplebus pnpinfo name=spdif@1c21000 compat=allwinner,sun50i-a64-spdif
unattached on simplebus pnpinfo name=i2s@1c22000 compat=allwinner,sun50i-a64-i2s
unattached on simplebus pnpinfo name=i2s@1c22400 compat=allwinner,sun50i-a64-i2s
unattached on simplebus pnpinfo name=serial@1c28400 compat=snps,dw-apb-uart
unattached on simplebus pnpinfo name=serial@1c28800 compat=snps,dw-apb-uart
unattached on simplebus pnpinfo name=serial@1c28c00 compat=snps,dw-apb-uart
unattached on simplebus pnpinfo name=serial@1c29000 compat=snps,dw-apb-uart
unattached on simplebus pnpinfo name=i2c@1c2ac00 compat=allwinner,sun6i-a31-i2c
unattached on simplebus pnpinfo name=i2c@1c2b000 compat=allwinner,sun6i-a31-i2c
unattached on simplebus pnpinfo name=i2c@1c2b400 compat=allwinner,sun6i-a31-i2c
unattached on ofwbus pnpinfo name=aliases
unattached on ofwbus pnpinfo name=symbols

All simplebus node are disabled

After :
root@pine64-lts:~ # devmatch -u
unattached on ofwbus pnpinfo name=memory
unattached on ofwbus pnpinfo name=chosen
unattached on ofwbus pnpinfo name=sound_spdif compat=simple-audio-card
unattached on ofwbus pnpinfo name=spdif-out compat=linux,spdif-dit
unattached on simplebus pnpinfo name=dma-controller@1c02000 compat=allwinner,sun50i-a64-dma
unattached on simplebus pnpinfo name=usb@1c19000 compat=allwinner,sun8i-a33-musb
unattached on ofwbus pnpinfo name=aliases
unattached on ofwbus pnpinfo name=symbols

Reviewed by: imp (with some objection)
Differential Revision: https://reviews.freebsd.org/D15770

6 years agopowerpc64/powernv: Avoid type promotion
leitao [Tue, 12 Jun 2018 19:50:33 +0000 (19:50 +0000)]
powerpc64/powernv: Avoid type promotion

There is a type promotion that transform count = -1 into a unsigned int causing
the default TCE SEG SIZE not being returned on a Boston POWER9 machine.

This machine does not have the 'ibm,supported-tce-sizes' entries, thus, count
is set to -1, and the function continue to execute instead of returning.

Reviewed by: jhibbits, wma
Approved by: jhibbits (mentor)
Differential Revision: https://reviews.freebsd.org/D15763

6 years agoMerge the pNFS server code from projects/pnfs-planb-server into head.
rmacklem [Tue, 12 Jun 2018 19:36:32 +0000 (19:36 +0000)]
Merge the pNFS server code from projects/pnfs-planb-server into head.

This code merge adds a pNFS service to the NFSv4.1 server. Although it is
a large commit it should not affect behaviour for a non-pNFS NFS server.
Some documentation on how this works can be found at:
http://people.freebsd.org/~rmacklem/pnfs-planb-setup.txt
and will hopefully be turned into a proper document soon.
This is a merge of the kernel code. Userland and man page changes will
come soon, once the dust settles on this merge.
It has passed a "make universe", so I hope it will not cause build problems.
It also adds NFSv4.1 server support for the "current stateid".

Here is a brief overview of the pNFS service:
A pNFS service separates the Read/Write oeprations from all the other NFSv4.1
Metadata operations. It is hoped that this separation allows a pNFS service
to be configured that exceeds the limits of a single NFS server for either
storage capacity and/or I/O bandwidth.
It is possible to configure mirroring within the data servers (DSs) so that
the data storage file for an MDS file will be mirrored on two or more of
the DSs.
When this is used, failure of a DS will not stop the pNFS service and a
failed DS can be recovered once repaired while the pNFS service continues
to operate.  Although two way mirroring would be the norm, it is possible
to set a mirroring level of up to four or the number of DSs, whichever is
less.
The Metadata server will always be a single point of failure,
just as a single NFS server is.

A Plan B pNFS service consists of a single MetaData Server (MDS) and K
Data Servers (DS), all of which are recent FreeBSD systems.
Clients will mount the MDS as they would a single NFS server.
When files are created, the MDS creates a file tree identical to what a
single NFS server creates, except that all the regular (VREG) files will
be empty. As such, if you look at the exported tree on the MDS directly
on the MDS server (not via an NFS mount), the files will all be of size 0.
Each of these files will also have two extended attributes in the system
attribute name space:
pnfsd.dsfile - This extended attrbute stores the information that
    the MDS needs to find the data storage file(s) on DS(s) for this file.
pnfsd.dsattr - This extended attribute stores the Size, AccessTime, ModifyTime
    and Change attributes for the file, so that the MDS doesn't need to
    acquire the attributes from the DS for every Getattr operation.
For each regular (VREG) file, the MDS creates a data storage file on one
(or more if mirroring is enabled) of the DSs in one of the "dsNN"
subdirectories.  The name of this file is the file handle
of the file on the MDS in hexadecimal so that the name is unique.
The DSs use subdirectories named "ds0" to "dsN" so that no one directory
gets too large. The value of "N" is set via the sysctl vfs.nfsd.dsdirsize
on the MDS, with the default being 20.
For production servers that will store a lot of files, this value should
probably be much larger.
It can be increased when the "nfsd" daemon is not running on the MDS,
once the "dsK" directories are created.

For pNFS aware NFSv4.1 clients, the FreeBSD server will return two pieces
of information to the client that allows it to do I/O directly to the DS.
DeviceInfo - This is relatively static information that defines what a DS
             is. The critical bits of information returned by the FreeBSD
             server is the IP address of the DS and, for the Flexible
             File layout, that NFSv4.1 is to be used and that it is
             "tightly coupled".
             There is a "deviceid" which identifies the DeviceInfo.
Layout     - This is per file and can be recalled by the server when it
             is no longer valid. For the FreeBSD server, there is support
             for two types of layout, call File and Flexible File layout.
             Both allow the client to do I/O on the DS via NFSv4.1 I/O
             operations. The Flexible File layout is a more recent variant
             that allows specification of mirrors, where the client is
             expected to do writes to all mirrors to maintain them in a
             consistent state. The Flexible File layout also allows the
             client to report I/O errors for a DS back to the MDS.
             The Flexible File layout supports two variants referred to as
             "tightly coupled" vs "loosely coupled". The FreeBSD server always
             uses the "tightly coupled" variant where the client uses the
             same credentials to do I/O on the DS as it would on the MDS.
             For the "loosely coupled" variant, the layout specifies a
             synthetic user/group that the client uses to do I/O on the DS.
             The FreeBSD server does not do striping and always returns
             layouts for the entire file. The critical information in a layout
             is Read vs Read/Writea and DeviceID(s) that identify which
             DS(s) the data is stored on.

At this time, the MDS generates File Layout layouts to NFSv4.1 clients
that know how to do pNFS for the non-mirrored DS case unless the sysctl
vfs.nfsd.default_flexfile is set non-zero, in which case Flexible File
layouts are generated.
The mirrored DS configuration always generates Flexible File layouts.
For NFS clients that do not support NFSv4.1 pNFS, all I/O operations
are done against the MDS which acts as a proxy for the appropriate DS(s).
When the MDS receives an I/O RPC, it will do the RPC on the DS as a proxy.
If the DS is on the same machine, the MDS/DS will do the RPC on the DS as
a proxy and so on, until the machine runs out of some resource, such as
session slots or mbufs.
As such, DSs must be separate systems from the MDS.

Tested by: james.rose@framestore.com
Relnotes: yes

6 years agoWITHOUT_NLS cleanup of more empty dirs.
sbruno [Tue, 12 Jun 2018 19:26:25 +0000 (19:26 +0000)]
WITHOUT_NLS cleanup of more empty dirs.

Reviewed by: emaste
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D15626

6 years agocpucontrol:
sbruno [Tue, 12 Jun 2018 18:58:56 +0000 (18:58 +0000)]
cpucontrol:
- fix debugging for family on AMD cpus and add useful debugging for
  which file is being selected for update.

Reviewed by: cem
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D15574

6 years agolualoader: Match Forth module-loading behavior w.r.t flags
kevans [Tue, 12 Jun 2018 18:42:41 +0000 (18:42 +0000)]
lualoader: Match Forth module-loading behavior w.r.t flags

Also as documented in loader.conf(5), ${module}_flags are actually flags to
be passed to the module, not to `load` as was done thus far.

6 years agoInclude VirtIO devices to the GENERIC configuration file.
br [Tue, 12 Jun 2018 17:55:40 +0000 (17:55 +0000)]
Include VirtIO devices to the GENERIC configuration file.

These are now available in QEMU/RISC-V.

Sponsored by: DARPA, AFRL

6 years agoo Add driver for PLIC (Platform-Level Interrupt Controller) device.
br [Tue, 12 Jun 2018 17:45:15 +0000 (17:45 +0000)]
o Add driver for PLIC (Platform-Level Interrupt Controller) device.
o Convert interrupt machdep support to use INTRNG code.

Sponsored by: DARPA, AFRL

6 years agoAdd simplebus-like RISC-V SoC bus.
br [Tue, 12 Jun 2018 17:07:30 +0000 (17:07 +0000)]
Add simplebus-like RISC-V SoC bus.

This is required in order to probe and attach devices described under
"riscv-virtio-soc" node of DTS.

Sponsored by: DARPA, AFRL

6 years agoRelease secondary cores from WFI (wait for interrupt) by sending them
br [Tue, 12 Jun 2018 16:47:33 +0000 (16:47 +0000)]
Release secondary cores from WFI (wait for interrupt) by sending them
an IPI.

This does not work however yet in QEMU. As a temporary workaround set
software interrupt pending bit manually on a local core to ensure WFI
doesn't halt the hart.

This is required to smpboot in QEMU.

Sponsored by: DARPA, AFRL

6 years agoEnable USB OTG serial terminal on ARM SD card images. This configures
trasz [Tue, 12 Jun 2018 16:45:52 +0000 (16:45 +0000)]
Enable USB OTG serial terminal on ARM SD card images.  This configures
the system to make use of USB device mode / USB OTG to provide a "virtual
serial port" on release images.

Reviewed by: gjb@
MFC after: 2 weeks
Relnotes: yes
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D15602

6 years agoAdd an example to the chflags(1) man page.
trasz [Tue, 12 Jun 2018 16:44:13 +0000 (16:44 +0000)]
Add an example to the chflags(1) man page.

MFC after: 2 weeks

6 years agoFix memory leak
bapt [Tue, 12 Jun 2018 16:42:11 +0000 (16:42 +0000)]
Fix memory leak

CID: 1393352

6 years agoCorrectly test return value of pipe(2)
bapt [Tue, 12 Jun 2018 16:40:22 +0000 (16:40 +0000)]
Correctly test return value of pipe(2)

CID: 1393351

6 years agoAlign virtual addressing entries.
br [Tue, 12 Jun 2018 16:19:27 +0000 (16:19 +0000)]
Align virtual addressing entries.

This is required due to C-compressed ISA extension option being turned on.

This fixes SMP operation in QEMU.

Sponsored by: DARPA, AFRL

6 years agoRework PSCI so it only searches for the call function once.
andrew [Tue, 12 Jun 2018 14:54:17 +0000 (14:54 +0000)]
Rework PSCI so it only searches for the call function once.

This is in preperation for supporting newer smccc functions that also use
the same call method.

Reviewed by: manu
Differential Revision: https://reviews.freebsd.org/D15745

6 years agolinux64: use linux output target for linux_vdso.so
emaste [Tue, 12 Jun 2018 13:32:42 +0000 (13:32 +0000)]
linux64: use linux output target for linux_vdso.so

linux_vdso.so provides the vdso for the linuxulator's amd64 target and
is mapped into a Linux binary's address space.  Thus it should be a
Linux-style .so, which has the ELF OS/ABI unset.

It turns out that ELF Tool Chain elfcopy/objcopy also has a bug where
the OS/ABI field is unset, regardless of the specified --output-target,
so this change is a no-op with the default in-tree toolchain.  This is a
real fix when using external binutils, and the ELF Tool Chain bug will
be fixed in the future.

PR: 228934
Sponsored by: Turing Robotic Industries

6 years agoAdd a driver for the BCM2835 Mini-UART as seen on the RPi3
db [Tue, 12 Jun 2018 13:26:31 +0000 (13:26 +0000)]
Add a driver for the BCM2835 Mini-UART as seen on the RPi3

Reviewed by: andrew
Approved by: andrew
Differential Revision: https://reviews.freebsd.org/D15684

6 years agoarm64: rockchip: Correctly set armclk
manu [Tue, 12 Jun 2018 11:47:21 +0000 (11:47 +0000)]
arm64: rockchip: Correctly set armclk

Parent needs to be the same frequency as the armclk, not twice the freq.
The real divider is incremented by one so write it with - 1
The rate can be at index 0

Pointy Hat To: myself

6 years agoAll exceptions IDT descriptors must use interrupt gates on 4/4 kernel.
kib [Tue, 12 Jun 2018 10:43:20 +0000 (10:43 +0000)]
All exceptions IDT descriptors must use interrupt gates on 4/4 kernel.
Fix it for #MF.

Noted by: rlibby
Sponsored by: The FreeBSD Foundation

6 years agoFix typo.
kib [Tue, 12 Jun 2018 10:41:26 +0000 (10:41 +0000)]
Fix typo.

Sponsored by: The FreeBSD Foundation

6 years agoImplement the ip_eth_mc_map() function in the LinuxKPI.
hselasky [Tue, 12 Jun 2018 08:43:49 +0000 (08:43 +0000)]
Implement the ip_eth_mc_map() function in the LinuxKPI.

MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoAdd hrs, meta and myself to share/misc/committers-ports.dot
pi [Tue, 12 Jun 2018 07:51:03 +0000 (07:51 +0000)]
Add hrs, meta and myself to share/misc/committers-ports.dot

Approved by: remko

6 years agotop(1): remove trailing whitespace
eadler [Tue, 12 Jun 2018 07:31:59 +0000 (07:31 +0000)]
top(1): remove trailing whitespace

6 years agotop(1): style and related
eadler [Tue, 12 Jun 2018 07:14:12 +0000 (07:14 +0000)]
top(1): style and related

- style(9)
- remove now-defunct comments
- remove getuid check for low delay
- expand range of format_k

6 years agotop(1): move command mapping to commands.c
eadler [Tue, 12 Jun 2018 06:53:31 +0000 (06:53 +0000)]
top(1): move command mapping to commands.c

This eliminates the difficult to follow mapping of a string list. It
moves numbers from "#define" into (more) debuggable enums. More
generally, it follows the trend of moving more data into a more central
mechanism.

The help output is a little worse: " " is not rendered well, and there
are duplicate entries, but that will be fixed in a followup.

6 years agocxgbe(4): Remove homemade version of htobe32 from the driver.
np [Tue, 12 Jun 2018 06:46:03 +0000 (06:46 +0000)]
cxgbe(4): Remove homemade version of htobe32 from the driver.

It was needed only for ia64 where it was implemented as a call to
bswapXX, which was always a real function.  htobeXX with a constant
argument is calculated at compile-time everywhere else.

MFC after: 1 week
Sponsored by: Chelsio Communications

6 years agolualoader: More black-on-white fixes
kevans [Tue, 12 Jun 2018 03:44:34 +0000 (03:44 +0000)]
lualoader: More black-on-white fixes

To recap the problem: with a black-on-white xterm, the menu draws terribly.
Ideally, we would try our best for a white-on-black context for the menu
since graphics and whatnot might not be tested for other setups and there's
no reasonable way to sample the terminal at this point for the used color
scheme.

This commit attempts to address that further in two ways:
- Instead of issuing CSI bg/fg resets (CSI 39m and CSI 49m respectively for
  "default"), issue CSI bg/fg escape sequences for our expected color scheme
- Reset to *our* default color scheme before we even attempt to load the
  local module, so that we personally don't have any earlier text with the
  console default color scheme.

Reported by: emaste (again)

6 years agoFollow r333233, add fat32lba description to gpart(8)
lwhsu [Tue, 12 Jun 2018 01:50:58 +0000 (01:50 +0000)]
Follow r333233, add fat32lba description to gpart(8)

Reviewed by: emaste
MFC after: 3 days
X-MFC with: r333233
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D15767

6 years agoFix a memory leak for the BIOCSETWF ioctl on kernels with the BPF_JITTER
jtl [Mon, 11 Jun 2018 23:32:06 +0000 (23:32 +0000)]
Fix a memory leak for the BIOCSETWF ioctl on kernels with the BPF_JITTER
option.

The BPF code was creating a compiled filter in the common filter-creation
path.  However, BPF only uses compiled filters in the read direction.
When creating a write filter, the common filter-creation code was
creating an unneeded write filter and leaking the memory used for that.

MFC after: 2 weeks
Sponsored by: Netflix

6 years agoUser service foo rather than /etc/rc.d/foo.
imp [Mon, 11 Jun 2018 22:48:34 +0000 (22:48 +0000)]
User service foo rather than /etc/rc.d/foo.

devd predates service in the system. Modernize usage to use service to
start/stop things in reaction to events rather than calling the rc
file directly.

This was pointed out in my talk at BSDcan as well as indirectly
referrred to as a barrier to entry for OpenRC in that working group.

6 years agomuge.4: remove BUGS section (about link/act LEDs)
emaste [Mon, 11 Jun 2018 20:46:20 +0000 (20:46 +0000)]
muge.4: remove BUGS section (about link/act LEDs)

Lack of functioning link and activity LEDs on devices without an EEPROM
is expected (not a bug).  Quoting the EVB-LAN7850 User's Guide:

    When configured with the default internal register settings, the
    Ethernet Link status LEDs are not enabled.  To enable Ethernet Link
    status LEDs, enable the EEPROM.

This is an artifact of the different ways in which the evaluation board
can be used.  End-user USB-Ethernet adapters using the Microchip LAN78XX
or LAN7515 controllers should use an EEPROM or have OTP configuration,
if their product configuration does not match the boot default register
configuration.

Sponsored by: The FreeBSD Foundation

6 years agoRevert size limits.
imp [Mon, 11 Jun 2018 20:38:30 +0000 (20:38 +0000)]
Revert size limits.

The size limits came from a flawed understanding of dump records.
The real issue was that dump was bogusly interpreting c_count
sometimes. r334978 fixes that.

6 years agoFix a bug in the counting of blks.
imp [Mon, 11 Jun 2018 20:38:26 +0000 (20:38 +0000)]
Fix a bug in the counting of blks.

We shouldn't count the bytes set in c_addr for TS_CLRI and TS_BITS
nodes. Those block overload c_count to communicate how many blocks
follow, not now many c_addr spaces are used. Dump would dump core
(now) because memory layout moved around and we'd access elements past
the end to make a count.

Reviewed by: kib@

6 years agoConnect muge.4 man page
emaste [Mon, 11 Jun 2018 20:19:20 +0000 (20:19 +0000)]
Connect muge.4 man page

Sponsored by: The FreeBSD Foundation

6 years agomuge.4: correct BUGS statement
emaste [Mon, 11 Jun 2018 19:48:15 +0000 (19:48 +0000)]
muge.4: correct BUGS statement

The EVB-LAN7850 I have does function with the EEPROM disabled - the
link / activity LEDs just do not function.

Sponsored by: The FreeBSD Foundation

6 years agoDon't initialize c_count. We don't need to.
imp [Mon, 11 Jun 2018 19:35:41 +0000 (19:35 +0000)]
Don't initialize c_count. We don't need to.

6 years agoif_muge: retire lan78xx_eeprom_read
emaste [Mon, 11 Jun 2018 19:34:47 +0000 (19:34 +0000)]
if_muge: retire lan78xx_eeprom_read

lan78xx_eeprom_read just checked for EEPROM presence then called
lan78xx_eeprom_read_raw if present, and had only one caller.  Introduce
lan78xx_eeprom_present to check for EEPROM presence, and use it in the
one place it is needed.

This is used by r334964, which was accidentally committed out-of-order
from my work tree.

Reported by: markj
Sponsored by: The FreeBSD Foundation

6 years agoMinor style polishing.
imp [Mon, 11 Jun 2018 19:32:49 +0000 (19:32 +0000)]
Minor style polishing.

Declare c_count and initialize it with other ints.

Reported by: mjg@

6 years agoDocument the newly enforced 524288 inode restriction.
imp [Mon, 11 Jun 2018 19:32:45 +0000 (19:32 +0000)]
Document the newly enforced 524288 inode restriction.

6 years agoDocument the dump issue in UPDATING so people understand when they
imp [Mon, 11 Jun 2018 19:32:40 +0000 (19:32 +0000)]
Document the dump issue in UPDATING so people understand when they
get a new diagnostic.

6 years agoAdd asserts to prevent overflows of c_addr.
imp [Mon, 11 Jun 2018 19:32:36 +0000 (19:32 +0000)]
Add asserts to prevent overflows of c_addr.

Add some asserts that prevents the overflows of c_addr. This can't
happen, absent bugs. However, certain large filesystems can cause
problems. These have been prevented by r334968, but a solution
is needed. These asserts will help assure that solution is correct.

PR: 228807
Reviewed by: db

6 years agoLarge file systems with inodes > 512K have been silently overflowing
db [Mon, 11 Jun 2018 19:12:50 +0000 (19:12 +0000)]
Large file systems with inodes > 512K have been silently overflowing
c_addr in spcl. So check before we start dumping otherwise we can
end up with a corrupted dump.

PR: 228807
Submitted by: db
Reviewed by: imp
Approved by: imp

6 years agoAdd a couple of safety belt checks to the NFSv4.1 client related to sessions.
rmacklem [Mon, 11 Jun 2018 19:00:07 +0000 (19:00 +0000)]
Add a couple of safety belt checks to the NFSv4.1 client related to sessions.

There were a couple of cases in newnfs_request() that it assumed that it
was an NFSv4.1 mount with a session. This should always be the case when
a Sequence operation is in the reply or the server replies NFSERR_BADSESSION.
However, if a server was broken and sent an erroneous reply, these safety
belt checks should avoid trouble.
The one check required a small tweak to nfsmnt_mdssession() so that it
returns NULL when there is no session instead of the offset of the field
in the structure (0x8 for i386).
This patch should have no effect on normal operation of the client.
Found by inspection during pNFS server development.

MFC after: 2 weeks

6 years agomakesyscalls: simplify capenabled pipeline
emaste [Mon, 11 Jun 2018 18:57:40 +0000 (18:57 +0000)]
makesyscalls: simplify capenabled pipeline

Replace cat + 2x grep with one grep.

Sponsored by: Turing Robotic Industries

6 years agoif_muge: add LAN7850 support
emaste [Mon, 11 Jun 2018 18:44:56 +0000 (18:44 +0000)]
if_muge: add LAN7850 support

Differences between LAN7800 and LAN7850 from the driver's perspective:

* The LAN7800 muxes EEPROM signals with LEDs, so LED mode needs to be
  disabled when reading/writing EEPROM.  The EEPROM is not muxed on the
  LAN7850.

* The Linux driver enables automatic duplex and speed detection when
  there is no EEPROM, for the LAN7800 only.  With this FreeBSD driver
  LAN7850-based adapters without a configuration EEPROM fail to link
  (with or without the automatic duplex and speed detection code), so
  I have just followed the example of the Linux driver for now.

Sponsored by: The FreeBSD Foundation
Sponsored by: Microchip (hardware)

6 years agolimit change to fixing controlp handling pending review
mmacy [Mon, 11 Jun 2018 17:10:19 +0000 (17:10 +0000)]
limit change to fixing controlp handling pending review

6 years agoProcess CUs with a language attribute of DW_LANG_Mips_Assembler.
markj [Mon, 11 Jun 2018 16:33:36 +0000 (16:33 +0000)]
Process CUs with a language attribute of DW_LANG_Mips_Assembler.

At the moment ctfconvert(1) does not do much with such CUs, but
that may not be true in the future, and we run ctfconvert on several
assembly files during the build.

X-MFC with: r334883

6 years agosoreceive_stream: correctly handle edge cases
mmacy [Mon, 11 Jun 2018 16:31:42 +0000 (16:31 +0000)]
soreceive_stream: correctly handle edge cases

- non NULL controlp is not an error, returning EINVAL
  would cause X forwarding to fail

- MSG_PEEK and MSG_WAITALL are fairly exceptional, but we still
  want to handle them - punt to soreceive_generic

6 years agoUse the cached curthread reference in pmc_process_interrupt().
markj [Mon, 11 Jun 2018 16:27:09 +0000 (16:27 +0000)]
Use the cached curthread reference in pmc_process_interrupt().

Fix indentation while here.

6 years agoImplement the kstrtobool() and kstrtobool_from_user() functions
hselasky [Mon, 11 Jun 2018 16:26:33 +0000 (16:26 +0000)]
Implement the kstrtobool() and kstrtobool_from_user() functions
in the LinuxKPI.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
MFC after: 1 week
Sponsored by: Mellanox Technologies
Sponsored by: Limelight Networks

6 years agopmc gcc fixups
rlibby [Mon, 11 Jun 2018 16:09:54 +0000 (16:09 +0000)]
pmc gcc fixups

Fix the build of lib/libpmc and usr.sbin/pmc for gcc on amd64.

Reviewed by:    mmacy
Sponsored by:   Dell EMC Isilon
Differential Revision:  https://reviews.freebsd.org/D15723

6 years agoImplement the user_access_begin(), user_access_end(), usafe_get_user() and
hselasky [Mon, 11 Jun 2018 15:42:29 +0000 (15:42 +0000)]
Implement the user_access_begin(), user_access_end(), usafe_get_user() and
unsafe_put_user() function macros in the LinuxKPI.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
MFC after: 1 week
Sponsored by: Mellanox Technologies
Sponsored by: Limelight Networks

6 years agoFix braino in r334799. Maxmem is in pages.
kib [Mon, 11 Jun 2018 15:28:20 +0000 (15:28 +0000)]
Fix braino in r334799.  Maxmem is in pages.

Reported by: ae, pho
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

6 years agoMore style(9) fixes, space vs tab.
araujo [Mon, 11 Jun 2018 15:18:31 +0000 (15:18 +0000)]
More style(9) fixes, space vs tab.

6 years agostyle(9): Fix tabs after #define.
pfg [Mon, 11 Jun 2018 14:45:34 +0000 (14:45 +0000)]
style(9): Fix tabs after #define.

No functional change intended.

6 years agoChange RACK dependency on TCPHPTS from a build-time dependency to a load-
jtl [Mon, 11 Jun 2018 14:27:19 +0000 (14:27 +0000)]
Change RACK dependency on TCPHPTS from a build-time dependency to a load-
time dependency.

At present, RACK requires the TCPHPTS option to run. However, because
modules can be moved from machine to machine, this dependency is really
best assessed at load time rather than at build time.

Reviewed by: rrs
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D15756

6 years agoFix build of bxe with base gcc on i386
dim [Mon, 11 Jun 2018 10:08:22 +0000 (10:08 +0000)]
Fix build of bxe with base gcc on i386

Casting from rman_res_t to a pointer results in "cast to pointer from
integer of different size" warnings with base gcc on i386, so print
these without casting.  The kva field of struct bxe_bar is of type
vm_offset_t, which can be 32 or 64 bit, so cast it to uintmax_t before
printing.

Reviewed by: markj
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D15733

6 years agoDisable building aesni with base gcc
dim [Mon, 11 Jun 2018 08:42:03 +0000 (08:42 +0000)]
Disable building aesni with base gcc

Because base gcc does not support the required intrinsics, do not
attempt to compile the aesni module with it.

Noticed by: Dan Allen <danallen46@gmail.com>
MFC after: 3 days

6 years agoFix build of i915kms with base gcc
dim [Mon, 11 Jun 2018 08:11:35 +0000 (08:11 +0000)]
Fix build of i915kms with base gcc

Base gcc fails to compile sys/dev/drm2/i915/intel_display.c for i386,
with the following -Werror warnings:

cc1: warnings being treated as errors
/usr/src/sys/dev/drm2/i915/intel_display.c:8884: warning:
initialization from incompatible pointer type

This is due to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36432, which
incorrectly interprets the [] as a flexible array member.

Because base gcc does not have a -W flag to suppress this particular
warning, it requires a rather ugly cast.  To not influence any other
compiler, put it in a #if/#endif block.

Reviewed by: kib
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D15744

6 years agoFix build of ocs_fs with base gcc on i386
dim [Mon, 11 Jun 2018 07:57:32 +0000 (07:57 +0000)]
Fix build of ocs_fs with base gcc on i386

Add a few intermediate casts to uintptr_t to suppress "cast to pointer
from integer of different size" warnings from gcc.  Also remove a few
incorrect casts.

Reviewed by: ram
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D15747

6 years agoindent(1): rename -nsac/-sac ("space after cast") to -ncs/-cs
pstef [Mon, 11 Jun 2018 05:35:57 +0000 (05:35 +0000)]
indent(1): rename -nsac/-sac ("space after cast") to -ncs/-cs

Also update tests and the manpage.

GNU indent had the option earlier as -cs, let's not diverge unnecessarily.

6 years agousbdevs: sort my prior commit
eadler [Mon, 11 Jun 2018 05:28:00 +0000 (05:28 +0000)]
usbdevs: sort my prior commit

6 years agousbdevs: adding vendor
eadler [Mon, 11 Jun 2018 05:27:07 +0000 (05:27 +0000)]
usbdevs: adding vendor

PR: 228856
Reported by: hrs, ys-h@imail.earth

6 years agotop(1): handle 0 in "digits" functions
eadler [Mon, 11 Jun 2018 05:05:20 +0000 (05:05 +0000)]
top(1): handle 0 in "digits" functions

6 years ago- Add bhyve virtio-scsi storage backend support.
araujo [Mon, 11 Jun 2018 02:09:20 +0000 (02:09 +0000)]
- Add bhyve virtio-scsi storage backend support.

Example of configuration:
ctl.conf:
portal-group pg0 {
        discovery-auth-group no-authentication
        listen 0.0.0.0
        listen [::]
}

target iqn.2012-06.com.example:target0 {
        auth-group no-authentication
        portal-group pg0
        port ioctl/5/3

        lun 0 {
                path /z/test.img
                size 8G
        }
        lun 1 {
                path /z/test1.img
                size 8G
        }
}

bhyve <...> -s 4,virtio-scsi,/dev/cam/ctl5.3,iid=3 <VM_NAME>

From inside guest:
root@:~ # zpool status test
  pool: test
 state: ONLINE
  scan: none requested
config:

        NAME        STATE     READ WRITE CKSUM
        test        ONLINE       0     0     0
          da0       ONLINE       0     0     0
          da1       ONLINE       0     0     0

dmesg:
da0 at vtscsi0 bus 0 scbus0 target 0 lun 0
da0: <FREEBSD CTLDISK 0001> Fixed Direct Access SPC-5 SCSI device
da0: Serial Number MYSERIAL0000
da0: 300.000MB/s transfers
da0: Command Queueing enabled
da0: 8192MB (16777216 512 byte sectors)
da1 at vtscsi0 bus 0 scbus0 target 0 lun 1
da1: <FREEBSD CTLDISK 0001> Fixed Direct Access SPC-5 SCSI device
da1: Serial Number MYSERIAL0001
da1: 300.000MB/s transfers
da1: Command Queueing enabled
da1: 8192MB (16777216 512 byte sectors)

Discussed with: grehan
Reviewed by: mav
Obtained from: TrueOS
Relnotes: Yes
Sponsored by: iXsystems Inc.
Tested with: FreeBSD HEAD, Fedora 28 (Workstation) and
Ubuntu 18.04.
Differential Revision:  https://reviews.freebsd.org/D15276

6 years agolualoader: Allow brand-*.lua for adding new brands
kevans [Mon, 11 Jun 2018 01:32:18 +0000 (01:32 +0000)]
lualoader: Allow brand-*.lua for adding new brands

dteske@, I believe, had originally pointed out that lualoader failed to
allow logo-*.lua for new logos to be added. When correcting this mistake, I
failed to do the same for brands.

Correct the sub-mistake: creating new brands is almost identical to creating
new logos, except one must use `drawer.addBrand` and 'graphic' is the only
valid key for a branddef at the moment.

While here, I've added `drawer.default_brand` to be set to name of brand to
be used (e.g. 'fbsd', project default).

Eventually this whole goolash will be documented.

Reported by: kmoore, iXsystems

6 years agoaudit(4): add tests for stat(2) and friends
asomers [Sun, 10 Jun 2018 21:36:29 +0000 (21:36 +0000)]
audit(4): add tests for stat(2) and friends

This revision adds auditability tests for stat, lstat, fstat, and fstatat,
all from the fa audit class.  More tests from that audit class will follow.

Submitted by: aniketp
MFC after: 2 weeks
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15709

6 years agoRemove the psci option from arm64. It is now a standard option as it is
andrew [Sun, 10 Jun 2018 19:42:44 +0000 (19:42 +0000)]
Remove the psci option from arm64. It is now a standard option as it is
required to boot correctly.

Sponsored by: DARPA, AFRL

6 years agoRevert r334929
eadler [Sun, 10 Jun 2018 19:15:38 +0000 (19:15 +0000)]
Revert r334929

Apparently some software might depend on a header whose sole contents is
a `#warning` to remove it. Revert pending exp-run.

6 years agoAdd checks for the Flexible File layout to LayoutRecall callbacks.
rmacklem [Sun, 10 Jun 2018 19:03:21 +0000 (19:03 +0000)]
Add checks for the Flexible File layout to LayoutRecall callbacks.

The Flexible File layout case wasn't handled by LayoutRecall callbacks
because it just checked for File layout and returned NFSERR_NOMATCHLAYOUT
otherwise. This patch adds the Flexible File layout handling.
Found during testing of the pNFS server.

MFC after: 2 weeks

6 years agoinclude: remove sys/capability.h
eadler [Sun, 10 Jun 2018 18:38:48 +0000 (18:38 +0000)]
include: remove sys/capability.h

This file has only generated a warning for the last 18 months. Its
existence at this point only serves to confuse software looking for
POSIX.1e capabilities and produce actionless warnings.

6 years agolibc qsort(3): stop aliasing.
kib [Sun, 10 Jun 2018 17:54:44 +0000 (17:54 +0000)]
libc qsort(3): stop aliasing.

Qsort swap code aliases the sorted array elements to ints and longs in
order to do swap by machine words.  Unfortunately this breaks with the
full code optimization, e.g. LTO.

See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83201 which seems to
reference code directly copied from libc/stdlib/qsort.c.

PR: 228780
Reported by: mliska@suse.cz
Reviewed by: brooks
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D15714

6 years agoindent(1): group global option variables into an options structure
pstef [Sun, 10 Jun 2018 16:44:18 +0000 (16:44 +0000)]
indent(1): group global option variables into an options structure

It's clearer now when a variable represents a toggable command line option.

Many options were stored in the parser's state structure, so fix also that.

6 years agoClean up handling of unexpected exceptions. Previously we would issue a
andrew [Sun, 10 Jun 2018 16:21:21 +0000 (16:21 +0000)]
Clean up handling of unexpected exceptions. Previously we would issue a
breakpoint instruction, however this would lose information that may be
useful for debugging.

These are now handled in a similar way to other exceptions, however it
won't exit out of the exception handler until it is known if we can
handle these exceptions in a useful way.

Sponsored by: DARPA, AFRL

6 years agoUntangle configuration ifdefs a little. On x86, msi is optional on pci,
bde [Sun, 10 Jun 2018 14:49:13 +0000 (14:49 +0000)]
Untangle configuration ifdefs a little.  On x86, msi is optional on pci,
and also on apic in common and i386 files (except for xen it is optional
only on xenhvm), but it was not ifdefed except on apic in common and i386
files.

This is all that is left from an attempt to build a (sub-)minimal kernel
without any devices.  The isa "option" is still used without ifdefs in many
standard files even on amd64.  ISAPNP is not optional on at least i386.
ATPIC is not optional on i386 (it is used mainly for Xspuriousint).  But
pci is now supposed to be optional on x86.

6 years agoFix panics in potentially all x86bios calls on i386 since r332489.
bde [Sun, 10 Jun 2018 14:21:01 +0000 (14:21 +0000)]
Fix panics in potentially all x86bios calls on i386 since r332489.

A call to npxsave() in the exception trampolines was not relocated.
This call to a garbage address usually paniced when made, but it is only
made when the thread has used an FPU recently, and this is not the usual
case.

PR: 228755
Reviewed by: kib

6 years agoDrop MOUSE_GETVARS and MOUSE_SETVARS ioctls support.
wulf [Sun, 10 Jun 2018 10:23:31 +0000 (10:23 +0000)]
Drop MOUSE_GETVARS and MOUSE_SETVARS ioctls support.

These ioctls are not documented and only stubbed in a few drivers: mse(4),
psm(4) and syscon's sysmouse(4). The only exception is MOUSE_GETVARS
implemented in psm(4)

Given the fact that they were introduced 20 years ago and implementation
has never been completed, remove any related code.

PR: 228718 (exp-run)
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D15726

6 years agotop(1): use modern interfaces for nice and related
eadler [Sun, 10 Jun 2018 09:15:13 +0000 (09:15 +0000)]
top(1): use modern interfaces for nice and related

- attempt and fail, rather than check for permission.
- use macro rather than explicit "-20"

6 years agotop(1): add command aliases; correct dumb support
eadler [Sun, 10 Jun 2018 09:04:56 +0000 (09:04 +0000)]
top(1): add command aliases; correct dumb support

6 years agotop(1): use sys_signame instead of hard coding signals
eadler [Sun, 10 Jun 2018 09:00:01 +0000 (09:00 +0000)]
top(1): use sys_signame instead of hard coding signals

This enables the removal of the signal.h awk script. Shamelessly stolen
from kill(1).