From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LNPd2-0007XT-3g for qemu-devel@nongnu.org; Thu, 15 Jan 2009 05:39:12 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LNPd0-0007VQ-7K for qemu-devel@nongnu.org; Thu, 15 Jan 2009 05:39:11 -0500 Received: from [199.232.76.173] (port=39836 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LNPcz-0007V1-Vi for qemu-devel@nongnu.org; Thu, 15 Jan 2009 05:39:10 -0500 Received: from mx2.redhat.com ([66.187.237.31]:44994) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LNPcy-0003do-Ae for qemu-devel@nongnu.org; Thu, 15 Jan 2009 05:39:09 -0500 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n0FAd6Ya005092 for ; Thu, 15 Jan 2009 05:39:06 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n0FAd6ef022073 for ; Thu, 15 Jan 2009 05:39:06 -0500 Received: from dhcp-1-237.tlv.redhat.com (dhcp-1-237.tlv.redhat.com [10.35.1.237]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n0FAd5XF030814 for ; Thu, 15 Jan 2009 05:39:06 -0500 Date: Thu, 15 Jan 2009 12:37:33 +0200 From: Gleb Natapov Message-ID: <20090115103733.GA11299@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: [Qemu-devel] [PATCH] optionally specify vm stop message Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Should be applied on top of ENOSPC series. Signed-off-by: Gleb Natapov 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.