All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Pavel Dovgalyuk" <dovgaluk@ispras.ru>
To: 'Eric Blake' <eblake@redhat.com>, qemu-devel@nongnu.org
Cc: armbru@redhat.com, berrange@redhat.com,
	alistair.francis@xilinx.com,
	'Pavel Dovgalyuk' <pavel.dovgaluk@ispras.ru>,
	'Paolo Bonzini' <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v7 4/5] shutdown: Preserve shutdown cause through replay
Date: Wed, 10 May 2017 13:04:13 +0300	[thread overview]
Message-ID: <004801d2c974$c6e0db60$54a29220$@ru> (raw)
In-Reply-To: <20170508211953.28017-5-eblake@redhat.com>


> -----Original Message-----
> From: Eric Blake [mailto:eblake@redhat.com]
> Sent: Tuesday, May 09, 2017 12:20 AM
> To: qemu-devel@nongnu.org
> Cc: armbru@redhat.com; berrange@redhat.com; alistair.francis@xilinx.com; Pavel Dovgalyuk;
> Paolo Bonzini
> Subject: [PATCH v7 4/5] shutdown: Preserve shutdown cause through replay
> 
> With the recent addition of ShutdownCause, we want to be able to pass
> a cause through any shutdown request, and then faithfully replay that
> cause when later replaying the same sequence.  The easiest way is to
> expand the reply event mechanism to track a series of values for
> EVENT_SHUTDOWN, one corresponding to each value of ShutdownCause.
> 
> We are free to change the replay stream as needed, since there are
> already no guarantees about being able to use a replay stream by
> any other version of qemu than the one that generated it.
> 
> Signed-off-by: Eric Blake <eblake@redhat.com>

Reviewed-by: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>

> 
> ---
> v7: rebase to context
> v6: new patch
> ---
>  include/sysemu/replay.h  |  3 ++-
>  include/sysemu/sysemu.h  |  1 +
>  replay/replay-internal.h |  3 ++-
>  vl.c                     |  3 +--
>  replay/replay.c          | 10 +++++-----
>  5 files changed, 11 insertions(+), 9 deletions(-)
> 
> diff --git a/include/sysemu/replay.h b/include/sysemu/replay.h
> index f1c0712..fa14d0e 100644
> --- a/include/sysemu/replay.h
> +++ b/include/sysemu/replay.h
> @@ -13,6 +13,7 @@
>   */
> 
>  #include "qapi-types.h"
> +#include "sysemu.h"
> 
>  /* replay clock kinds */
>  enum ReplayClockKind {
> @@ -98,7 +99,7 @@ int64_t replay_read_clock(ReplayClockKind kind);
>  /* Events */
> 
>  /*! Called when qemu shutdown is requested. */
> -void replay_shutdown_request(void);
> +void replay_shutdown_request(ShutdownCause cause);
>  /*! Should be called at check points in the execution.
>      These check points are skipped, if they were not met.
>      Saves checkpoint in the SAVE mode and validates in the PLAY mode.
> diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
> index fe197aa..e0cbab1 100644
> --- a/include/sysemu/sysemu.h
> +++ b/include/sysemu/sysemu.h
> @@ -46,6 +46,7 @@ typedef enum ShutdownCause {
>                                       turns that into a shutdown */
>      SHUTDOWN_CAUSE_GUEST_PANIC,   /* Guest panicked, and command line turns
>                                       that into a shutdown */
> +    SHUTDOWN_CAUSE__MAX,
>  } ShutdownCause;
> 
>  void vm_start(void);
> diff --git a/replay/replay-internal.h b/replay/replay-internal.h
> index ed66ed8..3ebb199 100644
> --- a/replay/replay-internal.h
> +++ b/replay/replay-internal.h
> @@ -22,8 +22,9 @@ enum ReplayEvents {
>      EVENT_EXCEPTION,
>      /* for async events */
>      EVENT_ASYNC,
> -    /* for shutdown request */
> +    /* for shutdown requests, range allows recovery of ShutdownCause */
>      EVENT_SHUTDOWN,
> +    EVENT_SHUTDOWN_LAST = EVENT_SHUTDOWN + SHUTDOWN_CAUSE__MAX,
>      /* for character device write event */
>      EVENT_CHAR_WRITE,
>      /* for character device read all event */
> diff --git a/vl.c b/vl.c
> index 2d546460..65487d9 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -1820,8 +1820,7 @@ void qemu_system_killed(int signal, pid_t pid)
>  void qemu_system_shutdown_request(ShutdownCause reason)
>  {
>      trace_qemu_system_shutdown_request(reason);
> -    /* FIXME - add a parameter to let replay preserve reason */
> -    replay_shutdown_request();
> +    replay_shutdown_request(reason);
>      shutdown_requested = reason;
>      qemu_notify_event();
>  }
> diff --git a/replay/replay.c b/replay/replay.c
> index 604fa4f..ff58a5a 100644
> --- a/replay/replay.c
> +++ b/replay/replay.c
> @@ -49,10 +49,10 @@ bool replay_next_event_is(int event)
>              res = true;
>          }
>          switch (replay_state.data_kind) {
> -        case EVENT_SHUTDOWN:
> +        case EVENT_SHUTDOWN ... EVENT_SHUTDOWN_LAST:
>              replay_finish_event();
> -            /* FIXME - store actual reason */
> -            qemu_system_shutdown_request(SHUTDOWN_CAUSE_HOST_ERROR);
> +            qemu_system_shutdown_request(replay_state.data_kind -
> +                                         EVENT_SHUTDOWN);
>              break;
>          default:
>              /* clock, time_t, checkpoint and other events */
> @@ -171,11 +171,11 @@ bool replay_has_interrupt(void)
>      return res;
>  }
> 
> -void replay_shutdown_request(void)
> +void replay_shutdown_request(ShutdownCause cause)
>  {
>      if (replay_mode == REPLAY_MODE_RECORD) {
>          replay_mutex_lock();
> -        replay_put_event(EVENT_SHUTDOWN);
> +        replay_put_event(EVENT_SHUTDOWN + cause);
>          replay_mutex_unlock();
>      }
>  }
> --
> 2.9.3

  reply	other threads:[~2017-05-10 10:04 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-08 21:19 [Qemu-devel] [PATCH v7 0/5] event: Add source information to SHUTDOWN Eric Blake
2017-05-08 21:19 ` [Qemu-devel] [PATCH v7 1/5] shutdown: Simplify shutdown_signal Eric Blake
2017-05-08 21:19 ` [Qemu-devel] [PATCH v7 2/5] shutdown: Prepare for use of an enum in reset/shutdown_request Eric Blake
2017-05-08 21:19   ` Eric Blake
2017-05-09 11:40   ` [Qemu-devel] " Markus Armbruster
2017-05-09 11:40     ` Markus Armbruster
2017-05-08 21:19 ` [PATCH v7 3/5] shutdown: Add source information to SHUTDOWN and RESET Eric Blake
2017-05-08 21:19   ` [Qemu-devel] " Eric Blake
2017-05-09 11:56   ` Markus Armbruster
2017-05-09 11:56     ` Markus Armbruster
2017-05-09 11:56   ` Markus Armbruster
2017-05-09 14:07     ` Eric Blake
2017-05-09 14:07       ` Eric Blake
2017-05-10 14:44       ` Markus Armbruster
2017-05-10 14:44       ` Markus Armbruster
2017-05-10 14:44         ` Markus Armbruster
2017-05-09 14:07     ` Eric Blake
2017-05-09 13:57   ` Cornelia Huck
2017-05-09 13:57   ` Cornelia Huck
2017-05-09 13:57     ` [Qemu-devel] " Cornelia Huck
2017-05-08 21:19 ` Eric Blake
2017-05-08 21:19 ` [Qemu-devel] [PATCH v7 4/5] shutdown: Preserve shutdown cause through replay Eric Blake
2017-05-10 10:04   ` Pavel Dovgalyuk [this message]
2017-05-08 21:19 ` [Qemu-devel] [PATCH v7 5/5] shutdown: Expose bool cause in SHUTDOWN and RESET events Eric Blake
2017-05-09 12:07   ` Markus Armbruster
2017-05-09 14:18     ` Eric Blake
2017-05-09 15:03       ` Markus Armbruster

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='004801d2c974$c6e0db60$54a29220$@ru' \
    --to=dovgaluk@ispras.ru \
    --cc=alistair.francis@xilinx.com \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=eblake@redhat.com \
    --cc=pavel.dovgaluk@ispras.ru \
    --cc=pbonzini@redhat.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.