qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [RFC] [PATCHv8 00/30] aio / timers: Add AioContext timers and use ppoll
@ 2013-08-08 21:41 Alex Bligh
  2013-08-08 21:41 ` [Qemu-devel] [RFC] [PATCHv8 01/30] aio / timers: Rename qemu_new_clock and expose clock types Alex Bligh
                   ` (34 more replies)
  0 siblings, 35 replies; 91+ messages in thread
From: Alex Bligh @ 2013-08-08 21:41 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Anthony Liguori, Alex Bligh, liu ping fan,
	Stefan Hajnoczi, Paolo Bonzini, MORITA Kazutaka, rth

This patch series adds support for timers attached to an AioContext clock
which get called within aio_poll.

In doing so it removes alarm timers and moves to use ppoll where possible.

This patch set 'sort of' passes make check (see below for caveat)
including a new test harness for the aio timers, but has not been
tested much beyond that. In particular, the win32 changes have not
even been compile tested. Equally, alterations to use_icount
are untested.

Caveat: I have had to alter tests/test-aio.c so the following error
no longer occurs.

ERROR:tests/test-aio.c:346:test_wait_event_notifier_noflush: assertion failed: (aio_poll(ctx, false))

As gar as I can tell, this check was incorrect, in that it checking
aio_poll makes progress when in fact it should not make progress. I
fixed an issue where aio_poll was (as far as I can tell) wrongly
returning true on a timeout, and that generated this error.

Note also the comment on patch 18 in relation to a possible bug
in cpus.c.

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 of giving a provably correct conversion.

This patch set has been compile tested & make check tested on a
'christmas-tree' configuration, meaning a configuration with every
--enable- value tested that can be easily configured on Ubuntu Precise,
after application of each patch.

Changes since v7:
* Rebase to master 6fdf98f281f85ae6e2883bed2f691bcfe33b1f9f
* Add qemu_clock_get_ms and qemu_clock_get_ms
* Rename qemu_get_clock to qemu_clock_ptr
* Reorder qemu-timer.h to utilise the legacy API
* Hide qemu_clock_new & qemu_clock_free
* Rename default_timerlist to main_loop_timerlist
* Remove main_loop_timerlist once main_loop_tlg is in
* Add script to convert to new API
* Make rtc_clock use new API
* Convert tests/test-aio to use new API
* Run script on entire source code
* Remove legacy API functions

Changes since v6:
* Fix build failure in vnc-auth-sasl.c
* Split first patch into 3
* Add assert on timerlist_free
* Fix ==/= error on qemu_clock_use_for_deadline
* Remove unnecessary cast in aio_timerlist_notify
* Fix bad deadline comparison in aio_ctx_check
* Add assert to timerlist_new_from_clock to check init_clocks
* Use timer_list not tl
* Change default_timerlistgroup to main_loop_timerlistgroup
* Add comment on commit for qemu_clock_use_for_deadline
* Fixed various include file issues
* Convert *_has_timers and *_has_expired to return bool
* Make loop variable consistent when looping through clock types
* Add documentation to existing qemu_timer calls
* Remove qemu_clock_deadline and move to qemu_clock_deadline_ns

Changes since v5:
* Rebase onto master (b9ac5d9)
* Fix spacing in typedef QEMUTimerList
* Rename 'QEMUClocks' extern to 'qemu_clocks'

Changes since v4:
* Rename qemu_timerlist_ functions to timer_list (per Paolo Bonzini)
* Rename qemu_timer_.*timerlist.* to timer_ (per Paolo Bonzini)
* Use enum for QEMUClockType
* Put clocks into an array; remove global variables
* Introduce QEMUTimerListGroup - a timeliest of each type
* Add a QEMUTimerListGroup to AioContext
* Use a callback on timer modification, rather than binding in
  AioContext into the timeliest
* Make cpus.c iterate over all timerlists when it does a notify
* Make cpus.c icount timeout use soonest timeout
  across all timerlists

Changes since v3:
* Split up QEMUClock and QEMUClock list
* Improve commenting
* Fix comment in vl.c
* Change test/test-aio.c to reflect correct behaviour in aio_poll.

Changes since v2:
* Reordered to remove alarm timers last
* Added prctl(PR_SET_TIMERSLACK, 1, ...)
* Renamed qemu_g_poll_ns to qemu_poll_ns
* Moved declaration of above & drop glib types
* Do not use a global list of qemu clocks
* Add AioContext * to QEMUClock
* 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 (30):
  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 for deadlines
  aio / timers: add ppoll support with qemu_poll_ns
  aio / timers: Add prctl(PR_SET_TIMERSLACK, 1, ...) to reduce timer
    slack
  aio / timers: Make qemu_run_timers and qemu_run_all_timers return
    progress
  aio / timers: Split QEMUClock into QEMUClock and QEMUTimerList
  aio / timers: Untangle include files
  aio / timers: Add QEMUTimerListGroup and helper functions
  aio / timers: Add QEMUTimerListGroup to AioContext
  aio / timers: Add a notify callback to QEMUTimerList
  aio / timers: aio_ctx_prepare sets timeout from AioContext timers
  aio / timers: Add aio_timer_new wrapper
  aio / timers: Convert aio_poll to use AioContext timers' deadline
  aio / timers: Convert mainloop to use timeout
  aio / timers: On timer modification, qemu_notify or aio_notify
  aio / timers: Introduce new API qemu_timer_new and friends
  aio / timers: Use all timerlists in icount warp calculations
  aio / timers: Add documentation and new format calls
  aio / timers: Remove alarm timers
  aio / timers: Remove legacy qemu_clock_deadline &
    qemu_timerlist_deadline
  aio / timers: Add qemu_clock_get_ms and qemu_clock_get_ms
  aio / timers: Rearrange timer.h & make legacy functions call
    non-legacy
  aio / timers: Remove main_loop_timerlist
  aio / timers: Convert rtc_clock to be a QEMUClockType
  aio / timers: convert block_job_sleep_ns and co_sleep_ns to new API
  aio / timers: Add test harness for AioContext timers
  aio / timers: Add scripts/switch-timer-api
  aio / timers: Switch entire codebase to the new timer API
  aio / timers: Remove legacy interface

 aio-posix.c                 |   20 +-
 aio-win32.c                 |   22 +-
 arch_init.c                 |   12 +-
 async.c                     |   20 +-
 audio/audio.c               |    6 +-
 audio/noaudio.c             |    4 +-
 audio/spiceaudio.c          |    4 +-
 audio/wavaudio.c            |    2 +-
 backends/baum.c             |   12 +-
 block.c                     |   14 +-
 block/backup.c              |    4 +-
 block/commit.c              |    2 +-
 block/iscsi.c               |   14 +-
 block/mirror.c              |   10 +-
 block/qed.c                 |   10 +-
 block/stream.c              |    2 +-
 blockdev.c                  |    2 +-
 blockjob.c                  |    4 +-
 configure                   |   37 ++
 cpus.c                      |  138 +++++---
 dma-helpers.c               |    1 +
 hmp.c                       |    8 +-
 hw/acpi/core.c              |    8 +-
 hw/acpi/piix4.c             |    2 +-
 hw/alpha/typhoon.c          |    2 +-
 hw/arm/omap1.c              |   52 +--
 hw/arm/pxa2xx.c             |   61 ++--
 hw/arm/spitz.c              |    6 +-
 hw/arm/stellaris.c          |   10 +-
 hw/arm/strongarm.c          |   34 +-
 hw/audio/adlib.c            |    2 +-
 hw/audio/intel-hda.c        |    4 +-
 hw/audio/sb16.c             |    6 +-
 hw/block/fdc.c              |    6 +-
 hw/block/nvme.c             |   20 +-
 hw/block/pflash_cfi01.c     |    2 +-
 hw/block/pflash_cfi02.c     |   10 +-
 hw/bt/hci-csr.c             |    4 +-
 hw/bt/hci.c                 |   38 +-
 hw/bt/l2cap.c               |    8 +-
 hw/char/cadence_uart.c      |   12 +-
 hw/char/serial.c            |   22 +-
 hw/char/virtio-serial-bus.c |   10 +-
 hw/core/ptimer.c            |   18 +-
 hw/display/qxl-logger.c     |    2 +-
 hw/display/qxl.c            |    2 +-
 hw/display/vga.c            |    6 +-
 hw/dma/pl330.c              |    6 +-
 hw/dma/rc4030.c             |    4 +-
 hw/dma/soc_dma.c            |    8 +-
 hw/dma/xilinx_axidma.c      |    1 +
 hw/i386/kvm/apic.c          |    2 +-
 hw/i386/kvm/i8254.c         |    6 +-
 hw/i386/xen_domainbuild.c   |    6 +-
 hw/ide/core.c               |    6 +-
 hw/input/hid.c              |   10 +-
 hw/input/lm832x.c           |    8 +-
 hw/input/tsc2005.c          |   14 +-
 hw/input/tsc210x.c          |   30 +-
 hw/intc/apic.c              |   16 +-
 hw/intc/apic_common.c       |    2 +-
 hw/intc/armv7m_nvic.c       |   16 +-
 hw/intc/i8259.c             |    4 +-
 hw/mips/cputimer.c          |   12 +-
 hw/misc/arm_sysctl.c        |    2 +-
 hw/misc/macio/cuda.c        |   34 +-
 hw/misc/macio/macio.c       |    4 +-
 hw/misc/vfio.c              |   14 +-
 hw/net/dp8393x.c            |   20 +-
 hw/net/e1000.c              |   12 +-
 hw/net/lan9118.c            |    4 +-
 hw/net/pcnet-pci.c          |    4 +-
 hw/net/pcnet.c              |   10 +-
 hw/net/rtl8139.c            |   28 +-
 hw/net/virtio-net.c         |   20 +-
 hw/openrisc/cputimer.c      |   10 +-
 hw/ppc/ppc.c                |   64 ++--
 hw/ppc/ppc405_uc.c          |    8 +-
 hw/ppc/ppc_booke.c          |   10 +-
 hw/ppc/spapr.c              |    8 +-
 hw/sd/sdhci.c               |   28 +-
 hw/sparc64/sun4u.c          |   24 +-
 hw/timer/arm_mptimer.c      |   12 +-
 hw/timer/arm_timer.c        |    1 +
 hw/timer/cadence_ttc.c      |    6 +-
 hw/timer/etraxfs_timer.c    |    2 +-
 hw/timer/exynos4210_mct.c   |    3 +-
 hw/timer/exynos4210_pwm.c   |    1 +
 hw/timer/grlib_gptimer.c    |    2 +
 hw/timer/hpet.c             |   20 +-
 hw/timer/i8254.c            |   26 +-
 hw/timer/i8254_common.c     |    4 +-
 hw/timer/imx_epit.c         |    1 +
 hw/timer/imx_gpt.c          |    1 +
 hw/timer/lm32_timer.c       |    1 +
 hw/timer/m48t59.c           |   18 +-
 hw/timer/mc146818rtc.c      |   44 +--
 hw/timer/omap_gptimer.c     |   24 +-
 hw/timer/omap_synctimer.c   |    2 +-
 hw/timer/pl031.c            |   19 +-
 hw/timer/puv3_ost.c         |    1 +
 hw/timer/pxa2xx_timer.c     |   34 +-
 hw/timer/sh_timer.c         |    1 +
 hw/timer/slavio_timer.c     |    1 +
 hw/timer/tusb6010.c         |   12 +-
 hw/timer/twl92230.c         |   14 +-
 hw/timer/xilinx_timer.c     |    1 +
 hw/tpm/tpm_tis.c            |    1 +
 hw/usb/hcd-ehci.c           |   10 +-
 hw/usb/hcd-musb.c           |    6 +-
 hw/usb/hcd-ohci.c           |   12 +-
 hw/usb/hcd-uhci.c           |   15 +-
 hw/usb/hcd-xhci.c           |   26 +-
 hw/usb/host-libusb.c        |    6 +-
 hw/usb/host-linux.c         |    6 +-
 hw/usb/redirect.c           |   12 +-
 hw/virtio/virtio-balloon.c  |    8 +-
 hw/virtio/virtio-rng.c      |   14 +-
 hw/watchdog/wdt_i6300esb.c  |    6 +-
 hw/watchdog/wdt_ib700.c     |   10 +-
 hw/xtensa/pic_cpu.c         |   10 +-
 include/block/aio.h         |   23 ++
 include/block/block_int.h   |    1 +
 include/block/blockjob.h    |    2 +-
 include/block/coroutine.h   |    4 +-
 include/hw/acpi/acpi.h      |    2 +-
 include/qemu/ratelimit.h    |    2 +-
 include/qemu/timer.h        |  793 ++++++++++++++++++++++++++++++++++++++---
 include/sysemu/sysemu.h     |    2 +-
 main-loop.c                 |   51 ++-
 migration-exec.c            |    1 +
 migration-fd.c              |    1 +
 migration-tcp.c             |    1 +
 migration-unix.c            |    1 +
 migration.c                 |   17 +-
 monitor.c                   |    8 +-
 nbd.c                       |    1 +
 net/dump.c                  |    2 +-
 net/net.c                   |    1 +
 net/socket.c                |    1 +
 pc-bios/slof.bin            |  Bin 909720 -> 909720 bytes
 qemu-char.c                 |    2 +-
 qemu-coroutine-io.c         |    1 +
 qemu-coroutine-sleep.c      |   10 +-
 qemu-io-cmds.c              |    1 +
 qemu-nbd.c                  |    1 +
 qemu-timer.c                |  826 +++++++++++++++----------------------------
 qtest.c                     |   10 +-
 savevm.c                    |   22 +-
 scripts/switch-timer-api    |  178 ++++++++++
 slirp/if.c                  |    2 +-
 slirp/misc.c                |    1 +
 slirp/slirp.c               |    4 +-
 stubs/clock-warp.c          |    2 +-
 target-alpha/sys_helper.c   |   12 +-
 target-ppc/kvm.c            |    8 +-
 target-ppc/kvm_ppc.c        |    6 +-
 target-s390x/cpu.c          |    4 +-
 target-s390x/misc_helper.c  |    6 +-
 target-xtensa/op_helper.c   |    2 +-
 tests/libqtest.h            |   24 +-
 tests/test-aio.c            |  143 +++++++-
 tests/test-thread-pool.c    |    3 +
 thread-pool.c               |    1 +
 ui/console.c                |   30 +-
 ui/input.c                  |    6 +-
 ui/spice-core.c             |   10 +-
 ui/vnc-auth-sasl.h          |    1 +
 ui/vnc-auth-vencrypt.c      |    2 +-
 ui/vnc-ws.c                 |    1 +
 vl.c                        |   14 +-
 xen-all.c                   |   12 +-
 172 files changed, 2370 insertions(+), 1432 deletions(-)
 create mode 100755 scripts/switch-timer-api

-- 
1.7.9.5

^ permalink raw reply	[flat|nested] 91+ messages in thread

end of thread, other threads:[~2013-08-12 17:32 UTC | newest]

Thread overview: 91+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-08 21:41 [Qemu-devel] [RFC] [PATCHv8 00/30] aio / timers: Add AioContext timers and use ppoll Alex Bligh
2013-08-08 21:41 ` [Qemu-devel] [RFC] [PATCHv8 01/30] aio / timers: Rename qemu_new_clock and expose clock types Alex Bligh
2013-08-08 21:41 ` [Qemu-devel] [RFC] [PATCHv8 02/30] aio / timers: add qemu-timer.c utility functions Alex Bligh
2013-08-08 21:42 ` [Qemu-devel] [RFC] [PATCHv8 03/30] aio / timers: Consistent treatment of disabled clocks for deadlines Alex Bligh
2013-08-08 21:42 ` [Qemu-devel] [RFC] [PATCHv8 04/30] aio / timers: add ppoll support with qemu_poll_ns Alex Bligh
2013-08-08 21:42 ` [Qemu-devel] [RFC] [PATCHv8 05/30] aio / timers: Add prctl(PR_SET_TIMERSLACK, 1, ...) to reduce timer slack Alex Bligh
2013-08-09  8:53   ` Stefan Hajnoczi
2013-08-09 14:10     ` Alex Bligh
2013-08-08 21:42 ` [Qemu-devel] [RFC] [PATCHv8 06/30] aio / timers: Make qemu_run_timers and qemu_run_all_timers return progress Alex Bligh
2013-08-08 21:42 ` [Qemu-devel] [RFC] [PATCHv8 07/30] aio / timers: Split QEMUClock into QEMUClock and QEMUTimerList Alex Bligh
2013-08-09 10:03   ` Paolo Bonzini
2013-08-09 14:23     ` Alex Bligh
2013-08-09 14:28       ` Paolo Bonzini
2013-08-08 21:42 ` [Qemu-devel] [RFC] [PATCHv8 08/30] aio / timers: Untangle include files Alex Bligh
2013-08-08 21:42 ` [Qemu-devel] [RFC] [PATCHv8 09/30] aio / timers: Add QEMUTimerListGroup and helper functions Alex Bligh
2013-08-09 10:02   ` Paolo Bonzini
2013-08-09 14:27     ` Alex Bligh
2013-08-09 14:35       ` Paolo Bonzini
2013-08-09 14:47         ` Alex Bligh
2013-08-09 14:59           ` Paolo Bonzini
2013-08-10 11:05             ` Alex Bligh
2013-08-11  7:53               ` Paolo Bonzini
2013-08-11  8:29                 ` Alex Bligh
2013-08-12 17:27                   ` Paolo Bonzini
2013-08-12 17:32                     ` Alex Bligh
2013-08-12  6:53               ` Wenchao Xia
2013-08-12  7:08                 ` Alex Bligh
2013-08-09 15:09         ` Stefan Hajnoczi
2013-08-09 15:15           ` Paolo Bonzini
2013-08-10  3:27     ` liu ping fan
2013-08-10  8:38       ` Paolo Bonzini
2013-08-08 21:42 ` [Qemu-devel] [RFC] [PATCHv8 10/30] aio / timers: Add QEMUTimerListGroup to AioContext Alex Bligh
2013-08-08 21:42 ` [Qemu-devel] [RFC] [PATCHv8 11/30] aio / timers: Add a notify callback to QEMUTimerList Alex Bligh
2013-08-09  9:02   ` Stefan Hajnoczi
2013-08-09 14:16     ` Alex Bligh
2013-08-09 10:03   ` Paolo Bonzini
2013-08-09 14:28     ` Alex Bligh
2013-08-10 11:13     ` Alex Bligh
2013-08-08 21:42 ` [Qemu-devel] [RFC] [PATCHv8 12/30] aio / timers: aio_ctx_prepare sets timeout from AioContext timers Alex Bligh
2013-08-09 10:04   ` Paolo Bonzini
2013-08-09 14:30     ` Alex Bligh
2013-08-09 14:41       ` Paolo Bonzini
2013-08-09 14:55         ` Alex Bligh
2013-08-08 21:42 ` [Qemu-devel] [RFC] [PATCHv8 13/30] aio / timers: Add aio_timer_new wrapper Alex Bligh
2013-08-09 10:06   ` Paolo Bonzini
2013-08-09 14:32     ` Alex Bligh
2013-08-09 14:36       ` Paolo Bonzini
2013-08-09 14:51         ` Alex Bligh
2013-08-09 14:51           ` Paolo Bonzini
2013-08-09 14:57             ` Alex Bligh
2013-08-09 14:58               ` Paolo Bonzini
2013-08-09 22:57         ` Alex Bligh
2013-08-10  8:36           ` Paolo Bonzini
2013-08-08 21:42 ` [Qemu-devel] [RFC] [PATCHv8 14/30] aio / timers: Convert aio_poll to use AioContext timers' deadline Alex Bligh
2013-08-08 21:42 ` [Qemu-devel] [RFC] [PATCHv8 15/30] aio / timers: Convert mainloop to use timeout Alex Bligh
2013-08-09 10:07   ` Paolo Bonzini
2013-08-08 21:42 ` [Qemu-devel] [RFC] [PATCHv8 16/30] aio / timers: On timer modification, qemu_notify or aio_notify Alex Bligh
2013-08-09 10:08   ` Paolo Bonzini
2013-08-08 21:42 ` [Qemu-devel] [RFC] [PATCHv8 17/30] aio / timers: Introduce new API qemu_timer_new and friends Alex Bligh
2013-08-08 21:42 ` [Qemu-devel] [RFC] [PATCHv8 18/30] aio / timers: Use all timerlists in icount warp calculations Alex Bligh
2013-08-08 21:42 ` [Qemu-devel] [RFC] [PATCHv8 19/30] aio / timers: Add documentation and new format calls Alex Bligh
2013-08-08 21:42 ` [Qemu-devel] [RFC] [PATCHv8 20/30] aio / timers: Remove alarm timers Alex Bligh
2013-08-08 21:42 ` [Qemu-devel] [RFC] [PATCHv8 21/30] aio / timers: Remove legacy qemu_clock_deadline & qemu_timerlist_deadline Alex Bligh
2013-08-08 21:42 ` [Qemu-devel] [RFC] [PATCHv8 22/30] aio / timers: Add qemu_clock_get_ms and qemu_clock_get_ms Alex Bligh
2013-08-08 21:42 ` [Qemu-devel] [RFC] [PATCHv8 23/30] aio / timers: Rearrange timer.h & make legacy functions call non-legacy Alex Bligh
2013-08-08 22:12   ` Alex Bligh
2013-08-09  9:23   ` Stefan Hajnoczi
2013-08-09 14:18     ` Alex Bligh
2013-08-09 14:26       ` Paolo Bonzini
2013-08-08 21:42 ` [Qemu-devel] [RFC] [PATCHv8 24/30] aio / timers: Remove main_loop_timerlist Alex Bligh
2013-08-08 21:42 ` [Qemu-devel] [RFC] [PATCHv8 25/30] aio / timers: Convert rtc_clock to be a QEMUClockType Alex Bligh
2013-08-08 21:42 ` [Qemu-devel] [RFC] [PATCHv8 26/30] aio / timers: convert block_job_sleep_ns and co_sleep_ns to new API Alex Bligh
2013-08-08 21:42 ` [Qemu-devel] [RFC] [PATCHv8 27/30] aio / timers: Add test harness for AioContext timers Alex Bligh
2013-08-08 21:42 ` [Qemu-devel] [RFC] [PATCHv8 28/30] aio / timers: Add scripts/switch-timer-api Alex Bligh
2013-08-09 10:23   ` Paolo Bonzini
2013-08-09 14:34     ` Alex Bligh
2013-08-09 10:26   ` Paolo Bonzini
2013-08-09 14:35     ` Alex Bligh
2013-08-09 14:37       ` Paolo Bonzini
2013-08-08 21:42 ` [Qemu-devel] [RFC] [PATCHv8 29/30] aio / timers: Switch entire codebase to the new timer API Alex Bligh
2013-08-08 21:42 ` [Qemu-devel] [RFC] [PATCHv8 30/30] aio / timers: Remove legacy interface Alex Bligh
2013-08-08 21:46 ` [Qemu-devel] [RFC] [PATCHv8 00/30] aio / timers: Add AioContext timers and use ppoll Alex Bligh
2013-08-09  8:12 ` Jan Kiszka
2013-08-09  8:24   ` liu ping fan
2013-08-09  8:33     ` Jan Kiszka
2013-08-09 10:35   ` Alex Bligh
2013-08-09  9:41 ` Stefan Hajnoczi
2013-08-09 14:19   ` Alex Bligh
2013-08-09 14:27     ` Paolo Bonzini
2013-08-09 10:27 ` Paolo Bonzini
2013-08-09 11:18 ` Stefan Hajnoczi

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).