qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] optionally specify vm stop message
Date: Thu, 15 Jan 2009 14:46:06 -0600	[thread overview]
Message-ID: <496FA08E.4060806@codemonkey.ws> (raw)
In-Reply-To: <20090115103733.GA11299@redhat.com>

Gleb Natapov wrote:
> Should be applied on top of ENOSPC series.
>   

How about just adding a new vm_stop reason?  That will work out better 
when we introduce the improved monitor.

Regards,

Anthony Liguori

> Signed-off-by: Gleb Natapov <gleb@redhat.com>
> 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	other threads:[~2009-01-15 20:46 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-15 10:37 [Qemu-devel] [PATCH] optionally specify vm stop message Gleb Natapov
2009-01-15 20:46 ` Anthony Liguori [this message]
2009-01-16  7:14   ` Gleb Natapov
2009-01-16 15:26     ` Anthony Liguori
2009-01-16 16:24       ` [Qemu-devel] " Jan Kiszka
2009-01-16 16:27         ` Anthony Liguori
2009-01-16 16:36           ` Jan Kiszka
2009-01-16 16:45             ` Jan Kiszka
2009-01-16 17:02               ` Jan Kiszka
2009-01-16 17:14                 ` Anthony Liguori

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=496FA08E.4060806@codemonkey.ws \
    --to=anthony@codemonkey.ws \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).