* [PATCH] lapic3: kvm: qemu: fix a possible deadlock situation in save/restore
@ 2007-08-07 5:58 He, Qing
[not found] ` <37E52D09333DE2469A03574C88DBF40FA9C1A4-wq7ZOvIWXbM/UvCtAeCM4rfspsVTdybXVpNB7YpNyf8@public.gmane.org>
0 siblings, 1 reply; 2+ messages in thread
From: He, Qing @ 2007-08-07 5:58 UTC (permalink / raw)
To: kvm-devel
[-- Attachment #1: Type: text/plain, Size: 1369 bytes --]
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 <qing.he-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Yaozu (Eddie) Dong <eddie.dong-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
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]);
}
[-- Attachment #2: kvm-no-hlt-on-restore.patch --]
[-- Type: application/octet-stream, Size: 1276 bytes --]
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 <qing.he@intel.com>
Signed-off-by: Yaozu (Eddie) Dong <eddie.dong@intel.com>
---
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]);
}
[-- Attachment #3: Type: text/plain, Size: 315 bytes --]
-------------------------------------------------------------------------
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/
[-- Attachment #4: Type: text/plain, Size: 186 bytes --]
_______________________________________________
kvm-devel mailing list
kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/kvm-devel
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-08-07 8:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-07 5:58 [PATCH] lapic3: kvm: qemu: fix a possible deadlock situation in save/restore He, Qing
[not found] ` <37E52D09333DE2469A03574C88DBF40FA9C1A4-wq7ZOvIWXbM/UvCtAeCM4rfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-08-07 8:31 ` Avi Kivity
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox