mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-19 20:22:46 +00:00
IOC mediator: fix IOC mediator blocks acrn-dm shutdown flow
This patch resolves IOC mediator deinit function is blocked due to IOC mediator core thread enters into sleep by epoll_wait, then pthread_join cannot return. Trigger an event to wakeup core thread when IOC mediator deinit is invoked. Signed-off-by: Yuan Liu <yuan1.liu@intel.com> Reviewed-by: Liang Yang <liang3.yang@intel.com> Acked-by: Yu Wang <yu1.wang@intel.com>
This commit is contained in:
parent
159d57b703
commit
b7436272e7
@ -973,6 +973,10 @@ ioc_process_events(struct ioc_dev *ioc, enum ioc_ch_id id)
|
||||
return;
|
||||
}
|
||||
|
||||
/* IOC_E_KNOCK event is only used to wakeup core thread */
|
||||
if (evt == IOC_E_KNOCK)
|
||||
return;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(ioc_state_tbl); i++) {
|
||||
if (evt == ioc_state_tbl[i].evt &&
|
||||
ioc->state == ioc_state_tbl[i].cur_stat) {
|
||||
@ -1154,7 +1158,7 @@ ioc_core_thread(void *arg)
|
||||
}
|
||||
|
||||
/* Start to epoll wait loop */
|
||||
for (;;) {
|
||||
while (!ioc->closing) {
|
||||
n = epoll_wait(ioc->epfd, eventlist, IOC_MAX_EVENTS, -1);
|
||||
if (n < 0 && errno != EINTR) {
|
||||
DPRINTF("ioc epoll wait error:%s, exit ioc core\r\n",
|
||||
@ -1284,6 +1288,7 @@ ioc_kill_workers(struct ioc_dev *ioc)
|
||||
ioc->closing = 1;
|
||||
|
||||
/* Stop IOC core thread */
|
||||
ioc_update_event(ioc->evt_fd, IOC_E_KNOCK);
|
||||
close(ioc->epfd);
|
||||
ioc->epfd = IOC_INIT_FD;
|
||||
pthread_join(ioc->tid, NULL);
|
||||
|
@ -659,7 +659,8 @@ enum ioc_event_type {
|
||||
IOC_E_RAM_REFRESH,
|
||||
IOC_E_HB_INACTIVE,
|
||||
IOC_E_SHUTDOWN,
|
||||
IOC_E_RESUME
|
||||
IOC_E_RESUME,
|
||||
IOC_E_KNOCK,
|
||||
};
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user