aarch64 Linux: outline atomics never use LSE

Đang mở
#166,418 12 bình luận 1 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

  • #166430 của @ali-vercel — đã đóng, không merge

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
18/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
rust
Lĩnh vực
compilers, performance

Hướng nghiên cứu

Read rust-lang/compiler-builtins#1354 first, then the aarch64 outline-atomics helpers that define __aarch64_ldadd8_acq_rel and the runtime LSE feature check they branch on. Reproduce with the issue's script, comparing the disassembly of nightly-2026-10-28 against nightly-2026-10-29 under qemu-aarch64 -cpu max. Done means the helper emits ldaddal again when the LSE feature bit is set. Note that pull request #166430 is already open against this issue.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

A-compiler-builtins C-bug I-slow O-Arm O-linux P-high regression-untriaged S-has-bisection T-libs

Ever since rust nightly 2026-10-29, outline atomics on aarch64 linux don't use LSE. Appears to have been caused by rust-lang/compiler-builtins#1354. This causes poor performance because it falls back to an LL/SC retry loop.

Reproduction

use std::sync::atomic::{AtomicU64, Ordering};

static COUNTER: AtomicU64 = AtomicU64::new(0);

fn main() {
    COUNTER.fetch_add(1, Ordering::SeqCst);
}
Reproduction script to check arm64 instructions Install rustup and qemu-user.
#!/bin/bash
set -e
for toolchain in nightly-2026-10-28 nightly-2026-10-29; do
  rustup -q toolchain install --profile minimal $toolchain
  RUSTFLAGS="-C relocation-model=static" cargo +$toolchain build -q --release --target-dir target-$toolchain
  bin=target-$toolchain/release/lsemin
  helper=$(nm -S $bin | awk '/ __aarch64_ldadd8_acq_rel$/ {print "0x" $1 "+0x" $2}')
  echo "== $toolchain"
  qemu-aarch64 -cpu max -d in_asm -dfilter $helper $bin 2>&1 | grep '^0x'
done

Ran on qemu-aarch64 -cpu max. The helper __aarch64_ldadd8_acq_rel uses the following instructions

  adrp     x8, #0x460000
  ldrb     w8, [x8, #0xb0c]
  cbz      w8, #0x435a64
  mov      x16, x0
  ldaxr    x0, [x1]
  add      x17, x0, x16
  stlxr    w15, x17, [x1]
  cbnz     w15, #0x435a68
  ret

But I expected it to use ldaddal. Here's output from nightly-2026-10-28.

  adrp     x16, #0x460000
  ldrb     w16, [x16, #0xb0c]
  cbz      w16, #0x435b14
  ldaddal  x0, x0, [x1]
  ret

Claude Opus 5.5 helped me find and bisect this.

Meta

rustc +nightly-2026-10-29 --version --verbose:

rustc 1.101.0-nightly (92ffebece 2026-10-28)
binary: rustc
commit-hash: 92ffebeceaa0a071066f233873c2438e73d70fe7
commit-date: 2026-10-28
host: aarch64-unknown-linux-gnu
release: 1.101.0-nightly
LLVM version: 23.1.4
Ngôn ngữ chính
Rust
Star
123k
Fork
16.6k
Merge trung bình
2 ngày 17 giờ
Pull request đã merge (30 ngày)
532

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của rust-lang/rust

Tất cả issue của rust-lang/rust

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.