Skip to contentSkip to conversation

KVM, icount changes for 2014-08-06

GIT PULL Applied Paolo Bonzini 3 participants 4 messages Aug 7, 2014 – Aug 8, 2014

lore
Share & tools
lore
#0 lore raw

The following changes since commit 41a1a9c42c4e0fb5f1b94aa8b72e42f66ebde3d9:

po: Update German translation (2014-07-28 23:37:17 +0200)

are available in the git repository at:

git://github.com/bonzini/qemu.git tags/for-upstream

for you to fetch changes up to eddedd546a68f6ac864b71d50dd8d39b939b724b:

target-mips: Ignore unassigned accesses with KVM (2014-08-07 15:09:48 +0200)

----------------------------------------------------------------
KVM changes include a MIPS patch and the testdev backend used by the ARM kvm-unit-tests. icount include the first part of reverse execution and Sebastian Tanase's patches to slow down -icount execution to the desired speed of the target.

v1->v2: fix dump_drift_info to print nothing outside icount mode,
and to compile on 32-bit architectures

----------------------------------------------------------------
James Hogan (1):
target-mips: Ignore unassigned accesses with KVM

KONRAD Frederic (3):
icount: put icount variables into TimerState.
migration: migrate icount fields.
timer: add cpu_icount_to_ns function.

Paolo Bonzini (1):
backends: Introduce chr-testdev

Sebastian Tanase (6):
icount: Fix virtual clock start value on ARM
icount: Add QemuOpts for icount
icount: Add align option to icount
cpu-exec: Add sleeping algorithm
cpu-exec: Print to console if the guest is late
monitor: Add drift info to 'info jit'

 backends/Makefile.objs  |   2 +-
 backends/testdev.c      | 131 ++++++++++++++++++++++++++++++++++++++++++++++++
 cpu-exec.c              | 116 ++++++++++++++++++++++++++++++++++++++++++
 cpus.c                  | 118 ++++++++++++++++++++++++++++++++++++-------
 include/qemu-common.h   |   8 ++-
 include/qemu/timer.h    |   2 +
 include/sysemu/char.h   |   3 ++
 monitor.c               |   1 +
 qapi-schema.json        |   3 +-
 qemu-char.c             |   4 ++
 qemu-options.hx         |  17 +++++--
 qtest.c                 |  13 ++++-
 stubs/Makefile.objs     |   1 +
 stubs/chr-testdev.c     |   7 +++
 target-mips/op_helper.c |  11 ++++
 vl.c                    |  39 +++++++++++---
 16 files changed, 444 insertions(+), 32 deletions(-)
 create mode 100644 backends/testdev.c
 create mode 100644 stubs/chr-testdev.c
Signature · 1 line
1.8.3.1
#1 lore raw

[Qemu-devel] [PULL v2 10/11] monitor: Add drift info to 'info jit'

From: Sebastian Tanase <[email protected]>

Show in 'info jit' the current delay between the host clock and the guest clock. In addition, print the maximum advance and delay of the guest compared to the host.

---
 cpu-exec.c            |  6 ++++++
 cpus.c                | 19 +++++++++++++++++++
 include/qemu-common.h |  4 ++++
 monitor.c             |  1 +
 4 files changed, 30 insertions(+)
cpu-exec.c +6 -0
index 3c14502..cbc8067 100644
@@ -105,6 +105,12 @@ static void init_delay_params(SyncClocks *sc,
                    sc->realtime_clock +
                    cpu_get_clock_offset();
     sc->last_cpu_icount = cpu->icount_extra + cpu->icount_decr.u16.low;
+    if (sc->diff_clk < max_delay) {
+        max_delay = sc->diff_clk;
+    }
+    if (sc->diff_clk > max_advance) {
+        max_advance = sc->diff_clk;
+    }
 
     /* Print every 2s max if the guest is late. We limit the number
        of printed messages to NB_PRINT_MAX(currently 100) */
cpus.c +19 -0
index 19245e9..2b5c0bd 100644
@@ -64,6 +64,8 @@
 #endif /* CONFIG_LINUX */
 
 static CPUState *next_cpu;
+int64_t max_delay;
+int64_t max_advance;
 
 bool cpu_is_stopped(CPUState *cpu)
 {
@@ -1552,3 +1554,20 @@ void qmp_inject_nmi(Error **errp)
     error_set(errp, QERR_UNSUPPORTED);
 #endif
 }
+
+void dump_drift_info(FILE *f, fprintf_function cpu_fprintf)
+{
+    if (!use_icount) {
+        return;
+    }
+
+    cpu_fprintf(f, "Host - Guest clock  %"PRIi64" ms\n",
+                (cpu_get_clock() - cpu_get_icount())/SCALE_MS);
+    if (icount_align_option) {
+        cpu_fprintf(f, "Max guest delay     %"PRIi64" ms\n", -max_delay/SCALE_MS);
+        cpu_fprintf(f, "Max guest advance   %"PRIi64" ms\n", max_advance/SCALE_MS);
+    } else {
+        cpu_fprintf(f, "Max guest delay     NA\n");
+        cpu_fprintf(f, "Max guest advance   NA\n");
+    }
+}
include/qemu-common.h +4 -0
index 5d10ac2..bcf7a6a 100644
@@ -109,6 +109,10 @@ static inline char *realpath(const char *path, char *resolved_path)
 void configure_icount(QemuOpts *opts, Error **errp);
 extern int use_icount;
 extern int icount_align_option;
+/* drift information for info jit command */
+extern int64_t max_delay;
+extern int64_t max_advance;
+void dump_drift_info(FILE *f, fprintf_function cpu_fprintf);
 
 #include "qemu/osdep.h"
 #include "qemu/bswap.h"
monitor.c +1 -0
index 5bc70a6..cdbaa60 100644
@@ -1047,6 +1047,7 @@ static void do_info_registers(Monitor *mon, const QDict *qdict)
 static void do_info_jit(Monitor *mon, const QDict *qdict)
 {
     dump_exec_info((FILE *)mon, monitor_fprintf);
+    dump_drift_info((FILE *)mon, monitor_fprintf);
 }
 
 static void do_info_history(Monitor *mon, const QDict *qdict)
Signature · 1 line
1.8.3.1
#2 lore raw

Re: [Qemu-devel] [PULL v2 10/11] monitor: Add drift info to 'info jit'

----- Mail original -----

Quoted 71 lines

De: "Paolo Bonzini" <[email protected]>
À: [email protected]
Cc: "Sebastian Tanase" <[email protected]> Envoyé: Jeudi 7 Août 2014 15:34:49
Objet: [PULL v2 10/11] monitor: Add drift info to 'info jit'

From: Sebastian Tanase <[email protected]>

Show in 'info jit' the current delay between the host clock and the guest clock. In addition, print the maximum advance and delay of the guest compared to the host.

---
 cpu-exec.c            |  6 ++++++
 cpus.c                | 19 +++++++++++++++++++
 include/qemu-common.h |  4 ++++
 monitor.c             |  1 +
 4 files changed, 30 insertions(+)
cpu-exec.c +6 -0
index 3c14502..cbc8067 100644
@@ -105,6 +105,12 @@ static void init_delay_params(SyncClocks *sc,
                    sc->realtime_clock +
                    cpu_get_clock_offset();
     sc->last_cpu_icount = cpu->icount_extra +
     cpu->icount_decr.u16.low;
+    if (sc->diff_clk < max_delay) {
+        max_delay = sc->diff_clk;
+    }
+    if (sc->diff_clk > max_advance) {
+        max_advance = sc->diff_clk;
+    }
 
     /* Print every 2s max if the guest is late. We limit the number

of printed messages to NB_PRINT_MAX(currently 100) */

cpus.c +14 -1
index 19245e9..2b5c0bd 100644
@@ -64,6 +64,8 @@
 #endif /* CONFIG_LINUX */
 
 static CPUState *next_cpu;
+int64_t max_delay;
+int64_t max_advance;
 
 bool cpu_is_stopped(CPUState *cpu)
 {
@@ -1552,3 +1554,20 @@ void qmp_inject_nmi(Error **errp)
     error_set(errp, QERR_UNSUPPORTED);
 #endif
 }
+
+void dump_drift_info(FILE *f, fprintf_function cpu_fprintf)
+{
+    if (!use_icount) {
+        return;
+    }
+
+    cpu_fprintf(f, "Host - Guest clock  %"PRIi64" ms\n",
+                (cpu_get_clock() - cpu_get_icount())/SCALE_MS);
+    if (icount_align_option) {
+        cpu_fprintf(f, "Max guest delay     %"PRIi64" ms\n",
-max_delay/SCALE_MS);
+        cpu_fprintf(f, "Max guest advance   %"PRIi64" ms\n",

max_advance/SCALE_MS);

cpus.c void qmp_inject_nmi(Error **errp) · line 1573

Quoted 5 lines
cpus.c +5 -0
+    } else {
+        cpu_fprintf(f, "Max guest delay     NA\n");
+        cpu_fprintf(f, "Max guest advance   NA\n");
+    }
+}

Thank you very much for fixing this.
I must have missed it somehow.

Best regards,

Sebastian

Quoted 32 lines
include/qemu-common.h +4 -0
index 5d10ac2..bcf7a6a 100644
@@ -109,6 +109,10 @@ static inline char *realpath(const char *path,
 char *resolved_path)
 void configure_icount(QemuOpts *opts, Error **errp);
 extern int use_icount;
 extern int icount_align_option;
+/* drift information for info jit command */
+extern int64_t max_delay;
+extern int64_t max_advance;
+void dump_drift_info(FILE *f, fprintf_function cpu_fprintf);
 
 #include "qemu/osdep.h"

#include "qemu/bswap.h"

monitor.c +1 -0
index 5bc70a6..cdbaa60 100644
@@ -1047,6 +1047,7 @@ static void do_info_registers(Monitor *mon,
 const QDict *qdict)
 static void do_info_jit(Monitor *mon, const QDict *qdict)
 {
     dump_exec_info((FILE *)mon, monitor_fprintf);
+    dump_drift_info((FILE *)mon, monitor_fprintf);
 }
 

static void do_info_history(Monitor *mon, const QDict *qdict)
--
1.8.3.1

#3 lore raw
In reply to Paolo Bonzini
Quoted 33 lines · Paolo Bonzini

The following changes since commit 41a1a9c42c4e0fb5f1b94aa8b72e42f66ebde3d9:

po: Update German translation (2014-07-28 23:37:17 +0200)

are available in the git repository at:

git://github.com/bonzini/qemu.git tags/for-upstream

for you to fetch changes up to eddedd546a68f6ac864b71d50dd8d39b939b724b:

target-mips: Ignore unassigned accesses with KVM (2014-08-07 15:09:48 +0200)

----------------------------------------------------------------
KVM changes include a MIPS patch and the testdev backend used by the ARM kvm-unit-tests. icount include the first part of reverse execution and Sebastian Tanase's patches to slow down -icount execution to the desired speed of the target.

v1->v2: fix dump_drift_info to print nothing outside icount mode,
and to compile on 32-bit architectures

----------------------------------------------------------------
James Hogan (1):
target-mips: Ignore unassigned accesses with KVM

KONRAD Frederic (3):
icount: put icount variables into TimerState.
migration: migrate icount fields.
timer: add cpu_icount_to_ns function.

Paolo Bonzini (1):
backends: Introduce chr-testdev

Quoted 7 lines

Sebastian Tanase (6):
icount: Fix virtual clock start value on ARM
icount: Add QemuOpts for icount
icount: Add align option to icount
cpu-exec: Add sleeping algorithm
cpu-exec: Print to console if the guest is late
monitor: Add drift info to 'info jit'

Applied, thanks.

-- PMM