Skip to contentSkip to conversation

Kemari: use signal to save qemu state for Kemari

RFC PATCH In review Yoshiaki Tamura 1 participant 2 messages Mar 12, 2009 – Mar 24, 2009

lore
Share & tools
lore
#0 lore raw

RFC PATCH 12/13 Kemari: use signal to save qemu state for Kemari

References: <[email protected]>
In-Reply-To: <[email protected]>
Content-Type: text/plain; charset=ISO-2022-JP
Content-Transfer-Encoding: 7bit

This is an updated version of the following patch. Followed the changes in saving qemu state code.

http://lists.xensource.com/archives/html/xen-devel/2009-03/msg00381.html

---
 vl.c              |   24 ++++++++++++++++++++++++
 xen-config-host.h |    1 +
 2 files changed, 25 insertions(+)
vl.c +24 -0
index 8539f6d..58875d9 100644
@@ -274,6 +274,8 @@ static int icount_time_shift;
 static int64_t qemu_icount_bias;
 static QEMUTimer *icount_rt_timer;
 static QEMUTimer *icount_vm_timer;
+/* Kemari */
+volatile int kemari_enabled = 0;
 
 uint8_t qemu_uuid[16];
 
@@ -6961,6 +6963,8 @@ int qemu_savevm_state_complete(QEMUFile *f)
 
     for(se = first_se; se != NULL; se = se->next) {
         int len;
+        if (kemari_enabled && strstr(se->idstr, "vga"))
+            continue;
 
 	if (se->save_state == NULL)
 	    continue;
@@ -9005,6 +9009,25 @@ static void termsig_setup(void)
     sigaction(SIGTERM, &act, NULL);
 }
 
+void xenstore_process_logdirty_event(void);
+static void kemari_handler(int dummy)
+{
+    kemari_enabled = 1; /* QEMU will run in kemari mode */
+    xenstore_process_logdirty_event();
+}
+
+static void kemari_setup(void)
+{
+    struct sigaction act;
+
+    memset(&act, 0, sizeof(act));
+#ifdef CONFIG_DM
+    act.sa_handler = kemari_handler;
+#else /* !CONFIG_DM */
+    act.sa_handler = SIG_DFL;
+#endif /* CONFIG_DM */
+    sigaction(SIGUSR1, &act, NULL);
+}
 #endif
 
 int main(int argc, char **argv)
@@ -10045,6 +10068,7 @@ int main(int argc, char **argv)
 #ifndef _WIN32
     /* must be after terminal init, SDL library changes signal handlers */
     termsig_setup();
+    kemari_setup();
 #endif
 
     /* Maintain compatibility with multiple stdio monitors */
xen-config-host.h +1 -0
index 3d53364..8c7fa28 100644
@@ -41,3 +41,4 @@ void xenstore_store_serial_port_info(int i, struct CharDriverState *chr,
 
 extern unsigned long *logdirty_bitmap;
 extern unsigned long logdirty_bitmap_size;
+extern volatile int kemari_enabled;
#1 lore raw

This is an updated version of the following patch. Some codes are removed since signal will not be used any more.

http://lists.xensource.com/archives/html/xen-devel/2009-03/msg00756.html

---
 vl.c              |    4 ++++
 xen-config-host.h |    1 +
 2 files changed, 5 insertions(+)
vl.c +4 -0
index 8539f6d..d84f43b 100644
@@ -274,6 +274,8 @@ static int icount_time_shift;
 static int64_t qemu_icount_bias;
 static QEMUTimer *icount_rt_timer;
 static QEMUTimer *icount_vm_timer;
+/* Kemari */
+volatile int kemari_enabled = 0;
 
 uint8_t qemu_uuid[16];
 
@@ -6961,6 +6963,8 @@ int qemu_savevm_state_complete(QEMUFile *f)
 
     for(se = first_se; se != NULL; se = se->next) {
         int len;
+        if (kemari_enabled && strstr(se->idstr, "vga"))
+            continue;
 
 	if (se->save_state == NULL)
 	    continue;
xen-config-host.h +1 -0
index 3d53364..8c7fa28 100644
@@ -41,3 +41,4 @@ void xenstore_store_serial_port_info(int i, struct CharDriverState *chr,
 
 extern unsigned long *logdirty_bitmap;
 extern unsigned long logdirty_bitmap_size;
+extern volatile int kemari_enabled;