Re: [Qemu-devel] [RFC PATCH v6 08/32] icount: implement icount requesting
On 11/12/2014 09:16, Pavel Dovgaluk wrote: >>> > > No, it worked well and I deleted _nocache version of that function. >>> > > But I still need _raw one to get the instructions counter. >> > >> > Oh, great. This patch can also go in early. > What's the next? Will you upstream some of the patches to simplify reviewing > of the others? I'm waiting for Alex to review the PPC bits, but I've already queued these: Paolo Bonzini (9): target-mips: kvm: do not use get_clock() Pavel Dovgalyuk (8): cpu-exec: fix cpu_exec_nocache cpu-exec: reset exception_index correctly icount: set can_do_io outside TB execution icount: introduce cpu_get_icount_raw cpu-exec: invalidate nocache translation if they are interrupted timer: introduce new QEMU_CLOCK_VIRTUAL_RT clock cpus: make icount warp behave well with respect to stop/cont i386: do not cross the pages boundaries in replay mode Also, more get_clock() changes were in Kevin's block pull request. Paolo
Re: [Qemu-devel] [RFC PATCH v6 08/32] icount: implement icount requesting
> From: Paolo Bonzini [mailto:paolo.bonz...@gmail.com] On Behalf Of Paolo > Bonzini > On 10/12/2014 07:35, Pavel Dovgalyuk wrote: > > No, it worked well and I deleted _nocache version of that function. > > But I still need _raw one to get the instructions counter. > > Oh, great. This patch can also go in early. What's the next? Will you upstream some of the patches to simplify reviewing of the others? Pavel Dovgalyuk
Re: [Qemu-devel] [RFC PATCH v6 08/32] icount: implement icount requesting
On 10/12/2014 07:35, Pavel Dovgalyuk wrote: > No, it worked well and I deleted _nocache version of that function. > But I still need _raw one to get the instructions counter. Oh, great. This patch can also go in early. Paolo
Re: [Qemu-devel] [RFC PATCH v6 08/32] icount: implement icount requesting
No, it worked well and I deleted _nocache version of that function. But I still need _raw one to get the instructions counter. Sent using CloudMagic On вт, Дек 09, 2014 at 8:39 PM, Paolo Bonziniwrote: On 08/12/2014 08:53, Pavel Dovgalyuk wrote: > if (!cpu_can_do_io(cpu)) { > - fprintf(stderr, "Bad clock read\n"); > + fprintf(stderr, "Bad icount read\n"); > + exit(1); > } > icount -= (cpu->icount_decr.u16.low + cpu->icount_extra); > } > + return icount; > +} > + > +/* Return the virtual CPU time, based on the instruction counter. */ > +static int64_t cpu_get_icount_locked(void) > +{ > + int64_t icount = cpu_get_icount_raw(); > return timers_state.qemu_icount_bias + cpu_icount_to_ns(icount); So it didn't work to set can_do_io? Paolo
Re: [Qemu-devel] [RFC PATCH v6 08/32] icount: implement icount requesting
On 08/12/2014 08:53, Pavel Dovgalyuk wrote: > if (!cpu_can_do_io(cpu)) { > -fprintf(stderr, "Bad clock read\n"); > +fprintf(stderr, "Bad icount read\n"); > +exit(1); > } > icount -= (cpu->icount_decr.u16.low + cpu->icount_extra); > } > +return icount; > +} > + > +/* Return the virtual CPU time, based on the instruction counter. */ > +static int64_t cpu_get_icount_locked(void) > +{ > +int64_t icount = cpu_get_icount_raw(); > return timers_state.qemu_icount_bias + cpu_icount_to_ns(icount); So it didn't work to set can_do_io? Paolo
[Qemu-devel] [RFC PATCH v6 08/32] icount: implement icount requesting
Replay uses number of executed instructions to determine corrent events injection moments. This patch introduces new function for querying the instructions counter. Signed-off-by: Pavel Dovgalyuk --- cpus.c | 13 ++--- include/qemu/timer.h |1 + 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/cpus.c b/cpus.c index 38af588..6602acc 100644 --- a/cpus.c +++ b/cpus.c @@ -136,8 +136,7 @@ typedef struct TimersState { static TimersState timers_state; -/* Return the virtual CPU time, based on the instruction counter. */ -static int64_t cpu_get_icount_locked(void) +int64_t cpu_get_icount_raw(void) { int64_t icount; CPUState *cpu = current_cpu; @@ -145,10 +144,18 @@ static int64_t cpu_get_icount_locked(void) icount = timers_state.qemu_icount; if (cpu) { if (!cpu_can_do_io(cpu)) { -fprintf(stderr, "Bad clock read\n"); +fprintf(stderr, "Bad icount read\n"); +exit(1); } icount -= (cpu->icount_decr.u16.low + cpu->icount_extra); } +return icount; +} + +/* Return the virtual CPU time, based on the instruction counter. */ +static int64_t cpu_get_icount_locked(void) +{ +int64_t icount = cpu_get_icount_raw(); return timers_state.qemu_icount_bias + cpu_icount_to_ns(icount); } diff --git a/include/qemu/timer.h b/include/qemu/timer.h index 5f5210d..3dae414 100644 --- a/include/qemu/timer.h +++ b/include/qemu/timer.h @@ -743,6 +743,7 @@ static inline int64_t get_clock(void) #endif /* icount */ +int64_t cpu_get_icount_raw(void); int64_t cpu_get_icount(void); int64_t cpu_get_clock(void); int64_t cpu_get_clock_offset(void);