Commit Graph

271073 Commits

Author SHA1 Message Date
Glen Barber
66df505066 release: riscv64 - increase GENERICSD image size
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-12-15 15:26:22 -05:00
Jessica Clarke
aee99ab4fe cross-build: Add comment missing from 9e5b0d9eac
Whilst the commit message documented some of the details, I had intended
to include this comment in the actual header, but failed to amend the
commit properly.

Fixes:		9e5b0d9eac ("cross-build: Fix bmake bootstrap with glibc 2.34")
MFC after:	1 week
2021-12-15 19:45:31 +00:00
Mark Murray
03a88e3de9 * lib/msun/Makefile b/lib/msun/Makefile:
. Disconnect imprecise.c from the build.  This file can be deleted.
  . Add b_tgammal.c to the build for ld80 and ld128 targets.  The ld128
    is a 'git mv' of imprecise.c to ld128/b_tgammal.c.

* lib/msun/ld80/b_expl.c:
  . New file.  Implement __exp__D for ld80 targets.  This is based on
    bsdsrc/b_exp.c.

* lib/msun/ld80/b_logl.c:
  . New file.  Implement __log__D for ld80 targets.  This is based on
    bsdsrc/b_log.c.

* lib/msun/ld80/b_tgammal.c b/lib/msun/ld80/b_tgammal.c
  . New file.  Implement tgammal(x) for ld80 targets.

Submitted by:           Steve Kargl
Differential Revision:  https://reviews.freebsd.org/D33444
Reviewed by:            pfg
2021-12-15 18:36:20 +00:00
Mark Murray
455b2ccda3 * lib/msun/Makefile:
. Disconnect b_exp.c and b_log.c from the build.

* lib/msun/bsdsrc/b_exp.c:
  . Replace scalb() usage with C99's ldexp().
  . Replace finite(x) usage with C99's isfinite().
  . Whitespace changes towards style(9).
  . Remove include of "mathimpl.h".  It is no longer needed.
  . Remove #if 0 ... #endif code, which has been present since svn r93211
    (2002-03-26).
  . New minimax polynomial coefficients.
  . Add comments to explain origins of some constants.
  . Use ansi-C prototype.  Remove K&R prototype.  Add static to prototype.

* lib/msun/bsdsrc/b_log.c:
  . Remove include of "mathimpl.h".  It is no longer needed.
  . Fix comments to actually describe the code.
  . Reduce minimax polynomial from degree 4 to degree 3.
    This uses newly computed coefficients.
  . Use ansi-C prototype.  Remove K&R prototype.  Add static to prototype.
  . Remove volatile in declaration of u1.
  . Alphabetize decalaration list.
  . Whitespace changes towards style(9).
  . In argument reduction of x to g and m, replace use of logb() and
    ldexp() with a single call to frexp().  Add code to get 1 <= g < 2.
  . Remove #if 0 ... #endif code, which has been present since svn r93211
    (2002-03-26).
  . The special case m == -1022, replace logb() with ilogb().

* lib/msun/bsdsrc/b_tgamma.c:
  . Update comments.  Fix comments where needed.
  . Add float.h to get LDBL_MANT_DIG for weak reference of tgammal to tgamma.
  . Remove include of "mathimpl.h".  It is no longer needed.
  . Use "math.h" instead of <math.h>.
  . Add '#include math_private.h"
  . Add struct Double from mathimpl.h and include b_log.c and b_exp.c.
  . Remove forward declarations of neg_gam(), small_gam(), smaller_gam,
    large_gam() and ratfun_gam() by re-arranging the code to move these
    function above their first reference.
  . New minimax coefficients for polynomial in large_gam().
  . New splitting of a0 into a0hi nd a0lo, which include additional
    bits of precision.
  . Use ansi-C prototype.  Remove K&R prototype.
  . Replace the TRUNC() macro with a simple cast of a double entities
    to float before assignment (functional changes).
  . Replace sin(M_PI*z) with sinpi(z) and cos(M_PI*(0.5-z)) with cospi(0.5-z).

Submitted by:		Steve Kargl
Differential Revision:	https://reviews.freebsd.org/D33444
Reviewed by:		pfg
2021-12-15 18:36:19 +00:00
Emmanuel Vadot
a46856c3f9 amd64: Do not build sconfig
We do not build the drivers for this arch so no need to build the
configuration tools.

MFC after:	2 weeks
Sponsored by:	Beckhoff Automation GmbH & Co. KG
2021-12-15 17:39:36 +01:00
Rick Macklem
867c27c23a nfscl: Change IO_APPEND writes to direct I/O
IO_APPEND writes have always been very slow over NFS, due to
the need to acquire an up to date file size after flushing
all writes to the NFS server.

This patch switches the IO_APPEND writes to use direct I/O,
bypassing the buffer cache.  As such, flushing of writes
normally only occurs when the open(..O_APPEND..) is done.
It does imply that all writes must be done synchronously
and must be committed to stable storage on the file server
(NFSWRITE_FILESYNC).

For a simple test program that does 10,000 IO_APPEND writes
in a loop, performance improved significantly with this patch.

For a UFS exported file system, the test ran 12x faster.
This drops to 3x faster when the open(2)/close(2) are done
for each loop iteration.
For a ZFS exported file system, the test ran 40% faster.

The much smaller improvement may have been because the ZFS
file system I tested against does not have a ZIL log and
does have "sync" enabled.

Note that IO_APPEND write performance is still much slower
than when done on local file systems.

Although this is a simple patch, it does result in a
significant semantics change, so I have given it a
large MFC time.

Tested by:	otis
MFC after:	3 months
2021-12-15 08:35:48 -08:00
Cy Schubert
7835925aa4 ipfilter fil.c: Fix two typos in comments
MFC after:	3 days
2021-12-15 08:09:39 -08:00
Randall Stewart
9b60296531 tcp: Rack in a rare case we can get stuck sending a very small amount.
If a tlp sending new data fails, and then the peer starts
talking to us again, we can be in a situation where the
tlp_new_data count is set, we are not in recovery and
we always send one packet every RTT. The failure
has to occur when we send the TLP initially from the ip_output()
which is rare. But if it occurs you are basically stuck.

This fixes it so we use the new_data count and clear it so
we know it will be cleared. If a failure occurs the tlp timer
will regenerate a new amount anyway so it is un-needed to
carry the value on.

Reviewed by: Michael Tuexen
Sponsored by: Netflix Inc.
Differential Revision: https://reviews.freebsd.org/D33325
2021-12-15 09:41:33 -05:00
Emmanuel Vadot
9935b0e8ea bsdinstall: zfsboot: Prompt user for zpool name if the pool already exists
If one install FreeBSD on multiple disks (say 13 and CURRENT) the first created
pool will always be used.
Prompt the user for a new pool name if we detect that the default or supplied one
already exists.

Reviewed by:	imp
MFC after:      2 weeks
Sponsored by:   Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D33331
2021-12-15 15:24:07 +01:00
Emmanuel Vadot
40c928e7b8 bsdinstall: bootconfig: Try to clean old efi boot entries
If one install FreeBSD on the same machine multiple times in a row or
on different harddrive they have a lot of 'FreeBSD' efi boot entries added.
With this patch we now do :
- If there is no 'FreeBSD' entry we add one like before
- If there is one or more entries we ask the user if they want to delete
  them all and add a new one
  - If they say yes we do that
  - If they say no we prompt them an inputbox so they can enter a different
    entry name if they want, it defaults to 'FreeBSD'

Reviewed by:	bapt, imp
MFC after:	2 weeks
Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D33330
2021-12-15 15:23:27 +01:00
Mateusz Guzik
e7236a7ddf xen: plug some of set-but-not-used vars
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-12-15 13:46:17 +00:00
Andrew Gallatin
517a7adb11 Make hwpmc work for userspace binaries again
hwpmc has been utterly broken for userspace binaries, and has been
labeling all samples from userspace binaries as dubious frames. The
issues are that:

-The check for ph.p_offset & (-ph.p_align) == 0 was mostly bogus. The
 intent was to ignore all executable segments other than the first,
 which when using BFD appeared in the first page, but with current LLD
 a read-only data segment appears before the executable segment,
 pushing the latter into the second page or later. This meant no
 executable segment was ever found, and thus pi_vaddr remained
 0. Instead of relying on BFD's layout, track whether we've seen an
 executable segment explicitly with a local bool.

-Shared libraries were not parsing the segments to calculate pi_vaddr,
 resulting in it always being 0. Again, when using BFD, the executable
 segment started at the first page, and so pi_vaddr was genuinely
 meant to be 0, but not with LLD's current layout. This meant that
 pmcstat_image_link's offset calculation gave the base address of the
 segment in memory, rather than the base address of the whole library
 in memory, and so when adding that to pi_start/pi_end to get the
 range of the executable sections in memory it double-counted the
 offset of the first executable segment within the library. Thus we
 need to do the exact same parsing for ET_DYN as we do for ET_EXEC,
 which is simpler to write as special-casing ET_REL to not look for
 segments. Note that, whilst PT_INTERP isn't needed for shared
 libraries, it will be for PIEs, which pmcstat still fails to handle
 due to not knowing the base address of the PIE; we get the base
 address for libraries by MAP_IN events, and for rtld by virtue of the
 process's entry address being rtld's, but have no equivalent for the
 executable.

Fixes courtesy of jrtc27@.

Reviewed by: jrtc27, jhb (earlier version)
Differential Revision: https://reviews.freebsd.org/D33055
Sponsored by: Netflix
2021-12-15 08:38:36 -05:00
Mateusz Guzik
cec04a5d71 mwl: plug some of set-but-not-used vars
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-12-15 12:35:38 +00:00
Mateusz Guzik
fe30e08ac7 ng_pppoe: plug set-but-not-used vars
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-12-15 12:32:40 +00:00
Leandro Lupori
a076e2060c powerpc64: fix the calculation of Maxmem
The calculation of Maxmem was skipping the last phys_avail segment,
because of a wrong stop condition.

This was detected when using QEMU/PowerNV with Radix MMU and low
memory (2G). In this case opal_pci would allocate a DMA window that
was too small to cover all physical memory, resulting in reading all
zeroes from disk when using memory that was not inside the allocated
window.

Reviewed by:		jhibbits
Sponsored by:		Instituto de Pesquisas Eldorado (eldorado.org.br)
Differential Revision:	https://reviews.freebsd.org/D33449
MFC after:		2 weeks
2021-12-15 08:49:47 -03:00
Andriy Gapon
18679ab1c0 mmc_sim: fix setting of the mutex name
To quote the manual:
 The pointer passed in as name and type is saved rather than the data
 it points to.  The data pointed to must remain stable until the mutex
 is destroyed.

It seems that the type is actually copied, but the name is stored as
a pointer indeed.
mmc_cam_sim_alloc used a name stored on stack.
So, a corrupt mutex name would be reported.
For example:
  lock order reversal: (sleepable after non-sleepable)
  1st 0xd7285b20 <8A><C0><C0>P@<C1><D0>P@<C1>^D^A (aw_mmc_sim, sleep mutex) @ sys/cam/cam_xpt.c:2804

This change moves the name to struct mmc_sim.
Also, that name is used as the sim name as well.
Unused mtx_name variable is removed too.
The name buffer is reduced to 16 characters.

Reviewed by:	manu, bz
MFC after:	10 days
Differential Revision:	https://reviews.freebsd.org/D33412
2021-12-15 13:42:02 +02:00
Andriy Gapon
5dab06a003 sys/queue.h: move trashing from SLIST_REMOVE to REMOVE_AFTER, REMOVE_HEAD
SLIST_REMOVE calls either REMOVE_AFTER or REMOVE_HEAD to do the job.
But those two macros can be used independently as well.

MFC after:	2 weeks
2021-12-15 13:28:33 +02:00
Andriy Gapon
b7bcd21d2d rk_i2c_fill_tx: fixup previous commit
I forgot to amend the previous commit where i was uninitialized.

Fixes:		c663545951 rk_i2c_fill_tx: fix a number of issues
MFC after:	1 week
2021-12-15 13:21:16 +02:00
Andriy Gapon
c663545951 rk_i2c_fill_tx: fix a number of issues
- maximum number of bytes that can be sent is 32, not 8;
- previous interface required callers to bump sc->msg->len in addition
  to setting sc->tx_slave_addr;
- because of the above there was an issue with writing one too many bytes
  because sc->cnt is not advanced when the slave address is written;
- the inetraction between outer and inner loops was confusing as the former
  was bounded on the number of bytes to write and the counter was
  incremented by one, but the inner loop advanced four bytes at a time;
- the return value was incorrect in the tx_slave_addr case; one call place
  had to use its own (and incorrect in some cases) notion of the write
  lenth.

All of the above issues should be fixed.
Some sanity asserts are added.
All callers use the return value to program RK_I2C_MTXCNT.
iic_msg::len no longer needs to be hacked.
A constant is added to reflect the maximum number of octets that can be
sent or received in one go (they are the same).

MFC after:	1 week
2021-12-15 13:16:14 +02:00
Andriy Gapon
25e92673b5 rk_i2c_transfer: minor improvement to bit twiddling
No need to mask a uint8_t with 0xff, the mask covers the whole type.
Explcitly cast to uint32_t before bit shifting instead of relying on
the implicit promotion to signed int.

MFC after:	1 week
2021-12-15 13:16:09 +02:00
Andriy Gapon
4501b07071 rk_i2c: do not hide NACK condition from consumers
Previously the driver would happily talk to addresses with no device
returning some garbage for reads and sending bits into the void for writes.

MFC after:	1 week
2021-12-15 13:16:04 +02:00
Andriy Gapon
7dc8a0e5df rk_i2c: keep sending bytes until all bytes are sent
Previously the code would decalre the transfer complete after sending
first 31 bytes (plus the slave address) of a larger I2C write transfer.

That was tested using a large write to an EEPROM with 32-byte write page
size and a 2-byte address type.  Such a transaction needed to send 34
bytes, 2 bytes for an offset and 32 bytes of actual data.

MFC after:	1 week
2021-12-15 13:15:58 +02:00
Andriy Gapon
b6a2aba959 rk_i2c_transfer: fix off-by-one in check for last message
This also fixes an access beyond msgs array.

MFC after:	1 week
2021-12-15 13:15:50 +02:00
Andriy Gapon
ede576831b rk_i2c_drain_rx: remove useless arithmetic manipulations
When i % 4 == 0 the result of (i / 4) * 4 is always i.

MFC after:	1 week
2021-12-15 13:15:45 +02:00
Andriy Gapon
1da04ae8fb rk_i2c: consistently treat booleans as such
MFC after:	1 week
2021-12-15 13:15:23 +02:00
Andriy Gapon
552503aca9 rk_i2c_transfer: use iicbus error codes instead of generic ones
MFC after:	1 week
2021-12-15 13:14:56 +02:00
Andriy Gapon
5f863d7e13 rk_i2c: remove write-only softc field
MFC after:	1 week
2021-12-15 13:14:29 +02:00
Peter Holm
8296d2f9a3 stress2: Added new tests 2021-12-15 08:57:15 +00:00
Jessica Clarke
9e5b0d9eac cross-build: Fix bmake bootstrap with glibc 2.34
As of glibc 2.34, our unistd.h wrapper's inclusion of stdlib.h exposes
fragility in glibc's sys/wait.h and corresponding part of stdlib.h,
leading to "error: use of undeclared identifier 'WNOHANG'" and similar
errors when bootstrapping bmake.

Work around this by wrapping sys/wait.h to force stdlib.h's inclusion
first before it's implicitly included during the problematic window in
sys/wait.h.

MFC after:	1 week
2021-12-15 05:52:13 +00:00
Warner Losh
6a2b72bf1a Remove test-includes build
This is making the CI red. I believe this is because we do a clean build
w/o metamode in the tinderbox, so none of the artifacts needed to build
a binary are present. However, I've not recreated the problem locally
yet to confirm. Remove this while I investigate. This partially reverts
dd55767b86. The rest of the commit causes no harm w/o the explicit
test here.

Sponsored by:		Netflix
2021-12-14 21:42:47 -07:00
Jessica Clarke
d752d10e53 cross-build: Add __weak_symbol definition for libdwarf bootstrap
Fixes:		3aa0bc89c6 ("libdwarf: Add a weak uncompress() symbol")
MFC after:	1 week
2021-12-15 04:36:11 +00:00
Warner Losh
9dc70af83e stand/uboot: reorg
Build uboot ubldr and friends like we build efi binaries
o move everything to be under stand/uboot
o md code goes in arch/$ARCH
o move everything over from the library
  - Had to rename console.c, disk.c and module.c due to conflicts
o update version to 1.5 to reflect the new way of building

This results in a more consistent build system and should represent no
functional change, apart from powerpc version getting new help
file. Also, moved to exlcuding uboot on powerpc64le by using
BROKEN_OPTION instead of the incidental exclusion we had before due to
Makefile reorgs.

Sponsored by:		Netflix
Feedback by:		stevek, jrtc27
Differential Revision:	https://reviews.freebsd.org/D33362
2021-12-14 21:09:53 -07:00
Warner Losh
aab8ed235a test-includes: add missing file
Fixes:		dd55767b86
Sponsored by:	Netflix
2021-12-14 21:05:27 -07:00
Warner Losh
dd55767b86 Test various header files to ensure they can be included by themselves.
A number of header files in sys/* have, going back to 7th Edition Unix
in 1979, reqiured other files (like sys/types.h) to compile. Likewise
the 4BSD networking code has had prerequisites. However, going back to
around the turn of the 21st century, other systems have made them be
independently include-able (wide-spread header include protection
post-dates 7th edition Unix by maybe 3 or so years judging from USENET
source postings). Start down the path of making them all independently
include-able by creating this test that fails buildworld when they are
not.

The file 'badfiles.inc' contains a list of the currently broken files
that cannot be included w/o any prerequisites. As files are fixed, 'make
badfiles.inc' should be re-run to remove them from the list. Note: All
files that start with an underscore are considered internal and not
tested.

Please note: once a file is removed from badfiles.inc, it must pass on
all architectures. Buildworld through at least the _includes target is
needed to ensure its working (though a buildkernel should also be done
on all architectures as well).

Sponsored by:		Netflix
Reviewed by:		brooks, markj
Differential Revision:	https://reviews.freebsd.org/D32498
2021-12-14 20:25:37 -07:00
Warner Losh
56e4bee1da UPDATING: Add warning about NO_CLEAN build after turning off llvm mips target
Due to the way that we configure llvm, there's a problem with NO_CLEAN
builds. The *.def files listed in the commit change their behavior based
on command line arguments. Since my flipping the default of the mips
target, this meant there were .o files that were now inconsistent with
how we'll now compile things, leading to errors. By touching the *.def
files list, one can workaround this problem.

Noticed by:		jhb
Sponsored by:		Netflix
2021-12-14 20:25:36 -07:00
Warner Losh
2426adf4f4 ata-promise: kill lenght, it's set but never used
Sponsored by:		Netflix
2021-12-14 16:53:09 -07:00
Warner Losh
f581847a72 hyperv: scanning locking is using the bus mtx
The scanning code uses Giant to coordinate its accesses to newbus as
well as to synchronize a little state within hyperv's vmbus. Switch to
the new bus_topo_* functions instead of referring to Giant explicitly.

Sponsored by:		Netflix
Reviewed by:		jhb
Differential Revision:	https://reviews.freebsd.org/D31840
2021-12-14 16:53:09 -07:00
Chuck Tuffli
cf3ed8e0cd bhyve nvme: Inform guests of namespace resize
Register a "block resize" callback to be notified of changes to the
backing storage for the Namespace. Use this to generate an Asynchronous
Event Notification, Namespace Attributes Changed when the guest OS
provides an Asynchronous Event Request.

MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D32953
2021-12-14 23:17:55 -08:00
Chuck Tuffli
9f1fa1a461 bhyve nvme: Add AEN support to NVMe emulation
Add Asynchronous Event Notification infrastructure to the NVMe
emulation.

Reviewed by:	imp, grehan
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D32952
2021-12-14 23:16:49 -08:00
Warner Losh
31b35400cf pccard: Remove more of the PC Card infrastructure
Remove more of the pccard infrasturcture. CardBus Yenta driver (cbb)
still references the remaining bits. It needs some additiona work to
remove 16-bit support still, so it remains.

Sponsored by:		Netflix
2021-12-14 15:27:47 -07:00
Warner Losh
b4fba31b63 Remove references to PCMCIA
Remove more references to PCMCIA in kernel config files. We no longer
support PC Card devices.

Sponsored by:		Netflix
2021-12-14 15:27:47 -07:00
Warner Losh
574763f1a7 rtsold: Note network interfaces changing index when removed/inserted
Remove reference to PCMCIA. The issue is more generic than that. Also,
it does apply to FreeBSD, so no need to hedge about some OSes. The index
won't change if no other interfaces are created after the card is
removed, so note that it may change, not will change.

Suggested by:	phk
Reviewed by:	gleb
Sponsored by:	Netflix
2021-12-14 15:27:47 -07:00
Warner Losh
91d462192d loader: move all gfx_fb.c stubs to common/gfx_fb_stub.c
All these files are the same, modulo one comment. Move them all into
common/gfx_fb_stub.c and adjust Makefiles accordingly.

Sponsored by:		Netflix
Reviewed by:		manu
Differential Revision:	https://reviews.freebsd.org/D33428
2021-12-14 15:27:47 -07:00
Warner Losh
aaaa5a2e68 loader: narrow the scope of gfx frame buffer wrt tg supported kernels
Store whether or not we found a vbefb module (eg, a tg supported kernel)
in the preloaded_file structure. This automatically resets on reload and
eliminates load_elf knowing about any gfx_* interface. Restrict this to
i386, which is the only place it's used. Update libi386 to check in the
preloaded_file struct. Eliminate this from the teken_gfx
structure. Rewrite the parsing code to be more inline. Check this from
the same place we check for a relocatable amd64 kernel.

Sponsored by:		Netflix
Reviewed by:		manu, tsoome
Differential Revision:	https://reviews.freebsd.org/D33427
2021-12-14 15:27:47 -07:00
Florian Walpen
e28767f0e1 Thread creation privilege for realtime group
With the mac_priority(4) realtime policy active, users and processes in
the realtime group may promote existing threads and processes to
realtime scheduling priority. Extend the privileges granted to
PRIV_SCHED_SETPOLICY which allows explicit creation of new realtime
threads.

One use case of this is when the pthread scheduling policy is set to
SCHED_RR or SCHED_FIFO via pthread_attr_setschedpolicy(...) before
calling pthread_create(...). I ran into this when testing audio software
with realtime threads, particularly audio/ardour6.

MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D33393
2021-12-15 00:01:58 +02:00
Fabian Keil
8b9fe05a49 README.md: correct GPL expansion
PR:		260404
MFC after:	3 days
2021-12-14 16:51:22 -05:00
Dimitry Andric
20d425842a Remove set-but-unused variable from s_sincosl.c
This look like a copy and paste leftover.

Reported by:	enh@google.com (via freebsd-numerics@)
Reviewed by:	Steve Kargl <sgk@troutmask.apl.washington.edu>
MFC after:	3 days
2021-12-14 22:50:30 +01:00
Mark Johnston
bfd451210e imgact_elf: Disable the stack gap for now
The integration with RLIMIT_STACK is still causing problems for some
programs such as lang/sdcc and syzkaller's executor.  Until this is
resolved by some work currently in progress, disable the stack gap by
default.

PR:		260303
Reviewed by:	kib, emaste
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D33438
2021-12-14 16:19:40 -05:00
Jung-uk Kim
754c4757c9 OpenSSL: Merge OpenSSL 1.1.1m 2021-12-14 16:03:52 -05:00
Jung-uk Kim
b2bf0c7e5f OpenSSL: Merge OpenSSL 1.1.1m
Merge commit '56eae1b760adf10835560a9ee595549a1f10410f'
2021-12-14 16:03:52 -05:00