mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2026-06-06 17:21:22 +00:00
DM: mevent_add/del refine for Linux
Unlike kqueue/kevent of BSD, the epoll of Linux could be add/del by using different API on the fly. This patch drops the notify used by mevent_add/del and call epoll_ctl to add/delete target fd. Only keeps global_head to track mevent added and makes the code logic in mevent_dispatch() a littel bit simpler. Another thing is related with epoll_ctl. If the target fd is regular fd which doesn't support epoll, epoll_ctl will return -1. When DM is start by systemd, the STDIO is not mapped to terminal, epoll_ctl on STDIO could return -1. Which block UOS boot. We only call mevent_add after confirm STDIO is mapped to terminal. Signed-off-by: Yin Fengwei <fengwei.yin@intel.com> Reviewed-by: Zhao Yakui <yakui.zhao@intel.com> Acked-by: Anthony Xu <anthony.xu@intel.com>
This commit is contained in:
@@ -691,12 +691,14 @@ virtio_console_add_backend(struct virtio_console *console,
|
||||
}
|
||||
|
||||
if (virtio_console_backend_can_read(be_type)) {
|
||||
be->evp = mevent_add(fd, EVF_READ,
|
||||
virtio_console_backend_read, be);
|
||||
if (be->evp == NULL) {
|
||||
WPRINTF(("vtcon: mevent_add failed\n"));
|
||||
error = -1;
|
||||
goto out;
|
||||
if (isatty(fd)) {
|
||||
be->evp = mevent_add(fd, EVF_READ,
|
||||
virtio_console_backend_read, be);
|
||||
if (be->evp == NULL) {
|
||||
WPRINTF(("vtcon: mevent_add failed\n"));
|
||||
error = -1;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -267,8 +267,11 @@ static void
|
||||
uart_opentty(struct uart_vdev *uart)
|
||||
{
|
||||
ttyopen(&uart->tty);
|
||||
uart->mev = mevent_add(uart->tty.fd, EVF_READ, uart_drain, uart);
|
||||
assert(uart->mev != NULL);
|
||||
if (isatty(uart->tty.fd)) {
|
||||
uart->mev = mevent_add(uart->tty.fd, EVF_READ,
|
||||
uart_drain, uart);
|
||||
assert(uart->mev != NULL);
|
||||
}
|
||||
}
|
||||
|
||||
static uint8_t
|
||||
|
||||
Reference in New Issue
Block a user