Skip to content

p14s-personal: backport amdgpu/TTM lockup fix - #86

Merged
hazelnusse merged 1 commit into
mainfrom
fix-amdgpu-ttm-lockup
Sep 14, 2026
Merged

hazelnusse merged 1 commit into
mainfrom
fix-amdgpu-ttm-lockup

Conversation

@hazelnusse

@hazelnusse hazelnusse commented Sep 14, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Closing multiple GPU apps at once (Firefox, Chrome, then Telegram)
    hung the whole system three times (2026-09-11, 2026-09-12,
    2026-09-14), each requiring a hard power cycle. journalctl -b -1
    showed CPUs livelocked in ttm_resource_manager's spinlock,
    reached via amdgpu_cs_ioctl / GEM-close ioctls.
  • Root cause: upstream commit b2ed01e7ad3d ("drm/ttm: Fix
    ttm_bo_swapout() infinite LRU walk on swapout failure") moved
    TTM's bulk-move bookkeeping under if (!ret) in
    ttm_bo_swapout_cb(), but ttm_tt_swapout() never returns 0 on
    success — so the bookkeeping is skipped on every successful
    swapout, leaving a stale cursor in the resource manager's LRU list
    that later teardown livelocks on.
  • The 1-line upstream fix (drm/amd#5387)
    hasn't shipped in any released kernel as of 7.2.6, and nixpkgs'
    own kernel-bump PR (NixOS/nixpkgs#563193)
    only reaches 7.2.6 via a staging branch that can take weeks to
    reach nixpkgs-unstable. Backports the fix locally via
    boot.kernelPatches on p14s-personal until nixpkgs catches up
    (comment in the diff notes when to drop it).

Test plan

  • nix build .#nixosConfigurations.p14s-personal.config.system.build.toplevel succeeds — kernel compiled from source with the patch applied cleanly (verified against both 7.2.4 and, after a rebase, 7.2.5)
  • Verify live on p14s-personal after nixos-rebuild switch + reboot into the patched kernel

Closing multiple GPU apps at once (Firefox, Chrome, then Telegram)
hung the whole system three times (2026-09-11, 2026-09-12,
2026-09-14), requiring a hard power cycle each time. journalctl
showed CPUs livelocked in ttm_resource_manager's spinlock, reached
via amdgpu_cs_ioctl / GEM-close ioctls.

Root cause: upstream commit b2ed01e7ad3d ("drm/ttm: Fix
ttm_bo_swapout() infinite LRU walk on swapout failure") moved TTM's
bulk-move bookkeeping under `if (!ret)` in ttm_bo_swapout_cb(), but
ttm_tt_swapout() never returns 0 on success -- so the bookkeeping is
skipped on every successful swapout, leaving a stale cursor in the
resource manager's LRU list that later teardown livelocks on.

The 1-line upstream fix (Closes:
https://gitlab.freedesktop.org/drm/amd/-/issues/5387) hasn't shipped
in any released kernel as of 7.2.6, and nixpkgs' own kernel-bump PR
(NixOS/nixpkgs#563193) only reaches 7.2.6 via a staging branch that
can take weeks to reach nixpkgs-unstable. Backport it locally via
boot.kernelPatches until then.
@hazelnusse
hazelnusse merged commit cc393f8 into main Sep 14, 2026
1 check passed
@hazelnusse
hazelnusse deleted the fix-amdgpu-ttm-lockup branch September 14, 2026 20:40
@vcunat

vcunat commented Sep 16, 2026

Copy link
Copy Markdown

(randomly passing by)

and nixpkgs' own kernel-bump PR (NixOS/nixpkgs#563193) only reaches 7.2.6 via a staging branch that can take weeks to reach nixpkgs-unstable.

That's incorrect. The staging-nixos branch typically merges to master on every round of kernel updates. (it's there already) The channels usually lag a day or three behind master.

@hazelnusse

Copy link
Copy Markdown
Owner Author

Thanks for the correction — you're right, staging-nixos merging into master most rounds with only a day-or-three channel lag is not what I said in the PR description.

That said, the staging-lag point wasn't actually the blocker here: the upstream TTM fix itself (3db7d7d58341, queued in drm-misc-fixes/linux-next around 2026-09-09) hasn't reached a released kernel yet. 7.2.6 (out 2026-09-14) doesn't include it, and nixpkgs-unstable is still on 7.2.5. So there's nothing for a flake update to pick up right now regardless of staging lag — this patch needs to stay until the fix lands in a stable point release and nixpkgs bumps to it.

Anecdotally, the change in the patch seems to have resolved the issue I was experiencing, though admittedly it has only been a few days of moderate use of the laptop. 🤞

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.

2 participants