Commit Graph

120851 Commits

Author SHA1 Message Date
Brooks Davis
6d0fe480a8 Don't declare union semun in userspace unless _WANT_SEMUN is defined.
POSIX explicitly states that the application must declare union semun.
This makes no sense, but it is what it is.  This brings us into line
with Linux, MacOS/Darwin, and NetBSD.

In a ports exp-run a moderate number of ports fail due to a lack of
approprate autotools-like discovery mechanisms or local patches.  A
commit to address them will follow shortly.

PR:		224300, 224443 (exp-run)
Reviewed by:	emaste, jhb, kib
Exp-run by:	antoine
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D14492
2018-03-02 22:32:53 +00:00
Brooks Davis
ac3ef06af9 Don't define struct mymsg.
PR:		224299, 224443 (exp-run)
Reviewed by:	kib, jhb
Exp-run by:	antoine
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D14491
2018-03-02 22:13:29 +00:00
Brooks Davis
93e48a303a Rename kernel-only members of semid_ds and msgid_ds.
This deliberately breaks the API in preperation for future syscall
revisions which will remove these nonstandard members.

In an exp-run a single port (devel/qemu-user-static) was found to
use them which it did becuase it emulates system calls.  This has
been fixed in the ports tree.

PR:		224443 (exp-run)
Reviewed by:	kib, jhb (previous version)
Exp-run by:	antoine
Sponsored by:	DARPA, AFRP
Differential Revision:	https://reviews.freebsd.org/D14490
2018-03-02 22:10:48 +00:00
Mateusz Guzik
c505b59961 sx: fix adaptive spinning broken in r327397
The condition was flipped.

In particular heavy multithreaded kernel builds on zfs started suffering
due to nested sx locks.

For instance make -s -j 128 buildkernel:

before: 3326.67s user 1269.62s system 6981% cpu 1:05.84 total
after: 3365.55s user 911.27s system 6871% cpu 1:02.24 total

ps.
      .-'---`-.			      .-'---`-.
    ,'          `.		    ,'          `.
    |             \		    |             \
    |              \		    |              \
    \           _  \		    \           _  \
    ,\  _    ,'-,/-)\		    ,\  _    ,'-,/-)\
    ( * \ \,' ,' ,'-)		    ( * \ \,' ,' ,'-)
     `._,)     -',-')		     `._,)     -',-')
       \/         ''/		       \/         ''/
        )        / /		        )        / /
       /       ,'-'		       /       ,'-'
2018-03-02 21:26:27 +00:00
Emmanuel Vadot
9589b9f57b dtb/allwinner: Build sun8i-h3-nanopi-m1-plus.dts
We have a u-boot port for this board so add the dtb to the build.
2018-03-02 20:59:36 +00:00
Alexander Motin
9ff8b70ded Update QLogic ISP 24xx/25xx chips firmware to 8.07.00.
MFC after:	1 month
2018-03-02 19:50:41 +00:00
Stephen Hurd
226fb85d19 iflib: stop timer callout when stopping
iflib_timer has been seen running after the interface had been removed.
This change prevents that.

Submitted by:	matt.macy@joyent.com
2018-03-02 18:48:07 +00:00
Konstantin Belousov
7e79c3c15f Remove _Nonnull attributes from user addresses arguments for
copyout(9) family.

The addresses are user-controllable, and if the process ABI allows
mapping at zero, then the zero address is meaningful, contradicting
the definition of _Nonnull.  In any case, it does not require any
special code to handle NULL udaddr.

It is not clear if __restrict makes sense as well, since kaddr and
udaddr point to different address spaces, so equal numeric values of
the pointers do not imply aliasing and a legitimate.  But leave it for
later.

copyinstr(9) does not have its user address argument annotated.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2018-03-02 16:47:02 +00:00
Andrew Turner
6d9e17fc83 Count the number of children in the GICv3 ACPI attachment. This is needed
later for assigning IRQ vector space.

Sponsored by:	DARPA, AFRL
Sponsored by:	Cavium (Hardware)
2018-03-02 13:04:21 +00:00
Hans Petter Selasky
86ba49a722 Implement more lockdep stubs in the LinuxKPI.
MFC after:	1 week
Submitted by:	Johannes Lundberg <johalun0@gmail.com>
Sponsored by:	Mellanox Technologies
Sponsored by:	Limelight Networks
2018-03-02 08:59:53 +00:00
Hans Petter Selasky
8554bc585b Implement ktime_get_raw() function in the LinuxKPI.
MFC after:	1 week
Submitted by:	Johannes Lundberg <johalun0@gmail.com>
Sponsored by:	Mellanox Technologies
Sponsored by:	Limelight Networks
2018-03-02 08:58:32 +00:00
Hans Petter Selasky
d901abf167 Implement wait_on_bit() function macro in the LinuxKPI.
MFC after:	1 week
Submitted by:	Johannes Lundberg <johalun0@gmail.com>
Sponsored by:	Mellanox Technologies
Sponsored by:	Limelight Networks
2018-03-02 08:56:15 +00:00
Hans Petter Selasky
9555cfd2b2 Rename callout member in struct timer_list to match the one in struct
delayed_work in the LinuxKPI. This allows the timer_pending() function
macro to be used with delayed work structures.

No functional nor structural change.

MFC after:	1 week
Submitted by:	Johannes Lundberg <johalun0@gmail.com>
Sponsored by:	Mellanox Technologies
Sponsored by:	Limelight Networks
2018-03-02 08:52:27 +00:00
Conrad Meyer
90575a0ec9 g_label_ufs: Fix typo from r330264
Reported by:	O. Hartmann <o.hartmann AT walstatt.org>
Sponsored by:	Dell EMC Isilon
2018-03-02 06:02:54 +00:00
Kirk McKusick
efbf396426 This change is some refactoring of Mark Johnston's changes in r329375
to fix the memory leak that I introduced in r328426. Instead of
trying to clear up the possible memory leak in all the clients, I
ensure that it gets cleaned up in the source (e.g., ffs_sbget ensures
that memory is always freed if it returns an error).

The original change in r328426 was a bit sparse in its description.
So I am expanding on its description here (thanks cem@ and rgrimes@
for your encouragement for my longer commit messages).

In preparation for adding check hashing to superblocks, r328426 is
a refactoring of the code to get the reading/writing of the superblock
into one place. Unlike the cylinder group reading/writing which
ends up in two places (ffs_getcg/ffs_geom_strategy in the kernel
and cgget/cgput in libufs), I have the core superblock functions
just in the kernel (ffs_sbfetch/ffs_sbput in ffs_subr.c which is
already imported into utilities like fsck_ffs as well as libufs to
implement sbget/sbput). The ffs_sbfetch and ffs_sbput functions
take a function pointer to do the actual I/O for which there are
four variants:

    ffs_use_bread / ffs_use_bwrite for the in-kernel filesystem

    g_use_g_read_data / g_use_g_write_data for kernel geom clients

    ufs_use_sa_read for the standalone code (stand/libsa/ufs.c
	but not stand/libsa/ufsread.c which is size constrained)

    use_pread / use_pwrite for libufs

Uses of these interfaces are in the UFS filesystem, geoms journal &
label, libsa changes, and libufs. They also permeate out into the
filesystem utilities fsck_ffs, newfs, growfs, clri, dump, quotacheck,
fsirand, fstyp, and quot. Some of these utilities should probably be
converted to directly use libufs (like dumpfs was for example), but
there does not seem to be much win in doing so.

Tested by: Peter Holm (pho@)
2018-03-02 04:34:53 +00:00
Ian Lepore
35e313cfe8 Add a function to retrieve the EFI realtime clock capabilities. 2018-03-01 22:57:14 +00:00
Eitan Adler
58dcf3ff97 sys/sys: Use a more common spelling of 'dirent'
Submitted by:	Domagoj Stolfa <domagoj.stolfa@gmail.com>
MFC After:	3 days
2018-03-01 22:38:21 +00:00
Wojciech Macek
4ffd72e34c PowerNV: Initial support for OPAL I2C transfers
Add I2C OPAL driver and a set of dummy-ones to allow
all I2C things on Power8 to attach.

TODO: better async token management

Submitted by:          Wojciech Macek <wma@semihalf.com>
Obtained from:         Semihalf
Sponsored by:          IBM, QCM Technologies
2018-03-01 14:11:07 +00:00
Ed Maste
023b850b62 Rationalize license text on Linuxolator files
Many licenses on Linuxolator files contained small variations from the
standard FreeBSD license text.  To avoid license proliferation switch to
the standard 2-clause FreeBSD license for those files where I have
permission from each of the listed copyright holders.  Additional files
still waiting on permission from others are listed in review D14210.

Approved by:    dchagin, rdivacky, sos
MFC after:	1 week
MFC with:	r329370
Sponsored by:	The FreeBSD Foundation
2018-03-01 13:52:18 +00:00
Hans Petter Selasky
b44247b1a9 Correct the return value from flush_work() and flush_delayed_work() in the
LinuxKPI to comply more with Linux. This fixes an issue when these functions
are used in waiting loops.

MFC after:	1 week
Sponsored by:	Mellanox Technologies
2018-03-01 10:31:51 +00:00
Justin Hibbits
5903f5954a Fix the psl_userset32 definition.
It should be based on psl_userset, not psl_kernset.  As kernset, it would
inherit kernel config, including privilege level.
2018-03-01 04:44:17 +00:00
Conrad Meyer
fadd3f8a66 pci_ioctl: Avoid returning uninitialized error value if user provided empty buffer
In the weird case where the user-provided buffer was zero bytes, we could break
out of PCIOCGETCONF and return without initializing error.  In this case,
initialize error to zero -- we successfully did nothing, as requested.

Reported by:	Coverity
Sponsored by:	Dell EMC Isilon
2018-03-01 01:49:36 +00:00
Conrad Meyer
893daee680 psm(4): Always initialize used values in debug print
'status' array passed to get_mouse_status() is usually uninitialized by
callers.

Fully populating it with values in get_mouse_status() can fail due to
read_aux_data().

Additionally, nothing in API constrains 'len' to be >= 3.  In practice,
every caller passes three, so perhaps that argument should just be removed.
Refactoring is a larger change, though.

Remove use of potentially uninitialized values by:
1. Only printing 3 debug statuses if the passed array was at least
   'len' >= 3;
2. Populating 'status' array up to first three elements, if read_aux_data()
   failed.

No functional change intended.

Reported by:	Coverity
Sponsored by:	Dell EMC Isilon
2018-03-01 00:58:59 +00:00
Conrad Meyer
d4e6557bae ffs: softdep_disk_write_complete: Quiesce spurious Coverity warning
Coverity cannot determine that handle_written_indirdep() does not access
uninitialized 'sbp' when flags argument is zero.

So, simply move the initialization slightly sooner to silence the warning.

No functional change.

Reported by:	Coverity
Sponsored by:	Dell EMC Isilon
2018-03-01 00:29:52 +00:00
Kyle Evans
b5cdd987a8 Revert r328964: if_awg: Skip emac reset if configured for internal PHY
This broke EFI boots consistently, and emac reset is sometimes needed if
things get into a bad state -- this won't be done without a full powercycle.
2018-02-28 20:51:21 +00:00
Emmanuel Vadot
6151aa3860 RK3188: Mark it NO_UNIVERSE
This is an old kernel so mark it as NO_UNIVERSE so it's not built by
the universe rule or tinderbox.
2018-02-28 19:08:52 +00:00
Emmanuel Vadot
2f88239958 dwmmc_rockchip: Add ifdefs on EXT_RESOURCES
The old RK3188 kernel config uses dwmmc but isn't compiled with EXT_RESOURCES.
Add ifdefs around code using EXT_RESOURCES code.

Reported by:	rpokala
2018-02-28 19:05:25 +00:00
Alexander Motin
14e084ada5 Add support for Enhanced Gen 5 (16Gb) and Gen 6 (32Gb) QLogic FC HBAs.
MFC after:	2 weeks
Sponsored by:	iXsystems, Inc.
2018-02-28 16:24:32 +00:00
Andrew Turner
e9c0572e4c Allow releasing APs to take more time, as long as we are making progress.
On large core count machines this can be slow while all the CPUs update
the online counter.

Sponsored by:	DARPA, AFRL
Sponsored by:	Cavium (Hardware)
2018-02-28 16:03:40 +00:00
Andrew Turner
cf0afdaab6 Count the number of GIC redistributors in the ACPI tables. The GICv3 driver
needs this to allocate memory, and connect the CPUs to the interrupt
controller.

Sponsored by:	DARPA, AFRL
Sponsored by:	Cavium (Hardware)
2018-02-28 15:25:47 +00:00
Andrew Turner
3d9294b0a1 Only check the ProducerConsumer flag on extended memory. As per the ACPI
6.0 spec 6.4.3.5 bit 0 is ignored on QWord, DWord, and Word Address Space
Descriptors, but not Extended Address Space Descriptors.

Reviewed by:	jhb
Sponsored by:	DARPA, AFRL
Sponsored by:	Cavium (Hardware)
Differential Revision:	https://reviews.freebsd.org/D14516
2018-02-28 15:18:31 +00:00
Andrew Turner
92457451f4 The Arm pl011 driver assumes it's running a devicetree based system.
It calls OF_* functions to check if it needs to implement workarounds.
This may not be the case on arm64 where we support both FDT and ACPI.
Fix this by checking if we are booting on FDT before calling these checks.

Reviewed by:	ian
Sponsored by:	DARPA, AFRL
Sponsored by:	Cavium (Hardware)
Differential Revision:	https://reviews.freebsd.org/D14515
2018-02-28 15:02:27 +00:00
Ed Maste
e9093b66d5 Add kernel retpoline option for amd64
Retpoline is a compiler-based mitigation for CVE-2017-5715, also known
as Spectre V2, that protects against speculative execution branch target
injection attacks.

In this commit it is disabled by default, but will be changed in a
followup commit.

Reviewed by:	bdrewery (previous version)
MFC after:	3 days
Security:	CVE-2017-5715
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D14242
2018-02-28 14:57:45 +00:00
Michael Tuexen
1c714531e8 When checking the TCP fast cookie length, conststently also check
for the minimum length.

This fixes a bug where cookies of length 2 bytes (which is smaller
than the minimum length of 4) is provided by the server.

Sponsored by:	Netflix, Inc.
2018-02-27 22:12:38 +00:00
John Baldwin
6b554d26ed Move #include for rijndael.h out of x86-specific region.
The #include was added inside of the conditional by accident and the lack
of it broke non-x86 builds.

Reported by:	lwhsu (jenkins), andrew
2018-02-27 17:51:58 +00:00
Mark Johnston
3b8cf4acf0 Give the 0th domain's page daemon thread a consistent name.
Page daemon threads for other domains show up in ps(1) output as
"pagedaemon/domN", so let that be the case for domain 0 as well.

Submitted by:	Kevin Bowling <kevin.bowling@kev009.com>
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D14518
2018-02-27 16:51:09 +00:00
Michal Meloun
4a744c0e9d Define meaning of remaining clock rounding flags combinations.
MFC after: 2 weeks
2018-02-27 16:08:08 +00:00
Michal Meloun
81cb170fea Switch to mainstream DTS for Raspberry Pi-B and Pi-2.
This is first step in attempt to make FreeBSD compatible with all variants of
RPi boards.

Reviewed by:	gonzo
MFC after:	3 weeks
2018-02-27 15:01:17 +00:00
Andriy Gapon
f3b7b054dd add ZFS_ENTER protection to .zfs/snapshot vnode operations that need it
Those operations, zfsctl_snapdir_readdir and zfsctl_snapdir_getattr,
access the filesystem's objset and it can be unstable during operations
like receive and rollback.

MFC after:	2 weeks
2018-02-27 14:08:54 +00:00
Justin Hibbits
2d5320a818 Increase the size of a reservation granule for TLB locks
A reservation granule on PowerPC is a cache line.

On e500mc and derivatives a cacheline size is 64 bytes, not 32.  Allocate
the maximum size permitted, but only utilize the size that is needed.  On
e500v1 and e500v2 the reservation granule will still be 32 bytes.
2018-02-27 04:38:27 +00:00
Justin Hibbits
7fa00cd0ab Fix a minor typo. 2018-02-27 04:23:03 +00:00
Ian Lepore
665c7f6f1e Initialize all members of vm_page::md_page for armv4/5 systems. This fixes
a hang in SI_SUB_KMEM sysinit, and is apparently required after r323290.
Inspired by the commit message for r323676.

Reported by:	andreast@
2018-02-27 02:11:23 +00:00
Alexander Motin
731308d01d Allow physically non-contiguous chain frames allocation in mps(4)/mpr(4).
Chain frames required to satisfy all 2K of declared I/Os of 128KB each take
more then a megabyte of a physical memory, all of which existing code tries
allocate as physically contiguous.  This patch removes that physical
contiguousness requirement, leaving only virtual contiguousness.  I was
thinking about other ways of allocation, but the less granular allocation
becomes, the bigger is the overhead and/or complexity, reaching about 100%
overhead if allocate each frame separately.

The patch also bumps the chain frames hard limit from 2K to 16K.  It is more
than enough for the case of default REQ_FRAMES and MAXPHYS (the drivers will
allocate less than that automatically), while in case of increased MAXPHYS
it will control maximal memory usage.

Sponsored by:	iXsystems, Inc.
Differential Revision:	https://reviews.freebsd.org/D14420
2018-02-27 01:48:13 +00:00
Alexander Motin
060bac1db8 Add sysctls/tunables for dbuf cache size.
MFC after:	2 weeks
2018-02-27 01:36:43 +00:00
Ian Lepore
1d01310593 Remove obsolete options from these kernel configs. The functionality these
enabled is now on by default since r313330.
2018-02-27 00:30:10 +00:00
Ian Lepore
e5c6bca6ba Add a hw.model sysctl oid for armv6/7 which reports the CPU model, similar
to what other arches (all except riscv and armv4/5) do.

Submitted by:	Hyun Hwang <hyun@caffeinated.codes>
Differential Revision:	https://reviews.freebsd.org/D14465
2018-02-26 23:58:56 +00:00
Emmanuel Vadot
925ee294ea rk_cru: Add missing break 2018-02-26 22:57:52 +00:00
John Baldwin
db631975fe Don't overflow the ipad[] array when clearing the remainder.
After the auth key is copied into the ipad[] array, any remaining bytes
are cleared to zero (in case the key is shorter than one block size).
The full block size was used as the length of the zero rather than the
size of the remaining ipad[].  In practice this overflow was harmless as
it could only clear bytes in the following opad[] array which is
initialized with a copy of ipad[] in the next statement.

Sponsored by:	Chelsio Communications
2018-02-26 22:17:27 +00:00
John Baldwin
52f8c52677 Move ccr_aes_getdeckey() from ccr(4) to the cxgbe(4) driver.
This routine will also be used by the TOE module to manage TLS keys.

Sponsored by:	Chelsio Communications
2018-02-26 22:12:31 +00:00
John Baldwin
198729ea7d Fetch TLS key parameters from the firmware.
The parameters describe how much of the adapter's memory is reserved for
storing TLS keys.  The 'meminfo' sysctl now lists this region of adapter
memory as 'TLS keys' if present.

Sponsored by:	Chelsio Communications
2018-02-26 21:56:06 +00:00