Skip to contentSkip to conversation

Don't quit IO thread before all lvcpus stopped

PATCH Applied Dor Laor 2 participants 4 messages Apr 23, 2008 – Apr 24, 2008 KVM

lore
Share & tools
lore

Dor Laor

author
#0 lore raw

PATCH 1/1 Don't quit IO thread before all lvcpus stopped

while investigating the revert of "fix sci irq set when acpi timer" I discovered the reason. Please also re-revert the original patch. Thanks,
Dor

-------------
[PATCH] Don't quit IO thread before all lvcpus stopped

Call pause_all_threads() before exiting the i/o thread main loop.
This scenario happened on system_powerdown request:
The vcpu eventually makes pm_ioport_writew (soft power off) access that calls qemu_system_shutdown_request.
It causes the i/o thread to exit although the vcpu did not exit yet.

One of the symptoms is that vcpu may trigger timers thus causing a segfault since the i/o thread stopped the timer. [This is what happened on the sci irq timer, now there is no need to revert it[

---
 qemu/qemu-kvm.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
qemu/qemu-kvm.c +2 -0
index 50589a7..78127de 100644
@@ -452,7 +452,9 @@ int kvm_main_loop(void)
         pthread_mutex_unlock(&qemu_mutex);
     }
 
+    pause_all_threads();
     pthread_mutex_unlock(&qemu_mutex);
+
     return 0;
 }
 
Signature · 1 line
1.5.4.1
Quoted 1 line

From d74366f603f5b16077af93523e6ba072eb7d7aa1 Mon Sep 17 00:00:00 2001

From: Dor Laor <[email protected]>
Date: Thu, 24 Apr 2008 00:51:19 +0300
Subject: [PATCH] Don't quit IO thread before all vcpus stopped.

Call pause_all_threads() before exiting the i/o thread main loop.
This scenario happened on system_powerdown request:
The vcpu eventually makes pm_ioport_writew (soft power off) access that calls qemu_system_shutdown_request.
It causes the i/o thread to exit although the vcpu did not exit yet.

One of the symptoms is that vcpu may trigger timers thus causing a segfault since the i/o thread stopped the timer. [This is what happened on the sci irq timer, now there is no need to revert it[

---
 qemu/qemu-kvm.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
qemu/qemu-kvm.c +2 -0
index 50589a7..78127de 100644
@@ -452,7 +452,9 @@ int kvm_main_loop(void)
         pthread_mutex_unlock(&qemu_mutex);
     }
 
+    pause_all_threads();
     pthread_mutex_unlock(&qemu_mutex);
+
     return 0;
 }
 
Signature · 1 line
1.5.4.1

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone

_______________________________________________
kvm-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-devel

Applied
#1 lore raw
Quoted 3 lines · Dor Laor

while investigating the revert of "fix sci irq set when acpi timer" I discovered the reason. Please also re-revert the original patch.

Applied, but system_powerdown still doesn't work with the sci acpi timer fix.

Signature · 8 lines
error compiling committee.c: too many arguments to function


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
author
#2 lore raw
Quoted 9 lines · Avi Kivity
Quoted 3 lines · Dor Laor

while investigating the revert of "fix sci irq set when acpi timer" I discovered the reason. Please also re-revert the original patch.

Applied, but system_powerdown still doesn't work with the sci acpi timer fix.

With the above patch and revert the reversion of "fix sci irq set when acpi timer" it works for me. Can you give some details or try again?

My host is 2.6.24.3-50-fc8, your kvm head (user da00aa5090cf2de4259960ea659ac783bd65a041 + re-revert, kernel 1736e3f0a3e173a7f452b32ad19bfff085a1a255).
Guest is winXp with acpi hal. After it boots I go to the monitor and issue a system_powerdown.
Everything works and there is no segfaults (tested multiple time)

Dor

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone

#3 lore raw
Quoted 17 lines · Dor Laor
Quoted 11 lines · Avi Kivity
Quoted 4 lines · Dor Laor

while investigating the revert of "fix sci irq set when acpi timer" I discovered the reason. Please also re-revert the original patch.

Applied, but system_powerdown still doesn't work with the sci acpi timer fix.

With the above patch and revert the reversion of "fix sci irq set when acpi timer" it works for me. Can you give some details or try again?

Quoted 8 lines

My host is 2.6.24.3-50-fc8, your kvm head (user da00aa5090cf2de4259960ea659ac783bd65a041 + re-revert, kernel 1736e3f0a3e173a7f452b32ad19bfff085a1a255).
Guest is winXp with acpi hal. After it boots I go to the monitor and issue a system_powerdown.
Everything works and there is no segfaults (tested multiple time)

With current master, Windows and Linux (FC6, x86_64) both shut down correctly after system_powerdown. With the sci timer thing re-applied, Windows continues to work but Linux no longer responds to ACPI powerdown.

Signature · 8 lines
error compiling committee.c: too many arguments to function


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone