Skip to content

Arm build - #1

Merged
rations merged 11 commits into
masterfrom
arm-build
Sep 27, 2026
Merged

rations merged 11 commits into
masterfrom
arm-build

Conversation

@rations

@rations rations commented Sep 27, 2026

Copy link
Copy Markdown
Owner

No description provided.

rations and others added 11 commits September 27, 2026 20:59
rt_set_denormal_mode() only knew x86 MXCSR and compiled to an empty
function everywhere else, so on aarch64 no RT thread was protected from
subnormal-float stalls. AArch64 needs a single bit, FPCR bit 24 (FZ),
which flushes subnormal inputs and results for scalar and Advanced SIMD
alike. The bit position comes from the FPCR layout in glibc's aarch64
<fpu_control.h>; the register is read and written with mrs/msr directly
so the header stays libc-independent. The code does a read-modify-write
and skips the write when FZ is already set, because it runs before every
plugin.

Cross-compiled with clang-19 --target=aarch64-linux-gnu: it emits
mrs x8, FPCR / tbnz w8, #24 / orr / msr FPCR. It has not yet run on
aarch64 hardware.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The default LV2/VST3/LADSPA search paths, and lilv's fallback LV2_PATH,
hard-coded /usr/lib/x86_64-linux-gnu, so an aarch64 build never looked
under /usr/lib/aarch64-linux-gnu, where Debian arm64 installs distro
plugins. PH_MULTIARCH_LIBDIR is now picked from the compiler's
__x86_64__ / __aarch64__ predefines. On any other target it stays
undefined and the path is skipped. The x86_64 build embeds the same
three paths as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
x86 makes one core's stores visible to others in program order, and
aarch64 does not. Two publishes in the engine were correct only because
of that:

- Port counts. The main thread already publishes them with a release
  store (eng_publish_count). The RT readers did plain volatile loads and
  then loads of the port arrays, which are guarded only by a control
  dependency, and a weakly-ordered CPU may satisfy those out of order.
  The RT reads now go through eng_count(), an acquire load
  (g_atomic_int_get = __atomic_load SEQ_CST, i.e. LDAR on aarch64;
  lock-free). Main-thread reads are unchanged, because the main thread
  is the writer.
- Record-peak waveform. The RT thread wrote a [min,max] pair and then
  did a plain store of rec_peak_count, and the timeline read the count
  with a plain load. It is now a release store and an acquire load.

The CLAP in_get() bounds check now uses the same atomic read as
in_size(), for consistency. Ordering already held there through
size()'s acquire.

Audited and left as-is: render-tap end, count-in pos/len and loop
points. Each of these is published ahead of an atomic flag and read
after one, or is a standalone scalar.

Flagged, not fixed here, because none of them is ARM-specific: the
jack2 1.9.21 ringbuffer (Debian 12) has no memory fences, and 1.9.22
added them; port shrink unregisters without waiting for a cycle; the
CLAP pending-param queue has a lost-update race; worker threads call
jack_port_get_buffer() for armed instrument MIDI input; loop start/end
can be observed torn.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A tarball that carries the prebuilt binary runs on exactly one
architecture, and with aarch64 builds coming from CI the old
jackdaw-<VERSION>.tar.gz name no longer says which one. Binary tarballs
are now jackdaw-<VERSION>-linux-<ARCH>.tar.gz, with ARCH read from the
binary's ELF header (readelf), falling back to uname -m. Source-only
(--no-binary) tarballs keep the plain name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There is no ARM hardware on hand, so the aarch64 build is compiled on
GitHub's ubuntu-24.04-arm runner inside debian:12 (glibc 2.36), following
the NAMix and rations-amp workflows. The x86_64 and panel-diff jobs are
dropped, because x86_64 is built by hand.

Gates, each of which fails the job:
- no compiler warnings in src/ (the x86_64 baseline is zero)
- jackdaw and both LV2 UI helpers are aarch64 and resolve every library
- no GLIBC symbol newer than 2.36

The tarball comes from release-tarball.sh unchanged, with no CI-only
packaging, and is uploaded as a workflow artifact rather than a release
until it has run on a board. The README documents the aarch64 build and
the <arch>-dependent default plugin paths.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jack_ringbuffer_* resolves to the user's libjack at run time, and neither
jack2 < 1.9.22 (Debian 12 / Raspberry Pi OS bookworm ship 1.9.21) nor
PipeWire's pipewire-jack orders the data copy against the index update.
On aarch64 the consumer can then see the index move before the bytes land.

rt_ringbuffer mirrors the jack API subset in use (same capacity rule, same
non-thread-safe reset), with a release store of each side's index after
its copy and an acquire load of the other side's before. read_advance is
clamped to what is readable. Call sites change by one token.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The size header and payload are written by two separate ring writes, but
both readers took the header as soon as it was readable and then read the
payload, which could be short. work()/work_response() got a truncated job
and every later record was misframed. Peek the header and take it only
when the whole record is in, as the atom rings already do.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Lowering a port count, or clearing audio_in_r, hides the port from cycles
that start afterwards, but a cycle already running loaded the old value and
may still jack_port_get_buffer() it. Port shrink, set_track_stereo(FALSE)
and remove_track unregistered immediately, and the RT pre-fetch read
audio_in_r twice, so it could pass a just-cleared NULL to JACK.

eng_wait_rt_past() blocks the main thread until g_rt_cycle has advanced
twice (the track_retire_is_safe rule), bounded at 2 s for a client that
is no longer being run. audio_in_r is published and cleared atomically and
loaded once on the RT side.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
eng_gather_instrument_midi runs on the worker pool but called
jack_port_get_buffer() for an armed instrument track's MIDI input, which
only the JACK process thread may do. The pre-fetch loop already cached
that buffer, but only while recording. It now caches it for every armed
instrument track and gather takes the cached pointer; the MIDI recorder
keeps its own RECORDING gate.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
loop_start and loop_end are two stores from the main thread, and the RT
callback, the disk feeder and the offline render read them separately, so
one cycle could pair a new start with an old end and wrap to the wrong
place. A seqlock (loop_seq) guards the pair. RT and feeder readers never
wait on the writer: after a few tries they keep the pair they read last,
so a change lands at most a cycle late. The public getter, not RT, retries
until it gets a clean pair.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The main thread appended to pending[] and bumped n_pending while the RT
thread handed the same array to process() and then reset the count to 0.
An append racing that reset either was lost or re-delivered edits the
plugin had already received. Edits now go through an rt_ringbuffer; the RT
side drains it into its own events[] at the start of process() and the
in_events adapters read only that.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rations
rations merged commit c8d362b into master Sep 27, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant