KVM: arm64: softlockups in stage2_apply_range

Bug #2056227 reported by Krister Johansen
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
linux (Ubuntu)
Invalid
Undecided
Unassigned
Jammy
Fix Committed
Medium
Krister Johansen

Bug Description

[Impact]

Tearing down kvm VMs on arm64 can cause softlockups to appear on console. When
terminating VMs with > 100Gb of memory and 4k pages, the memory unmap times
often exceed 20 seconds, which can trigger the softlockup detector. Portions of
the unmap path also have interrupts disabled while tlb invalidation instructions
run, which can further contribute to latency problems. My team has observed
networking latency problems if the cpu where the teardown is occurring is also
mapped to handle a NIC interrupt.

Fortunately, a solution has been in place since Linux 6.1. A small pair of
patches modify stage2_apply_range to operate on smaller memory ranges before
performing a cond_resched. With these patches applied, softlockups are no
longer observed when tearing down VMs with large amounts of memory.

Although I also submitted the patches to 5.15 LTS (link to LTS submission in
"Backport" section), I'd appreciate it if Ubuntu were willing to take this
submission in parallel since the impact has left us unable to utilize arm64 for
kvm until we can either migrate our hypervisors to hugepages, pick up this fix,
or some combination of the two.

[Backport]

Backport the following fixes from linux 6.1:

3b5c082bbf KVM: arm64: Work out supported block level at compile time
5994bc9e05 KVM: arm64: Limit stage2_apply_range() batch size to largest block

The fix is in 5994bc9e05 and 3b5c082bbf is a dependency that was submitted as
part of the series. The original submission is here:

https://<email address hidden>/

I've also submitted the patches to 5.15 LTS here:

https://<email address hidden>/

Both fixes cherry picked cleanly and there were no conflicts.

[Test]

Executed the test from 5994bc9e05 as well as my own run of kvm_page_table_test
on a VM with 4k pages and a memory size > 100Gb. Without the patches,
softlockups were observed in both tests. With the patches applied, the tests
ran without incident.

This was tested against both LTS 5.15.150 and linux-aws-5.15.0-1055.

[Potential Regression]

Regression potential is low. These patches have been present in Linux since 6.1
and appear to have needed no further maintenance.

Revision history for this message
Krister Johansen (kmjohansen) wrote :

This specifically affects Jammy and the 5.15 series. I have the necessary patches prepared and will e-mail those to the kernel team's mailing list.

Revision history for this message
Krister Johansen (kmjohansen) wrote :
Changed in linux (Ubuntu Jammy):
importance: Undecided → Medium
status: New → In Progress
Changed in linux (Ubuntu):
status: New → Invalid
Changed in linux (Ubuntu Jammy):
status: In Progress → Fix Committed
assignee: nobody → Krister Johansen (kmjohansen)
Revision history for this message
Ubuntu Kernel Bot (ubuntu-kernel-bot) wrote :

This bug is awaiting verification that the linux/5.15.0-104.114 kernel in -proposed solves the problem. Please test the kernel and update this bug with the results. If the problem is solved, change the tag 'verification-needed-jammy-linux' to 'verification-done-jammy-linux'. If the problem still exists, change the tag 'verification-needed-jammy-linux' to 'verification-failed-jammy-linux'.

If verification is not done by 5 working days from today, this fix will be dropped from the source code, and this bug will be closed.

See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you!

tags: added: kernel-spammed-jammy-linux-v2 verification-needed-jammy-linux
Revision history for this message
Krister Johansen (kmjohansen) wrote :

For posterity, LTS 5.15 picked up this fix in 5.15.154

tags: added: verification-done-jammy-linux
removed: verification-needed-jammy-linux
Revision history for this message
Krister Johansen (kmjohansen) wrote :

I've tested linux/5.15.0-104.114 and it passes my tests. Marking verification-done-jammy-linux.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.