qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

KVM internal error due to non-atomic memslot updates by pci_update_vga()


From: Marcello Sylvester Bauer
Subject: KVM internal error due to non-atomic memslot updates by pci_update_vga()
Date: Thu, 7 Mar 2024 15:48:15 +0100
User-agent: Mozilla Thunderbird

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: OpenPGP_0xE54B6622A5EDBF61.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]