mirror of https://gitee.com/openkylin/qemu.git
qapi patches for 2018-04-10
- Peter Xu: iotests: fix wait_until_completed() - Peter Xu: iothread: workaround glib bug which hangs qmp-test - Peter Xu: monitor: bind dispatch bh to iohandler context -----BEGIN PGP SIGNATURE----- Comment: Public key at http://people.redhat.com/eblake/eblake.gpg iQEcBAABCAAGBQJazLjdAAoJEKeha0olJ0NqyqAH/0L5cDk93CCK2mhIz/BOHM+m 5C3VaKtL1iLtH2sM25kq/ge8ZMX0ia3J0V1+In1upPMyKN3NzdbeQTwsTEwnVoJE A/kN5JVin0qo/GPh/QqRxevOKxjQdn6zSO1nSQHTQ2SOGBWE3EPuB1W2X1BMD/+H 5hD1TziRBeneO7cuQyxxGnZutYSlGB5118luuNgrnluPoZe3cK04PmfrVMvzUlvi GJqZFjYtYxJhRApO2N0MZ/WPKTxhiMN7md5tj8BjvzaT7h1V5fBf64Uiz3L6R1Na k8mYO9U3xjceEYL6swgBRsS/wjNF75aIxaSTeECk9kXUSPX+JHrhCB5LNxo8xwU= =AWvL -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/ericb/tags/pull-qapi-2018-04-10' into staging qapi patches for 2018-04-10 - Peter Xu: iotests: fix wait_until_completed() - Peter Xu: iothread: workaround glib bug which hangs qmp-test - Peter Xu: monitor: bind dispatch bh to iohandler context # gpg: Signature made Tue 10 Apr 2018 14:15:09 BST # gpg: using RSA key A7A16B4A2527436A # gpg: Good signature from "Eric Blake <eblake@redhat.com>" # gpg: aka "Eric Blake (Free Software Programmer) <ebb9@byu.net>" # gpg: aka "[jpeg image of size 6874]" # Primary key fingerprint: 71C2 CC22 B1C4 6029 27D2 F3AA A7A1 6B4A 2527 436A * remotes/ericb/tags/pull-qapi-2018-04-10: monitor: bind dispatch bh to iohandler context iothread: workaround glib bug which hangs qmp-test iotests: fix wait_until_completed() Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
26d6a7c87b
18
iothread.c
18
iothread.c
|
@ -117,16 +117,26 @@ static void iothread_instance_finalize(Object *obj)
|
|||
IOThread *iothread = IOTHREAD(obj);
|
||||
|
||||
iothread_stop(iothread);
|
||||
/*
|
||||
* Before glib2 2.33.10, there is a glib2 bug that GSource context
|
||||
* pointer may not be cleared even if the context has already been
|
||||
* destroyed (while it should). Here let's free the AIO context
|
||||
* earlier to bypass that glib bug.
|
||||
*
|
||||
* We can remove this comment after the minimum supported glib2
|
||||
* version boosts to 2.33.10. Before that, let's free the
|
||||
* GSources first before destroying any GMainContext.
|
||||
*/
|
||||
if (iothread->ctx) {
|
||||
aio_context_unref(iothread->ctx);
|
||||
iothread->ctx = NULL;
|
||||
}
|
||||
if (iothread->worker_context) {
|
||||
g_main_context_unref(iothread->worker_context);
|
||||
iothread->worker_context = NULL;
|
||||
}
|
||||
qemu_cond_destroy(&iothread->init_done_cond);
|
||||
qemu_mutex_destroy(&iothread->init_done_lock);
|
||||
if (!iothread->ctx) {
|
||||
return;
|
||||
}
|
||||
aio_context_unref(iothread->ctx);
|
||||
}
|
||||
|
||||
static void iothread_complete(UserCreatable *obj, Error **errp)
|
||||
|
|
|
@ -4467,7 +4467,7 @@ static void monitor_iothread_init(void)
|
|||
* have assumption to be run on main loop thread. It would be
|
||||
* nice that one day we can remove this assumption in the future.
|
||||
*/
|
||||
mon_global.qmp_dispatcher_bh = aio_bh_new(qemu_get_aio_context(),
|
||||
mon_global.qmp_dispatcher_bh = aio_bh_new(iohandler_get_aio_context(),
|
||||
monitor_qmp_bh_dispatcher,
|
||||
NULL);
|
||||
|
||||
|
|
|
@ -470,18 +470,15 @@ def cancel_and_wait(self, drive='drive0', force=False, resume=False):
|
|||
|
||||
def wait_until_completed(self, drive='drive0', check_offset=True):
|
||||
'''Wait for a block job to finish, returning the event'''
|
||||
completed = False
|
||||
while not completed:
|
||||
while True:
|
||||
for event in self.vm.get_qmp_events(wait=True):
|
||||
if event['event'] == 'BLOCK_JOB_COMPLETED':
|
||||
self.assert_qmp(event, 'data/device', drive)
|
||||
self.assert_qmp_absent(event, 'data/error')
|
||||
if check_offset:
|
||||
self.assert_qmp(event, 'data/offset', event['data']['len'])
|
||||
completed = True
|
||||
|
||||
self.assert_no_active_block_jobs()
|
||||
return event
|
||||
self.assert_no_active_block_jobs()
|
||||
return event
|
||||
|
||||
def wait_ready(self, drive='drive0'):
|
||||
'''Wait until a block job BLOCK_JOB_READY event'''
|
||||
|
|
Loading…
Reference in New Issue