Skip to content

efi/runtime-wrappers: bound the wait for EFI runtime service calls

Breno Leitao linux-efi lkml 3 versions – In review

Get series with b4
b4 am [email protected] change-id 20260609-efi_timeout-6f51d5bbcfb7

Versions newest first

  1. v3 Latest7 patches 13 repliesIn review
  2. v26 patches 3 repliesSuperseded
  3. v12 patches 4 repliesSuperseded

Changes in v3 from the cover letter

- Fix two review-flagged races (entry-time worker park vs. freed args; non-blocking EFI_RUNTIME_SERVICES check now under efi_runtime_lock)
- Link to v2: https://lore.kernel.org/r/[email protected]

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7efi: fix stale reference to efi_recover_from_page_fault()include/linux/efi.h+2 -20 replies
2/7efi/runtime-wrappers: factor out efi_rts_park_worker()arch/x86/platform/efi/quirks.c drivers/firmware/efi/runtime-wrappers.c include/linux/efi.h+16 -80 replies
3/7efi/runtime-wrappers: handle queue_work() failure with goto exitdrivers/firmware/efi/runtime-wrappers.c+5 -30 replies
4/7efi/runtime-wrappers: check EFI_RUNTIME_SERVICES before using efi_rts_workdrivers/firmware/efi/runtime-wrappers.c+5 -60 replies
5/7efi/runtime-wrappers: bound the wait for EFI runtime service callsdrivers/firmware/efi/runtime-wrappers.c+18 -110 replies
6/7efi/runtime-wrappers: honour EFI_RUNTIME_SERVICES in the non-blocking pathsdrivers/firmware/efi/runtime-wrappers.c+16 -00 replies
7/7efi/runtime-wrappers: retire the worker if a wedged call ever returnsdrivers/firmware/efi/runtime-wrappers.c+3 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.

Read the v3 thread

Cover letter [PATCH v3 0/7] efi/runtime-wrappers: bound the wait for EFI runtime service calls

When an EFI runtime service call hangs in firmware, the kworker on efi_rts_wq is stuck inside the firmware call and cannot be cancelled. The kernel currently waits indefinitely on the completion, and the caller holds efi_runtime_lock for the duration, so every subsequent EFI runtime caller (efivarfs, NVRAM writes, set_wakeup_time, ACPI PRM handlers, ...) is wedged until reboot. The only externally visible symptom is a "workqueue lockup" message and userspace processes piling up uninterruptibly on the semaphore.

A real example from one of our NVIDIA Grace hosts:

  BUG: workqueue lockup - pool cpus=28 node=0 flags=0x0 nice=0 stuck for 127s!
  ...
  CPU: 28 PID: 590 Comm: kworker/u288:6
  Workqueue: efi_rts_wq efi_call_rts
  Call trace:
   0x4052f11ecc (P)
   0x4052f10ed4
   ...
   __efi_rt_asm_wrapper+0x50/0x78
   efi_call_rts+0x178/0x240
   process_scheduled_works+0x17c/0x420
   worker_thread+0x184/0x4d8
   kthread+0xcc/0x1f8
   ret_from_fork+0x10/0x20

PC and LR are inside EFI runtime services firmware memory; firmware never returned; the worker stayed stuck across the 127s / 157s / 188s "workqueue lockup" reports until external monitoring eventually rebooted the host.

This series doesn't fix the firmware bug - that's vendor territory - but it stops one stuck EFI call from taking the rest of userspace down with it, and turns a generic stalled-task mystery into an unambiguous "EFI firmware is at fault" signal in dmesg, which is especially valuable at fleet scale where the same symptom could otherwise be attributed to dozens of unrelated stalls.

---
Changes in v3:
- Fix two review-flagged races (entry-time worker park vs. freed args; non-blocking EFI_RUNTIME_SERVICES check now under efi_runtime_lock)
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- Drop v1's efi_rts_dead flag; reuse the existing EFI_RUNTIME_SERVICES bit (cleared on timeout) and return EFI_ABORTED instead of EFI_TIMEOUT (per Ard).
- Also guard the non-blocking paths (set_variable/query_variable_info/reset_system) and park the leaked worker via a shared efi_rts_park_worker() reused by x86's
page-fault handler;
- Split into smaller prep patches.
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Breno Leitao (7):
efi: fix stale reference to efi_recover_from_page_fault() efi/runtime-wrappers: factor out efi_rts_park_worker() efi/runtime-wrappers: handle queue_work() failure with goto exit efi/runtime-wrappers: check EFI_RUNTIME_SERVICES before using efi_rts_work efi/runtime-wrappers: bound the wait for EFI runtime service calls efi/runtime-wrappers: honour EFI_RUNTIME_SERVICES in the non-blocking paths efi/runtime-wrappers: retire the worker if a wedged call ever returns

 arch/x86/platform/efi/quirks.c          |  9 +----
 drivers/firmware/efi/runtime-wrappers.c | 68 ++++++++++++++++++++++++++++-----
 include/linux/efi.h                     |  6 ++-
 3 files changed, 64 insertions(+), 19 deletions(-)

---
base-commit: a87737435cfa134f9cdcc696ba3080759d04cf72
change-id: 20260609-efi_timeout-6f51d5bbcfb7

Best regards,

Signature · 1 line
Breno Leitao <[email protected]>