Re: [Qemu-devel] [PATCHv11 13/31] aio / timers: aio_ctx_prepare sets timeout from AioContext timers

2013-08-21 Thread Stefan Hajnoczi
On Thu, Aug 15, 2013 at 09:34:21PM +0100, Alex Bligh wrote: @@ -150,13 +150,14 @@ aio_ctx_prepare(GSource *source, gint*timeout) { AioContext *ctx = (AioContext *) source; QEMUBH *bh; +int deadline; for (bh = ctx-first_bh; bh; bh = bh-next) { if

Re: [Qemu-devel] [PATCHv11 13/31] aio / timers: aio_ctx_prepare sets timeout from AioContext timers

2013-08-21 Thread Alex Bligh
Stefan, --On 21 August 2013 11:01:42 +0200 Stefan Hajnoczi stefa...@gmail.com wrote: I agree with Wenchao: The docs explicitly say that .prepare() can set timeout to the maximum timeout value that is required. It then explains that the actual timeout used is the minimum of all timeout

Re: [Qemu-devel] [PATCHv11 13/31] aio / timers: aio_ctx_prepare sets timeout from AioContext timers

2013-08-20 Thread Alex Bligh
for (bh = ctx-first_bh; bh; bh = bh-next) { if (!bh-deleted bh-scheduled) { if (bh-idle) { /* idle bottom halves will be polled at least * every 10ms */ -*timeout = 10; +*timeout =

Re: [Qemu-devel] [PATCHv11 13/31] aio / timers: aio_ctx_prepare sets timeout from AioContext timers

2013-08-20 Thread Wenchao Xia
于 2013-8-20 14:48, Alex Bligh 写道: for (bh = ctx-first_bh; bh; bh = bh-next) { if (!bh-deleted bh-scheduled) { if (bh-idle) { /* idle bottom halves will be polled at least * every 10ms */ -*timeout = 10; +

Re: [Qemu-devel] [PATCHv11 13/31] aio / timers: aio_ctx_prepare sets timeout from AioContext timers

2013-08-20 Thread Alex Bligh
On 20 Aug 2013, at 08:19, Wenchao Xia wrote: Thanks for the explanation. It seems *timeout is always set to -1 before calling GSource's prepare(), so *timeout = qemu_soonest_timeout(*timeout, 10); will always get *timeout = 10, so this call can be saved. I believe that's incorrect too.

Re: [Qemu-devel] [PATCHv11 13/31] aio / timers: aio_ctx_prepare sets timeout from AioContext timers

2013-08-20 Thread Wenchao Xia
于 2013-8-20 17:29, Alex Bligh 写道: On 20 Aug 2013, at 08:19, Wenchao Xia wrote: Thanks for the explanation. It seems *timeout is always set to -1 before calling GSource's prepare(), so *timeout = qemu_soonest_timeout(*timeout, 10); will always get *timeout = 10, so this call can be saved.

Re: [Qemu-devel] [PATCHv11 13/31] aio / timers: aio_ctx_prepare sets timeout from AioContext timers

2013-08-20 Thread Alex Bligh
On 20 Aug 2013, at 12:19, Wenchao Xia wrote: So it is an undefined value, should avoid use it? It's not an undefined value. It's the value that the poll should wait for subject to modification by the prepare call. -- Alex Bligh

Re: [Qemu-devel] [PATCHv11 13/31] aio / timers: aio_ctx_prepare sets timeout from AioContext timers

2013-08-19 Thread Wenchao Xia
于 2013-8-16 4:34, Alex Bligh 写道: Calculate the timeout in aio_ctx_prepare taking into account the timers attached to the AioContext. Alter aio_ctx_check similarly. Signed-off-by: Alex Bligh a...@alex.org.uk --- async.c | 13 +++-- 1 file changed, 11 insertions(+), 2

[Qemu-devel] [PATCHv11 13/31] aio / timers: aio_ctx_prepare sets timeout from AioContext timers

2013-08-15 Thread Alex Bligh
Calculate the timeout in aio_ctx_prepare taking into account the timers attached to the AioContext. Alter aio_ctx_check similarly. Signed-off-by: Alex Bligh a...@alex.org.uk --- async.c | 13 +++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/async.c b/async.c index