summaryrefslogtreecommitdiff
path: root/trace-events
diff options
context:
space:
mode:
authorStefan Hajnoczi <stefanha@redhat.com>2016-12-01 19:26:42 +0000
committerStefan Hajnoczi <stefanha@redhat.com>2017-01-03 16:38:48 +0000
commit4a1cba3802554a3b077d436002519ff1fb0c18bf (patch)
tree57a8294b21598e4176e88ba91e6be74e057a8958 /trace-events
parentf6a51c84cdc97e0178aab7690788d3891d2fcf0a (diff)
downloadqemu-4a1cba3802554a3b077d436002519ff1fb0c18bf.tar.gz
aio: add polling mode to AioContext
The AioContext event loop uses ppoll(2) or epoll_wait(2) to monitor file descriptors or until a timer expires. In cases like virtqueues, Linux AIO, and ThreadPool it is technically possible to wait for events via polling (i.e. continuously checking for events without blocking). Polling can be faster than blocking syscalls because file descriptors, the process scheduler, and system calls are bypassed. The main disadvantage to polling is that it increases CPU utilization. In classic polling configuration a full host CPU thread might run at 100% to respond to events as quickly as possible. This patch implements a timeout so we fall back to blocking syscalls if polling detects no activity. After the timeout no CPU cycles are wasted on polling until the next event loop iteration. The run_poll_handlers_begin() and run_poll_handlers_end() trace events are added to aid performance analysis and troubleshooting. If you need to know whether polling mode is being used, trace these events to find out. Note that the AioContext is now re-acquired before disabling notify_me in the non-polling case. This makes the code cleaner since notify_me was enabled outside the non-polling AioContext release region. This change is correct since it's safe to keep notify_me enabled longer (disabling is an optimization) but potentially causes unnecessary event_notifer_set() calls. I think the chance of performance regression is small here. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Message-id: 20161201192652.9509-4-stefanha@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'trace-events')
-rw-r--r--trace-events4
1 files changed, 4 insertions, 0 deletions
diff --git a/trace-events b/trace-events
index f74e1d3d22..7fe3a1b0e8 100644
--- a/trace-events
+++ b/trace-events
@@ -25,6 +25,10 @@
#
# The <format-string> should be a sprintf()-compatible format string.
+# aio-posix.c
+run_poll_handlers_begin(void *ctx, int64_t max_ns) "ctx %p max_ns %"PRId64
+run_poll_handlers_end(void *ctx, bool progress) "ctx %p progress %d"
+
# thread-pool.c
thread_pool_submit(void *pool, void *req, void *opaque) "pool %p req %p opaque %p"
thread_pool_complete(void *pool, void *req, void *opaque, int ret) "pool %p req %p opaque %p ret %d"