qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Liguori <aliguori@us.ibm.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org, Jan Kiszka <jan.kiszka@siemens.com>
Subject: Re: [Qemu-devel] [PATCH 2/2] [RFC] time: refactor QEMU timer to use GHRTimer
Date: Tue, 23 Aug 2011 07:33:48 -0500	[thread overview]
Message-ID: <4E539E2C.7090407@us.ibm.com> (raw)
In-Reply-To: <4E535A08.8050706@redhat.com>

On 08/23/2011 02:43 AM, Paolo Bonzini wrote:
> On 08/22/2011 09:21 PM, Anthony Liguori wrote:
>> - ticks = cpu_get_real_ticks();
>> - if (timers_state.cpu_ticks_prev > ticks) {
>> - /* Note: non increasing ticks may happen if the host uses
>> - software suspend */
>> - timers_state.cpu_ticks_offset += timers_state.cpu_ticks_prev - ticks;
>> - }
>> + ticks = get_clock();
>>
>> [...]
>>
>> -static inline int64_t cpu_get_real_ticks(void)
>> -{
>> - int64_t val;
>> - asm volatile ("rdtsc" : "=A" (val));
>> - return val;
>> -}
>> -
>
> cpu_get_ticks is used also to emulate the guest TSC, are you sure you
> want to change that uniformly to a 1 GHz rate?

Where possible, CLOCK_MONOTONIC_RAW should be implemented in terms or 
rdtscp.  It will provide the highest accuracy time source that you can get.

So I don't think there's any different in terms of timer granularity 
from using CLOCK_MONOTONIC_RAW and rdtsc directly other than the former 
is more correct.

Regards,

Anthony Liguori

>
> I had some more cleanups in this area, I'll try to get them tested and
> submitted but I have little time for this right now.
>
> Paolo

  reply	other threads:[~2011-08-23 12:34 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-22 19:21 [Qemu-devel] [PATCH 1/2] main: add high resolution GSource based timer Anthony Liguori
2011-08-22 19:21 ` [Qemu-devel] [PATCH 2/2] [RFC] time: refactor QEMU timer to use GHRTimer Anthony Liguori
2011-08-22 20:28   ` Jan Kiszka
2011-08-22 20:36     ` Anthony Liguori
2011-08-22 20:49       ` Jan Kiszka
2011-08-22 21:55         ` Anthony Liguori
2011-08-22 23:48           ` Jan Kiszka
2011-08-23  8:12     ` Paolo Bonzini
2011-08-23  9:07       ` Edgar E. Iglesias
2011-08-23  7:43   ` Paolo Bonzini
2011-08-23 12:33     ` Anthony Liguori [this message]
2011-08-23 12:44       ` Paolo Bonzini
2011-08-22 19:26 ` [Qemu-devel] [PATCH 1/2] main: add high resolution GSource based timer Anthony Liguori

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=4E539E2C.7090407@us.ibm.com \
    --to=aliguori@us.ibm.com \
    --cc=jan.kiszka@siemens.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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).