Skip to content

[BUG] Scheduling while atomic in apple_bce (aaudio_handle_stream_timestamp → mutex_lock) causing random reboots on Ubuntu 24.04 (MacBookPro16,1) #179

@realpepio

Description

@realpepio

[BUG] Scheduling while atomic in apple_bce (aaudio_handle_stream_timestamp → mutex_lock) causing random reboots on Ubuntu 24.04 (MacBookPro16,1)

Bug Report: Kernel BUG "scheduling while atomic" in apple_bce aaudio DMA IRQ handler causing random hard reboots

Hardware:
• Model: MacBook Pro 16" 2019 (MacBookPro16,1) with Intel Core i9
• BIOS/iBridge: 2094.40.1.0.0.0 (iBridge: 23.16.12048.0.0,0) dated 11/08/2025

OS / Distribution / Kernel:
• Ubuntu 24.04 LTS (noble)
• Kernel: 6.19.5-1-t2-noble (from https://github.com/AdityaGarg8/t2-ubuntu-repo)
• Also reproduced on 6.18.2-1-t2-noble
• Tainted: G WC (WARN + out-of-tree module apple_bce)

Symptom:
• Random hard reboots / power cycles after long uptime (e.g., 7+ days stable, then sudden reboot with no panic screen or obvious trigger).
• Occurs during idle/light use; no heavy load, specific apps, or audio playback required.
• Kernel logs repeatedly show "BUG: scheduling while atomic" in the BCE DMA IRQ thread (irq/88-bce_dma or irq/98-bce_dma), likely leading to instability/watchdog/panic.

Key log excerpts (from journalctl -k):

First trace (with mutex details):
BUG: scheduling while atomic: irq/88-bce_dma/529/0x00000002
...
Call Trace:
...
__mutex_lock_slowpath+0x13/0x20
mutex_lock+0x3b/0x50
_snd_pcm_stream_lock_irqsave+0x36/0x60 [snd_pcm]
aaudio_handle_stream_timestamp+0x4f/0xf0 [apple_bce]
aaudio_handle_timestamp+0x2d/0x59 [apple_bce]
aaudio_handle_cmd_timestamp+0xd3/0x190 [apple_bce]
aaudio_handle_command+0x83/0x90 [apple_bce]
aaudio_bce_in_queue_completion+0x22f/0x2e0 [apple_bce]
bce_handle_cq_completions+0x19a/0x230 [apple_bce]
bce_handle_dma_irq+0x7e/0xe0 [apple_bce]
...

Followed by:
aaudio_pcm_pointer while not started
BUG: scheduling while atomic: irq/88-bce_dma/529/0x00000000

Mitigation / Workarounds Tried:
• Kernel upgrade: 6.18.2-t2 → 6.19.5-t2-noble → same issue persists.
• GRUB cmdline (per wiki): quiet splash intel_iommu=on iommu=pt pcie_ports=compat
• Also tested with added threadirqs → no improvement.
• Blacklisting apple_bce (via /etc/modprobe.d/blacklist.conf + update-initramfs -u -k all) → completely eliminates the BUG messages and reboots (but disables internal audio and Touch Bar).
• Audio stack: PipeWire (default on Ubuntu 24.04). Happens even with audio muted/idle; likely background timestamp/polling trigger.
• No hardware issues seen in macOS (if previously dual-booted); SSD health fine via smartctl.

Additional Info:
• No other oops/panics in logs.
• Seems tied to aaudio timestamp handling attempting mutex in atomic/IRQ context (e.g., _snd_pcm_stream_lock_irqsave from aaudio_handle_stream_timestamp when stream not started).
• Not widely reported (no matching issues found in apple-bce-drv or related repos).

Request / Questions:
• Is this a known issue in apple_bce / aaudio subsystem?
• Any quick workarounds besides blacklisting the module (e.g., config to disable timestamp queries, or defer locking)?
• Would a code change help (e.g., use spinlock, move lock to non-atomic path, skip if !started, or workqueue deferral)?
• Happy to test patches, debug branches, or provide more info (full dmesg, lsmod, pactl list, etc.).

Thanks for maintaining t2linux — this setup is otherwise very stable!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions