]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agoMove psci_call to a header file so we can use it in other files to
Andrew Turner [Wed, 13 Jun 2018 15:24:07 +0000 (15:24 +0000)]
Move psci_call to a header file so we can use it in other files to
communicate with the firmware.

Sponsored by: DARPA, AFRL

6 years agoaudit(4): fix the definition of ARG_TERMID_ADDR
Alan Somers [Wed, 13 Jun 2018 14:55:31 +0000 (14:55 +0000)]
audit(4): fix the definition of ARG_TERMID_ADDR

Due to a copy/paste error in r168688, ARG_TERMID_ADDR has the same
definition as ARG_SADDRUNIX.  Fix it.

The header change, while publicly visible, is guarded by #ifdef KERNEL, and
I can't find any kmod ports that use it.  So I'm not bumping
__FreeBSD_version.

PR: 228820
Submitted by: aniketp
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15702

6 years agoOops, r335053 had an old version of the comment about 16-bit linux dev_t
Bruce Evans [Wed, 13 Jun 2018 12:44:45 +0000 (12:44 +0000)]
Oops, r335053 had an old version of the comment about 16-bit linux dev_t
translation.

6 years agoAdd a handler for the PSCI_FEATURES function. This needs PSCI 1.0, so
Andrew Turner [Wed, 13 Jun 2018 12:33:47 +0000 (12:33 +0000)]
Add a handler for the PSCI_FEATURES function. This needs PSCI 1.0, so
check for this, returning an error if the version is too old.

Sponsored by: DARPA, AFRL

6 years agoFind and cache the PSCI version on driver attach.
Andrew Turner [Wed, 13 Jun 2018 12:32:04 +0000 (12:32 +0000)]
Find and cache the PSCI version on driver attach.

Sponsored by: DARPA, AFRL

6 years agoAdd the PSCI_FEATURES function ID. This is found in PSCI 1.0 and is used
Andrew Turner [Wed, 13 Jun 2018 12:26:37 +0000 (12:26 +0000)]
Add the PSCI_FEATURES function ID. This is found in PSCI 1.0 and is used
to query if a given function is implemented and its features.

Sponsored by: DARPA, AFRL

6 years agoFix the encoding of major and minor numbers in 64-bit dev_t by restoring
Bruce Evans [Wed, 13 Jun 2018 12:22:00 +0000 (12:22 +0000)]
Fix the encoding of major and minor numbers in 64-bit dev_t by restoring
the old encodings for the lower 16 and 32 bits and only using the
higher 32 bits for unusually large major and minor numbers.  This
change breaks compatibility with the previous encoding (which was only
used in -current).

Fix truncation to (essentially) 16-bit dev_t in newnfs v3.

Any encoding of device numbers gives an ABI, so it can't be changed
without translations for compatibility.  Extra bits give the much
larger complication that the translations need to compress into fewer
bits.  Fortunately, more than 32 bits are rarely needed, so
compression is rarely needed except for 16-bit linux dev_t where it
was always needed but never done.

The previous encoding moved the major number into the top 32 bits.
Almost no translation code handled this, so the major number was blindly
truncated away in most 32-bit encodings.  E.g., for ffs, mknod(8) with
major = 1 and minor = 2 gave dev_t = 0x10000002; ffs cannot represent
this and blindly truncated it to 2.  But if this mknod was run on any
released version of FreeBSD, it gives dev_t = 0x102.  ffs can represent
this, but in the previous encoding it was not decoded, giving major = 0,
minor = 0x102.

The presence of bugs was most obvious for exporting dev_t's from an
old system to -current, since bugs in newnfs augment them.  I fixed
oldnfs to support 32-bit dev_t in 1996 (r16634), but this regressed
to 16-bit dev_t in newnfs, first to the old 16-bit encoding and then
further in -current.  E.g., old ad0 with major = 234, minor = 0x10002
had the correct (major, minor) number on the wire, but newnfs truncated
this to (234, 2) and then the previous encoding shifted the major
number into oblivion as seen by ffs or old applications.

I first tried to fix this by translating on every ABI/API boundary, but
there are too many boundaries and too many sloppy translations by blind
truncation.  So use the old encoding for the low 32 bits so that sloppy
translations work no worse than before provided the high 32 bits are
not set.  Add some error checking for when bits are lost.  Keep not
doing any error checking for translations for almost everything in
compat/linux.

compat/freebsd32/freebsd32_misc.c:
Optionally check for losing bits after possibly-truncating assignments as
before.

compat/linux/linux_stats.c:
Depend on the representation being compatible with Linux's (or just with
itself for local use) and spell some of the translations as assignments in
a macro that hides the details.

fs/nfsclient/nfs_clcomsubs.c:
Essentially the same fix as in 1996, except there is now no possible
truncation in makedev() itself.  Also fix nearby style bugs.

kern/vfs_syscalls.c:
As for freebsd32.  Also update the sysctl description to include file
numbers, and change it to describe device ids as device numbers.

sys/types.h:
Use inline functions (wrapped by macros) since the expressions are now
a bit too complicated for plain macros.  Describe the encoding and
some of the reasons for it.  16-bit compatibility didn't leave many
reasonable choices for the 32-bit encoding, and 32-bit compatibility
doesn't leave many reasonable choices for the 64-bit encoding.  My
choice is to put the 8 new minor bits in the low 8 bits of the top 32
bits.  This minimizes discontiguities.

Reviewed by: kib (except for rewrite of the comment in linux_stats.c)

6 years agoRename the ThunderX CPU identification macros to include the X. This is the
Andrew Turner [Wed, 13 Jun 2018 12:17:11 +0000 (12:17 +0000)]
Rename the ThunderX CPU identification macros to include the X. This is the
name people know the product by, and is consistent with the later SoC ID
macros.

Sponsored by: DARPA, AFRL

6 years agoAdd more Cavium CPU part numbers.
Andrew Turner [Wed, 13 Jun 2018 11:58:41 +0000 (11:58 +0000)]
Add more Cavium CPU part numbers.

While here split the lists by vendor.

Sponsored by: DARPA, AFRL

6 years agoWhile I was investigating CID 1194192 related with a resource leak on mrp memory
Marcelo Araujo [Wed, 13 Jun 2018 11:49:34 +0000 (11:49 +0000)]
While I was investigating CID 1194192 related with a resource leak on mrp memory
allocation, I could identify that actually we use this pointer on pci_emul.c as
well as on vga.c source file.

I have reworked the logic here to make it more readable and also add a warn to
explicit show the function where the memory allocation error could happen,
also sort headers.

Also CID 1194192 was marked as "Intentional".

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

6 years agotop(1): remove unneeded logic
Eitan Adler [Wed, 13 Jun 2018 11:12:52 +0000 (11:12 +0000)]
top(1): remove unneeded logic

- remove __pure annotations I added earlier for some functions. One
writes to the the arguments as "out" pointers. The
other reads from an array, which while const within the function might
be mutated externally.
- total_change is modified to be at 1, if previously 0, so no if check
is needed.

6 years agoRework if_gre(4) to use encap_lookup_t method to speedup lookup
Andrey V. Elsukov [Wed, 13 Jun 2018 11:11:33 +0000 (11:11 +0000)]
Rework if_gre(4) to use encap_lookup_t method to speedup lookup
of needed interface when many gre interfaces are present.

Remove rmlock from gre_softc, use epoch(9) and CK_LIST instead.
Move more AF-related code into AF-related locations. Use hash table to
speedup lookup of needed softc.

6 years agoDon't jump to VA space until kernel is ready.
Ruslan Bukin [Wed, 13 Jun 2018 10:32:21 +0000 (10:32 +0000)]
Don't jump to VA space until kernel is ready.

This fixes the race when first core sets up the pagetables, while
secondary cores do translating the address of __riscv_boot_ap.

This now allows us to smpboot in QEMU with 8 cores just fine.

Sponsored by: DARPA, AFRL

6 years agodumpon(8): improve the examples a bit
Eitan Adler [Wed, 13 Jun 2018 09:28:47 +0000 (09:28 +0000)]
dumpon(8): improve the examples a bit

While here, remove extraneous extraneous Pp

Reviewed by: jhb (older version)

6 years agopmc: remove trailing whitespace
Eitan Adler [Wed, 13 Jun 2018 09:17:04 +0000 (09:17 +0000)]
pmc: remove trailing whitespace

Reported by: swills

6 years agoatoi.3: bump .Dd
Eitan Adler [Wed, 13 Jun 2018 09:07:24 +0000 (09:07 +0000)]
atoi.3: bump .Dd

I touched the man page. Bump Dd by just over 15 years.

6 years agotop(1): style(9)
Eitan Adler [Wed, 13 Jun 2018 08:52:22 +0000 (08:52 +0000)]
top(1): style(9)

- split return type from function name
- Sprinkle a __pure where possible.

6 years agotop(1): add myself to authors
Eitan Adler [Wed, 13 Jun 2018 08:52:19 +0000 (08:52 +0000)]
top(1): add myself to authors

At this point I've mucked enough with top(1) that all bugs should be
blamed on me rather than William LeFebvre.

6 years agolibc: remove explicit cast NULL in atoi
Eitan Adler [Wed, 13 Jun 2018 08:52:17 +0000 (08:52 +0000)]
libc: remove explicit cast NULL in atoi

There isn't any reason to cast NULL so just remove it. Noticed when
cleaning up top.

Reviewed by: pstef

6 years agotop(1): shift from atoi to non-deprecated function
Eitan Adler [Wed, 13 Jun 2018 08:52:14 +0000 (08:52 +0000)]
top(1): shift from atoi to non-deprecated function

6 years agotop(1): replace homegrown itoa with sprintf
Eitan Adler [Wed, 13 Jun 2018 08:52:12 +0000 (08:52 +0000)]
top(1): replace homegrown itoa with sprintf

Much of this should be inlined to the callsite, but leave it here for
now to make it easier to make it easier bisect later.

6 years agotop(1): format_time, format_k, etc.
Eitan Adler [Wed, 13 Jun 2018 08:52:09 +0000 (08:52 +0000)]
top(1): format_time, format_k, etc.

- Use humanize_number for format_k and format_k2
- Fix some style nits in format_time

6 years agotop(1): format help more nicely
Eitan Adler [Wed, 13 Jun 2018 08:52:06 +0000 (08:52 +0000)]
top(1): format help more nicely

For entries that are duplicates present them nicely rather than showing
two identical help entries. For ' ' present it as SPC

6 years agovmstat(1): various nits
Eitan Adler [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
Bruce Evans [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
Dimitry Andric [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).
Marcelo 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
Warner Losh [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
Matt Macy [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
Marcelo 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.
Marcelo 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).
Marcelo 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
Eitan Adler [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
Eitan Adler [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
Randall Stewart [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
Matt Macy [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.
Jung-uk Kim [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.
Rick Macklem [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,
Rick Macklem [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
Matt Macy [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
Matt Macy [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
Matt Macy [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
Emmanuel Vadot [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
Breno 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.
Rick Macklem [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.
Sean Bruno [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:
Sean Bruno [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
Kyle Evans [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.
Ruslan Bukin [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.
Ruslan Bukin [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.
Ruslan Bukin [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
Ruslan Bukin [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
Edward Tomasz Napierala [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.
Edward Tomasz Napierala [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
Baptiste Daroussin [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)
Baptiste Daroussin [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.
Ruslan Bukin [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 Turner [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
Ed Maste [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
Diane Bruce [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
Emmanuel Vadot [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.
Konstantin Belousov [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.
Konstantin Belousov [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.
Hans Petter Selasky [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
Kurt Jaeger [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
Eitan Adler [Tue, 12 Jun 2018 07:31:59 +0000 (07:31 +0000)]
top(1): remove trailing whitespace

6 years agotop(1): style and related
Eitan Adler [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
Eitan Adler [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.
Navdeep Parhar [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
Kyle Evans [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)
Li-Wen Hsu [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
Jonathan T. Looney [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.
Warner Losh [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)
Ed Maste [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.
Warner Losh [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.
Warner Losh [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
Ed Maste [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
Ed Maste [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.
Warner Losh [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
Ed Maste [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.
Warner Losh [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.
Warner Losh [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
Warner Losh [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.
Warner Losh [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
Diane Bruce [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.
Rick Macklem [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
Ed Maste [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
Ed Maste [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
Matt Macy [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.
Mark Johnston [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
Matt Macy [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().
Mark Johnston [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
Hans Petter Selasky [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
Ryan Libby [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
Hans Petter Selasky [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.
Konstantin Belousov [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.
Marcelo 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.
Pedro F. Giffuni [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-
Jonathan T. Looney [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
Dimitry Andric [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