From: Paolo Bonzini <pbonzini@redhat.com>
To: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Kevin Wolf <kwolf@redhat.com>, Alex Bligh <alex@alex.org.uk>,
Stefan Hajnoczi <stefanha@gmail.com>,
Liu Ping Fan <qemulist@gmail.com>,
qemu-devel@nongnu.org, Stefan Hajnoczi <stefanha@redhat.com>,
Anthony Liguori <anthony@codemonkey.ws>
Subject: Re: [Qemu-devel] [RFC 0/8] arm AioContext with its own timer stuff
Date: Thu, 25 Jul 2013 14:59:34 +0200 [thread overview]
Message-ID: <51F12136.8030608@redhat.com> (raw)
In-Reply-To: <51F11C63.40007@siemens.com>
Il 25/07/2013 14:38, Jan Kiszka ha scritto:
> On 2013-07-25 14:35, Paolo Bonzini wrote:
>> Il 25/07/2013 14:32, Jan Kiszka ha scritto:
>>> On 2013-07-25 14:21, Alex Bligh wrote:
>>>>
>>>>
>>>> --On 25 July 2013 14:05:30 +0200 Stefan Hajnoczi <stefanha@gmail.com>
>>>> wrote:
>>>>
>>>>> Alex Bligh's series gives each AioContext its own rt_clock. This avoids
>>>>> the need for synchronization in the simple case. If we require timer
>>>>> access between threads then we really need to synchronize.
>>>>>
>>>>> You pointed out in another email that vm_clock stops when the guest is
>>>>> paused. I think we can find a solution for I/O throttling and QED,
>>>>> which use vm_clock in the block layer. Note that block jobs already use
>>>>> rt_clock.
>>>>
>>>> I would happily at a QEMUClock of each type to AioContext. They are after
>>>> all pretty lightweight.
>>>
>>> What's the point of adding tones of QEMUClock instances? Considering
>>> proper abstraction, how are they different for each AioContext? Will
>>> they run against different clock sources, start/stop at different times?
>>> If the answer is "they have different timer list", then fix this
>>> incorrect abstraction.
>>
>> s/QEMUClock/QEMUTimerList/ ? :)
>
> What do you mean? If the content of struct QEMUClock remained the same,
> that would just paper over a design mistake.
I mean that really the "clock" part of QEMUClock is really just
#define QEMU_CLOCK_REALTIME 0
#define QEMU_CLOCK_VIRTUAL 1
#define QEMU_CLOCK_HOST 2
and
switch(clock_type) {
case QEMU_CLOCK_REALTIME:
return get_clock();
default:
case QEMU_CLOCK_VIRTUAL:
if (use_icount) {
return cpu_get_icount();
} else {
return cpu_get_clock();
}
case QEMU_CLOCK_HOST:
now = get_clock_realtime();
last = clock->last;
clock->last = now;
if (now < last) {
notifier_list_notify(&clock->reset_notifiers, &now);
}
return now;
}
Everything else in QEMUClock is just a list of timers. You also cannot
put timers from different clocks in the same list.
Different AioContexts needs different lists of timers even for the same
source (for obvious reasons of thread-safety). Different sources need
different lists of timers because they do not advance together. The
most obvious example is vm_clock which can stop for an arbitrary amount
of time while other rt_clock timers can be executed. It is a
fundamental invariant of QEMUClock that if the first timer in the list
hasn't expired, the following ones also haven't.
Paolo
next prev parent reply other threads:[~2013-07-25 13:00 UTC|newest]
Thread overview: 63+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-21 8:42 [Qemu-devel] [RFC 0/8] arm AioContext with its own timer stuff Liu Ping Fan
2013-07-21 8:42 ` [Qemu-devel] [RFC 1/8] timer: associate alarm_timer with AioContext Liu Ping Fan
2013-07-22 6:55 ` Jan Kiszka
2013-07-21 8:42 ` [Qemu-devel] [RFC 2/8] timer: pick out timer list info from QemuClock Liu Ping Fan
2013-07-21 8:43 ` [Qemu-devel] [RFC 3/8] timer: make timers_state static Liu Ping Fan
2013-07-22 6:36 ` Jan Kiszka
2013-07-22 17:40 ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
2013-07-21 8:43 ` [Qemu-devel] [RFC 4/8] timer: protect timers_state with lock Liu Ping Fan
2013-07-22 6:40 ` Jan Kiszka
2013-07-21 8:43 ` [Qemu-devel] [RFC 5/8] timer: associate timer with AioContext Liu Ping Fan
2013-07-21 8:43 ` [Qemu-devel] [RFC 6/8] timer: run timers on aio_poll Liu Ping Fan
2013-07-21 9:55 ` Alex Bligh
2013-07-23 2:56 ` liu ping fan
2013-07-23 14:22 ` Alex Bligh
2013-07-21 8:43 ` [Qemu-devel] [RFC 7/8] block: associate BlockDriverState with AioContext Liu Ping Fan
2013-07-21 8:43 ` [Qemu-devel] [RFC 8/8] block: enable throttle with aiocontext Liu Ping Fan
2013-07-21 9:53 ` [Qemu-devel] [RFC 0/8] arm AioContext with its own timer stuff Alex Bligh
2013-07-22 4:38 ` liu ping fan
2013-07-22 6:28 ` Jan Kiszka
2013-07-23 2:51 ` liu ping fan
2013-07-25 11:44 ` Stefan Hajnoczi
2013-07-25 12:01 ` Jan Kiszka
2013-07-22 9:40 ` Alex Bligh
2013-07-22 10:18 ` liu ping fan
2013-07-23 2:53 ` liu ping fan
2013-07-23 10:30 ` Paolo Bonzini
2013-07-24 1:28 ` liu ping fan
2013-07-24 6:42 ` Paolo Bonzini
2013-07-24 7:31 ` Alex Bligh
2013-07-24 7:43 ` Paolo Bonzini
2013-07-24 8:01 ` Alex Bligh
2013-07-24 8:19 ` Paolo Bonzini
2013-07-24 8:37 ` Alex Bligh
2013-07-24 11:28 ` Paolo Bonzini
2013-07-24 8:30 ` liu ping fan
2013-07-24 7:43 ` liu ping fan
2013-07-24 7:54 ` Paolo Bonzini
2013-07-24 8:06 ` Alex Bligh
2013-07-24 14:46 ` [Qemu-devel] [PATCHv2a] [RFC 8/7 (really)] Add prctl(PR_SET_TIMERSLACK, 1, ...) to reduce timer slack Alex Bligh
2013-07-23 14:21 ` [Qemu-devel] [RFC 0/8] arm AioContext with its own timer stuff Alex Bligh
2013-07-25 11:47 ` Stefan Hajnoczi
2013-07-25 12:05 ` Stefan Hajnoczi
2013-07-25 12:21 ` Alex Bligh
2013-07-25 12:32 ` Jan Kiszka
2013-07-25 12:35 ` Paolo Bonzini
2013-07-25 12:38 ` Jan Kiszka
2013-07-25 12:41 ` Stefan Hajnoczi
2013-07-25 12:48 ` Jan Kiszka
2013-07-25 13:02 ` Paolo Bonzini
2013-07-25 13:06 ` Jan Kiszka
2013-07-25 13:31 ` Stefan Hajnoczi
2013-07-25 14:01 ` Jan Kiszka
2013-07-25 12:59 ` Paolo Bonzini [this message]
2013-07-25 18:53 ` Alex Bligh
2013-07-26 8:43 ` Stefan Hajnoczi
2013-07-26 9:08 ` Alex Bligh
2013-07-26 9:19 ` Paolo Bonzini
2013-07-29 8:58 ` Kevin Wolf
2013-07-29 10:22 ` Alex Bligh
2013-07-29 10:45 ` Paolo Bonzini
2013-07-31 9:02 ` Stefan Hajnoczi
2013-07-26 10:05 ` Jan Kiszka
2013-07-26 19:29 ` Alex Bligh
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=51F12136.8030608@redhat.com \
--to=pbonzini@redhat.com \
--cc=alex@alex.org.uk \
--cc=anthony@codemonkey.ws \
--cc=jan.kiszka@siemens.com \
--cc=kwolf@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemulist@gmail.com \
--cc=stefanha@gmail.com \
--cc=stefanha@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).