VM enter into hung status after triggering a crash
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
linux-azure (Ubuntu) |
Fix Released
|
Medium
|
Marcelo Cerri | ||
Bionic |
Fix Released
|
Medium
|
Marcelo Cerri | ||
linux-azure-4.15 (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned | ||
Bionic |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
[Impact]
* When kdumping on trusty/4.15 in an Azure instance, we observe quite frequently a stall on the kdump kernel, it gets blocked and soon we see a stack like the following:
[ 65.452007] INFO: rcu_sched detected stalls on CPUs/tasks:
[ 65.456004] 1-...!: (0 ticks this GP) idle=488/0/0 softirq=1/1 fqs=0
[ 65.456004] (detected by 0, t=15002 jiffies, g=707, c=706, q=8457)
[ 65.456004] rcu_sched kthread starved for 15002 jiffies! g707 c706 f0x0 RCU_GP_WAIT_FQS(3) ->state=0x402 ->cpu=1
* By using the Azure serial console, we collected a sysrq-w when the issue happens:
[ 529.515013] sysrq: Show Blocked State
[ 529.517730] task PC stack pid father
[ 529.519006] kworker/u4:2 D 0 94 2 0x80000000
[ 529.519006] Workqueue: events_unbound fsnotify_
[ 529.519006] Call Trace:
[ 529.519006] __schedule+
[ 529.519006] schedule+0x36/0x80
[ 529.519006] schedule_
[ 529.519006] ? check_preempt_
[ 529.519006] wait_for_
[ 529.519006] ? wake_up_q+0x80/0x80
[ 529.519006] __synchronize_
[ 529.519006] ? trace_raw_
[ 529.519006] ? __switch_
[ 529.519006] synchronize_
[ 529.519006] fsnotify_
[ 529.519006] process_
[ 529.519006] worker_
[ 529.519006] kthread+0x105/0x140
[ 529.519006] ? max_active_
[ 529.519006] ? kthread_
[ 529.519006] ret_from_
[ 529.519006] udevadm D 0 544 1 0x00000000
[ 529.519006] Call Trace:
[ 529.519006] __schedule+
[ 529.519006] schedule+0x36/0x80
[ 529.519006] schedule_
[ 529.519006] ? try_to_
[ 529.519006] ? try_to_
[ 529.519006] wait_for_
[ 529.519006] ? wake_up_q+0x80/0x80
[ 529.519006] __flush_
[ 529.519006] ? destroy_
[ 529.519006] flush_delayed_
[ 529.519006] fsnotify_
[ 529.519006] fsnotify_
[ 529.519006] inotify_
[ 529.519006] __fput+0xea/0x220
[ 529.519006] ____fput+0xe/0x10
[ 529.519006] task_work_
[ 529.519006] exit_to_
[ 529.519006] do_syscall_
[ 529.519006] entry_SYSCALL_
[ 529.519006] dhclient D 0 573 572 0x00000000
[ 529.519006] Call Trace:
[ 529.519006] __schedule+
[ 529.519006] schedule+0x36/0x80
[ 529.519006] schedule_
[ 529.519006] ? aa_profile_
[ 529.519006] wait_for_
[ 529.519006] ? wake_up_q+0x80/0x80
[ 529.519006] __wait_
[ 529.519006] synchronize_
[ 529.519006] ? __call_
[ 529.519006] ? trace_raw_
[ 529.519006] synchronize_
[ 529.519006] __unregister_
[ 529.519006] packet_
[ 529.519006] packet_
[ 529.519006] SYSC_bind+
[ 529.519006] ? sock_alloc_
[ 529.519006] SyS_bind+0xe/0x10
[ 529.519006] do_syscall_
[ 529.519006] entry_SYSCALL_
* Bisecting mainline kernels, we found that v4.17-rc1 didn't reproduce the issue, whereas v4.16 reproduced. Then, a fine-grained git bisect led us to the fix - the following patch, when backported to a problematic version, fixes the issue: d8e462e19305 ("Drivers: hv: vmbus: Implement Direct Mode for stimer0")
* In Azure/Hyper-V, before the aforementioned commit, timer interrupts were passed to the hypervisor through a vmbus message, a mechanism of communication of hyper-v guests/hypervisor. With the patch, a check is made (through MSR-like mechanism) and if the hypervisor supports, a direct timer IRQ mechanism is put in-place instead of the vmbus channel.
* Our theory is that on kdump kernel, specially due to the single cpu nature, the vmbus-messaged timer IRQ could interfere with scheduling and create a dead-lock condition, which is what we observe from the stack traces. Hence, we hereby propose to backport such patch to azure 4.15 kernels.
* Our hypothesis about why this wasn't observed in Bionic is that changes in the kdump mechanism make it start earlier, and this might hide the schedule issue. Lack of testing also could be the cause of the non-observability.
[Test Case]
* Perform a kdump in Trusty/4.15 and after some rounds, you should see the mentioned RCU stack trace. With the patch, no issue is observed, and we could perform ~30 kdumps in a row.
[Where problems could occur]
* Since the patch touches IRQ code (although restricted to Hyper-v), it's a somewhat invasive change. It could lead to issues in the IRQ subsystem, although the patch is upstream since 2018 and no fixes for that were found (we count on Fixes tag for that).
Changed in linux-azure (Ubuntu): | |
status: | Confirmed → In Progress |
assignee: | nobody → Guilherme G. Piccoli (gpiccoli) |
description: | updated |
Changed in linux-azure (Ubuntu): | |
assignee: | Guilherme G. Piccoli (gpiccoli) → nobody |
assignee: | nobody → Marcelo Cerri (mhcerri) |
Changed in linux-azure (Ubuntu Bionic): | |
assignee: | nobody → Marcelo Cerri (mhcerri) |
status: | New → In Progress |
Changed in linux-azure (Ubuntu): | |
importance: | Undecided → Medium |
Changed in linux-azure (Ubuntu Bionic): | |
importance: | Undecided → Medium |
Changed in linux-azure (Ubuntu Bionic): | |
status: | In Progress → Fix Committed |
Changed in linux-azure-4.15 (Ubuntu): | |
status: | New → Fix Committed |
Changed in linux-azure-4.15 (Ubuntu Bionic): | |
status: | New → Fix Committed |
tags: |
added: verification-done-bionic removed: verification-needed-bionic |
Changed in linux-azure-4.15 (Ubuntu): | |
status: | Fix Committed → Fix Released |
Changed in linux-azure (Ubuntu Bionic): | |
status: | Fix Committed → Fix Released |
Changed in linux-azure (Ubuntu): | |
status: | In Progress → Fix Released |
Last time I did verification against gallery image, the default kernel version is 4.4.0-148-generic. 4.15.0- 1042-azure is the first one which we hit this bug, it is not specific for the esm kernel.
And I tried below kernel, found the kernel linux-image-
# Kernel Version/Package Result 4.15.0- 1023-azure => Good 4.15.0- 1030-azure 4.15.0- 1031-azure 4.15.0- 1032-azure 4.15.0- 1035-azure 4.15.0- 1036-azure => Good 4.15.0- 1037-azure 4.15.0- 1039-azure 4.15.0- 1040-azure => Good 4.15.0- 1041-azure => Good 4.15.0- 1042-azure => Bad 4.15.0- 1045-azure => Bad
0 Default kernel 4.4.0-148-generic => Good
1 linux-image-
2 linux-image-
3 linux-image-
4 linux-image-
5 linux-image-
6 linux-image-
7 linux-image-
8 linux-image-
9 linux-image-
10 linux-image-
11 linux-image-
12 linux-image-