qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] optionally specify vm stop message


From: Gleb Natapov
Subject: [Qemu-devel] [PATCH] optionally specify vm stop message
Date: Thu, 15 Jan 2009 12:37:33 +0200

Should be applied on top of ENOSPC series.

Signed-off-by: Gleb Natapov <address@hidden>
diff --git a/gdbstub.c b/gdbstub.c
index a3ff07a..0c6a695 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -1928,7 +1928,7 @@ void gdb_do_syscall(gdb_syscall_complete_cb cb, const 
char *fmt, ...)
     gdb_current_syscall_cb = cb;
     s->state = RS_SYSCALL;
 #ifndef CONFIG_USER_ONLY
-    vm_stop(EXCP_DEBUG);
+    vm_stop(EXCP_DEBUG, NULL);
 #endif
     s->state = RS_IDLE;
     va_start(va, fmt);
@@ -2002,7 +2002,7 @@ static void gdb_read_byte(GDBState *s, int ch)
     if (vm_running) {
         /* when the CPU is running, we cannot do anything except stop
            it when receiving a char */
-        vm_stop(EXCP_INTERRUPT);
+        vm_stop(EXCP_INTERRUPT, NULL);
     } else
 #endif
     {
@@ -2253,7 +2253,7 @@ static void gdb_chr_event(void *opaque, int event)
 {
     switch (event) {
     case CHR_EVENT_RESET:
-        vm_stop(EXCP_INTERRUPT);
+        vm_stop(EXCP_INTERRUPT, NULL);
         gdb_has_xml = 0;
         break;
     default:
diff --git a/hw/ide.c b/hw/ide.c
index 2d2cead..adc15a7 100644
--- a/hw/ide.c
+++ b/hw/ide.c
@@ -999,7 +999,7 @@ static void ide_sector_write(IDEState *s)
         if (ret == -ENOSPC) {
             s->bmdma->ide_if = s;
             s->bmdma->status |= BM_STATUS_PIO_RETRY;
-            vm_stop(0);
+            vm_stop(0, "No more space on a disk");
         } else
             ide_rw_error(s);
         return;
@@ -1058,7 +1058,7 @@ static void ide_write_dma_cb(void *opaque, int ret)
     if (ret < 0) {
         if (ret == -ENOSPC) {
             bm->status |= BM_STATUS_DMA_RETRY;
-            vm_stop(0);
+            vm_stop(0, "No more space on a disk");
         } else
             ide_dma_error(s);
         return;
diff --git a/migration-exec.c b/migration-exec.c
index caeed4b..0fb8ce4 100644
--- a/migration-exec.c
+++ b/migration-exec.c
@@ -124,7 +124,7 @@ int exec_start_incoming_migration(const char *command)
         dprintf("Unable to apply qemu wrapper to popen file\n");
         return -errno;
     }
-    vm_stop(0); /* just in case */
+    vm_stop(0, NULL); /* just in case */
     ret = qemu_loadvm_state(f);
     if (ret < 0) {
         fprintf(stderr, "load of migration failed\n");
diff --git a/migration-tcp.c b/migration-tcp.c
index 6fc1943..3b3bf10 100644
--- a/migration-tcp.c
+++ b/migration-tcp.c
@@ -161,7 +161,7 @@ static void tcp_accept_incoming_migration(void *opaque)
         goto out;
     }
 
-    vm_stop(0); /* just in case */
+    vm_stop(0, NULL); /* just in case */
     ret = qemu_loadvm_state(f);
     if (ret < 0) {
         fprintf(stderr, "load of migration failed\n");
diff --git a/migration.c b/migration.c
index 0ef777a..10b308c 100644
--- a/migration.c
+++ b/migration.c
@@ -213,7 +213,7 @@ void migrate_fd_put_ready(void *opaque)
     dprintf("iterate\n");
     if (qemu_savevm_state_iterate(s->file) == 1) {
         dprintf("done iterating\n");
-        vm_stop(0);
+        vm_stop(0, NULL);
 
         bdrv_flush_all();
         qemu_savevm_state_complete(s->file);
diff --git a/monitor.c b/monitor.c
index 7ff9890..f6fb546 100644
--- a/monitor.c
+++ b/monitor.c
@@ -491,7 +491,7 @@ static void do_log(const char *items)
 
 static void do_stop(void)
 {
-    vm_stop(EXCP_INTERRUPT);
+    vm_stop(EXCP_INTERRUPT, NULL);
 }
 
 static void do_cont(void)
diff --git a/savevm.c b/savevm.c
index 729e849..badac22 100644
--- a/savevm.c
+++ b/savevm.c
@@ -770,7 +770,7 @@ int qemu_savevm_state(QEMUFile *f)
     int ret;
 
     saved_vm_running = vm_running;
-    vm_stop(0);
+    vm_stop(0, NULL);
 
     bdrv_flush_all();
 
@@ -1037,7 +1037,7 @@ void do_savevm(const char *name)
     qemu_aio_flush();
 
     saved_vm_running = vm_running;
-    vm_stop(0);
+    vm_stop(0, NULL);
 
     must_delete = 0;
     if (name) {
@@ -1133,7 +1133,7 @@ void do_loadvm(const char *name)
     qemu_aio_flush();
 
     saved_vm_running = vm_running;
-    vm_stop(0);
+    vm_stop(0, NULL);
 
     for(i = 0; i <= nb_drives; i++) {
         bs1 = drives_table[i].bdrv;
diff --git a/sysemu.h b/sysemu.h
index 47c1fea..4687def 100644
--- a/sysemu.h
+++ b/sysemu.h
@@ -23,7 +23,7 @@ int qemu_add_vm_stop_handler(VMStopHandler *cb, void *opaque);
 void qemu_del_vm_stop_handler(VMStopHandler *cb, void *opaque);
 
 void vm_start(void);
-void vm_stop(int reason);
+void vm_stop(int reason, const char *msg);
 
 int64_t cpu_get_ticks(void);
 void cpu_enable_ticks(void);
diff --git a/vl.c b/vl.c
index e29072b..8646f3d 100644
--- a/vl.c
+++ b/vl.c
@@ -3438,7 +3438,7 @@ void vm_start(void)
     }
 }
 
-void vm_stop(int reason)
+void vm_stop(int reason, const char *msg)
 {
     if (vm_running) {
         cpu_disable_ticks();
@@ -3449,6 +3449,8 @@ void vm_stop(int reason)
             }
         }
         vm_state_notify(0);
+        if (msg)
+            term_printf("%s\n", msg);
     }
 }
 
@@ -3745,7 +3747,7 @@ static int main_loop(void)
             if (shutdown_requested) {
                 ret = EXCP_INTERRUPT;
                 if (no_shutdown) {
-                    vm_stop(0);
+                    vm_stop(0, NULL);
                     no_shutdown = 0;
                 }
                 else
@@ -3763,7 +3765,7 @@ static int main_loop(void)
             }
             if (unlikely(ret == EXCP_DEBUG)) {
                 gdb_set_stop_cpu(cur_cpu);
-                vm_stop(EXCP_DEBUG);
+                vm_stop(EXCP_DEBUG, NULL);
             }
             /* If all cpus are halted then wait until the next IRQ */
             /* XXX: use timeout computed from timers */
--
                        Gleb.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]