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: peter.maydell@linaro.org, peter.crosthwaite@xilinx.com,
	alex.bennee@linaro.org, mark.burton@greensocs.com,
	real@ispras.ru, batuzovk@ispras.ru,
	maria.klimushenkova@ispras.ru, afaerber@suse.de,
	fred.konrad@greensocs.com
Subject: Re: [Qemu-devel] [RFC PATCH v8 20/21] replay: command line options
Date: Fri, 30 Jan 2015 11:54:29 +0100	[thread overview]
Message-ID: <54CB62E5.3000807@redhat.com> (raw)
In-Reply-To: <20150122085323.5276.64995.stgit@PASHA-ISP.def.inno>



On 22/01/2015 09:53, Pavel Dovgalyuk wrote:
> This patch introduces command line options for enabling recording or replaying
> virtual machine behavior. "-record" option starts recording of the execution
> and saves it into the log, specified with "fname" parameter. "-replay" option
> is intended for replaying previously saved log.
> 
> Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
> ---
>  cpus.c          |    3 ++-
>  qemu-options.hx |    8 ++++++--
>  vl.c            |   27 ++++++++++++++++++++++++++-
>  3 files changed, 34 insertions(+), 4 deletions(-)
> 
> diff --git a/cpus.c b/cpus.c
> index 9c32491..7689cec 100644
> --- a/cpus.c
> +++ b/cpus.c
> @@ -912,9 +912,10 @@ static void qemu_wait_io_event_common(CPUState *cpu)
>  static void qemu_tcg_wait_io_event(void)
>  {
>      CPUState *cpu;
> +    GMainContext *context = g_main_context_default();
>  
>      while (all_cpu_threads_idle()) {
> -       /* Start accounting real time to the virtual clock if the CPUs
> +        /* Start accounting real time to the virtual clock if the CPUs
>            are idle.  */
>          qemu_clock_warp(QEMU_CLOCK_VIRTUAL);
>          qemu_cond_wait(tcg_halt_cond, &qemu_global_mutex);

Extraneous change.

> diff --git a/qemu-options.hx b/qemu-options.hx
> index 10b9568..cb4b577 100644
> --- a/qemu-options.hx
> +++ b/qemu-options.hx
> @@ -3037,11 +3037,11 @@ re-inject them.
>  ETEXI
>  
>  DEF("icount", HAS_ARG, QEMU_OPTION_icount, \
> -    "-icount [shift=N|auto][,align=on|off]\n" \
> +    "-icount [shift=N|auto][,align=on|off][,rr=record|replay,rrfname=<filename>]\n" \

rrfile?

>      "                enable virtual instruction counter with 2^N clock ticks per\n" \
>      "                instruction and enable aligning the host and virtual clocks\n", QEMU_ARCH_ALL)
>  STEXI
> -@item -icount [shift=@var{N}|auto]
> +@item -icount [shift=@var{N}|auto][,rr=record|replay,rrfname=@var{filename}]
>  @findex -icount
>  Enable virtual instruction counter.  The virtual cpu will execute one
>  instruction every 2^@var{N} ns of virtual time.  If @code{auto} is specified
> @@ -3063,6 +3063,10 @@ Currently this option does not work when @option{shift} is @code{auto}.
>  Note: The sync algorithm will work for those shift values for which
>  the guest clock runs ahead of the host clock. Typically this happens
>  when the shift value is high (how high depends on the host machine).
> +
> +When @option{rr} option is specified deterministic record/replay is enabled.
> +Replay log is written into @var{filename} file in record mode and
> +read from this file in replay mode.
>  ETEXI
>  
>  DEF("watchdog", HAS_ARG, QEMU_OPTION_watchdog, \
> diff --git a/vl.c b/vl.c
> index ae3e97e..39d9024 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -475,6 +475,12 @@ static QemuOptsList qemu_icount_opts = {
>          }, {
>              .name = "align",
>              .type = QEMU_OPT_BOOL,
> +        }, {
> +            .name = "rr",
> +            .type = QEMU_OPT_STRING,
> +        }, {
> +            .name = "rrfname",
> +            .type = QEMU_OPT_STRING,
>          },
>          { /* end of list */ }
>      },
> @@ -2752,6 +2758,8 @@ int main(int argc, char **argv, char **envp)
>  {
>      int i;
>      int snapshot, linux_boot;
> +    int not_compatible_replay_param = 0;
> +    const char *icount_option = NULL;
>      const char *initrd_filename;
>      const char *kernel_filename, *kernel_cmdline;
>      const char *boot_order;
> @@ -2949,6 +2957,7 @@ int main(int argc, char **argv, char **envp)
>                  break;
>              case QEMU_OPTION_pflash:
>                  drive_add(IF_PFLASH, -1, optarg, PFLASH_OPTS);
> +                not_compatible_replay_param++;

Why not compatible?

>                  break;
>              case QEMU_OPTION_snapshot:
>                  snapshot = 1;
> @@ -3105,6 +3114,7 @@ int main(int argc, char **argv, char **envp)
>  #endif
>              case QEMU_OPTION_bt:
>                  add_device_config(DEV_BT, optarg);
> +                not_compatible_replay_param++;

Could it be enough to add a migration blocker?

>                  break;
>              case QEMU_OPTION_audio_help:
>                  AUD_help ();
> @@ -3244,6 +3254,7 @@ int main(int argc, char **argv, char **envp)
>                  if (!opts) {
>                      exit(1);
>                  }
> +                not_compatible_replay_param++;

Why not compatible?

>                  break;
>              case QEMU_OPTION_fsdev:
>                  olist = qemu_find_opts("fsdev");
> @@ -3372,6 +3383,7 @@ int main(int argc, char **argv, char **envp)
>                  if (strncmp(optarg, "mon:", 4) == 0) {
>                      default_monitor = 0;
>                  }
> +                not_compatible_replay_param++;

Add a migration blocker?

>                  break;
>              case QEMU_OPTION_debugcon:
>                  add_device_config(DEV_DEBUGCON, optarg);
> @@ -3489,6 +3501,7 @@ int main(int argc, char **argv, char **envp)
>                  if (!qemu_opts_parse(qemu_find_opts("smp-opts"), optarg, 1)) {
>                      exit(1);
>                  }
> +                not_compatible_replay_param++;

Check smp_cpus instead in replay_configure?

>                  break;
>              case QEMU_OPTION_vnc:
>  #ifdef CONFIG_VNC
> @@ -3628,6 +3641,7 @@ int main(int argc, char **argv, char **envp)
>                  if (!icount_opts) {
>                      exit(1);
>                  }
> +                replay_configure(icount_opts);

Perhaps move this outside the switch so that you have a fuller view of
the command line?

>                  break;
>              case QEMU_OPTION_incoming:
>                  incoming = optarg;
> @@ -3786,6 +3800,12 @@ int main(int argc, char **argv, char **envp)
>          exit(1);
>      }
>  
> +    if (not_compatible_replay_param && (replay_mode != REPLAY_MODE_NONE)) {
> +        fprintf(stderr, "options -smp, -pflash, -chardev, -bt, -parallel "
> +                        "are not compatible with record/replay\n");
> +        exit(1);
> +    }

... so this (or some replacement) can be done in replay_configure.

>      if (qemu_opts_foreach(qemu_find_opts("sandbox"), parse_sandbox, NULL, 0)) {
>          exit(1);
>      }
> @@ -4136,6 +4156,11 @@ int main(int argc, char **argv, char **envp)
>          qemu_opts_del(icount_opts);
>      }
>  
> +    if (replay_mode != REPLAY_MODE_NONE && !use_icount) {
> +        fprintf(stderr, "Please enable icount to use record/replay\n");
> +        exit(1);
> +    }

Same here.

Paolo

>      /* clean up network at qemu process termination */
>      atexit(&net_cleanup);
>  
> @@ -4172,7 +4197,7 @@ int main(int argc, char **argv, char **envp)
>      }
>  
>      /* open the virtual block devices */
> -    if (snapshot)
> +    if (snapshot || replay_mode != REPLAY_MODE_NONE)
>          qemu_opts_foreach(qemu_find_opts("drive"), drive_enable_snapshot, NULL, 0);
>      if (qemu_opts_foreach(qemu_find_opts("drive"), drive_init_func,
>                            &machine_class->block_default_type, 1) != 0) {
> 

  reply	other threads:[~2015-01-30 10:54 UTC|newest]

Thread overview: 82+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-22  8:51 [Qemu-devel] [RFC PATCH v8 00/21] Deterministic replay core Pavel Dovgalyuk
2015-01-22  8:51 ` [Qemu-devel] [RFC PATCH v8 01/21] i386: partial revert of interrupt poll fix Pavel Dovgalyuk
2015-01-22  8:51 ` [Qemu-devel] [RFC PATCH v8 02/21] replay: global variables and function stubs Pavel Dovgalyuk
2015-01-29  9:02   ` Paolo Bonzini
2015-01-29 23:23   ` Eric Blake
2015-01-22  8:51 ` [Qemu-devel] [RFC PATCH v8 03/21] sysemu: system functions for replay Pavel Dovgalyuk
2015-01-29  9:03   ` Paolo Bonzini
2015-01-22  8:51 ` [Qemu-devel] [RFC PATCH v8 04/21] replay: internal functions for replay log Pavel Dovgalyuk
2015-01-29  9:11   ` Paolo Bonzini
2015-01-30 12:56     ` Pavel Dovgaluk
2015-01-30 13:06       ` Paolo Bonzini
2015-01-30 13:11         ` Mark Burton
2015-01-22  8:51 ` [Qemu-devel] [RFC PATCH v8 05/21] replay: introduce mutex to protect the " Pavel Dovgalyuk
2015-01-29  9:12   ` Paolo Bonzini
2015-01-22  8:52 ` [Qemu-devel] [RFC PATCH v8 06/21] replay: introduce icount event Pavel Dovgalyuk
2015-01-29  9:14   ` Paolo Bonzini
2015-01-22  8:52 ` [Qemu-devel] [RFC PATCH v8 07/21] cpu-exec: allow temporary disabling icount Pavel Dovgalyuk
2015-01-22  8:52 ` [Qemu-devel] [RFC PATCH v8 08/21] cpu: replay instructions sequence Pavel Dovgalyuk
2015-01-29  9:32   ` Paolo Bonzini
2015-02-02 12:28     ` Pavel Dovgaluk
2015-02-02 12:38       ` Paolo Bonzini
2015-02-02 12:42         ` Pavel Dovgaluk
     [not found]         ` <28583.7738695138$1422880978@news.gmane.org>
2015-02-02 13:18           ` Paolo Bonzini
2015-02-16 12:26             ` Pavel Dovgaluk
     [not found]             ` <6071.25815372473$1424089600@news.gmane.org>
2015-02-16 12:59               ` Paolo Bonzini
2015-02-16 13:27                 ` Pavel Dovgaluk
     [not found]                 ` <8198.56250095672$1424093273@news.gmane.org>
2015-02-16 13:31                   ` Paolo Bonzini
2015-02-16 13:37                     ` Pavel Dovgaluk
     [not found]                     ` <39577.5216319182$1424093895@news.gmane.org>
2015-02-16 13:53                       ` Paolo Bonzini
2015-02-17  8:43                         ` Pavel Dovgaluk
2015-02-17 10:58                           ` Paolo Bonzini
2015-02-17 11:35                             ` Pavel Dovgaluk
2015-02-17 12:21                               ` Paolo Bonzini
2015-01-22  8:52 ` [Qemu-devel] [RFC PATCH v8 09/21] replay: interrupts and exceptions Pavel Dovgalyuk
2015-01-29  9:44   ` Paolo Bonzini
2015-02-02 13:50     ` Pavel Dovgaluk
     [not found]     ` <23862.806443549$1422885088@news.gmane.org>
2015-02-02 14:18       ` Paolo Bonzini
2015-01-22  8:52 ` [Qemu-devel] [RFC PATCH v8 10/21] replay: asynchronous events infrastructure Pavel Dovgalyuk
2015-01-29 10:06   ` Paolo Bonzini
2015-01-22  8:52 ` [Qemu-devel] [RFC PATCH v8 11/21] replay: recording and replaying clock ticks Pavel Dovgalyuk
2015-01-29 10:16   ` Paolo Bonzini
2015-02-03 10:51     ` Pavel Dovgaluk
2015-02-03 11:04       ` Paolo Bonzini
2015-02-03 11:23         ` Pavel Dovgaluk
2015-02-03 11:59           ` Paolo Bonzini
2015-01-22  8:52 ` [Qemu-devel] [RFC PATCH v8 12/21] replay: recording and replaying different timers Pavel Dovgalyuk
2015-01-29 10:20   ` Paolo Bonzini
2015-02-03 14:05     ` Pavel Dovgaluk
2015-02-04 15:20       ` Paolo Bonzini
2015-01-22  8:52 ` [Qemu-devel] [RFC PATCH v8 13/21] replay: shutdown event Pavel Dovgalyuk
2015-01-29 10:20   ` Paolo Bonzini
2015-01-22  8:52 ` [Qemu-devel] [RFC PATCH v8 14/21] replay: checkpoints Pavel Dovgalyuk
2015-01-30 11:05   ` Paolo Bonzini
2015-01-22  8:52 ` [Qemu-devel] [RFC PATCH v8 15/21] aio: replace stack of bottom halves with queue Pavel Dovgalyuk
2015-01-30 10:43   ` Paolo Bonzini
2015-01-22  8:53 ` [Qemu-devel] [RFC PATCH v8 16/21] replay: bottom halves Pavel Dovgalyuk
2015-01-30 10:49   ` Paolo Bonzini
2015-02-11 13:03     ` Pavel Dovgaluk
2015-01-22  8:53 ` [Qemu-devel] [RFC PATCH v8 17/21] replay: replay aio requests Pavel Dovgalyuk
2015-01-30 11:07   ` Paolo Bonzini
2015-01-22  8:53 ` [Qemu-devel] [RFC PATCH v8 18/21] replay: thread pool Pavel Dovgalyuk
2015-01-30 11:13   ` Paolo Bonzini
2015-01-22  8:53 ` [Qemu-devel] [RFC PATCH v8 19/21] replay: initialization and deinitialization Pavel Dovgalyuk
2015-01-30 11:02   ` Paolo Bonzini
2015-02-09 12:59     ` Pavel Dovgaluk
2015-02-09 13:01       ` Paolo Bonzini
2015-01-22  8:53 ` [Qemu-devel] [RFC PATCH v8 20/21] replay: command line options Pavel Dovgalyuk
2015-01-30 10:54   ` Paolo Bonzini [this message]
2015-02-09 12:15     ` Pavel Dovgaluk
2015-02-09 12:26       ` Paolo Bonzini
2015-02-12  9:12         ` Pavel Dovgaluk
2015-02-12 14:12           ` Paolo Bonzini
2015-01-22  8:53 ` [Qemu-devel] [RFC PATCH v8 21/21] replay: recording of the user input Pavel Dovgalyuk
2015-01-30 11:23   ` Paolo Bonzini
2015-02-12  7:43     ` Pavel Dovgaluk
2015-02-12  8:08     ` Pavel Dovgaluk
2015-02-12 14:41       ` Paolo Bonzini
2015-01-28 11:45 ` [Qemu-devel] [RFC PATCH v8 00/21] Deterministic replay core Pavel Dovgaluk
     [not found] ` <28048.5671981753$1422445570@news.gmane.org>
2015-01-29 10:21   ` Paolo Bonzini
2015-01-30 11:25     ` Paolo Bonzini
2015-02-02 14:30 ` Paolo Bonzini
2015-02-03  6:47   ` Pavel Dovgaluk

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=54CB62E5.3000807@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=Pavel.Dovgaluk@ispras.ru \
    --cc=afaerber@suse.de \
    --cc=alex.bennee@linaro.org \
    --cc=batuzovk@ispras.ru \
    --cc=fred.konrad@greensocs.com \
    --cc=maria.klimushenkova@ispras.ru \
    --cc=mark.burton@greensocs.com \
    --cc=peter.crosthwaite@xilinx.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=real@ispras.ru \
    /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).