3a973442 mav Sept. 15, 2019, 11:56 p.m.
Since TX interrupt is generated when THRE is set, wait for TEMT set means
wait for full character transmission time.  At low speeds that may take
awhile, burning CPU time while holding sc_hwmtx lock, also congested.

This is partial revert of r317659.

PR:		240121
MFC after:	2 weeks
cgit ViewVC
eb1c42c1 delphij Sept. 15, 2019, 7:41 p.m.
Obtained from:	NetBSD
MFC after:	2 weeks
cgit ViewVC
7887a5a1 ian Sept. 15, 2019, 7:38 p.m.
The latest imported FDT data defines a node for an iomuxc-gpr device,
which we don't support (or need, right now) in addition to the usual
iomuxc device.  Unfortunately, the dts improperly assigns overlapping
ranges of mmio space to both devices.  The -gpr device is also a syscon
and simple_mfd device.

At runtime the simple_mfd driver attaches for the iomuxc-gpr node, then
when the real iomuxc driver comes along later, it fails to attach because
it tries to allocate its register space, and it's already partially in
use by the bogus instance of simple_mfd.

This change works around the problem by simply disabling the node for
the iomuxc-gpr device, since we don't need it for anything.
cgit ViewVC
52f6a809 tuexen Sept. 15, 2019, 6:29 p.m.
checksum computation, do not assume that the IP header chain and the
SCTP common header are in contiguous memory although the SCTP lays
out the mbuf chains that way. If there are IP-level options inserted
by the IP layer, the constraint is not fulfilled anymore.

This issues was found by running syzkaller. Thanks to markj@ who is
running an instance which also provides kernel dumps. This allowed me
to find this issue.

MFC after:		3 days
cgit ViewVC
3155f2f0 kevans Sept. 15, 2019, 2:59 a.m.
A future change to posixshm to add file sealing (in DIFF_21391[0] and child)
will move locking out of shm_dotruncate as kern_shm_open() will require the
lock to be held across the dotruncate until the seal is actually applied.
For this, the cookie is passed into shm_dotruncate_locked which asserts

[0] Name changed to protect the innocent, hopefully, from getting autoclosed
due to this reference...

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D21628
cgit ViewVC
3dffab60 ian Sept. 15, 2019, 1:02 a.m.
that makes the upstream FDT data work right, so we don't need to see a
couple dozen instances of it spam the dmesg at boot time unless it's a
verbose boot.
cgit ViewVC
c0f37bf6 dim Sept. 14, 2019, 9:49 p.m.
On arm and arm64, where chars are unsigned by default, buildworld dies

--- terminal.o ---
/usr/src/contrib/libedit/terminal.c:569:41: error: comparison of
integers of different signs: 'wint_t' (aka 'int') and 'wchar_t' (aka
'unsigned int') [-Werror,-Wsign-compare]
                                     el->el_cursor.v][where & 0370] !=
                                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
/usr/src/contrib/libedit/terminal.c:659:28: error: comparison of
integers of different signs: 'wint_t' (aka 'int') and 'wchar_t' (aka
'unsigned int') [-Werror,-Wsign-compare]
                                     [el->el_cursor.h] == MB_FILL_CHAR)
                                     ~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~

Fix this by making MB_FILL_CHAR a wint_t, so no casting is needed.

Note that in https://reviews.freebsd.org/D21584 this was also proposed
by Yuichiro Naito <naito.yuichiro_gmail.com>.

Reviewed by:	bapt
Subscribers:	naito.yuichiro_gmail.com, ml_vishwin.info
MFC after:	3 weeks
X-MFC-With:	r352275
Differential Revision: https://reviews.freebsd.org/D21657
cgit ViewVC
d020b3eb bdragon Sept. 14, 2019, 9:18 p.m.
After the aux vector is moved, it is necessary to re-digest aux_info so the
pointers are updated to the new locations.

This was causing thread creation to fail on powerpc64 when using direct
execution due to a nonsense value being read for aux_info[AT_STACKPROT].

Approved by: jhibbits (mentor)
Differential Revision: https://reviews.freebsd.org/D21656
cgit ViewVC
b897b02c ian Sept. 14, 2019, 7:33 p.m.
Errors are communicated between the i2c controller layer and upper layers
(iicbus and slave device drivers) using a set of IIC_Exxxxxx constants which
effectively define a private number space separate from (and having values
that conflict with) the system errno number space. Sometimes it is necessary
to report a plain old system error (especially EINTR) from the controller or
bus layer and have that value make it back across the syscall interface

I initially considered replicating a few "crucial" errno values with similar
names and new numbers, e.g., IIC_EINTR, IIC_ERESTART, etc. It seemed like
that had the potential to grow over time until many of the errno names were
duplicated into the IIC_Exxxxx space.

So instead, this defines a mechanism to "encode" an errno into the IIC_Exxxx
space by setting the high bit and putting the errno into the lower-order
bits; a new errno2iic() function does this. The existing iic2errno()
recognizes the encoded values and extracts the original errno out of the
encoded value. An interesting wrinkle occurs with the pseudo-error values
such as ERESTART -- they aleady have the high bit set, and turning it off
would be the wrong thing to do. Instead, iic2errno() recognizes that lots of
high bits are on (i.e., it's a negative number near to zero) and just
returns that value as-is.

Thus, existing drivers continue to work without needing any changes, and
there is now a way to return errno values from the lower layers. The first
use of that is in iicbus_poll() which does mtx_sleep() with the PCATCH flag,
and needs to return the errno from that up the call chain.

Differential Revision:	https://reviews.freebsd.org/D20975
cgit ViewVC
fad4b12b trasz Sept. 14, 2019, 7:23 p.m.
to the traditional tree(3) RB trees, but using an array (preallocated,
linear chunk of memory) to store the tree.

This avoids allocation overhead, improves memory locality,
and makes it trivially easy to share/transfer/copy the entire tree
without the need for marshalling.  The downside is that the size
is fixed at initialization time; there is no mechanism to resize

This is one of the dependencies for the new stats(3) framework

Reviewed by:	bcr (man pages), markj
Discussed with:	cem
MFC after:	2 weeks
Sponsored by:	Klara Inc, Netflix
Obtained from:	Netflix
Differential Revision:	https://reviews.freebsd.org/D20324
cgit ViewVC
c950e612 dim Sept. 14, 2019, 7:19 p.m.
leading to hundreds of lines of fairly unreadable error messages.

I don't think we particularly care about the specific source file gcc
dies on, and the many layers of macros and sub-types in googletest make
it very hard to diagnose whether this is a bug in googletest, gcc, clang
or libc++.
cgit ViewVC
23e2b4d9 dim Sept. 14, 2019, 7:16 p.m.
std::auto_ptr in a whole bunch of individual Makefiles, make the warning
globally non-fatal instead.  This is similar to what was done to many
more non-fatal warnings from newer gcc versions.
cgit ViewVC
cf389852 trasz Sept. 14, 2019, 7:16 p.m.
of the reverse.

This fixes Linux sysctl(8) binary - it assumes the first two
directory entries are always "." and "..". There might be other
Linux apps affected by this.

NB it might be a good idea to rewrite it using queue(3).

Reviewed by:	kib
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D21550
cgit ViewVC
53117a36 ian Sept. 14, 2019, 6:20 p.m.
f1343abc sg Sept. 14, 2019, 2:26 p.m.
Approved by:    bcr (mentor)
cgit ViewVC