2a239e6e | 20-Feb-2019 |
Kevin Wolf <kwolf@redhat.com> |
io: Remove redundant read/write_coroutine assignments
qio_channel_yield() now updates ioc->read_write/coroutine and calls qio_channel_set_aio_fd_handlers(), so the code in the handlers has become re
io: Remove redundant read/write_coroutine assignments
qio_channel_yield() now updates ioc->read_write/coroutine and calls qio_channel_set_aio_fd_handlers(), so the code in the handlers has become redundant and can be removed.
This does not make a difference in intermediate states because aio_co_wake() really enters the coroutine immediately here: These handlers are never run in coroutine context, and we're in the right AioContext because qio_channel_attach_aio_context() asserts that the handlers are inactive.
To make these conditions more obvious, assert the right AioContext.
Suggested-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
show more ...
|
dbb44504 | 11-Feb-2019 |
Daniel P. Berrangé <berrange@redhat.com> |
io: add qio_task_wait_thread to join with a background thread
Add the ability for a caller to wait for completion of the background thread to synchronously dispatch its result, without needing to wa
io: add qio_task_wait_thread to join with a background thread
Add the ability for a caller to wait for completion of the background thread to synchronously dispatch its result, without needing to wait for the main loop to run the idle callback.
This method needs very careful usage to avoid a dangerous race condition with the free'ing of the task. The completion callback is normally invoked from an idle callback registered with the main loop context. The qio_task_wait_thread method must only be called if the completion callback has not yet run. The only safe way to achieve this is to run the qio_task_wait_thread method from the thread that executes the main loop.
It is generally a bad idea to use this method since it will block execution of the main loop, however, the design of the character devices and its usage from vhostuser already requires blocking execution.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20190211182442.8542-3-berrange@redhat.com> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
show more ...
|
8005fdd8 | 05-Mar-2018 |
Peter Xu <peterx@redhat.com> |
qio: non-default context for async conn
We have worked on qio_task_run_in_thread() already. Further, let all the qio channel APIs use that context.
Signed-off-by: Peter Xu <peterx@redhat.com> Sign
qio: non-default context for async conn
We have worked on qio_task_run_in_thread() already. Further, let all the qio channel APIs use that context.
Signed-off-by: Peter Xu <peterx@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
show more ...
|
a17536c5 | 05-Mar-2018 |
Peter Xu <peterx@redhat.com> |
qio: non-default context for threaded qtask
qio_task_run_in_thread() allows main thread to run blocking operations in the background. However it has an assumption on that it's always working with th
qio: non-default context for threaded qtask
qio_task_run_in_thread() allows main thread to run blocking operations in the background. However it has an assumption on that it's always working with the default context. This patch tries to allow the threaded QIO task framework to run with non-default gcontext.
Currently no functional change so far, so the QIOTasks are still always running on main context.
Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Signed-off-by: Peter Xu <peterx@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
show more ...
|
938c8b79 | 05-Mar-2018 |
Peter Xu <peterx@redhat.com> |
qio: store gsources for net listeners
Originally we were storing the GSources tag IDs. That'll be not enough if we are going to support non-default gcontext for QIO code. Switch to GSources withou
qio: store gsources for net listeners
Originally we were storing the GSources tag IDs. That'll be not enough if we are going to support non-default gcontext for QIO code. Switch to GSources without changing anything real. Now we still always pass in NULL, which means the default gcontext.
Signed-off-by: Peter Xu <peterx@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
show more ...
|
315409c7 | 05-Mar-2018 |
Peter Xu <peterx@redhat.com> |
qio: introduce qio_channel_add_watch_{full|source}
Firstly, introduce an internal qio_channel_add_watch_full(), which enhances qio_channel_add_watch() that context can be specified.
Then add a new
qio: introduce qio_channel_add_watch_{full|source}
Firstly, introduce an internal qio_channel_add_watch_full(), which enhances qio_channel_add_watch() that context can be specified.
Then add a new API wrapper qio_channel_add_watch_source() to return a GSource pointer rather than a tag ID.
Note that the _source() call will keep a reference of GSource so that callers need to unref them explicitly when finished using the GSource.
Signed-off-by: Peter Xu <peterx@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
show more ...
|