]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agodts: Update our copy to Linux 4.17
manu [Thu, 14 Jun 2018 07:12:10 +0000 (07:12 +0000)]
dts: Update our copy to Linux 4.17

5 years agodts: Import files from Linux 4.17
manu [Thu, 14 Jun 2018 06:56:07 +0000 (06:56 +0000)]
dts: Import files from Linux 4.17

5 years agobootprog_info is generated in vers.c. Move it's definition to
imp [Thu, 14 Jun 2018 06:41:33 +0000 (06:41 +0000)]
bootprog_info is generated in vers.c. Move it's definition to
bootstrap.h and remove all the redundant copies.

Sponsored by: Netflix

5 years agoUse bool for vargood, since it's a boolean.
imp [Thu, 14 Jun 2018 06:41:22 +0000 (06:41 +0000)]
Use bool for vargood, since it's a boolean.

Sponsored by: Netflix

5 years agoAdd modules/rockchip
manu [Thu, 14 Jun 2018 06:40:59 +0000 (06:40 +0000)]
Add modules/rockchip

Build rockchip modules as part of buildkernel.
Add the i2c controller module.

5 years agork_i2c: Add driver for the I2C controller present in RockChip SoC
manu [Thu, 14 Jun 2018 06:39:33 +0000 (06:39 +0000)]
rk_i2c: Add driver for the I2C controller present in RockChip SoC

This controller have a special mode for RX to help with smbus-like transfer
when the controller will automatically send the slave address, register address
and read the data. Use it when possible.
The same mode for TX is describe is the datasheet but is broken and have been
since ~10 years of presence of this controller in RockChip SoCs.

Attach this driver early at we need it to communicate with the PMIC early in the
boot.
Do not hook it to the kernel build for now.

5 years agork3328: Add support for the i2c clocks
manu [Thu, 14 Jun 2018 06:34:27 +0000 (06:34 +0000)]
rk3328: Add support for the i2c clocks

5 years agoif_dwc_rk: Add DesignWare driver for RockChip SoCs.
manu [Thu, 14 Jun 2018 06:28:09 +0000 (06:28 +0000)]
if_dwc_rk: Add DesignWare driver for RockChip SoCs.

Add driver for the designware ethernet controller found in some RockChip SoCs.
The driver still rely on a lot of things setup by the bootloader like clocks
and phy mode.
But since netbooting is the only/easiest way to boot rockchip board at the
moment add the driver so other people can test/dev on thoses boards.

5 years agoRemove redundant defs.mk includes. They aren't needed.
imp [Thu, 14 Jun 2018 06:14:48 +0000 (06:14 +0000)]
Remove redundant defs.mk includes. They aren't needed.

5 years agork_armclk: Add the write mask to the register mux value
manu [Thu, 14 Jun 2018 05:46:57 +0000 (05:46 +0000)]
rk_armclk: Add the write mask to the register mux value

This was omitted in r334112 and r334996 which cause the PLL to not correctly
reparent, leaving the armclk to be derived from the APLL instead of the NPLL.
The arm core clock is now correctly set to 600Mhz via the assigned-clock present
in the DTB.

5 years agork_pll: Add support for mode
manu [Thu, 14 Jun 2018 05:43:45 +0000 (05:43 +0000)]
rk_pll: Add support for mode

RockChip PLL have two modes controlled by a register, a "slow mode" (the
default one) where the frequency is derived from the 24Mhz oscillator on the
board, and a "normal" one when the pll take it's input from the real PLL output.

Default the mode to normal for all the PLLs.

5 years agork_pinctrl: Only add gpio subnode
manu [Thu, 14 Jun 2018 05:41:16 +0000 (05:41 +0000)]
rk_pinctrl: Only add gpio subnode

This is the only node we are interested in so do not waste time to test
creating device that will be either unused or fail as most of the nodes
don't have a compatible string.

5 years agoThis fixes several bugs that Larry Rosenman helped me find in
rrs [Thu, 14 Jun 2018 03:27:42 +0000 (03:27 +0000)]
This fixes several bugs that Larry Rosenman helped me find in
Rack with respect to its handling of TCP Fast Open. Several
fixes all related to TFO are included in this commit:
1) Handling of non-TFO retransmissions
2) Building the proper send-map when we are doing TFO
3) Dealing with the ack that comes back that includes the
   SYN and data.

It appears that with this commit TFO now works :-)

Thanks Larry for all your help!!

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

5 years agoaudit(4): add tests for statfs(2), fstatfs(2), and getfsstat(2)
asomers [Thu, 14 Jun 2018 02:30:43 +0000 (02:30 +0000)]
audit(4): add tests for statfs(2), fstatfs(2), and getfsstat(2)

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

5 years agoFix style(9) space vs tab.
araujo [Thu, 14 Jun 2018 01:34:53 +0000 (01:34 +0000)]
Fix style(9) space vs tab.

Reviewed by: jhb
MFC after: 3 weeks.
Sponsored by: iXsystems Inc.
Differential Revision: https://reviews.freebsd.org/D15768

5 years agoFix style(9) space vs tab.
araujo [Thu, 14 Jun 2018 01:28:55 +0000 (01:28 +0000)]
Fix style(9) space vs tab.

Reviewed by: jhb
MFC after: 3 weeks.
Sponsored by: iXsystems Inc.
Differential Revision: https://reviews.freebsd.org/D15774

5 years agocxgbe(4): Catch up with recent changes in the kernel -- it no longer
np [Thu, 14 Jun 2018 01:27:35 +0000 (01:27 +0000)]
cxgbe(4): Catch up with recent changes in the kernel -- it no longer
holds non-sleepable locks around any of the driver ioctls.

Sponsored by: Chelsio Communications

5 years agoNVME support is only for x86 and powerpc64.
imp [Thu, 14 Jun 2018 01:15:19 +0000 (01:15 +0000)]
NVME support is only for x86 and powerpc64.

Implement MK_NVME now that the expression for where NVMe is
complicated. Default it to "yes" for x86 and powerpc64 and
no everywhere else. Use it in camcontrol to define WITH_NVME
for those platforms where we support nvme.

This should fix the newly introduced nvme files to camcontrol
which were building everywhere.

Pointy Hat To: imp
Sponsored by: Netflix

5 years agoFix top(1) support for displaying ZFS Compressed ARC statistics
allanjude [Thu, 14 Jun 2018 00:10:16 +0000 (00:10 +0000)]
Fix top(1) support for displaying ZFS Compressed ARC statistics

Broken in r334514

sysctlbyname("vfs.zfs.compressed_arc_enabled", ...) would return ENOMEM
while trying to read the sysctl (a boolean_t) into a bool, which is too small.

Reviewed by: jhb (on irc)
Sponsored by: Klara Systems

5 years agofix OFED build after r335053
mmacy [Wed, 13 Jun 2018 23:30:54 +0000 (23:30 +0000)]
fix OFED build after r335053

5 years agoFix PCBGROUPS build post CK conversion of pcbinfo
mmacy [Wed, 13 Jun 2018 23:19:54 +0000 (23:19 +0000)]
Fix PCBGROUPS build post CK conversion of pcbinfo

5 years agoMake camcontrol identify work with nda devices
imp [Wed, 13 Jun 2018 22:00:08 +0000 (22:00 +0000)]
Make camcontrol identify work with nda devices

Both ATA and NVME have an identify command. They are completely
different, but to the user they are the same. Leverage nvmecontrol's
print_controller code to provide that functionality to camcontrol
identify. Query the path to see what kind of protocol it supports, and
send the most appropriate command down. Refactor nvme_print_dev a
little to make it easy to get the nvme cdata.

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

5 years agoMake it possible to use print_controller from another program
imp [Wed, 13 Jun 2018 22:00:02 +0000 (22:00 +0000)]
Make it possible to use print_controller from another program

Rename print_controller to nvme_print_controller. Put it in its
own file for easy inclusion. Move util.c to be nc_util.c to not
conflict with camcontrol. add nvecontrol_ext.h to define shared
interfaces.

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

5 years agoEnable eager FPU context switch by default on i386 too, based on
kib [Wed, 13 Jun 2018 21:10:23 +0000 (21:10 +0000)]
Enable eager FPU context switch by default on i386 too, based on
amd64 r335072.

Security: CVE-2018-3665
Sponsored by: The FreeBSD Foundation

5 years agoAdd PNP info to PCI attachment of ae driver
imp [Wed, 13 Jun 2018 20:25:36 +0000 (20:25 +0000)]
Add PNP info to PCI attachment of ae driver

Reviewed by: imp, chuck
Submitted by: Lakhan Shiva Kamireddy <lakhanshiva@gmail.com>
Sponsored by: Google, Inc. (GSoC 2018)

5 years agoAdd PNP info to PCI attachments of age driver
imp [Wed, 13 Jun 2018 20:25:32 +0000 (20:25 +0000)]
Add PNP info to PCI attachments of age driver

Reviewed by: imp, chuck
Submitted by: Lakhan Shiva Kamireddy <lakhanshiva@gmail.com>
Sponsored by: Google, Inc. (GSoC 2018)

5 years agoAdd PNP info to PCI attachment of amr driver
imp [Wed, 13 Jun 2018 20:25:27 +0000 (20:25 +0000)]
Add PNP info to PCI attachment of amr driver

Reviewed by: imp, chuck
Submitted by: Lakhan Shiva Kamireddy <lakhanshiva@gmail.com>
Sponsored by: Google, Inc. (GSoC 2018)

5 years agoAdd PNP info to PCI attachment of ale driver
imp [Wed, 13 Jun 2018 20:25:23 +0000 (20:25 +0000)]
Add PNP info to PCI attachment of ale driver

Reviewed by: imp, chuck
Submitted by: Lakhan Shiva Kamireddy <lakhanshiva@gmail.com>
Sponsored by: Google, Inc. (GSoC 2018)

5 years agoAdd PNP info to PCI attachment of bwi driver
imp [Wed, 13 Jun 2018 20:25:18 +0000 (20:25 +0000)]
Add PNP info to PCI attachment of bwi driver

Reviewed by: imp, chuck
Submitted by: Lakhan Shiva Kamireddy <lakhanshiva@gmail.com>
Sponsored by: Google, Inc. (GSoC 2018)

5 years agoAdd PNP info to PCI attachment of bwn driver
imp [Wed, 13 Jun 2018 20:25:13 +0000 (20:25 +0000)]
Add PNP info to PCI attachment of bwn driver

Reviewed by: imp, chuck
Submitted by: Lakhan Shiva Kamireddy <lakhanshiva@gmail.com>
Sponsored by: Google, Inc. (GSoC 2018)

5 years agoAdd PNP info to PCI attachment of an driver
imp [Wed, 13 Jun 2018 20:25:09 +0000 (20:25 +0000)]
Add PNP info to PCI attachment of an driver

Reviewed by: imp, chuck
Submitted by: Lakhan Shiva Kamireddy <lakhanshiva@gmail.com>
Sponsored by: Google, Inc. (GSoC 2018)

5 years agoAdd PNP info to the PCI attachment of the ahci driver
imp [Wed, 13 Jun 2018 20:25:04 +0000 (20:25 +0000)]
Add PNP info to the PCI attachment of the ahci driver

Mark the PNP table, but still need to handle the CLASS / SUBCLASS /
REVID matching.

Reviewed by: imp, chuck
Submitted by: Lakhan Shiva Kamireddy <lakhanshiva@gmail.com>
Sponsored by: Google, Inc. (GSoC 2018)

5 years agoAdd PNP info to the PCI attachment of the aacraid driver.
imp [Wed, 13 Jun 2018 20:25:00 +0000 (20:25 +0000)]
Add PNP info to the PCI attachment of the aacraid driver.

Reviewed by: imp, chuck
Submitted by: Lakhan Shiva Kamireddy <lakhanshiva@gmail.com>
Sponsored by: Google, Inc. (GSoC 2018)

5 years agoAdd PNP info to the PCI attachment of the ncr driver.
imp [Wed, 13 Jun 2018 20:24:49 +0000 (20:24 +0000)]
Add PNP info to the PCI attachment of the ncr driver.

Reviewed by: imp, chuck
Submitted by: Lakhan Shiva Kamireddy <lakhanshiva@gmail.com>
Sponsored by: Google, Inc. (GSoC 2018)

5 years agoi386: copyin/copyout error is EFAULT
rlibby [Wed, 13 Jun 2018 19:57:03 +0000 (19:57 +0000)]
i386: copyin/copyout error is EFAULT

Discussed with: kib
MFC with: r332489
Sponsored by: Dell EMC Isilon

5 years agoMention that ports are used to build packages, this fact - obvious
trasz [Wed, 13 Jun 2018 18:50:51 +0000 (18:50 +0000)]
Mention that ports are used to build packages, this fact - obvious
to the developers, but much less so to users - seems to be rather
weakly documented.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agoGet rid of references to /usr/share/doc/ from ports(7) and getosreldate(3).
trasz [Wed, 13 Jun 2018 18:34:49 +0000 (18:34 +0000)]
Get rid of references to /usr/share/doc/ from ports(7) and getosreldate(3).
The handbooks are not installed there anymore. While here, improve the
URLs markup a bit.

Reviewed by: allanjude@
MFC after: 2 weeks
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D15793

5 years agoEnable eager FPU context switch by default on amd64.
kib [Wed, 13 Jun 2018 17:55:09 +0000 (17:55 +0000)]
Enable eager FPU context switch by default on amd64.

With compilers making increasing use of vector instructions the
performance benefit of lazily switching FPU state is no longer a
desirable tradeoff.  Linux switched to eager FPU context switch some
time ago, and the idea was floated on the FreeBSD-current mailing list
some years ago[1].

Enable eager FPU context switch by default on amd64, with a tunable/sysctl
available to turn it back off.

[1] https://lists.freebsd.org/pipermail/freebsd-current/2015-March/055198.html

Reviewed by: jhb
Tested by: pho
Sponsored by: The FreeBSD Foundation

5 years agoInitialize variables we later free so they aren't used
imp [Wed, 13 Jun 2018 17:42:55 +0000 (17:42 +0000)]
Initialize variables we later free so they aren't used
uninitialized in the error path.
Remove unused variables.

Sponsored by: Netflix

5 years agoRemove unused variables.
imp [Wed, 13 Jun 2018 17:42:50 +0000 (17:42 +0000)]
Remove unused variables.

Sponsored by: Netflix

5 years agoRemove fail: label. It's unused.
imp [Wed, 13 Jun 2018 17:28:06 +0000 (17:28 +0000)]
Remove fail: label. It's unused.

Sponsored by: Netflix

5 years agoMake UMA and malloc(9) return non-executable memory in most cases.
jtl [Wed, 13 Jun 2018 17:04:41 +0000 (17:04 +0000)]
Make UMA and malloc(9) return non-executable memory in most cases.

Most kernel memory that is allocated after boot does not need to be
executable.  There are a few exceptions.  For example, kernel modules
do need executable memory, but they don't use UMA or malloc(9).  The
BPF JIT compiler also needs executable memory and did use malloc(9)
until r317072.

(Note that a side effect of r316767 was that the "small allocation"
path in UMA on amd64 already returned non-executable memory.  This
meant that some calls to malloc(9) or the UMA zone(9) allocator could
return executable memory, while others could return non-executable
memory.  This change makes the behavior consistent.)

This change makes malloc(9) return non-executable memory unless the new
M_EXEC flag is specified.  After this change, the UMA zone(9) allocator
will always return non-executable memory, and a KASSERT will catch
attempts to use the M_EXEC flag to allocate executable memory using
uma_zalloc() or its variants.

Allocations that do need executable memory have various choices.  They
may use the M_EXEC flag to malloc(9), or they may use a different VM
interfact to obtain executable pages.

Now that malloc(9) again allows executable allocations, this change also
reverts most of r317072.

PR: 228927
Reviewed by: alc, kib, markj, jhb (previous version)
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D15691

5 years agoaudit(4): Fix file descriptor leaks in ATF tests
asomers [Wed, 13 Jun 2018 17:01:57 +0000 (17:01 +0000)]
audit(4): Fix file descriptor leaks in ATF tests

Submitted by: aniketp
Reported by: Coverity
CID: 1393343 1393346 1392695 1392781 1391709 1392078 1392413
CID: 1392014 1392521 1393344 1393345 1393347 1393348 1393349
CID: 1393354 1393355 1393356 1393357 1393358 1393360 1393362
CID: 1393368 1393369 1393370 1393371 1393372 1393373 1393376
CID: 1393380 1393384 1393387 1393388 1393389
MFC after: 2 weeks
Sponsored by: Google, Inc (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15782

5 years agoImplement a 'car limit' for bioq.
imp [Wed, 13 Jun 2018 16:48:07 +0000 (16:48 +0000)]
Implement a 'car limit' for bioq.

Allow one to implement a 'car limit' for
bioq_disksort. debug.bioq_batchsize sets the size of car limit. Every
time we queue that many requests, we start over so that we limit the
latency for requests when the software queue depths are large. A value
of '0', the default, means to revert to the old behavior.

Sponsored by: Netflix

5 years agoAdd ThunderX2 to the list of CPUs we need to apply the branch predictor
andrew [Wed, 13 Jun 2018 15:58:33 +0000 (15:58 +0000)]
Add ThunderX2 to the list of CPUs we need to apply the branch predictor
hardening to.

Sponsored by: DARPA, AFRL

5 years agoSwitch to the SMCCC function for branch predictor hardening. The previous
andrew [Wed, 13 Jun 2018 15:56:24 +0000 (15:56 +0000)]
Switch to the SMCCC function for branch predictor hardening. The previous
method may not have worked as the firmware checks for the ARCH_WORKAROUND_1
function ID.

Sponsored by: DARPA, AFRL

5 years agoAdd the SMCCC return codes from ARM DEN 0070A.
andrew [Wed, 13 Jun 2018 15:41:22 +0000 (15:41 +0000)]
Add the SMCCC return codes from ARM DEN 0070A.

While here add a comment with the document the function IDs come from.

Sponsored by: DARPA, AFRL

5 years agoAdd support for the ARM SMC Calling Convention (SMCCC). This is a method
andrew [Wed, 13 Jun 2018 15:32:00 +0000 (15:32 +0000)]
Add support for the ARM SMC Calling Convention (SMCCC). This is a method
to call into the firmware in a similar way to the existing PSCI, and used
PSCI to detect when SMCCC is enabled.

There is a function ID space we can use. Currently we only support 3
functions in the ARM Architecture Calls region, however it is expected we
will expend these in the future.

Sponsored by: DARPA, AFRL

5 years agoMove psci_call to a header file so we can use it in other files to
andrew [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

5 years agoaudit(4): fix the definition of ARG_TERMID_ADDR
asomers [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

5 years agoOops, r335053 had an old version of the comment about 16-bit linux dev_t
bde [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.

5 years agoAdd a handler for the PSCI_FEATURES function. This needs PSCI 1.0, so
andrew [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

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

Sponsored by: DARPA, AFRL

5 years agoAdd the PSCI_FEATURES function ID. This is found in PSCI 1.0 and is used
andrew [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

5 years agoFix the encoding of major and minor numbers in 64-bit dev_t by restoring
bde [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)

5 years agoRename the ThunderX CPU identification macros to include the X. This is the
andrew [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

5 years agoAdd more Cavium CPU part numbers.
andrew [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

5 years agoWhile I was investigating CID 1194192 related with a resource leak on mrp memory
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.

5 years agotop(1): remove unneeded logic
eadler [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.

5 years agoRework if_gre(4) to use encap_lookup_t method to speedup lookup
ae [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.

5 years agoDon't jump to VA space until kernel is ready.
br [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

5 years agodumpon(8): improve the examples a bit
eadler [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)

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

Reported by: swills

5 years agoatoi.3: bump .Dd
eadler [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.

5 years agotop(1): style(9)
eadler [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.

5 years agotop(1): add myself to authors
eadler [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.

5 years agolibc: remove explicit cast NULL in atoi
eadler [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

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

5 years agotop(1): replace homegrown itoa with sprintf
eadler [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.

5 years agotop(1): format_time, format_k, etc.
eadler [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

5 years agotop(1): format help more nicely
eadler [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

5 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

5 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)

5 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

5 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.

5 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

5 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.

5 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.

5 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.

5 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.

5 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

5 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

5 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

5 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

5 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

5 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.

5 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.

5 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

5 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.

5 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

5 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

5 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

5 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

5 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

5 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

5 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.

5 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

5 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

5 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

5 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