263753 Commits

Author SHA1 Message Date
luporl
97ed980e58 [PPC] Avoid underflows in NUMA domains
On POWER8 systems with only one memory domain, the "ibm,associativity"
number that corresponds to it is 0, unlike POWER9 systems with two
or more domains, in which the minimum value is 1.

In POWER8 case, subtracting 1 causes an underflow on the unsigned domain
variable and a subsequent index out-of-bounds access.

Reviewed by:	jhibbits
Tested by:	bdragon, luporl
2019-10-22 18:28:58 +00:00
glebius
10ee156a04 Allow epoch tracker to use the very last byte of the stack. Not sure
this will help to avoid panic in this function, since it will also use
some stack, but makes code more strict.

Submitted by:	hselasky
2019-10-22 18:05:15 +00:00
markj
9582ed1083 Apply r353893 to arm64.
Reported by:	Jenkins (hardware CI lab)
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2019-10-22 17:22:10 +00:00
markj
0bf520b0ec Initialize thread0.td_kstack_pages on arm.
Fix style on the line below.

Reported by:	Jenkins (hardware CI lab)
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2019-10-22 17:21:23 +00:00
markj
599c125fa1 Fix thread0 kernel stack initialization on riscv.
- td_kstack_pages was not being initialized.
- td_kstack is supposed to be the base address of the stack region,
  not the top.

The arm ports seem to have similar problems and will be fixed next.

Reported by:	Jenkins via lwhsu
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2019-10-22 16:52:56 +00:00
kib
6d8044f142 Assert that vnode_pager_setsize() is called with the vnode exclusively locked
except for filesystems that set the MNTK_VMSETSIZE_BUG,  Set the flag for ZFS.

Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D21883
2019-10-22 16:21:24 +00:00
kib
ae2561e593 Fix interface between nfsclient and vnode pager.
Make the nfsclient always call vnode_pager_setsize() with the vnode
exclusively locked.  This ensures that page fault always can find the
backing page if the object size check succeeded.  Set VV_VMSIZEVNLOCK
flag on NFS nodes.

The main offender breaking the interface in nfsclient is
nfs_loadattrcache(), which is used whenever server responded with
updated attributes, which can happen on non-changing operations as
well.  Also, iod threads only have buffers locked (and even that is
LK_KERNPROC), but they still may call nfs_loadattrcache() on RPC
response.

Instead of immediately calling vnode_pager_setsize() if server
response indicated changed file size, but the vnode is not exclusively
locked, set a new node flag NVNSETSZSKIP.  When the vnode exclusively
locked, or when we can temporary upgrade the lock to exclusive, call
vnode_pager_setsize(), by providing the nfsclient VOP_LOCK() implementation.

Tested by:	pho
Discussed with:	rmacklem
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D21883
2019-10-22 16:17:38 +00:00
kib
e970ed6a1e Add VV_VMSIZEVNLOCK flag.
The flag specifies that vm_fault() handler should check the vnode'
vm_object size under the vnode lock.  It is converted into the object'
OBJ_SIZEVNLOCK flag in vnode_pager_alloc().

Tested by:	pho
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D21883
2019-10-22 16:09:25 +00:00
glebius
fd813c4f09 Execute nd6_dad_timer() in the network epoch, since nd6_dad_duplicated()
requires it.
Make nd6_dad_starttimer() require network epoch.  Two calls out of three
happen from nd6_dad_timer().  Enter epoch in the remaining one.
2019-10-22 16:06:33 +00:00
kib
5c066fbc3a vm_fault(): extract code to lock the vnode into a helper vn_fault_lock_vnode().
Tested by:	pho
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D21883
2019-10-22 15:59:16 +00:00
avg
39a9e50d87 nctgpio: improve performance (latency) of operation
This change consists of two parts.

First, nctgpio now supports hardware access via an I/O port window if
it's configured by firmware.  For instance, PC Engines firmware
v4.10.0.2 does that.  This is faster than going through the Super I/O
configuration registers.

Second, nctgpio now caches values of bits that it controls.  For
example, the driver does not need to access the hardware to determine if
a pin is an output or an input, or a state of an output.  Also, the
driver makes use of the fact that the hardware preserves an output state
of a pin accross a switch to the input mode and back.

With this change I am able to use the 1-Wire bus over nctgpio whereas
previously the driver introduced too much latency to be compliant with
the relatively strict protocol timings.

superio0: <Nuvoton NCT5104D/NCT6102D/NCT6106D (rev. B+)> at port 0x2e-0x2f on isa0
gpio1: <Nuvoton GPIO controller> at GPIO ldn 0x07 on superio0
pcib0: allocated type 4 (0x220-0x226) for rid 0 of gpio1
gpiobus1: <GPIO bus> on gpio1
owc0: <GPIO attached one-wire bus> at pin 4 on gpiobus1
ow0: <1 Wire Bus> on owc0
ow0: romid 28:b2:9e:45:92:10:02:34: no driver
ow_temp0: <Advanced One Wire Temperature> romid 28:b2:9e:45:92:10:02:34 on ow0

MFC after:	4 weeks
2019-10-22 14:20:35 +00:00
markj
93c4e46434 Avoid reloading bucket pointers in uma_vm_zone_stats().
The correctness of per-CPU cache accounting in that function is
dependent on reading per-CPU pointers exactly once.  Ensure that
the compiler does not emit multiple loads of those pointers.

Reported and tested by:	pho
Reviewed by:	kib
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D22081
2019-10-22 14:20:06 +00:00
kevans
eb99e62aa8 tuntap(4): properly declare if_tun and if_tap modules
Simply adding MODULE_VERSION does not do the trick, because the modules
haven't been declared. This should actually fix modfind/kldstat, which
r351229 aimed and failed to do.

This should make vm-bhyve do the right thing again when using the ports
version, rather than the latest version not in ports.

MFC after:	3 days
2019-10-22 00:18:16 +00:00
glebius
6d6c13e9ac Assert that any epoch tracker belongs to the thread stack.
Reviewed by:	kib
2019-10-21 23:12:14 +00:00
brooks
f7262b6430 Update tcsh to git revision 83c5be0 bringing in a number of bug fixes.
Reported by:	sobomax
MFC after:	3 days
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D22099
2019-10-21 21:21:34 +00:00
kevans
1879756c5f if_tuntap: remove if_{tun,tap}.ko -> if_tuntap.ko links
These drivers have been merged into a single if_tuntap in 13.0. The
compatibility links existed only for the interim and will be MFC'd along
with the if_tuntap merge shortly.

MFC after:	never
2019-10-21 20:28:38 +00:00
kevans
faec23395b lualoader: fix setting of loader_color=NO in loader.conf(5)
Previously color.disabled would be calculated at color module load time,
then never touched again. We can detect serial boots beyond just what we're
told by loader.conf(5) so this works out in many cases, but we must
re-evaluate the situation after the config is loaded to make sure we're not
supposed to be forcing it enabled/disabled.

Discovered while trying to test r353872.
2019-10-21 20:17:31 +00:00
kevans
3c286dfb69 lualoader: don't botch disabling of color
When colors are disabled, color.escape{fg,bg} would return the passed in
color rather than the proper ANSI sequence for the color.
color.escape{fg,bg} would be wrong.

Instead return '', as the associated reset* functions will also return ''.
This should get rid of the funky '2' and '4' in the kernel selector if
you're booting serial.

Reported by:	npn
2019-10-21 20:09:43 +00:00
emaste
476da9c530 Additional fix for -DNO_CLEAN build across r353340 and r353381
opensolaris_atomic.S is now only used on i386 with opensolaris_atomic.c
used on other platforms.  After r353381 it doesn't exist on those
platforms so the stale dependency would result in a build error.

r353408 addressed this issue for cddl/lib/libzpool, but it persisted
with the opensolaris and zfs modules.
2019-10-21 18:40:03 +00:00
glebius
e344cc8c4e Remove epoch tracker from struct thread. It was an ugly crutch to emulate
locking semantics for if_addr_rlock() and if_maddr_rlock().
2019-10-21 18:19:32 +00:00
glebius
8ec25643ca Remove obsoleted KPIs that were used to access interface address lists. 2019-10-21 18:17:03 +00:00
glebius
5e4ec8a4ab Convert to if_foreach_llmaddr() KPI. 2019-10-21 18:13:37 +00:00
glebius
94b667e416 Convert to if_foreach_llmaddr() KPI. 2019-10-21 18:13:33 +00:00
glebius
f4c54dafcb Convert to if_foreach_llmaddr() KPI. 2019-10-21 18:13:28 +00:00
glebius
e5e567ec6b Convert to if_foreach_llmaddr() KPI. 2019-10-21 18:13:24 +00:00
glebius
2cc29d9c44 Convert to if_foreach_llmaddr() KPI. 2019-10-21 18:13:19 +00:00
glebius
c329711ad4 Convert to if_foreach_llmaddr() KPI. 2019-10-21 18:13:14 +00:00
glebius
2b275c29ae Convert to if_foreach_llmaddr() KPI. 2019-10-21 18:12:58 +00:00
glebius
e72d8e699e Convert to if_foreach_llmaddr() KPI. 2019-10-21 18:12:40 +00:00
glebius
6f81707ddf Convert to if_foreach_llmaddr() KPI. 2019-10-21 18:12:36 +00:00
glebius
8a79afdc2f Convert to if_foreach_llmaddr() KPI. 2019-10-21 18:12:31 +00:00
glebius
70b8dd2ad2 Convert to if_foreach_llmaddr() KPI. 2019-10-21 18:12:26 +00:00
glebius
ab1b6a2add Convert to if_foreach_llmaddr() KPI. 2019-10-21 18:12:21 +00:00
glebius
6e3ad73bab Convert to if_foreach_llmaddr() KPI. 2019-10-21 18:12:17 +00:00
glebius
fb73f23ad9 Convert to if_foreach_llmaddr() KPI. 2019-10-21 18:12:12 +00:00
glebius
ef00a2a81b Convert to if_foreach_llmaddr() KPI. 2019-10-21 18:12:07 +00:00
glebius
197fdf9314 Convert to if_foreach_llmaddr() KPI. 2019-10-21 18:12:02 +00:00
glebius
d2ff69d93a Convert to if_foreach_llmaddr() KPI. 2019-10-21 18:11:58 +00:00
glebius
ecac278aef Convert to if_foreach_llmaddr() KPI. 2019-10-21 18:11:54 +00:00
glebius
dfedfb9d27 Convert to if_foreach_llmaddr() KPI. 2019-10-21 18:11:48 +00:00
glebius
309ada9dc2 Convert to if_foreach_llmaddr() KPI. 2019-10-21 18:11:43 +00:00
glebius
6d7378a35c Convert to if_foreach_llmaddr() KPI. 2019-10-21 18:11:38 +00:00
glebius
6bb2f449cf Convert to if_foreach_llmaddr() KPI. 2019-10-21 18:11:32 +00:00
glebius
6434b43321 Convert to if_foreach_llmaddr() KPI. 2019-10-21 18:11:28 +00:00
glebius
cbeb7969f0 Convert to if_foreach_llmaddr() KPI. 2019-10-21 18:11:24 +00:00
glebius
cec3f25f17 Convert to if_foreach_llmaddr() KPI. 2019-10-21 18:11:19 +00:00
glebius
d863887af9 Convert to if_foreach_llmaddr() KPI. 2019-10-21 18:11:15 +00:00
glebius
e674340498 Convert to if_foreach_llmaddr() KPI. 2019-10-21 18:11:11 +00:00
glebius
7ec3a50549 Convert to if_foreach_llmaddr() KPI. 2019-10-21 18:11:08 +00:00
glebius
27d717ee7e Convert to if_foreach_llmaddr() KPI. 2019-10-21 18:11:02 +00:00