aarch64 Linux: outline atomics never use LSE

オープン
#166,418 コメント 12 件 リアクション 1 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

  • #166430 @ali-vercel による — マージされずにクローズ

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
18/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
rust

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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
主要言語
Rust
スター
123k
フォーク
16.6k
平均マージ
2日 17時間
マージ済み PR(30日)
532

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

rust-lang/rust のほかの issue

rust-lang/rust の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。