[Qemu-devel] [RFC] [PATCHv8 04/30] aio / timers: add ppoll support with qemu_poll_ns

2013-08-08 Thread Alex Bligh
Add qemu_poll_ns which works like g_poll but takes a nanosecond timeout. Signed-off-by: Alex Bligh --- configure| 19 +++ include/qemu/timer.h | 12 qemu-timer.c | 24 3 files changed, 55 insertions(+) diff --git a

[Qemu-devel] [RFC] [PATCHv8 03/30] aio / timers: Consistent treatment of disabled clocks for deadlines

2013-08-08 Thread Alex Bligh
Make treatment of disabled clocks consistent in deadline calculation Signed-off-by: Alex Bligh --- qemu-timer.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qemu-timer.c b/qemu-timer.c index 8f378a9..47b5e4b 100644 --- a/qemu-timer.c +++ b/qemu-timer.c @@ -264,7 +264,7

[Qemu-devel] [RFC] [PATCHv8 15/30] aio / timers: Convert mainloop to use timeout

2013-08-08 Thread Alex Bligh
Convert mainloop to use timeout from default timerlist group (i.e. the current 3 static timers) Signed-off-by: Alex Bligh --- main-loop.c | 45 ++--- 1 file changed, 34 insertions(+), 11 deletions(-) diff --git a/main-loop.c b/main-loop.c index a44fff6

[Qemu-devel] [RFC] [PATCHv8 18/30] aio / timers: Use all timerlists in icount warp calculations

2013-08-08 Thread Alex Bligh
always set an icount clock expiry about 2 seconds ahead. NB: thread safety - when different timerlists sit on different threads, this will need some locking. Signed-off-by: Alex Bligh --- cpus.c | 46 +- include/qemu/timer.h | 13

[Qemu-devel] [RFC] [PATCHv8 13/30] aio / timers: Add aio_timer_new wrapper

2013-08-08 Thread Alex Bligh
Add aio_timer_new wrapper function. Signed-off-by: Alex Bligh --- include/block/aio.h | 19 +++ 1 file changed, 19 insertions(+) diff --git a/include/block/aio.h b/include/block/aio.h index a13f6e8..bd6f17c 100644 --- a/include/block/aio.h +++ b/include/block/aio.h @@ -255,4

Re: [Qemu-devel] [RFC] [PATCHv8 00/30] aio / timers: Add AioContext timers and use ppoll

2013-08-09 Thread Alex Bligh
esult (and for that matter all the intermediate steps) are available at: https://github.com/abligh/qemu/tree/timer-api If you are pulling this tree, note there is an intermediate commit * b1eb241 2013-07-19 | Disable expensive tests [Alex Bligh] which should not be included in the final pull,

Re: [Qemu-devel] [RFC] [PATCHv8 05/30] aio / timers: Add prctl(PR_SET_TIMERSLACK, 1, ...) to reduce timer slack

2013-08-09 Thread Alex Bligh
On 9 Aug 2013, at 09:53, Stefan Hajnoczi wrote: > The ./configure change should also be in this patch. I think it crept > into another patch by mistake. Oops - I will fix. -- Alex Bligh

Re: [Qemu-devel] [RFC] [PATCHv8 11/30] aio / timers: Add a notify callback to QEMUTimerList

2013-08-09 Thread Alex Bligh
d instead > pass in cb/opaque in timerlist_new(). This is good idea. I will do that. -- Alex Bligh

Re: [Qemu-devel] [RFC] [PATCHv8 23/30] aio / timers: Rearrange timer.h & make legacy functions call non-legacy

2013-08-09 Thread Alex Bligh
On 9 Aug 2013, at 10:23, Stefan Hajnoczi wrote: > On Thu, Aug 08, 2013 at 10:42:20PM +0100, Alex Bligh wrote: >> @@ -269,17 +299,17 @@ bool timerlist_expired(QEMUTimerList *timer_list); >> int64_t timerlist_deadline_ns(QEMUTimerList *timer_list); >> >> /*

Re: [Qemu-devel] [RFC] [PATCHv8 00/30] aio / timers: Add AioContext timers and use ppoll

2013-08-09 Thread Alex Bligh
ted program does that and produces git comments. That's about 130 commits I think. Would you prefer that? -- Alex Bligh

Re: [Qemu-devel] [RFC] [PATCHv8 07/30] aio / timers: Split QEMUClock into QEMUClock and QEMUTimerList

2013-08-09 Thread Alex Bligh
If we don't want both, I would suggest using timer_* rather than qemu_timer_*. This will reduce some of the line wrap issues in the automated patch. -- Alex Bligh

Re: [Qemu-devel] [RFC] [PATCHv8 11/30] aio / timers: Add a notify callback to QEMUTimerList

2013-08-09 Thread Alex Bligh
On 9 Aug 2013, at 11:03, Paolo Bonzini wrote: > Il 08/08/2013 23:42, Alex Bligh ha scritto: >> Add a notify pointer to QEMUTimerList so it knows what to notify >> on a timer change. > > If we do the "two AioContexts" trick, this can simply be a back-pointer > t

Re: [Qemu-devel] [RFC] [PATCHv8 09/30] aio / timers: Add QEMUTimerListGroup and helper functions

2013-08-09 Thread Alex Bligh
timers(tlg[type]); >> +} >> +return progress; >> +} >> + >> +int64_t timerlistgroup_deadline_ns(QEMUTimerListGroup tlg) >> +{ >> +int64_t deadline = -1; >> + QEMUClockType type; >> +for (type = 0; type < QEMU_CLOCK_MAX; type++) { >> +if (qemu_clock_use_for_deadline(tlg[type]->clock)) { >> +deadline = qemu_soonest_timeout(deadline, >> + >> timerlist_deadline_ns(tlg[type])); >> +} >> +} >> +return deadline; >> +} >> + >> int64_t qemu_get_clock_ns(QEMUClock *clock) >> { >> int64_t now, last; >> @@ -616,6 +656,7 @@ void init_clocks(void) >> for (type = 0; type < QEMU_CLOCK_MAX; type++) { >> if (!qemu_clocks[type]) { >> qemu_clocks[type] = qemu_clock_new(type); >> +main_loop_tlg[type] = qemu_clocks[type]->main_loop_timerlist; >> } >> } >> >> > > -- Alex Bligh

Re: [Qemu-devel] [RFC] [PATCHv8 12/30] aio / timers: aio_ctx_prepare sets timeout from AioContext timers

2013-08-09 Thread Alex Bligh
g) == 0); > > Again, if we do the "two AioContext" tricks, the > timerlistgroup_deadline_ns function would be internal to AioContext. I don't think that's true as I think we'd still want to encapsulate walking the array of clocks within qemu-timer.c. -- Alex Bligh

Re: [Qemu-devel] [RFC] [PATCHv8 28/30] aio / timers: Add scripts/switch-timer-api

2013-08-09 Thread Alex Bligh
use I feared there might be changes in the users of rtc_clock before this series is merged. -- Alex Bligh

Re: [Qemu-devel] [RFC] [PATCHv8 13/30] aio / timers: Add aio_timer_new wrapper

2013-08-09 Thread Alex Bligh
imer_init. We can remove the allocation completely, it is a > useless indirection and we misuse it since we hardly ever call > qemu_free_timer. Would that not require change the huge number of qemu_timer_new references to use this new API? That sounds less than automatic! Not in favour of that one. -- Alex Bligh

Re: [Qemu-devel] [RFC] [PATCHv8 28/30] aio / timers: Add scripts/switch-timer-api

2013-08-09 Thread Alex Bligh
On 9 Aug 2013, at 11:26, Paolo Bonzini wrote: > Il 08/08/2013 23:42, Alex Bligh ha scritto: >> +# these have just changed name >> +$line =~ s/\bqemu_mod_timer\b/qemu_timer_mod/g; >> +$line =~ s/\bqemu_mod_timer_(ns|us|ms)\b/qemu_timer_mod_$1/g; &

Re: [Qemu-devel] [RFC] [PATCHv8 09/30] aio / timers: Add QEMUTimerListGroup and helper functions

2013-08-09 Thread Alex Bligh
asy. What I don't want to do is have all the worry about breaking things I don't fully understand by requiring that everything has an AioContext that uses timers now. -- Alex Bligh

Re: [Qemu-devel] [RFC] [PATCHv8 13/30] aio / timers: Add aio_timer_new wrapper

2013-08-09 Thread Alex Bligh
at you are after is for people to put a QEMUTimer into their struct, rather than a QEMUTimer * (and hopefully to remember to put qemu_timer_init in!) then I need to move the whole of the declaration of the struct to the .h file which is a bit yucky. Other than that, fair enough. -- Alex Bligh

Re: [Qemu-devel] [RFC] [PATCHv8 12/30] aio / timers: aio_ctx_prepare sets timeout from AioContext timers

2013-08-09 Thread Alex Bligh
e anything either way. The 80 or so lines of tlg code is still going to be needed in AioContext. As I've said, is not that I'm against putting the tlg array in the AioContext per se, it's that I'm against doing it now. -- Alex Bligh

Re: [Qemu-devel] [RFC] [PATCHv8 13/30] aio / timers: Add aio_timer_new wrapper

2013-08-09 Thread Alex Bligh
lying too much on opaque types anyway. Out of interest, there was some talk about modular block drivers (i.e. loading them at run time). If we do that, we'll need a stable API, and this would be a move in the wrong direction. -- Alex Bligh

Re: [Qemu-devel] [RFC] [PATCHv8 13/30] aio / timers: Add aio_timer_new wrapper

2013-08-09 Thread Alex Bligh
ll likely have been freed. This means walking the timer list will be dangerous. This seems to add a good deal of fragility. I've no objection to adding timer_init (especially as I've already done it), but I wonder whether we're right to make this the only interface for aio_timer etc. - i.e. maybe we should have aio_timer_new and aio_timer_init. WDYT? -- Alex Bligh

[Qemu-devel] [RFC] [PATCHv9 01/31] aio / timers: Rename qemu_timer_* functions

2013-08-10 Thread Alex Bligh
Rename four functions in preparation for new API. Rename qemu_timer_expired to timer_expired Rename qemu_timer_expire_time_ns to timer_expire_time_ns Rename qemu_timer_pending to timer_pending Rename qemu_timer_expired_ns to timer_expired_ns Signed-off-by: Alex Bligh --- backends/baum.c

[Qemu-devel] [RFC] [PATCHv9 07/31] aio / timers: Make qemu_run_timers and qemu_run_all_timers return progress

2013-08-10 Thread Alex Bligh
Make qemu_run_timers and qemu_run_all_timers return progress so that aio_poll etc. can determine whether a timer has been run. Signed-off-by: Alex Bligh --- include/qemu/timer.h | 21 +++-- qemu-timer.c | 18 -- 2 files changed, 31 insertions(+), 8

[Qemu-devel] [RFC] [PATCHv9 05/31] aio / timers: add ppoll support with qemu_poll_ns

2013-08-10 Thread Alex Bligh
Add qemu_poll_ns which works like g_poll but takes a nanosecond timeout. Signed-off-by: Alex Bligh --- configure| 19 +++ include/qemu/timer.h | 12 qemu-timer.c | 24 3 files changed, 55 insertions(+) diff --git a

[Qemu-devel] [RFC] [PATCHv9 02/31] aio / timers: Rename qemu_new_clock and expose clock types

2013-08-10 Thread Alex Bligh
Rename qemu_new_clock to qemu_clock_new. Expose clock types. Signed-off-by: Alex Bligh --- include/qemu/timer.h |4 qemu-timer.c | 12 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/qemu/timer.h b/include/qemu/timer.h index a9afdb3

[Qemu-devel] [RFC] [PATCHv9 04/31] aio / timers: Consistent treatment of disabled clocks for deadlines

2013-08-10 Thread Alex Bligh
Make treatment of disabled clocks consistent in deadline calculation Signed-off-by: Alex Bligh --- qemu-timer.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qemu-timer.c b/qemu-timer.c index df8f12b..be29adf 100644 --- a/qemu-timer.c +++ b/qemu-timer.c @@ -264,7 +264,7

[Qemu-devel] [RFC] [PATCHv9 03/31] aio / timers: add qemu-timer.c utility functions

2013-08-10 Thread Alex Bligh
when ppoll is not used. Signed-off-by: Alex Bligh --- include/qemu/timer.h | 42 ++ qemu-timer.c | 50 ++ 2 files changed, 92 insertions(+) diff --git a/include/qemu/timer.h b/include/qemu/timer.h

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

2013-08-10 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 --- async.c | 13 +++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/async.c b/async.c index 2051921..dd27459

[Qemu-devel] [RFC] [PATCHv9 14/31] aio / timers: Add aio_timer_init & aio_timer_new wrappers

2013-08-10 Thread Alex Bligh
Add aio_timer_init and aio_timer_new wrapper functions. Signed-off-by: Alex Bligh --- include/block/aio.h | 43 +++ 1 file changed, 43 insertions(+) diff --git a/include/block/aio.h b/include/block/aio.h index a13f6e8..b08de19 100644 --- a/include

[Qemu-devel] [RFC] [PATCHv9 10/31] aio / timers: Add QEMUTimerListGroup and helper functions

2013-08-10 Thread Alex Bligh
Add QEMUTimerListGroup and helper functions, to represent a QEMUTimerList associated with each clock. Add a default QEMUTimerListGroup representing the default timer lists which are not associated with any other object (e.g. an AioContext as added by future patches). Signed-off-by: Alex Bligh

[Qemu-devel] [RFC] [PATCHv9 17/31] aio / timers: On timer modification, qemu_notify or aio_notify

2013-08-10 Thread Alex Bligh
On qemu_mod_timer_ns, ensure qemu_notify or aio_notify is called to end the appropriate poll(), irrespective of use_icount value. On qemu_clock_enable, ensure qemu_notify or aio_notify is called for all QEMUTimerLists attached to the QEMUClock. Signed-off-by: Alex Bligh --- include/qemu

[Qemu-devel] [RFC] [PATCHv9 11/31] aio / timers: Add QEMUTimerListGroup to AioContext

2013-08-10 Thread Alex Bligh
Add a QEMUTimerListGroup each AioContext (meaning a QEMUTimerList associated with each clock is added) and delete it when the AioContext is freed. Signed-off-by: Alex Bligh --- async.c |2 ++ include/block/aio.h |4 tests/test-aio.c |3 +++ tests

[Qemu-devel] [RFC] [PATCHv9 29/31] aio / timers: Add scripts/switch-timer-api

2013-08-10 Thread Alex Bligh
Add scripts/switch-timer-api to programatically rewrite source files to use the new timer system. Signed-off-by: Alex Bligh --- scripts/switch-timer-api | 178 ++ 1 file changed, 178 insertions(+) diff --git a/scripts/switch-timer-api b/scripts

[Qemu-devel] [RFC] [PATCHv9 00/31] aio / timers: Add AioContext timers and use ppoll

2013-08-10 Thread Alex Bligh
ock * Split up conversion to use ppoll and timers * Indentation fix * Fix aio_win32.c aio_poll to return progress * aio_notify / qemu_notify when timers are modified * change comment in deprecation of clock options Alex Bligh (31): aio / timers: Rename qemu_timer_* functions aio / timers: Rename

[Qemu-devel] [RFC] [PATCHv9 12/31] aio / timers: Add a notify callback to QEMUTimerList

2013-08-10 Thread Alex Bligh
Add a notify pointer to QEMUTimerList so it knows what to notify on a timer change. Signed-off-by: Alex Bligh --- async.c |7 ++- include/qemu/timer.h | 27 +++ qemu-timer.c | 31 --- 3 files changed, 53

[Qemu-devel] [RFC] [PATCHv9 18/31] aio / timers: Introduce new API timer_new and friends

2013-08-10 Thread Alex Bligh
Introduce new API for creating timers - timer_new and _ns, _ms, _us derivatives. Signed-off-by: Alex Bligh --- include/qemu/timer.h | 69 ++ 1 file changed, 69 insertions(+) diff --git a/include/qemu/timer.h b/include/qemu/timer.h index 0ae1d53

[Qemu-devel] [RFC] [PATCHv9 09/31] aio / timers: Untangle include files

2013-08-10 Thread Alex Bligh
include/qemu/timer.h has no need to include main-loop.h and doing so causes an issue for the next patch. Unfortunately various files assume including timers.h will pull in main-loop.h. Untangle this mess. Signed-off-by: Alex Bligh --- dma-helpers.c |1 + hw/dma/xilinx_axidma.c

[Qemu-devel] [RFC] [PATCHv9 23/31] aio / timers: Add qemu_clock_get_ms and qemu_clock_get_ms

2013-08-10 Thread Alex Bligh
Add utility functions qemu_clock_get_ms and qemu_clock_get_us Signed-off-by: Alex Bligh --- include/qemu/timer.h | 28 1 file changed, 28 insertions(+) diff --git a/include/qemu/timer.h b/include/qemu/timer.h index fae92b3..2561740 100644 --- a/include/qemu

[Qemu-devel] [RFC] [PATCHv9 22/31] aio / timers: Remove legacy qemu_clock_deadline & qemu_timerlist_deadline

2013-08-10 Thread Alex Bligh
Remove qemu_clock_deadline and qemu_timerlist_deadline now we are using the ns functions throughout. Signed-off-by: Alex Bligh --- include/qemu/timer.h | 16 qemu-timer.c | 20 2 files changed, 36 deletions(-) diff --git a/include/qemu/timer.h

[Qemu-devel] [RFC] [PATCHv9 20/31] aio / timers: Add documentation and new format calls

2013-08-10 Thread Alex Bligh
Add documentation for existing qemu timer calls. Add new format calls of the format timer_XXX rather than qemu_XXX_timer for consistency. Signed-off-by: Alex Bligh --- include/qemu/timer.h | 206 -- 1 file changed, 184 insertions(+), 22 deletions

[Qemu-devel] [RFC] [PATCHv9 19/31] aio / timers: Use all timerlists in icount warp calculations

2013-08-10 Thread Alex Bligh
always set an icount clock expiry about 2 seconds ahead. NB: thread safety - when different timerlists sit on different threads, this will need some locking. Signed-off-by: Alex Bligh --- cpus.c | 46 +- include/qemu/timer.h | 13

[Qemu-devel] [RFC] [PATCHv9 08/31] aio / timers: Split QEMUClock into QEMUClock and QEMUTimerList

2013-08-10 Thread Alex Bligh
is used in the next patch. Signed-off-by: Alex Bligh --- include/qemu/timer.h | 347 ++ qemu-timer.c | 207 ++ 2 files changed, 475 insertions(+), 79 deletions(-) diff --git a/include/qemu/timer.h b/include/qe

[Qemu-devel] [RFC] [PATCHv9 25/31] aio / timers: Remove main_loop_timerlist

2013-08-10 Thread Alex Bligh
Now we have timerlistgroups implemented and main_loop_tlg, we no longer need the concept of a default timer list associated with each clock. Remove it and simplify initialisation of clocks and timer lists. Signed-off-by: Alex Bligh --- include/qemu/timer.h |6 + qemu-timer.c

[Qemu-devel] [RFC] [PATCHv9 27/31] aio / timers: convert block_job_sleep_ns and co_sleep_ns to new API

2013-08-10 Thread Alex Bligh
Convert block_job_sleep_ns and co_sleep_ns to use the new timer API. Signed-off-by: Alex Bligh --- block/backup.c|4 ++-- block/commit.c|2 +- block/mirror.c|4 ++-- block/stream.c|2 +- blockjob.c|4

[Qemu-devel] [RFC] [PATCHv9 31/31] aio / timers: Remove legacy interface

2013-08-10 Thread Alex Bligh
Remove the legacy interface from include/qemu/timers.h. Ensure struct QEMUClock is not exposed at all. Signed-off-by: Alex Bligh --- include/qemu/timer.h | 214 +- qemu-timer.c | 35 + 2 files changed, 5 insertions(+), 244

[Qemu-devel] [RFC] [PATCHv9 26/31] aio / timers: Convert rtc_clock to be a QEMUClockType

2013-08-10 Thread Alex Bligh
Convert rtc_clock to be a QEMUClockType Move rtc_clock users to use the new API Signed-off-by: Alex Bligh --- hw/arm/omap1.c|4 ++-- hw/arm/pxa2xx.c | 35 +++ hw/arm/strongarm.c| 10 +- hw/timer/m48t59.c

Re: [Qemu-devel] [RFC] Convert AioContext to Gsource sub classes

2013-08-10 Thread Alex Bligh
erListGroup to the the GSource sub class I guess. This does seem a little less hacky. However we'd have to make g_source timeouts work in nanoseconds rather than milliseconds. -- Alex Bligh

[Qemu-devel] [RFC] [PATCHv9 21/31] aio / timers: Remove alarm timers

2013-08-10 Thread Alex Bligh
Remove alarm timers from qemu-timers.c now we use g_poll / ppoll instead. Signed-off-by: Alex Bligh --- include/qemu/timer.h |3 - main-loop.c |4 - qemu-timer.c | 500 +- vl.c |4 +- 4 files changed

[Qemu-devel] [RFC] [PATCHv9 28/31] aio / timers: Add test harness for AioContext timers

2013-08-10 Thread Alex Bligh
Add a test harness for AioContext timers. The g_source equivalent is unsatisfactory as it suffers from false wakeups. Signed-off-by: Alex Bligh --- tests/test-aio.c | 136 ++ 1 file changed, 136 insertions(+) diff --git a/tests/test-aio.c b

[Qemu-devel] [RFC] [PATCHv9 24/31] aio / timers: Rearrange timer.h & make legacy functions call non-legacy

2013-08-10 Thread Alex Bligh
Rearrange timer.h so it is in order by function type. Make legacy functions call non-legacy functions rather than vice-versa. Convert cpus.c to use new API. Signed-off-by: Alex Bligh --- cpus.c | 112 - hw/acpi/piix4.c |2 +- hw/input/tsc2005.c |4 +- hw

[Qemu-devel] [RFC] [PATCHv9 06/31] aio / timers: Add prctl(PR_SET_TIMERSLACK, 1, ...) to reduce timer slack

2013-08-10 Thread Alex Bligh
Where supported, called prctl(PR_SET_TIMERSLACK, 1, ...) to set one nanosecond timer slack to increase precision of timer calls. Signed-off-by: Alex Bligh --- configure| 18 ++ qemu-timer.c |7 +++ 2 files changed, 25 insertions(+) diff --git a/configure b

[Qemu-devel] [RFC] [PATCHv9 16/31] aio / timers: Convert mainloop to use timeout

2013-08-10 Thread Alex Bligh
Convert mainloop to use timeout from default timerlist group (i.e. the current 3 static timers) Signed-off-by: Alex Bligh --- main-loop.c | 45 ++--- 1 file changed, 34 insertions(+), 11 deletions(-) diff --git a/main-loop.c b/main-loop.c index a44fff6

[Qemu-devel] [RFC] [PATCHv9 15/31] aio / timers: Convert aio_poll to use AioContext timers' deadline

2013-08-10 Thread Alex Bligh
aio.c where an assert was backwards. Signed-off-by: Alex Bligh --- aio-posix.c | 20 +--- aio-win32.c | 22 +++--- tests/test-aio.c |4 ++-- 3 files changed, 34 insertions(+), 12 deletions(-) diff --git a/aio-posix.c b/aio-posix.c index b6

[Qemu-devel] [RFC] [PATCH] aio / timers pt2: Replace main_loop_tlg with qemu_dummy_timer_ctx

2013-08-10 Thread Alex Bligh
Currently we use a separate timer list group (main_loop_tlg) for the main loop. This patch replaces this with a dummy AioContext used just for timers in the main loop. Signed-off-by: Alex Bligh --- include/block/aio.h |3 +++ include/qemu/timer.h |9 ++--- main-loop.c

Re: [Qemu-devel] [RFC] [PATCHv8 09/30] aio / timers: Add QEMUTimerListGroup and helper functions

2013-08-10 Thread Alex Bligh
iled instructions) - it's main saving is removing a pile of commenting from include/qemu/timer.h, which makes things more opaque. I also think there may well be a use for something that wants to use timers but not AioContext (I am thinking for instance of a thread that does not do block IO). This permits that, but does not require it. WDYT? -- Alex Bligh

Re: [Qemu-devel] [RFC] [PATCHv8 11/30] aio / timers: Add a notify callback to QEMUTimerList

2013-08-10 Thread Alex Bligh
Paolo, On 9 Aug 2013, at 11:03, Paolo Bonzini wrote: > Il 08/08/2013 23:42, Alex Bligh ha scritto: >> Add a notify pointer to QEMUTimerList so it knows what to notify >> on a timer change. > > If we do the "two AioContexts" trick, this can simply be a back-pointer

[Qemu-devel] peculiar make check problems: tests/libqtest.c

2013-08-10 Thread Alex Bligh
Occasionally running make check I am seeing the following opaque error: ERROR:tests/libqtest.c:69:init_socket: assertion failed (ret != -1): (-1 != -1) Rerunning it it runs clean. Any ideas? -- Alex Bligh

[Qemu-devel] [RFC] [PATCHv2] aio / timers pt2: Replace main_loop_tlg with qemu_dummy_timer_ctx

2013-08-10 Thread Alex Bligh
Currently we use a separate timer list group (main_loop_tlg) for the main loop. This patch replaces this with a dummy AioContext used just for timers in the main loop. Signed-off-by: Alex Bligh --- include/block/aio.h |3 +++ include/qemu/timer.h |9 ++--- main-loop.c

Re: [Qemu-devel] [RFC] [PATCHv9 00/31] aio / timers: Add AioContext timers and use ppoll

2013-08-10 Thread Alex Bligh
--On 10 August 2013 11:06:04 +0100 Alex Bligh wrote: The penultimate patch is patch which is created in an automated manner using scripts/switch-timer-api, added in this patch set. It violates some coding standards (e.g. line length >= 80 characters), but this is preferable in terms

Re: [Qemu-devel] [RFC] [PATCHv8 09/30] aio / timers: Add QEMUTimerListGroup and helper functions

2013-08-11 Thread Alex Bligh
27;m not sure I understood the code. -- Alex Bligh -- Forwarded Message -- Subject: [RFC] [PATCHv9 19/31] aio / timers: Use all timerlists in icount warp calculations ... For compatibility, maintain an apparent bug where when using icount, if no vm_clock timer was set, qemu_cl

Re: [Qemu-devel] peculiar make check problems: tests/libqtest.c

2013-08-11 Thread Alex Bligh
On 11 Aug 2013, at 15:22, Andreas Färber wrote: > Am 10.08.2013 13:20, schrieb Alex Bligh: >> Occasionally running make check I am seeing the following opaque error: >> ERROR:tests/libqtest.c:69:init_socket: assertion failed (ret != -1): (-1 >> != -1) >> >> Reru

[Qemu-devel] [RFC] [PATCHv10 02/31] aio / timers: Rename qemu_new_clock and expose clock types

2013-08-11 Thread Alex Bligh
Rename qemu_new_clock to qemu_clock_new. Expose clock types. Signed-off-by: Alex Bligh --- include/qemu/timer.h |4 qemu-timer.c | 12 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/qemu/timer.h b/include/qemu/timer.h index a9afdb3

[Qemu-devel] [RFC] [PATCHv10 03/31] aio / timers: add qemu-timer.c utility functions

2013-08-11 Thread Alex Bligh
when ppoll is not used. Signed-off-by: Alex Bligh --- include/qemu/timer.h | 42 ++ qemu-timer.c | 50 ++ 2 files changed, 92 insertions(+) diff --git a/include/qemu/timer.h b/include/qemu/timer.h

[Qemu-devel] [RFC] [PATCHv10 06/31] aio / timers: Add prctl(PR_SET_TIMERSLACK, 1, ...) to reduce timer slack

2013-08-11 Thread Alex Bligh
Where supported, called prctl(PR_SET_TIMERSLACK, 1, ...) to set one nanosecond timer slack to increase precision of timer calls. Signed-off-by: Alex Bligh --- configure| 18 ++ qemu-timer.c |7 +++ 2 files changed, 25 insertions(+) diff --git a/configure b

[Qemu-devel] [RFC] [PATCHv10 11/31] aio / timers: Add QEMUTimerListGroup to AioContext

2013-08-11 Thread Alex Bligh
Add a QEMUTimerListGroup each AioContext (meaning a QEMUTimerList associated with each clock is added) and delete it when the AioContext is freed. Signed-off-by: Alex Bligh --- async.c |2 ++ include/block/aio.h |4 tests/test-aio.c |3 +++ tests

[Qemu-devel] [RFC] [PATCHv10 14/31] aio / timers: Add aio_timer_init & aio_timer_new wrappers

2013-08-11 Thread Alex Bligh
Add aio_timer_init and aio_timer_new wrapper functions. Signed-off-by: Alex Bligh --- include/block/aio.h | 43 +++ 1 file changed, 43 insertions(+) diff --git a/include/block/aio.h b/include/block/aio.h index a13f6e8..07d5053 100644 --- a/include

[Qemu-devel] [RFC] [PATCHv10 17/31] aio / timers: On timer modification, qemu_notify or aio_notify

2013-08-11 Thread Alex Bligh
On qemu_mod_timer_ns, ensure qemu_notify or aio_notify is called to end the appropriate poll(), irrespective of use_icount value. On qemu_clock_enable, ensure qemu_notify or aio_notify is called for all QEMUTimerLists attached to the QEMUClock. Signed-off-by: Alex Bligh --- include/qemu

[Qemu-devel] [RFC] [PATCHv10 16/31] aio / timers: Convert mainloop to use timeout

2013-08-11 Thread Alex Bligh
Convert mainloop to use timeout from default timerlist group (i.e. the current 3 static timers) Signed-off-by: Alex Bligh --- main-loop.c | 45 ++--- 1 file changed, 34 insertions(+), 11 deletions(-) diff --git a/main-loop.c b/main-loop.c index a44fff6

[Qemu-devel] [RFC] [PATCHv10 18/31] aio / timers: Introduce new API timer_new and friends

2013-08-11 Thread Alex Bligh
Introduce new API for creating timers - timer_new and _ns, _ms, _us derivatives. Signed-off-by: Alex Bligh --- include/qemu/timer.h | 69 ++ 1 file changed, 69 insertions(+) diff --git a/include/qemu/timer.h b/include/qemu/timer.h index 11a6c61

[Qemu-devel] [RFC] [PATCHv10 01/31] aio / timers: Rename qemu_timer_* functions

2013-08-11 Thread Alex Bligh
Rename four functions in preparation for new API. Rename qemu_timer_expired to timer_expired Rename qemu_timer_expire_time_ns to timer_expire_time_ns Rename qemu_timer_pending to timer_pending Rename qemu_timer_expired_ns to timer_expired_ns Signed-off-by: Alex Bligh --- backends/baum.c

[Qemu-devel] [RFC] [PATCHv10 28/31] aio / timers: Add test harness for AioContext timers

2013-08-11 Thread Alex Bligh
Add a test harness for AioContext timers. The g_source equivalent is unsatisfactory as it suffers from false wakeups. Signed-off-by: Alex Bligh --- tests/test-aio.c | 136 ++ 1 file changed, 136 insertions(+) diff --git a/tests/test-aio.c b

[Qemu-devel] [RFC] [PATCHv10 15/31] aio / timers: Convert aio_poll to use AioContext timers' deadline

2013-08-11 Thread Alex Bligh
aio.c where an assert was backwards. Signed-off-by: Alex Bligh --- aio-posix.c | 20 +--- aio-win32.c | 22 +++--- tests/test-aio.c |4 ++-- 3 files changed, 34 insertions(+), 12 deletions(-) diff --git a/aio-posix.c b/aio-posix.c index b6

[Qemu-devel] [RFC] [PATCHv10 20/31] aio / timers: Add documentation and new format calls

2013-08-11 Thread Alex Bligh
Add documentation for existing qemu timer calls. Add new format calls of the format timer_XXX rather than qemu_XXX_timer for consistency. Signed-off-by: Alex Bligh --- include/qemu/timer.h | 206 -- 1 file changed, 184 insertions(+), 22 deletions

[Qemu-devel] [RFC] [PATCHv10 31/31] aio / timers: Remove legacy interface

2013-08-11 Thread Alex Bligh
Remove the legacy interface from include/qemu/timers.h. Ensure struct QEMUClock is not exposed at all. Signed-off-by: Alex Bligh --- include/qemu/timer.h | 214 +- qemu-timer.c | 35 + 2 files changed, 5 insertions(+), 244

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

2013-08-11 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 --- async.c | 13 +++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/async.c b/async.c index 2b9ba9b..d8656cc

[Qemu-devel] [RFC] [PATCHv10 26/31] aio / timers: Convert rtc_clock to be a QEMUClockType

2013-08-11 Thread Alex Bligh
Convert rtc_clock to be a QEMUClockType Move rtc_clock users to use the new API Signed-off-by: Alex Bligh --- hw/arm/omap1.c|4 ++-- hw/arm/pxa2xx.c | 35 +++ hw/arm/strongarm.c| 10 +- hw/timer/m48t59.c

[Qemu-devel] [RFC] [PATCHv10 00/31] aio / timers: Add AioContext timers and use ppoll

2013-08-11 Thread Alex Bligh
en timers are modified * change comment in deprecation of clock options Alex Bligh (31): aio / timers: Rename qemu_timer_* functions aio / timers: Rename qemu_new_clock and expose clock types aio / timers: add qemu-timer.c utility functions aio / timers: Consistent treatment of disabled clocks fo

[Qemu-devel] [RFC] [PATCHv10 09/31] aio / timers: Untangle include files

2013-08-11 Thread Alex Bligh
include/qemu/timer.h has no need to include main-loop.h and doing so causes an issue for the next patch. Unfortunately various files assume including timers.h will pull in main-loop.h. Untangle this mess. Signed-off-by: Alex Bligh --- dma-helpers.c |1 + hw/dma/xilinx_axidma.c

[Qemu-devel] [RFC] [PATCHv10 24/31] aio / timers: Rearrange timer.h & make legacy functions call non-legacy

2013-08-11 Thread Alex Bligh
Rearrange timer.h so it is in order by function type. Make legacy functions call non-legacy functions rather than vice-versa. Convert cpus.c to use new API. Signed-off-by: Alex Bligh --- cpus.c | 112 - hw/acpi/piix4.c |2 +- hw/input/tsc2005.c |4 +- hw

[Qemu-devel] [RFC] [PATCHv10 22/31] aio / timers: Remove legacy qemu_clock_deadline & qemu_timerlist_deadline

2013-08-11 Thread Alex Bligh
Remove qemu_clock_deadline and qemu_timerlist_deadline now we are using the ns functions throughout. Signed-off-by: Alex Bligh --- include/qemu/timer.h | 16 qemu-timer.c | 20 2 files changed, 36 deletions(-) diff --git a/include/qemu/timer.h

[Qemu-devel] [RFC] [PATCHv10 19/31] aio / timers: Use all timerlists in icount warp calculations

2013-08-11 Thread Alex Bligh
always set an icount clock expiry about 2 seconds ahead. NB: thread safety - when different timerlists sit on different threads, this will need some locking. Signed-off-by: Alex Bligh --- cpus.c | 46 +- include/qemu/timer.h | 13

[Qemu-devel] [RFC] [PATCHv10 08/31] aio / timers: Split QEMUClock into QEMUClock and QEMUTimerList

2013-08-11 Thread Alex Bligh
is used in the next patch. Signed-off-by: Alex Bligh --- include/qemu/timer.h | 347 ++ qemu-timer.c | 207 ++ 2 files changed, 475 insertions(+), 79 deletions(-) diff --git a/include/qemu/timer.h b/include/qe

[Qemu-devel] [RFC] [PATCHv10 27/31] aio / timers: convert block_job_sleep_ns and co_sleep_ns to new API

2013-08-11 Thread Alex Bligh
Convert block_job_sleep_ns and co_sleep_ns to use the new timer API. Signed-off-by: Alex Bligh --- block/backup.c|4 ++-- block/commit.c|2 +- block/mirror.c|4 ++-- block/stream.c|2 +- blockjob.c|4

[Qemu-devel] [RFC] [PATCHv10 25/31] aio / timers: Remove main_loop_timerlist

2013-08-11 Thread Alex Bligh
Now we have timerlistgroups implemented and main_loop_tlg, we no longer need the concept of a default timer list associated with each clock. Remove it and simplify initialisation of clocks and timer lists. Signed-off-by: Alex Bligh --- include/qemu/timer.h |6 + qemu-timer.c

[Qemu-devel] [RFC] [PATCHv10 21/31] aio / timers: Remove alarm timers

2013-08-11 Thread Alex Bligh
Remove alarm timers from qemu-timers.c now we use g_poll / ppoll instead. Signed-off-by: Alex Bligh --- include/qemu/timer.h |3 - main-loop.c |4 - qemu-timer.c | 500 +- vl.c |4 +- 4 files changed

[Qemu-devel] [RFC] [PATCHv10 07/31] aio / timers: Make qemu_run_timers and qemu_run_all_timers return progress

2013-08-11 Thread Alex Bligh
Make qemu_run_timers and qemu_run_all_timers return progress so that aio_poll etc. can determine whether a timer has been run. Signed-off-by: Alex Bligh --- include/qemu/timer.h | 21 +++-- qemu-timer.c | 18 -- 2 files changed, 31 insertions(+), 8

[Qemu-devel] [RFC] [PATCHv10 23/31] aio / timers: Add qemu_clock_get_ms and qemu_clock_get_ms

2013-08-11 Thread Alex Bligh
Add utility functions qemu_clock_get_ms and qemu_clock_get_us Signed-off-by: Alex Bligh --- include/qemu/timer.h | 28 1 file changed, 28 insertions(+) diff --git a/include/qemu/timer.h b/include/qemu/timer.h index 899a11a..8a154c2 100644 --- a/include/qemu

[Qemu-devel] [RFC] [PATCHv10 29/31] aio / timers: Add scripts/switch-timer-api

2013-08-11 Thread Alex Bligh
Add scripts/switch-timer-api to programatically rewrite source files to use the new timer system. Signed-off-by: Alex Bligh --- scripts/switch-timer-api | 178 ++ 1 file changed, 178 insertions(+) diff --git a/scripts/switch-timer-api b/scripts

[Qemu-devel] [PATCH] add qemu-img convert -C option (skip target volume creation)

2013-08-11 Thread Alex Bligh
specify through the qemu-img convert command line. Code: Author: Alexandre Derumier Signed-off-by: Alexandre Derumier Signed-off-by: Alex Bligh Documentaton: Author: Alex Bligh Signed-off-by: Alex Bligh --- qemu-img-cmds.hx |4 ++-- qemu-img.c | 37

[Qemu-devel] [RFC] [PATCHv10 05/31] aio / timers: add ppoll support with qemu_poll_ns

2013-08-11 Thread Alex Bligh
Add qemu_poll_ns which works like g_poll but takes a nanosecond timeout. Signed-off-by: Alex Bligh --- configure| 19 +++ include/qemu/timer.h | 12 qemu-timer.c | 24 3 files changed, 55 insertions(+) diff --git a

[Qemu-devel] [RFC] [PATCHv10 04/31] aio / timers: Consistent treatment of disabled clocks for deadlines

2013-08-11 Thread Alex Bligh
Make treatment of disabled clocks consistent in deadline calculation Signed-off-by: Alex Bligh --- qemu-timer.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qemu-timer.c b/qemu-timer.c index df8f12b..be29adf 100644 --- a/qemu-timer.c +++ b/qemu-timer.c @@ -264,7 +264,7

[Qemu-devel] [RFC] [PATCHv10 10/31] aio / timers: Add QEMUTimerListGroup and helper functions

2013-08-11 Thread Alex Bligh
Add QEMUTimerListGroup and helper functions, to represent a QEMUTimerList associated with each clock. Add a default QEMUTimerListGroup representing the default timer lists which are not associated with any other object (e.g. an AioContext as added by future patches). Signed-off-by: Alex Bligh

[Qemu-devel] [RFC] [PATCHv10 12/31] aio / timers: Add a notify callback to QEMUTimerList

2013-08-11 Thread Alex Bligh
Add a notify pointer to QEMUTimerList so it knows what to notify on a timer change. Signed-off-by: Alex Bligh --- async.c |7 ++- include/qemu/timer.h | 27 +++ qemu-timer.c | 31 --- 3 files changed, 53

Re: [Qemu-devel] [RFC] [PATCHv8 09/30] aio / timers: Add QEMUTimerListGroup and helper functions

2013-08-12 Thread Alex Bligh
Looks like Paolo is happy going with TimerListGroup for now. So I wrapped the array in a struct for v10. -- Alex Bligh

[Qemu-devel] [PATCHv2] add qemu-img convert -C option (skip target volume creation)

2013-08-12 Thread Alex Bligh
specify through the qemu-img convert command line. Code: Author: Alexandre Derumier Signed-off-by: Alexandre Derumier Signed-off-by: Alex Bligh Documentaton: Author: Alex Bligh Signed-off-by: Alex Bligh --- qemu-img-cmds.hx |4 ++-- qemu-img.c | 39

Re: [Qemu-devel] [PATCH] add qemu-img convert -C option (skip target volume creation)

2013-08-12 Thread Alex Bligh
t(int argc, char **argv) >> { >> -int c, ret = 0, n, n1, bs_n, bs_i, compress, cluster_size, >> cluster_sectors; >> +int c, ret = 0, n, n1, bs_n, bs_i, compress, cluster_size, >> cluster_sectors, skipcreate; > > This line is too long, please break it. Done in v2 just posted. -- Alex Bligh

Re: [Qemu-devel] [PATCHv2] add qemu-img convert -C option (skip target volume creation)

2013-08-12 Thread Alex Bligh
On 12 Aug 2013, at 10:03, Fam Zheng wrote: >> + " prior to running qemu-img)\n" > > Parenthesis not balanced. Otherwise, > > Reviewed-by: Fam Zheng Fixed in PATCHv3, just sent. -- Alex Bligh

[Qemu-devel] [PATCHv3] add qemu-img convert -C option (skip target volume creation)

2013-08-12 Thread Alex Bligh
specify through the qemu-img convert command line. Code: Author: Alexandre Derumier Signed-off-by: Alexandre Derumier Signed-off-by: Alex Bligh Documentaton: Author: Alex Bligh Signed-off-by: Alex Bligh --- qemu-img-cmds.hx |4 ++-- qemu-img.c | 39

Re: [Qemu-devel] [PATCHv3] add qemu-img convert -C option (skip target volume creation)

2013-08-12 Thread Alex Bligh
--On 12 August 2013 10:42:05 +0100 Alex Bligh wrote: Add a -C option to skip volume creation on qemu-img convert. This is useful for targets such as rbd / ceph, where the target volume may already exist; we cannot always rely on qemu-img convert to create the image, as dependent on the

<    1   2   3   4   5   6   7   8   9   10   >