* KVM internal error due to non-atomic memslot updates by pci_update_vga()
@ 2024-03-07 14:48 Marcello Sylvester Bauer
0 siblings, 0 replies; only message in thread
From: Marcello Sylvester Bauer @ 2024-03-07 14:48 UTC (permalink / raw)
To: qemu-devel
Cc: eesposit, alex.williamson, richard.henderson, pbonzini, eduardo,
marcel.apfelbaum, Philippe Mathieu-Daudé, wangyanan55
[-- Attachment #1.1.1: Type: text/plain, Size: 1713 bytes --]
Greetings,
I'm facing a problem with KVM memslot updates in pci_update_vga() and
I'm looking for a possible solution to prevent this error.
Background:
Over the past few weeks, we have been investigating a bug where QEMU
Windows 10 VMs using VT-d Intel GPU passthrough suddenly crash due to an
internal KVM error. In order for this bug to occur, Windows is set to
automatically turn off the display when idle. The reason for this bug is
that the Windows Intel GPU driver disables VGA and therefore disables
the QEMU memory region "vfio-vga-mmio@0xa0000". This change results in a
non-atomic KVM memslot update (0x0-0xa000 -> 0x0-0xc000). Accessing this
memory during this operation will cause a page fault and result in a
KVM_EXIT_MMIO. While QEMU can provide the data, KVM is required to
emulate the instruction, which in our case failed due to lack of support
for the MOVSD instruction. I'm currently working on a kvm patch set to
implement the missing instructions on the kernel side. But it would be
great to prevent this race condition in QEMU as well.
Now to my general question:
Besides disabling VGA, what can we do in QEMU to avoid this?
Will the patch set "KVM: allow listener to stop all vcpus before" [1] be
enough to prevent this bug or are additional changes needed?
There are even efforts to implement atomic memslot updates on the kernel
side, but it does not look like this change will be adopted. [2]
Any thoughts and suggestions are welcome.
Thanks.
Marcello
---
[1](https://patchwork.kernel.org/project/kvm/cover/20221111154758.1372674-1-eesposit@redhat.com/)
[2](https://lore.kernel.org/lkml/20220909104506.738478-1-eesposit@redhat.com/)
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 10181 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-03-07 17:30 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-07 14:48 KVM internal error due to non-atomic memslot updates by pci_update_vga() Marcello Sylvester Bauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).