kvm: qemu: fix a possible deadlock situation in save/restore
If a VM using userspace irqchip is saved when it's in HLT state,
and is restored to use the in-kernel irqchip, the HLT state flag
is also restored. This HLT flag in userspace HLT handling prevents
kvm kernel driver from being run. And at the same time, the original
userspace irqchip is now unused thus will not generate any interrupt
to wake up the HLT state. This patch fixes this deadlock situation
by dropping the HLT state at restore time
Signed-off-by: Qing He <[EMAIL PROTECTED]>
Signed-off-by: Yaozu (Eddie) Dong <[EMAIL PROTECTED]>
---
qemu/vl.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/qemu/vl.c b/qemu/vl.c
index b14233c..7150d48 100644
--- a/qemu/vl.c
+++ b/qemu/vl.c
@@ -5428,6 +5428,9 @@ int cpu_load(QEMUFile *f, void *opaque, int
version_id)
tlb_flush(env, 1);
#ifdef USE_KVM
if (kvm_allowed) {
+ /* when in-kernel irqchip is used, HF_HALTED_MASK causes
deadlock
+ because no userspace IRQs will ever clear this flag */
+ env->hflags &= ~HF_HALTED_MASK;
for (i = 0; i < NR_IRQ_WORDS ; i++) {
qemu_get_be32s(f, &env->kvm_interrupt_bitmap[i]);
}
kvm-no-hlt-on-restore.patch
Description: kvm-no-hlt-on-restore.patch
------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________ kvm-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/kvm-devel
