From: Jan Kiszka <jan.kiszka@siemens.com>
To: Anthony Liguori <anthony@codemonkey.ws>
Cc: Glauber Costa <glommer@redhat.com>, Avi Kivity <avi@redhat.com>,
qemu-devel <qemu-devel@nongnu.org>, kvm <kvm@vger.kernel.org>,
Ulrich Obergfell <uobergfe@redhat.com>
Subject: Re: [Qemu-devel] Re: [RFC: 0/2] patch for QEMU HPET periodic timer emulation to alleviate time drift
Date: Mon, 07 Feb 2011 16:08:55 +0100 [thread overview]
Message-ID: <4D500B07.1070305@siemens.com> (raw)
In-Reply-To: <4D50092C.1080109@codemonkey.ws>
On 2011-02-07 16:01, Anthony Liguori wrote:
> On 02/07/2011 08:57 AM, Jan Kiszka wrote:
>> There should rather be a special vmstate struct for PeriodicTimer, just
>> like we already have for normal timers.
>>
>
> Agreed.
>
>>> It's convenient because then if we lose ticks in the PeriodicTimer
>>> layer, the devices have instance access to that info. When you do a
>>> read() from timerfd, it returns the number of coalesced events. That's
>>> the interface I had in my mind.
>>>
>>> We could just add a getter for PeriodicTimer and it would serve the same
>>> purpose.
>>>
>> I'm still not sure what the device model is supposed to do with that
>> information. I think at could remain private to the PeriodicTimer
>> implementation (unless we want to dump some stats or such).
>>
>
> Yeah, I've been thinking about it too and I think I agree with you.
>
> So here's the new proposal:
>
> typedef struct PeriodicTimer PeriodicTimer;
>
> /**
> * @accumulated_ticks: the number of unacknowledged ticks in total
> since the creation of the timer
> **/
> typedef void (PeriodicTimerFunc)(void *opaque);
Or just use QEMUTimerCB directly. BTW, QEMUPeriodicTimer* would probably
be more consistent with the existing naming scheme.
>
> PeriodicTimer *periodic_timer_new(PeriodicTimerFunc *cb, void *opaque);
>
> void periodic_timer_mod(PeriodicTimer *timer, int64_t interval, TimeUnit
> unit);
>
> /**
> * @policy: the drift catch-up policy
> * DRIFT_COMP_FAST, deliver next tick as soon as any
> tick is acknowledged if accumulated_ticks > 1
> * DRIFT_COMP_NONE, do not change interval regardless of
> accumulated ticks
> * DRIFT_COMP_GRADUAL, shorten interval by half until
> accumulated_ticks <= 1
> */
> void periodic_timer_set_policy(PeriodicTimer *timer,
> DriftCompensationPolicy policy);
>
> /**
> * @ticks: number of ticks to acknowledge that are currently outstanding.
> **/
> void periodic_timer_ack(PeriodicTimer *timer, int ticks);
>
> int periodic_timer_get_accumulated_ticks(PeriodicTimer *timer);
>
Looks like a plan.
Jan
--
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
next prev parent reply other threads:[~2011-02-07 15:09 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <480481933.225059.1296734409954.JavaMail.root@zmail07.collab.prod.int.phx2.redhat.com>
[not found] ` <1375835067.226263.1296740625327.JavaMail.root@zmail07.collab.prod.int.phx2.redhat.com>
2011-02-03 15:28 ` [Qemu-devel] Re: [RFC: 0/2] patch for QEMU HPET periodic timer emulation to alleviate time drift Jan Kiszka
2011-02-03 20:07 ` Anthony Liguori
2011-02-03 21:24 ` Jan Kiszka
2011-02-04 2:06 ` Anthony Liguori
2011-02-04 8:56 ` Jan Kiszka
2011-02-07 12:34 ` Avi Kivity
2011-02-07 13:11 ` Anthony Liguori
2011-02-07 13:14 ` Avi Kivity
2011-02-07 13:23 ` Anthony Liguori
2011-02-07 13:34 ` Avi Kivity
2011-02-07 13:41 ` Gleb Natapov
2011-02-07 13:46 ` Avi Kivity
2011-02-07 13:48 ` Gleb Natapov
2011-02-07 13:51 ` Avi Kivity
2011-02-07 13:54 ` Gleb Natapov
2011-02-07 14:10 ` Jan Kiszka
2011-02-07 14:28 ` Anthony Liguori
2011-02-07 14:43 ` Jan Kiszka
2011-02-07 14:54 ` Anthony Liguori
2011-02-07 14:57 ` Jan Kiszka
2011-02-07 15:01 ` Anthony Liguori
2011-02-07 15:08 ` Jan Kiszka [this message]
2011-02-07 15:13 ` Avi Kivity
2011-02-07 15:17 ` Jan Kiszka
2011-02-07 15:29 ` Avi Kivity
2011-02-07 19:30 ` Anthony Liguori
2011-02-08 9:11 ` Avi Kivity
2011-02-07 15:20 ` Jan Kiszka
2011-02-07 15:30 ` Avi Kivity
2011-02-07 19:28 ` Anthony Liguori
2011-02-07 14:58 ` Avi Kivity
2011-02-07 15:01 ` Jan Kiszka
2011-02-07 15:08 ` Avi Kivity
2011-02-07 15:14 ` Jan Kiszka
2011-02-07 15:16 ` Avi Kivity
2011-02-07 15:22 ` Anthony Liguori
2011-02-07 15:18 ` Anthony Liguori
2011-02-04 9:52 ` Ulrich Obergfell
2011-02-07 10:44 ` Ulrich Obergfell
2011-02-07 13:24 ` 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=4D500B07.1070305@siemens.com \
--to=jan.kiszka@siemens.com \
--cc=anthony@codemonkey.ws \
--cc=avi@redhat.com \
--cc=glommer@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=qemu-devel@nongnu.org \
--cc=uobergfe@redhat.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).