From 19fb5fa03c5c86c10dd3967aa67643177e27e2ca Mon Sep 17 00:00:00 2001 From: Yin Fengwei Date: Tue, 11 Dec 2018 10:22:16 +0800 Subject: [PATCH] dm: adjust the sequence of destroy client and wait for vm_loop exit To fix the issue that watchdog reset hang issue. At previous change, we assume the reset comes from guest. But watchdog reset or dm killed by signal is different. It's possible the vm_loop stick on ioreq attaching. The new fixing has two parts: - fixing from kernel side to remove the race issue in ioreq attach, req_complete_notify and client destory. - Move the client destroy before waiting of vm_loop exit. Tracked-On: #1986 Signed-off-by: Yin Fengwei Reviewed-by: Liu Shuo Acked-by: Yu Wang --- devicemodel/core/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devicemodel/core/main.c b/devicemodel/core/main.c index b7b280a5e..e804466c1 100644 --- a/devicemodel/core/main.c +++ b/devicemodel/core/main.c @@ -289,8 +289,8 @@ delete_cpu(struct vmctx *ctx, int vcpu) exit(1); } - pthread_join(mt_vmm_info[0].mt_thr, NULL); vm_destroy_ioreq_client(ctx); + pthread_join(mt_vmm_info[0].mt_thr, NULL); CPU_CLR_ATOMIC(vcpu, &cpumask); return CPU_EMPTY(&cpumask);