From: Alex Bligh <alex@alex.org.uk>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
Anthony Liguori <aliguori@us.ibm.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
qemu-devel@nongnu.org, Alex Bligh <alex@alex.org.uk>,
rth@twiddle.net
Subject: Re: [Qemu-devel] [PATCH] [RFC] aio/async: Add timed bottom-halves
Date: Mon, 15 Jul 2013 21:15:10 +0100 [thread overview]
Message-ID: <75638CBA408455BF52192DA7@Ximines.local> (raw)
In-Reply-To: <51E4063D.6010308@redhat.com>
Paolo,
--On 15 July 2013 16:25:01 +0200 Paolo Bonzini <pbonzini@redhat.com> wrote:
Thanks for the review.
> Il 06/07/2013 18:24, Alex Bligh ha scritto:
>> Add timed bottom halves. A timed bottom half is a bottom half that
>> will not execute until a given time has passed (qemu_bh_schedule_at)
>> or a given interval has passed (qemu_bh_schedule_in).
>
> ... and may be delayed arbitrarily past that given interval if you are
> running in qemu-img or in other synchronous I/O APIs.
That's true. However, the problem with timers is worse, in that we
poll for timers even less frequently as far as I can tell.
> I'm especially
> worried that this will not have any effect if bdrv_aio_cancel is calling
> qemu_aio_wait. bdrv_aio_cancel is presumably one place where you want
> timeout/reconnect functionality to trigger.
Well, I'm a newbie here, so may well be wrong but I thought qemu_aio_wait
/did/ call bottom halves (but didn't call QemuTimers). Provided time
does actually advance (which inspection suggests it does), then
these bh's should be called just like any other bh's. I may have missed
the point here entirely.
> I would really prefer to have a TimeEventNotifier or something like
> that, which is API-compatibile with EventNotifier (so you can use the
> regular aio-*.c APIs) but triggers when a given time has passed.
> Basically an "heavyweight" QEMUTimer; that would be a timerfd on Linux,
> and a queue timer on Windows. No idea on other POSIX systems,
> unfortunately.
I was trying to use the bh API because that's what the existing block
drivers use, and what I really wanted was a bh that wouldn't execute
for a while. Do EventNotifiers run whilst AIO is polling for completion?
> Even better would be to remove the whole timer stuff (POSIX timers,
> setitimer, and the Win32 equivalents), and just make the timers use a
> shorter timeout for the main loop. If you do this, I suspect adding
> timer support to AioContext would be much simpler.
In discussion with Stefan H on IRC, I originally suggested moving the
QemuTimer poll to the AIO loop (or adding another), which is a half
arsed way to do what you are suggesting. He suggested this would be
hairy because the existing users might not be safe to be called there.
This was an attempt at a minimal change to fix that use.
> BTW, note that qemu-nbd (and qemu-io too) does call timers.
I'd thought I tested qemu-io. qemu-convert definitely does not.
Alex
> Paolo
>
>> Any qemu
>> clock can be used, and times are specified in nanoseconds.
>>
>> Timed bottom halves can be used where timers cannot. For instance,
>> in block drivers where there is no mainloop that calls timers
>> (qemu-nbd, qemu-img), or where (per stefanha@redhat.com) the
>> aio code loops internally and thus timers never get called.
>>
>> Signed-off-by: Alex Bligh <alex@alex.org.uk>
>
>
--
Alex Bligh
next prev parent reply other threads:[~2013-07-15 20:25 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-06 16:24 [Qemu-devel] [PATCH] [RFC] aio/async: Add timed bottom-halves Alex Bligh
2013-07-06 16:31 ` Alex Bligh
2013-07-06 18:04 ` [Qemu-devel] [PATCHv2] " Alex Bligh
2013-07-15 14:25 ` [Qemu-devel] [PATCH] " Paolo Bonzini
2013-07-15 20:15 ` Alex Bligh [this message]
2013-07-15 20:53 ` Paolo Bonzini
2013-07-15 23:04 ` Alex Bligh
2013-07-16 6:16 ` Paolo Bonzini
2013-07-16 7:30 ` Alex Bligh
2013-07-16 7:34 ` Paolo Bonzini
2013-07-16 15:29 ` Alex Bligh
2013-07-16 15:43 ` Paolo Bonzini
2013-07-16 16:14 ` Alex Bligh
2013-07-16 16:55 ` Paolo Bonzini
2013-07-16 21:22 ` [Qemu-devel] [PATCHv3] " Alex Bligh
2013-07-16 21:24 ` [Qemu-devel] [PATCH] " Alex Bligh
2013-07-17 3:02 ` Stefan Hajnoczi
2013-07-17 8:07 ` Alex Bligh
2013-07-17 8:11 ` Paolo Bonzini
2013-07-17 16:09 ` Alex Bligh
2013-07-18 18:48 ` Alex Bligh
2013-07-19 1:58 ` Stefan Hajnoczi
2013-07-19 6:22 ` Paolo Bonzini
2013-07-19 6:38 ` Alex Bligh
2013-07-19 6:51 ` Paolo Bonzini
2013-07-19 17:26 ` [Qemu-devel] [PATCH] [RFC] aio/timers: Drop alarm timers; introduce QEMUClock to AioContext; run timers in aio_poll Alex Bligh
2013-07-25 9:00 ` Stefan Hajnoczi
2013-07-25 9:02 ` Stefan Hajnoczi
2013-07-17 7:50 ` [Qemu-devel] [PATCH] [RFC] aio/async: Add timed bottom-halves Kevin Wolf
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=75638CBA408455BF52192DA7@Ximines.local \
--to=alex@alex.org.uk \
--cc=aliguori@us.ibm.com \
--cc=kwolf@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.