qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>, qemu-devel@nongnu.org
Cc: zealot351@gmail.com, maria.klimushenkova@ispras.ru
Subject: Re: [Qemu-devel] [PATCH] cpu: init vmstate for ticks and clock offset
Date: Mon, 01 Sep 2014 10:02:16 +0200	[thread overview]
Message-ID: <54042808.4080805@redhat.com> (raw)
In-Reply-To: <20140901053449.440.82678.stgit@PASHA-ISP>

Il 01/09/2014 07:34, Pavel Dovgalyuk ha scritto:
> Ticks and clock offset used by CPU timers have to be saved in vmstate.
> But vmstate for these fields registered only in icount mode.
> Missing registration leads to breaking the continuity when vmstate is loaded.
> This patch introduces new initialization function which fixes this.
> 
> Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
> ---
>  cpus.c                |    8 ++++++--
>  include/qemu-common.h |    2 ++
>  vl.c                  |    1 +
>  3 files changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/cpus.c b/cpus.c
> index 2b5c0bd..c07826d 100644
> --- a/cpus.c
> +++ b/cpus.c
> @@ -492,13 +492,17 @@ static const VMStateDescription vmstate_timers = {
>      }
>  };
>  
> +void cpu_ticks_init(void)
> +{
> +    seqlock_init(&timers_state.vm_clock_seqlock, NULL);
> +    vmstate_register(NULL, 0, &vmstate_timers, &timers_state);
> +}
> +
>  void configure_icount(QemuOpts *opts, Error **errp)
>  {
>      const char *option;
>      char *rem_str = NULL;
>  
> -    seqlock_init(&timers_state.vm_clock_seqlock, NULL);
> -    vmstate_register(NULL, 0, &vmstate_timers, &timers_state);
>      option = qemu_opt_get(opts, "shift");
>      if (!option) {
>          if (qemu_opt_get(opts, "align") != NULL) {
> diff --git a/include/qemu-common.h b/include/qemu-common.h
> index bcf7a6a..dcb57ab 100644
> --- a/include/qemu-common.h
> +++ b/include/qemu-common.h
> @@ -105,6 +105,8 @@ static inline char *realpath(const char *path, char *resolved_path)
>  }
>  #endif
>  
> +void cpu_ticks_init(void);
> +
>  /* icount */
>  void configure_icount(QemuOpts *opts, Error **errp);
>  extern int use_icount;
> diff --git a/vl.c b/vl.c
> index b796c67..9241e2d 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -4330,6 +4330,7 @@ int main(int argc, char **argv, char **envp)
>      qemu_spice_init();
>  #endif
>  
> +    cpu_ticks_init();
>      if (icount_opts) {
>          if (kvm_enabled() || xen_enabled()) {
>              fprintf(stderr, "-icount is not allowed with kvm or xen\n");
> 
> 
> 

Thanks, will send a pull request for this ASAP.

Paolo

      reply	other threads:[~2014-09-01  8:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-01  5:34 [Qemu-devel] [PATCH] cpu: init vmstate for ticks and clock offset Pavel Dovgalyuk
2014-09-01  8:02 ` Paolo Bonzini [this message]

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=54042808.4080805@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=Pavel.Dovgaluk@ispras.ru \
    --cc=maria.klimushenkova@ispras.ru \
    --cc=qemu-devel@nongnu.org \
    --cc=zealot351@gmail.com \
    /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).