diff mbox

SeaBios: Fix reset procedure reentrancy problem on qemu-kvm platform

Message ID 8E78D212B8C25246BE4CE7EA0E645FE529193D@SZXEMI504-MBS.china.huawei.com
State New
Headers show

Commit Message

Xulei (Stone, Euler) Nov. 3, 2015, 6:29 a.m. UTC
On qemu-kvm platform, when I reset a VM through "virsh reset", and coincidently
the VM is in process of internal rebooting at the same time. Then the VM will 
not be successfully reseted any more due to the reset reentrancy. I found: 
(1)SeaBios try to shutdown the VM after reseting it failed by apm_shutdown(). 
However, apm_shutdown() does not work on qemu-kvm platform;
(2)I add 1s sleep in qemu_prep_reset(), then continuously reset the VM twice,
aforementioned case must happen.
This patch fixes this issue by letting the VM always execute the reboot
routing while a reenrancy happenes instead of attempting apm_shutdown on
qemu-kvm platform.

Signed-off-by: Lei Xu <stone.xulei@huawei.com>

---
 roms/seabios/src/resume.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

--
1.7.12.4
diff mbox

Patch

diff --git a/roms/seabios/src/resume.c b/roms/seabios/src/resume.c
index 1903174..96ff79e 100644
--- a/roms/seabios/src/resume.c
+++ b/roms/seabios/src/resume.c
@@ -16,6 +16,7 @@ 
 #include "std/bda.h" // struct bios_data_area_s
 #include "string.h" // memset
 #include "util.h" // dma_setup
+#include "fw/paravirt.h" //runningOnKVM
 
 // Handler for post calls that look like a resume.
 void VISIBLE16
@@ -122,7 +123,11 @@  tryReboot(void)
         dprintf(1, "Unable to hard-reboot machine - attempting shutdown.\n");
         apm_shutdown();
     }
-    HaveAttemptedReboot = 1;
+    if (!runningOnKVM()) {
+        // Hard reboot has failed - try to shutdown machine.
+        HaveAttemptedReboot = 1;
+    }
+
 
     dprintf(1, "Attempting a hard reboot\n");