Public bug reported:

sphde fails to build on arm64 and armhf in stonking (and resolute). The build 
is killed after 150 minutes of inactivity in sphsinglepcqueue_ttt:
https://launchpad.net/ubuntu/+source/sphde/1.4.0-5.1build2/+build/32794042

Debian has the same failure: https://bugs.debian.org/1125773

The test does not just hang; it deadlocks. Running it under gdb on an
arm64 buildd showed that SPHSinglePCQueueAllocStrideEntry() fails in the
producer thread, which then exits. The consumer thread spins forever
waiting for entries that never arrive, and main() is blocked in
pthread_join().

Root cause: arm and aarch64 use src/sasatom_generic.h, where
sas_read_barrier(), sas_write_barrier() and sas_full_barrier() are
compiler-only barriers (asm("" ::: "memory")). On a weakly ordered CPU,
the producer can see the qtail advanced by
SPHSinglePCQueueFreeNextEntry() while still reading the stale
"allocated" entry header. As a result, SPHSinglePCQueueFull() says "not
full" but the allocation fails. x86_64 and powerpc use real fences.
Upstream master already uses __sync_synchronize() in the newer riscv and
loongarch headers, but arm was never covered.

Fix: make the generic barriers real fences
(__atomic_thread_fence(__ATOMIC_SEQ_CST)), and add the missing load
ordering in the single PC queue alloc/get functions.

Test build with the patch: the full test suite passes (20/20) on arm64 and 
armhf:
https://launchpad.net/~ubuntu-desktop/+archive/ubuntu/transitions/+build/33825522
https://launchpad.net/~ubuntu-desktop/+archive/ubuntu/transitions/+build/33825523

** Affects: sphde (Ubuntu)
     Importance: Undecided
     Assignee: Sebastien Bacher (seb128)
         Status: Fix Committed

** Affects: sphde (Debian)
     Importance: Unknown
         Status: Unknown


** Tags: arm64 armhf ftbfs patch

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2170172

Title:
  sphde FTBFS on arm64/armhf: sphsinglepcqueue_ttt deadlocks due to
  missing memory barriers

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/sphde/+bug/2170172/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to