Technical Root Cause Analysis
This report is a false-positive soft lockup caused by a hypervisor vCPU pause/preemption on an arm64 Google Compute Engine (GCE) virtual machine, rather than a deadlock, atomic loop, or preemption-disable leak in ext4.
1. Why ext4 is not deadlocked or looping
- No cross-CPU spinlock contention: The NMI backtrace shows CPU 1 is idle (
default_idle_call), and CPU 0 had not yet attempted to acquire &pa->pa_lock. In ext4_mb_put_pa() (fs/ext4/mballoc.c:5166), spin_lock(&pa->pa_lock) expands to __raw_spin_lock() -> lock_acquire(). The interrupted PC is at lock_acquire+0x168/0x320 (kernel/locking/lockdep.c:5946, raw_local_irq_restore(flags)), right after __lock_acquire() completed and before do_raw_spin_lock() was reached.
- No preemption leak or long atomic section: The kernel is built with
CONFIG_PREEMPT=y and CONFIG_DEBUG_ATOMIC_SLEEP=y. ext4_mb_new_blocks() (fs/ext4/mballoc.c:6240) calls might_sleep(), and ext4_mb_scan_groups() / ext4_mb_discard_preallocations() call cond_resched(), ensuring preempt_count == 0 on entry to ext4_mb_new_blocks() and throughout ext4_do_writepages(). Any multi-second loop with preemption enabled would have been preempted by migration/0 (softlockup_fn()), preventing a soft lockup; any loop with preempt_count != 0 leaking into cond_resched() or might_sleep() would have triggered BUG: scheduling while atomic.
- IRQ event trace rules out an active 21-second kernel loop:
softirqs last enabled at (26046): fpsimd_restore_current_state (arch/arm64/kernel/fpsimd.c:1781, invoked via arch_exit_to_user_mode_work() on return to userspace) vs. irq event stamp: 26243.
- Only 197 hardirq enable/disable transitions occurred between user-mode return and the interrupt at
lock_acquire(), and zero TIMER_SOFTIRQ (__do_softirq()) executions completed during ksys_pwrite64(). An active 21-second loop across writeback/extent mapping would have produced orders of magnitude more hardirq and timer-softirq events.
- Prior softlockup taint: The task header shows
Tainted: G L ([L]=SOFTLOCKUP) before watchdog_timer_fn() calls add_taint(TAINT_SOFTLOCKUP, ...), indicating an earlier soft lockup had already occurred on this VM.
2. How the false-positive soft lockup occurs in the arm64 watchdog
- Inside
ext4_mb_put_pa() -> spin_lock(&pa->pa_lock) -> lock_acquire() (kernel/locking/lockdep.c:5938), raw_local_irq_save(flags) masks hardirqs on CPU 0 while executing __lock_acquire().
- During this window (or while vCPU 0 was running
ext4_mb_put_pa()), the GCE host hypervisor paused/preempted vCPU 0 for ~21 seconds while the arm64 architectural counter (cntvct_el0) continued advancing.
- Because
# CONFIG_PARAVIRT_TIME_ACCOUNTING is not set, get_timestamp() (kernel/watchdog.c:665) -> running_clock() measures raw elapsed counter time without discounting hypervisor steal/pause time.
- Furthermore, arm64 does not implement
kvm_check_and_clear_guest_paused(), falling back to the generic stub in include/asm-generic/kvm_para.h:12-15 that unconditionally returns false.
- When vCPU 0 resumed and
lock_acquire() executed raw_local_irq_restore(flags) (kernel/locking/lockdep.c:5946), the overdue watchdog hrtimer (watchdog_timer_fn() in kernel/watchdog.c:836-893) fired immediately, observed a 21s gap since watchdog_touch_ts/watchdog_report_ts, failed to detect the host pause via kvm_check_and_clear_guest_paused(), and emitted BUG: soft lockup - CPU#0 stuck for 21s!.