All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Alex Bligh <alex@alex.org.uk>
Cc: Kevin Wolf <kwolf@redhat.com>,
	Anthony Liguori <aliguori@us.ibm.com>,
	qemu-devel@nongnu.org, Stefan Hajnoczi <stefanha@redhat.com>,
	rth@twiddle.net
Subject: Re: [Qemu-devel] [PATCH] [RFC] aio/async: Add timed bottom-halves
Date: Tue, 16 Jul 2013 08:16:42 +0200	[thread overview]
Message-ID: <51E4E54A.10908@redhat.com> (raw)
In-Reply-To: <44590808AF4A6E7DC093637A@nimrod.local>

Il 16/07/2013 01:04, Alex Bligh ha scritto:
> Paolo,
> 
> --On 15 July 2013 22:53:17 +0200 Paolo Bonzini <pbonzini@redhat.com> wrote:
> 
>> So far you are right.
>>
>> But this only happens if qemu_aio_wait() actually returns, so that on
>> the next call we poll for timers.  If QEMU is stuck in qemu_aio_wait()'s
>> infinite-timeout poll(), it will never advance and process the timed
>> bottom halves.
> 
> I may have misunderstood the code here. I thought what it was doing was
> setting the timeout to poll() to 0 if there was a bh queued, 10ms if
> there was a bh->idle timeout queued, or infinite otherwise.
> 
> What I changed it to do was set the timeout to:
> * 0 if there was an untimed bh ready (no change)
> * 10ms if there was an untimed idle bh ready (no change)
> * the number of ms to expiry if there is a timed bh ready (rounded up)
> * infinite otherwise (no change)
> * and if there is more the one, the minimum of those

You did.  But aio_wait() ignores the timeout.  It is only used by the
main loop.

> So the infinite timeout poll should not be entered if there is a timed
> bh there. This of course assumes a single thread as else there is a TOCTOU
> problem if a timed bh gets inserted between calculating the expiry time
> and the poll.
> 
>> This goes to the question of having aio_notify() or not.  If you have
>> it, you will immediately process timed BHs that are "born expired".  For
>> other bottom halves, there will be no difference if you add it or not.
> 
> You've lost me there. I'm taking it by 'born expired' you mean
> when poll() is entered, they're already expired. Timed BH's that are
> 'born expired' should (with the patch I sent) be treated exactly the
> same as untimed BH's, i.e. the timeout to poll should be being
> set to zero.

Yes, that's exactly what I meant.  Looks like you understood well! :)

Paolo

  reply	other threads:[~2013-07-16  6:17 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
2013-07-15 20:53     ` Paolo Bonzini
2013-07-15 23:04       ` Alex Bligh
2013-07-16  6:16         ` Paolo Bonzini [this message]
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=51E4E54A.10908@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=alex@alex.org.uk \
    --cc=aliguori@us.ibm.com \
    --cc=kwolf@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.