qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Sebastian Tanase <sebastian.tanase@openwide.fr>
Cc: kwolf@redhat.com, peter maydell <peter.maydell@linaro.org>,
	aliguori@amazon.com, wenchaoqemu@gmail.com, quintela@redhat.com,
	qemu-devel@nongnu.org, mst@redhat.com, stefanha@redhat.com,
	armbru@redhat.com, lcapitulino@redhat.com, michael@walle.cc,
	camille begue <camille.begue@openwide.fr>,
	alex@alex.org.uk, crobinso@redhat.com, afaerber@suse.de,
	rth@twiddle.net
Subject: Re: [Qemu-devel] [RFC PATCH V4 6/6] monitor: Add drift info to 'info jit'
Date: Tue, 22 Jul 2014 12:19:42 +0200	[thread overview]
Message-ID: <53CE3ABE.3000100@redhat.com> (raw)
In-Reply-To: <601871010.20021638.1406023084319.JavaMail.root@openwide.fr>

Il 22/07/2014 11:58, Sebastian Tanase ha scritto:
> 
> -timers_state.cpu_clock_offset contains the offset between the real and virtual clocks.
> However, when using the value of the virtual clock (qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL)),
> qemu_icount_bias already includes this offset because, on ARM, qemu_clock_warp (which 
> then calls icount_warp_rt) is called for the first time in tcg_exec_all, making
> qemu_icount_bias take the value of qemu_clock_get_ns(QEMU_CLOCK_REALTIME)

Does this means that QEMU_CLOCK_VIRTUAL counts up from
qemu_clock_get_ns(QEMU_CLOCK_REALTIME) rather than 0?  This would be a
bug, and it would be good to fix it (by initializing vm_clock_warp_start
to -1).

> A solution to not compute the initial offset in qemu_icount_bias would be to initialize 
> vm_clock_warp_start to -1. The result  will be that qemu_icount_bias will start counting when
> the vcpu goes from active to inactive. At that time, vm_clock_warp_start will already store the realtime clock 
> value and a timer on the real clock will be set to expire at clock + deadline, making qemu_icount_bias increment
> by deadline.

That would be correct.

> A consequence of initializing vm_clock_warp_start to -1 is also 
> the fact that we'll skip the first check for a virtual expired timer. As I mentioned above, in ARM case, 
> it's not dangerous because there are no timers active the first time we perform this check. However, this 
> is just a potential scenario and I cannot guarantee that on other target architectures there won't be 
> an expired timer pending the first time we check.

Like a timer that expired in the past?  That would be caught in
tcg_cpu_exec, when it initializes the decrementer to
qemu_clock_deadline_ns_all(QEMU_CLOCK_VIRTUAL).

> So, do you think it is worth taking this solution into account or it will cause more harm than good?

Yes, even more so.  If we add workarounds to complicated code, it will
become even more complicated.

Paolo

  reply	other threads:[~2014-07-22 10:20 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-16 12:18 [Qemu-devel] [RFC PATCH V4 0/6] icount: Implement delay algorithm between guest and host clocks Sebastian Tanase
2014-07-16 12:18 ` [Qemu-devel] [RFC PATCH V4 1/6] icount: Add QemuOpts for icount Sebastian Tanase
2014-07-16 12:18 ` [Qemu-devel] [RFC PATCH V4 2/6] icount: Add align option to icount Sebastian Tanase
2014-07-16 12:18 ` [Qemu-devel] [RFC PATCH V4 3/6] icount: Make icount_time_shift available everywhere Sebastian Tanase
2014-07-16 12:18 ` [Qemu-devel] [RFC PATCH V4 4/6] cpu_exec: Add sleeping algorithm Sebastian Tanase
2014-07-16 12:18 ` [Qemu-devel] [RFC PATCH V4 5/6] cpu_exec: Print to console if the guest is late Sebastian Tanase
2014-07-16 12:18 ` [Qemu-devel] [RFC PATCH V4 6/6] monitor: Add drift info to 'info jit' Sebastian Tanase
2014-07-16 13:18   ` Paolo Bonzini
2014-07-22  9:58     ` Sebastian Tanase
2014-07-22 10:19       ` Paolo Bonzini [this message]
2014-07-22 13:55         ` Sebastian Tanase
2014-07-16 13:20 ` [Qemu-devel] [RFC PATCH V4 0/6] icount: Implement delay algorithm between guest and host clocks Paolo Bonzini
2014-07-22 14:02   ` Sebastian Tanase
2014-07-22 14:59     ` Paolo Bonzini
2014-07-22 15:17       ` Sebastian Tanase
2014-07-22 15:22         ` Paolo Bonzini
2014-07-22 15:28           ` Sebastian Tanase
2014-07-22 15:44             ` Paolo Bonzini
2014-07-16 13:40 ` Luiz Capitulino

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=53CE3ABE.3000100@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=afaerber@suse.de \
    --cc=alex@alex.org.uk \
    --cc=aliguori@amazon.com \
    --cc=armbru@redhat.com \
    --cc=camille.begue@openwide.fr \
    --cc=crobinso@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=michael@walle.cc \
    --cc=mst@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=rth@twiddle.net \
    --cc=sebastian.tanase@openwide.fr \
    --cc=stefanha@redhat.com \
    --cc=wenchaoqemu@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).