[X86] Enable SlotIndexes compaction by default
Compacting SlotIndexes before greedy allocation drops the entries of
erased instructions, so live range sizes and instruction distances
reflect the code being allocated rather than how much was erased
before it. AMDGPU has done this since #235806; do the same for X86.
Codegen changes only through allocation: no new crashes, verifier
errors or allocation failures in the lit suites, including
EXPENSIVE_CHECKS, and a stage-2 build of LLVM, clang and lld with
-verify-machineinstrs passes its own tests. On llvm-test-suite at -O3,
spills and reloads drop 0.4% and .text 0.04%, with compile time
unchanged.
Most test updates are regenerated checks. misched-matmul now inserts
20 spills instead of 24. live-debug-vars-stale-slotindexes.mir gets
one more use of %27 so that accumulate_fit still reaches the stale
index path it was written for. reloc-opt.ll gets an NF add that keeps
its source live, because compaction compresses the existing one to the
[3 lines not shown]
[CIR] Make redeclarations of a global replace/get the right answer (#249001)
It was brought up that the order of a vtable init (on #248103) would
cause crashes, so this makes sure we get the proper replacement of a
symbol when the type changes. At the moment, this is not testible with
relative vtables since we can't create the RTTI pointers yet.
vdev_initialize: resume a suspended initialize at a sector boundary
Initializing records its offset when it issues a write, even if the
write later fails. So an initialize that ran before this series with a
chunk size below the sector size could record a last offset in the
middle of a sector: where writes to a 4Kn disk failed, the offset
still advanced and initializing stayed active. After an upgrade,
resuming from that offset would issue misaligned writes for the rest
of that range. Round the saved offset down to the top-level sector
size when it is loaded.
Reviewed-by: Tigerblue77 <37409593+tigerblue77 at users.noreply.github.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Matthew Ahrens <matt at mahrens.org>
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
Closes #20036
vdev_initialize: align chunk size to the top-level ashift
Initialize ranges are aligned to the top-level vdev's ashift, but the
chunk size was rounded to the leaf's vdev_ashift. A leaf's vdev_ashift
is its logical sector size, which can be smaller than the top-level
ashift, for example for 512e disks in an ashift=12 mirror. A chunk size
such as 512 or 6144 was then used as is, so initializing issued writes
smaller than a block, or starting off a block boundary, which such
disks can only do with a read-modify-write.
Round the chunk size to the top-level ashift instead. It is never
smaller than any child's logical sector size, so writes to disks with
4096-byte sectors stay sector-aligned. Update the tunable's description
in zfs(4) to match.
Reviewed-by: Tigerblue77 <37409593+tigerblue77 at users.noreply.github.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Matthew Ahrens <matt at mahrens.org>
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
Closes #20036
ZTS: initialize a leaf whose ashift is below the top-level ashift
A leaf attached to a mirror keeps the ashift of its own disk, which can
be smaller than that of its top-level vdev. Attach a disk to a pool with
ashift=12 and initialize the new leaf with a 512-byte chunk size, and
check that no write to it is smaller than 4096 bytes. The test fails
until the following commit aligns the chunk size to the top-level
ashift.
Reviewed-by: Tigerblue77 <37409593+tigerblue77 at users.noreply.github.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Matthew Ahrens <matt at mahrens.org>
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
Closes #20036
ZTS: address review feedback on zpool_initialize_chunk_size
Rework the test as requested in review of #19096:
- Use the first disk in $DISKS instead of a file vdev.
- Save and restore the tunable with save_tunable/restore_tunable.
- Clear injected faults unconditionally in cleanup, and inject the
write delay with zinject -T write directly.
- Check that initializing started the way the other initialize tests
do, and replace the wait helpers with wait_for_write, which waits up
to 30 seconds for the initialized byte count to grow. Around each
change to the tunable, wait for a write before the change, so that
the running thread has sampled the tunable, and for the first write
sized after it.
- Add an in-range, sector-unaligned chunk size, so that rounding down
to the sector size is exercised.
- Check that initializing wrote only whole sectors, so that a missing
clamp or round-down fails the test even where the disk accepts
partial-sector writes.
- Resume with a chunk size that differs from the suspended thread's.
[12 lines not shown]
vdev_initialize: bound and snapshot chunk size
The initialisation buffer allocation and write loop read
zfs_initialize_chunk_size independently. A concurrent tunable change can
make the write size inconsistent with the allocated buffer.
Snapshot and normalise the value once per device initialisation thread.
Clamp it to the configured vdev sector size and maximum block size.
Derive every write split from the allocated ABD size. This makes the
allocation the single source of truth.
Document the effective bounds and when tunable changes take effect. Add
regression coverage for bounds, unaligned values, tunable changes, and
suspend/resume.
Reviewed-by: Tigerblue77 <37409593+tigerblue77 at users.noreply.github.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Matthew Ahrens <matt at mahrens.org>
Signed-off-by: Matthias Goergens <matthias.goergens at gmail.com>
Closes #20036
ZTS: initialize a 4Kn disk with a sub-sector chunk size
The zpool_initialize and zpool_wait tests set zfs_initialize_chunk_size
to 512 bytes but run on 512-byte-sector loop devices in CI, so they
never issue initialize writes smaller than a disk sector. On disks
with 4096-byte logical sectors, those writes trip the alignment
assertion in vdev_disk_check_alignment() on debug builds. A chunk size
of 1536 bytes or more that is not a multiple of the sector size also
panics release builds: its scatter ABD fails the same check after
vdev_disk_io_rw() copies it into a new one, and the VERIFY there fails.
Add a Linux test that initializes a scsi_debug 4Kn disk with a
512-byte chunk size and checks that it completes without errors. It
reads the per-vdev initializing state and error count from
"zpool status -j" with a new initialize_stat helper in
zpool_initialize.kshlib. The test fails until the following commits
bound and align the chunk size.
Reviewed-by: Tigerblue77 <37409593+tigerblue77 at users.noreply.github.com>
[4 lines not shown]
bootptest: use getifaddrs(3) to find an interface
The getif() restored in 6c3c05c5f131 is not really functional. Put it
back into history and implement [supposedly] desired functionality with
getifaddrs(3). Put getether() into history as well.
Reported by: llm-postcr
Fixes: 6c3c05c5f131637b95574faead1bf3219978ad1d
bootpgw: use getifaddrs(3) to find interface closest to 'your' address
The daemon is supposed to relay BOOTP packets between interfaces, and
of course routing replies back to original interface was incorrect.
Bring back a fresh implementation of getif() into handle_reply() that
uses a more modern API, but makes selection using the old logic.
Reported by: llm-postcr
Fixes: d4452259e75f3891b77302270e6f69057e2d9f2e
[RISCV][RuntimeDyld] Add RV64 call stubs to RuntimeDyld (#229469)
R_RISCV_CALL and R_RISCV_CALL_PLT encode function calls using an
`auipc+jalr` instruction pair with a limited PC-relative range.
Therefore, calls to out-of-range or not-yet-resolved targets cannot
always be resolved directly, which could result in segmentation faults
or other runtime errors.
This change adds RV64 RISC-V call-stub support to RuntimeDyldELF.
Same-section calls whose displacement is representable are resolved
directly. Otherwise, the call is redirected through a stub that loads
the final 64-bit target address from an embedded literal.
Assisted-by: Claude
[mlir][SPIR-V] Fix misc-ops-to-llvm.mlir after #239337 (NFC) (#249089)
PR #245665 made Kernel entry points spir_kernelcc, but the @baz check
from #239337 predates it
[libc] Remove the dependency of integer_to_string on wctype_utils (#236576)
With LIBC_CONF_WCTYPE_MODE=LIBC_WCTYPE_MODE_UTF8 and the tests enabled,
CMake fails at configure time with "Maximum recursion depth of 1000
exceeded" in get_object_files_for_test. wctype_utils pulls in the UTF8
tables, which reach libc_assert and CPP::string, and both of those
depend on integer_to_string, which depended on wctype_utils for the
wchar_t overloads of int_to_b36_char and toupper. The cycle is invisible
to the compiler because of the include guards, but
get_object_files_for_test follows the target dependencies without end
Move the switch/case wide character functions into a new header,
wctype_basics.h, which needs none of the tables. wctype_utils.h includes
it, and integer_to_string.h includes it instead of wctype_utils.h, so
character generation stays in __support. The output is unchanged
check-libc passes in a full build in the default configuration and in
UTF8 mode with the experimental entrypoints and LIBC_WNO_ERROR=ON.
integer_to_string_test and snprintf_test pass with Bazel
[4 lines not shown]
Linux: handle const mnt_idmap in VFS callbacks
In our generated VFS callback trampolines, we need to correctly name the
time (const or not) in the prototype, or we'll fail to compile. So, when
we detect mnt_idmap in use, also check if its the const version, and if
so, include a const qualifier in our generated functions.
We also need to check for const mnt_idmap in some callback prototype
checks, otherwise those checks will fail to compile, which we'll
interpret as a missing or older prototype, and we'll end up generating
the wrong thing there too. Ideally, we would propagate the result of the
above configure check into subsequents checks, but this is awkward to do
with concurrent checks, and there's only a handful of them so we just
repeate them.
Sponsored-by: TrueNAS
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Tony Hutter <hutter2 at llnl.gov>
Signed-off-by: Rob Norris <rob.norris at truenas.com>
Closes #19507
Linux: pass zidmap_t around as const
Linux 7.4 makes the struct mnt_idmap * const throughout the VFS, as
there is never a reason to modify it. Since we don't ever modify the
zidmap_t we derive from mnt_idmap or user_namespace, it's worth also
making those pointers const throughout the ZPL. There's no change for
release kernels, and it sidesteps the need for a bunch of casting for
7.4.
Sponsored-by: TrueNAS
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Tony Hutter <hutter2 at llnl.gov>
Signed-off-by: Rob Norris <rob.norris at truenas.com>
Closes #19507
Linux 7.4: PageWriteback() no longer exists.
This is the macro for test if a page is currently in writeback. The
folio version yields the same result, so we wrap it.
Sponsored-by: TrueNAS
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Tony Hutter <hutter2 at llnl.gov>
Signed-off-by: Rob Norris <rob.norris at truenas.com>
Closes #19507
Linux: include umh.h directly for usermode helper
7.4 slimmed down some include lists, and we are no longer getting it
through some transitive header. Include it directly.
Sponsored-by: TrueNAS
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Tony Hutter <hutter2 at llnl.gov>
Signed-off-by: Rob Norris <rob.norris at truenas.com>
Closes #19507
Linux 7.4: PG_private no longer exists
Sponsored-by: TrueNAS
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Tony Hutter <hutter2 at llnl.gov>
Signed-off-by: Rob Norris <rob.norris at truenas.com>
Closes #19507
Linux/ARC: look for the SPL reclaim thread, not kswapd
That the SPL reclaim thread is backed by kswapd is an implementation
detail. The ARC reclaim path should always have been asking the SPL via
current_is_reclaim_thread().
Sponsored-by: TrueNAS
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Tony Hutter <hutter2 at llnl.gov>
Signed-off-by: Rob Norris <rob.norris at truenas.com>
Closes #19507
[libc] Push back lookahead character after inf and nan in scanf (#248269)
In `scanf_core::convert_float`, the `inf` and `nan` loops call
`reader->getc()` after every matched character without pushing back a
non-matching lookahead character. Inputs such as `"inf,42"`,
`"infinity!"`, and `"nan,42"` therefore consume one character past the
matched token (or past `max_width`), so following format directives miss
the delimiter and `%n` reports an extra character.
Stop reading once the full token or `max_width` is reached, and push
back the lookahead character with `reader->ungetc` on a mismatch.
Assisted-By: Gemini
[libc] Check length after exponent marker in HighPrecisionDecimal (#248670)
In `HighPrecisionDecimal`'s constructor, `num_cur` is incremented past
an `'e'` or `'E'` exponent marker before checking whether an exponent
digit or sign follows. Check `num_cur < num_len` first so inputs whose
`num_len` ends at the exponent marker skip exponent parsing cleanly, and
add unit tests covering bounded inputs ending at `'e'`, `'E'`, or a
trailing sign.
Assisted-By: Gemini
audio/speech_tools: New port, the Edinburgh Speech Tools Library 2.5.1
The Edinburgh Speech Tools Library is a collection of C++ classes,
functions and related programs for manipulating the objects used in
speech processing: waveforms, parameter files, utterances, grammars.
It includes CSTR's fork of the SIOD Scheme interpreter, wagon, and
audio output support. It is the foundation of Festival (and of the
voice-building tools of festvox and flite), which so far bundled its
own copy.
Built with meson from upstream's latest commit, and tested with
upstream's test suite -- whose script outputs are also compared with
the expected ones. Besides the libraries, headers and programs, a
configured copy of the old make-framework is installed under
lib/speech_tools (ESTDIR), as Festival's build expects it.
FreeBSD-specific changes:
- textproc/rxp is used instead of the bundled XML parser, whose
sources are not even extracted;
[12 lines not shown]
audio/speech_tools: Start with festival's patches to its bundled copy
The upcoming audio/speech_tools port fixes some of the same problems,
which audio/festival has been patching in its bundled copy of the
Edinburgh Speech Tools. Copy those patches over unchanged -- so that
their history can be followed -- before adapting them to the new port
in the next commit:
patch-speech__tools_main_sig2fv__main.cc -> patch-main_sig2fv__main.cc
patch-voxware
patch-speech_tools_include_EST_unix.h
audio/festival keeps using its copies until it is updated to use the
new port.
PR: 299348
Co-Authored-By: Claude Opus 5.5 (effort medium)
[lld][AMDGPU] Accept R_AMDGPU_NONE (#247846)
When a relocatable link (-r) discards a duplicate COMDAT group, lld
rewrites the relocations that referenced it from .eh_frame and debug
sections to R_*_NONE with symbol index 0. A later link of that output
fails on AMDGPU with "unknown relocation (0) against symbol", because
AMDGPU::getRelExpr has no case for R_AMDGPU_NONE. Other targets map
their R_*_NONE to R_NONE.
This shows up in two-stage device links on ASAN builds and other
cases with COMDAT groups.
Return R_NONE for R_AMDGPU_NONE.