Commit Graph

119108 Commits

Author SHA1 Message Date
Xin LI
ea10ca8944 Avoid calling get_controller_count() until attaching, this would avoid
costly PCI config space operations that slows down systems without the
hardware.

Many thanks to HighPoint for continued support of FreeBSD!

Submitted by:	Steve Chang
Reported by:	cperciva
MFC after:	2 weeks
2017-11-04 06:19:46 +00:00
Warner Losh
ad75dfaf99 Cleanup stray libstand names to be libsa names.
Sponsored by: Netflix
2017-11-04 06:15:20 +00:00
Warner Losh
6db64731d7 Revert "WIP: centralize machine links"
This reverts commit accidentally pushed r325376
2017-11-04 03:08:03 +00:00
Warner Losh
796adb9625 Revert "mostly libsa"
This reverts accidentally pushed r325377.
2017-11-04 03:07:58 +00:00
Warner Losh
c154763db1 Make the startup timeout 0 seconds by default rathern than 420s. This
makes the default fail safe when watchdogd is disabled (which is also
the default).

Sponsored by
2017-11-04 03:01:58 +00:00
Warner Losh
cc088d92e2 mostly libsa 2017-11-04 03:01:52 +00:00
Warner Losh
2caf918121 WIP: centralize machine links 2017-11-04 03:01:11 +00:00
Justin Hibbits
51cfee5d13 Stop passing -me500 to the assembler for Book-E kernels
We already pass -many to the assembler, and -me500 drops 64-bit instruction
handling, for some reason only breaking module building for 64-bit kernels.

Additionally, build with CTF for dtrace.
2017-11-04 00:47:21 +00:00
Bryan Drewery
2abeba9d7a Follow-up r318105: Don't use NO_OBJ at top-level, use NO_OBJWALK.
NO_OBJ has a very specific meaning in sub-directories in that no object
directory will be made.  If a user wanted to skip the 'make obj' phase then
passing -DNO_OBJ would break all sub-directories from building properly.  Using
NO_OBJ internally also causes issue with NO_OBJ handling being added in
share/mk/bsd.init.mk soon.

Sponsored by:	Dell EMC Isilon
2017-11-03 23:22:03 +00:00
Michael Tuexen
28a6adde1d Allow the setting of the MTU for future paths using an SCTP socket option.
This functionality was missing.

MFC after:	1 week
2017-11-03 20:46:12 +00:00
Mateusz Guzik
a2c36a24b6 Special-case pget lookups where pid == curproc->pid
Saves on allproc_lock acquires during buildworld, poudriere etc.

Submitted by:	Pawel Biernacki <pawel.biernacki@gmail.com>
Sponsored by:	Mysterious Code Ltd.
Differential Revision:	D12929
2017-11-03 19:21:36 +00:00
Alan Somers
1d909844ab Fix mpr(4) panics caused by bad drive mapping tables
sys/dev/mpr/mpr_mapping.c
	If _mapping_process_dpm_pg0 detects inconsistencies in the drive
	mapping table (stored in the HBA's NVRAM), abort reading it and
	continue to boot as if the mapping table were blank.  I observed
	such inconsistencies in several HBAs after upgrading firmware from
	14.0.0.0 to 15.0.0.0.

Reviewed by:	slm
MFC after:	3 weeks
Sponsored by:	Spectra Logic Corp
Differential Revision:	https://reviews.freebsd.org/D12901
2017-11-03 15:07:36 +00:00
Hans Petter Selasky
56c49c63e7 Allow CUSE(3) to free all memory mapped memory by using regular SWAP objects
instead of malloc(). The SWAP objects are automagically freed when there are no
more consumers. This greatly simplifies the mmap logic inside CUSE(3) in the
kernel. This change fixes an issue where mmapped memory can accumulate and never
get freed, if many different mmap sizes are needed over time. Further this
change fixes memory leaks when the CUSE(3) kernel module is unloaded.

While at it make sure the CUSE_ALLOC_PAGES_MAX limit is treated as an exclusive
limit. CUSE(3) memory maps must be less than CUSE_ALLOC_PAGES_MAX number of pages.

Reviewed by:		kib @
Differential Revision:	https://reviews.freebsd.org/D11392
Sponsored by:		Mellanox Technologies
MFC after:		1 week
2017-11-03 14:10:57 +00:00
Hans Petter Selasky
8ead3a9933 Remove redundant dev->si_drv1 NULL checks in the LinuxKPI.
This pointer is checked during the linux_dev_open() callback and does
not need to be NULL checked again. It should always be set for
character devices belonging to the "linuxcdevsw" and technically
there is no need to NULL check this pointer at all.

Suggested by:	kib @
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2017-11-03 13:43:05 +00:00
Andrey V. Elsukov
cd48d883bd Use correct pointer in key_updateaddresses() when updating NAT-T config.
key_updateaddresses() is used to update SA addresses and NAT-T
configuration in SADB_UPDATE message. This is done using cloning SA
content from old SA into new one. But addresses and NAT-T configuration
are taking from SADB_UPDATE message. Use newsa pointer to set NAT-T
properties into cloned SA.

PR:		223382
MFC after:	1 week
2017-11-03 11:33:13 +00:00
Fabien Thomas
39bbca6ffd crypto(9) is called from ipsec in CRYPTO_F_CBIFSYNC mode. This is working
fine when a lot of different flows to be ciphered/deciphered are involved.

However, when a software crypto driver is used, there are
situations where we could benefit from making crypto(9) multi threaded:
- a single flow is to be ciphered: only one thread is used to cipher it,
- a single ESP flow is to be deciphered: only one thread is used to
decipher it.

The idea here is to call crypto(9) using a new mode (CRYPTO_F_ASYNC) to
dispatch the crypto jobs on multiple threads, if the underlying crypto
driver is working in synchronous mode.

Another flag is added (CRYPTO_F_ASYNC_KEEPORDER) to make crypto(9)
dispatch the crypto jobs in the order they are received (an additional
queue/thread is used), so that the packets are reinjected in the network
using the same order they were posted.

A new sysctl net.inet.ipsec.async_crypto can be used to activate
this new behavior (disabled by default).

Submitted by:	Emeric Poupon <emeric.poupon@stormshield.eu>
Reviewed by:	ae, jmg, jhb
Differential Revision:    https://reviews.freebsd.org/D10680
Sponsored by:	Stormshield
2017-11-03 10:27:22 +00:00
Justin Hibbits
8c6037c4f8 Fix integer type and format in debug print
gcc complains "cast to pointer from integer of different size".  phandle_t is
*always* a uint32_t, so treat it as such, not as a pointer.  Fixes 64-bit build.
2017-11-03 03:13:15 +00:00
Warner Losh
3947701525 This used to have bzip2 support too. 2017-11-02 19:53:51 +00:00
Andriy Gapon
b2ef499041 loader: fix BOOTSRC -> BOOTOBJ in a library path 2017-11-02 19:45:51 +00:00
Roger Pau Monné
1305bc4107 loader: re-enable gzip support for x86
r324653 inadvertently disabled default gzip support on x86, re-enable.

Sponsored by:		Citrix System R&D
Reviewed by:		imp
Differential revision:	https://reviews.freebsd.org/D12913
2017-11-02 18:13:26 +00:00
Svatopluk Kraus
d18f8e22ec Take into account race conditions in case of accessed or modified bit
emulation in fast path of data/prefetch abort common routine. Process
these bits only if related page table entries are consistent with
provided abort info. In case of inconsistency, do nothing and let
processor to signal new abort if still needed.

The mapping related to an abort may be a subject of change concurrently.
The situation is more evident on multicore machines. Mapping may be
removed on one core while being used on another one before TLB flush
happened. Memory swapping process may be an example. Or, two or more
aborts may be signaled for the same page on more cores concurrently.
While an abort on one core may cause a promotion of related mapping,
an abort on another core may be inconsistent then as related mapping
was promoted. A question is how much real the issue may be on single
core machine. However, it's better to play safe even for these machines.

This change may solve some "PT2MAP abort" panics reported rarely.
The revision of pmap_fault() was initiated thanks to stack backtrace
provided by Bob Prohaska (fbsd at www.zefox.net).

While here, INVARIANTS block was changed. The previous check had iffy
value as only one entry from many was checked from L2 page table.

Reviewed by:	mmel
MFC after:	3 weeks
2017-11-02 14:08:38 +00:00
Andriy Gapon
96ed2690df Disable posix_fallocate(2) for ZFS
The generic (naive) implementation of posix_fallocate cannot provide the
standard mandated guarantee that overwrites would never fail due to the lack
of free space.  The fundamental reason is the copy-on-write architecture
of ZFS.  Other features like compression and deduplication can also
increase the size difference between the (pre-)allocated dummy content
and the future content.

So, until ZFS can properly implement the feature it's better to report
that it is unsupported rather than providing an ersatz implementation.
Please note that EINVAL is used to report that the underlying file system
does not support the operation (POSIX.1-2008).

illumos and ZoL seem to do the same.

MFC after:	3 weeks
Sponsored by:	Panzura
2017-11-02 13:49:08 +00:00
Toomas Soome
955f7bd709 zfs.c:vdev_read() needs to be careful about large sectors
Using the same implementation as done in efi/boot1. We must handle smaller
than sector size IO etc.

Differential Revision:	https://reviews.freebsd.org/D12850
2017-11-02 08:47:03 +00:00
Justin Hibbits
1163f0612f Fix interrupt handling for dtsec
The macId is the dTSEC unit within the FMan, so use the cell-index, not the unit
number, which may not match the cell index.

MFC after:	1 week
2017-11-02 04:07:41 +00:00
Andriy Voskoboinyk
76ff59295f rsu(4): trim code for Rx rate calculation.
Include ridx <-> rate conversion functions from rtwn(4) +
reuse already calculated value for ieee80211_radiotap(9).

Tested with Asus USB-N10, STA mode.
2017-11-02 00:17:52 +00:00
Vladimir Kondratyev
37ff334548 evdev: Do not start/stop softrepeat callout if no clients attached
Reviewed by:		gonzo
Approved by:		gonzo (mentor)
MFC after:		2 weeks
Differential Revision:	https://reviews.freebsd.org/D12676
2017-11-01 22:37:43 +00:00
Vladimir Kondratyev
c6e809423f evdev: Disable value normalization and state filtering for SND events.
Some events can take sound pitch as a value so can not be represented
as binary on/off events. Tracking for on/off state is left in place
as it is a part of the evdev API.

Reviewed by:		gonzo
Approved by:		gonzo (mentor)
MFC after:		2 weeks
Differential Revision:	https://reviews.freebsd.org/D12676
2017-11-01 22:33:44 +00:00
Vladimir Kondratyev
d52d8bce16 sysmouse(4): Fix ums(4)-style T-axis reporting via evdev protocol
- Do not report T-axis wheel events as button presses
- Reverse T-axis to match Linux
- Remove wrong comment. T-axis buttons state should be checked by level not
    by edge to allow continuous wheel tilt reporting

Reviewed by:		gonzo
Approved by:		gonzo (mentor)
MFC after:		2 weeks
Differential Revision:	https://reviews.freebsd.org/D12676
2017-11-01 22:30:36 +00:00
Vladimir Kondratyev
f3f8069493 evdev: Take driver's lock in cdev write handler if necessary
Reviewed by:		gonzo
Approved by:		gonzo (mentor)
MFC after:		2 weeks
Differential Revision:	https://reviews.freebsd.org/D12676
2017-11-01 22:19:19 +00:00
Vladimir Kondratyev
f7ee4f9029 evdev: Lock Giant around keyboard ioctls
This fixes turning ukbd(4) LEDs on/off with evdev interface as well

Reviewed by:		gonzo
Approved by:		gonzo (mentor)
MFC after:		2 weeks
Differential Revision:	https://reviews.freebsd.org/D12676
2017-11-01 22:15:19 +00:00
Vladimir Kondratyev
233e10741a evdev: Hide "kern.evdev.rcpt_mask" sysctl if kernel is compiled
w/o EVDEV_SUPPORT as it's value has no meaning in this case.

Now presence of this sysctl can be used for discovery if evdev support
for hybrid devices is compiled into kernel or not.
Hide "kern.evdev.sysmouse_t_axis" sysctl for the same reason.

Reviewed by:		gonzo
Approved by:		gonzo (mentor)
MFC after:		1 week
Differential Revision:	https://reviews.freebsd.org/D12676
2017-11-01 22:09:10 +00:00
Toomas Soome
9c103b4675 efipart_strategy is using wrong offset with >512B sectors
The strategy() calls are assuming 512B sectors, so we need to adjust the
offset accordingly.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D12849
2017-11-01 18:49:45 +00:00
Konstantin Belousov
ad4e4ae591 Restore an optimization that was temporary disabled by r324665.
In reclaim_pv_chunk(), rotate the pv chunks list so that next
invocations of the reclaim do not scan the same pv chunks that could
not be freed.  Only do the rotation when there is no parallel scan,
tracked by active_reclaims counter.

To rotate, move all chunks that are before current iteration marker,
after another marker that is inserted at the list tail on start of the
reclaim.

Reviewed by:	alc
Tested by:	pho (previous version)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2017-11-01 18:06:44 +00:00
Michael Tuexen
ba5fc4cf78 Fix the reporting of the MTU for SCTP sockets when using IPv6.
MFC after:	1 week
2017-11-01 16:32:11 +00:00
Kristof Provost
85f330e5fa epair: Fix panic on unload
The VNET_SYSUNINIT() callback is executed after the MOD_UNLOAD. That means
that netisr_unregister() has already been called when
netisr_unregister_vnet() gets calls, leading to an assertion failure.

Restore the expected order of operations by performing everything that
was done in MOD_UNLOAD to a SYSUNINIT() (that will be called after the
VNET_SYSUNINIT()).

Differential Revision:	https://reviews.freebsd.org/D12771
2017-11-01 14:27:26 +00:00
Hans Petter Selasky
62d08fae13 Implement ioread16be() in the LinuxKPI.
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2017-11-01 12:34:18 +00:00
Hans Petter Selasky
b37c654140 Unconditionally include "opt_inet6.h" in the LinuxKPI.
This makes sure the INET6 macro gets properly defined,
also for kernel module builds.

MFC after:	1 week
Sponsored by:	Mellanox Technologies
2017-11-01 12:21:28 +00:00
Konstantin Belousov
20b555e146 Do not run pmclog_configure_log() without pmc_sx protection.
The r195005 unlocked pmc_sx before calling into pmclog_configure_log()
to avoid the LOR, but it allows flush or closelog to run in parallel
with the configuration, causing many failure modes.

Revert r195005.  Pre-create the logging process, allowing it to run
after the set up succeeded, otherwise the process terminates itself.

Reported and tested by:	pho
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D12882
2017-11-01 11:43:39 +00:00
Konstantin Belousov
1121a37474 Be protective and check the po_file validity before dropping the ref.
Reported and tested by:	pho
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
X-Differential revision:	https://reviews.freebsd.org/D12882
2017-11-01 11:37:45 +00:00
Konstantin Belousov
ea4d25f90b In hwpmc, do not double-close the logging file.
hwpmc(4) must not voluntarily call fo_close(), doing this causes
double-close of the file.  It seems to almost avoid bad consequences
for pipes, but other types of files demonstrate random memory access.

To fix, remove fo_close() calls, which also do not provide the
declared wake-up of waiters consistently.  Instead, send a signal to
the logger and configure the logger process to not block it.  Since
logger never returns to userspace, the signal only causes termination
of the interruptible sleeps in fo_write().

Reported and tested by:	pho
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
X-Differential revision:	https://reviews.freebsd.org/D12882
2017-11-01 11:32:52 +00:00
Konstantin Belousov
bd63e82975 There is no use for dropping Giant in the pmc syscall.
Reviewed by:	markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
X-Differential revision:	https://reviews.freebsd.org/D12882
2017-11-01 11:16:18 +00:00
Konstantin Belousov
cf9ef80607 Minor style tweaks.
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
X-Differential revision:	https://reviews.freebsd.org/D12882
2017-11-01 11:05:47 +00:00
Andriy Gapon
f0fa2af656 geom_slice: fix r325227, protect against multiple calls to g_slice_free
This geom does not immediately detach its consumer relying on the
wither-washer to do that.  Since that happens asynchronously we may get
additional spoiling events.  So, we need to account for that.

There are multiple options for fixing this issue like detaching
immediately or checking for G_CF_ORPHAN in g_slice_spoiled().
The most reliable and least intrusive fix seems to be setting
geom->softc to NULL on the first call and checking for NULL on
subsequent calls.  This is something that the code did before r325227.

Reported by:	David Wolfskill <david@catwhisker.org>,
		O. Hartmann <o.hartmann@walstatt.org>
Tested by:	David Wolfskill <david@catwhisker.org> (earlier version)
Discussed with:	mav
MFC after:	1 week
X-MFC with:	r325227
2017-11-01 10:53:10 +00:00
Konstantin Belousov
1cfbc451b9 Use designated initializers for pmc sysent and module data.
Reviewed by:	markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
X-Differential revision:	https://reviews.freebsd.org/D12882
2017-11-01 10:49:41 +00:00
Konstantin Belousov
aa788cc387 Consistently ensure that we do not load MXCSR with reserved bits set.
Some callers of fpusetregs()/npxsetregs(), most importantly
set_fpcontext(), clear reserved bits.  But some did not.  Do the
clearing in fpusetregs() and remove now redundand operation from
set_fpcontext().

Reported by:	Maxime Villard <max@m00nbsd.net>
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2017-11-01 10:32:44 +00:00
Jean-Sébastien Pédron
906b7574bf evdev: Translate KEY_102ND in evdev_scancode2key()
This is the extra key on 102/105-keys keyboards, located on the right
of the Left Shift key. For instance on a French layout, this is the '<'
key.

This fixes an issue where the key fires no evdev event and thus remains
inactive in an evdev/libinput-enabled X.Org server. The issue only
occurred on an AT keyboard; the same key on a USB keyboard worked fine.

PR:		222609 (only for reference)
Approved by:	wulf@
Differential Revision:	https://reviews.freebsd.org/D12883
2017-11-01 09:18:41 +00:00
Mateusz Guzik
ac850e5a8d namecache: fix .. check broken after r324378
wtf by:	mjg
Diagnosed by:	avg
2017-11-01 08:40:04 +00:00
Mateusz Guzik
59e260f860 Fixup r325264, take #2
whack an unused variable
2017-11-01 06:46:58 +00:00
Mateusz Guzik
5644fffa25 namecache: ncnegfactor 16 -> 12
It is used on each new entry addition to decide whether to whack an existing
negative entry in order to prevent a blow out in size, but the parameter was
set years ago and never revisited.

Building with poudriere results in about 400 evictions per second which
unnecessarily grab entries from the hot list.

With the new parameter there are next to no evictions of the sort.
2017-11-01 06:45:41 +00:00
Mateusz Guzik
5d03f1e11f Fixup r325264
Accidentally committed an incomplete diff.
2017-11-01 06:38:46 +00:00