From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Guo, Jia" Subject: Re: [PATCH V14 1/3] eal: add uevent monitor api and callback func Date: Fri, 2 Feb 2018 18:45:30 +0800 Message-ID: <8c67f41f-938a-c8b4-5152-254f261b9686@intel.com> References: <1516938577-27662-3-git-send-email-jia.guo@intel.com> <1517314860-8097-1-git-send-email-jia.guo@intel.com> <20180130164436.5d8babcf@xeon-e3> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Cc: bruce.richardson@intel.com, gaetan.rivet@6wind.com, jingjing.wu@intel.com, thomas@monjalon.net, motih@mellanox.com, ferruh.yigit@intel.com, konstantin.ananyev@intel.com, jblunck@infradead.org, shreyansh.jain@nxp.com, dev@dpdk.org, helin.zhang@intel.com, harry.van.haaren@intel.com, jianfeng.tan@intel.com To: Stephen Hemminger Return-path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id C2BE7728E for ; Fri, 2 Feb 2018 11:45:34 +0100 (CET) In-Reply-To: <20180130164436.5d8babcf@xeon-e3> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 1/31/2018 8:44 AM, Stephen Hemminger wrote: > On Tue, 30 Jan 2018 20:20:58 +0800 > Jeff Guo wrote: > >> + memset(&ep_kernel, 0, sizeof(struct epoll_event)); >> + ep_kernel.events = EPOLLIN | EPOLLPRI | EPOLLRDHUP | EPOLLHUP; >> + ep_kernel.data.fd = netlink_fd; >> + if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, netlink_fd, >> + &ep_kernel) < 0) { >> + RTE_LOG(ERR, EAL, "error addding fd to epoll: %m\n"); >> + goto out; >> + } >> + >> + while (!service_exit) { >> + int fdcount; >> + struct epoll_event ev[1]; >> + >> + fdcount = epoll_wait(fd_ep, ev, 1, -1); >> + if (fdcount < 0) { >> + if (errno != EINTR) >> + RTE_LOG(ERR, EAL, "error receiving uevent " >> + "message: %m\n"); >> + continue; >> + } >> + >> + /* epoll_wait has at least one fd ready to read */ >> + if (dev_uev_process(ev, fdcount) < 0) { >> + if (errno != EINTR) >> + RTE_LOG(ERR, EAL, "error processing uevent " >> + "message: %m\n"); >> + } >> + } > What is the point of the extra epoll here? > Why not just make netlink_fd blocking and do recv? > Rather than having two syscalls per event. if device event monitor only monitor a netlink fd, that might be right not need to add extra epoll, let me think about that if it is need to restore for future advance or just make it simpler. thanks , stephen.