From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jeff Guo Subject: [PATCH v4 0/2] add uevent monitor for hot plug Date: Sun, 3 Sep 2017 23:49:43 +0800 Message-ID: <1504453785-15735-1-git-send-email-jia.guo@intel.com> References: <1498712510-44217-2-git-send-email-jia.guo@intel.com> Cc: dev@dpdk.org, gaetan.rivet@6wind.com, shreyansh.jain@nxp.com, jblunck@infradead.org, helin.zhang@intel.com, ferruh.yigit@intel.com, konstantin.ananyev@intel.com, thomas@monjalon.net, jingjing.wu@intel.com, jia.guo@intel.com To: stephen@networkplumber.org, bruce.richardson@intel.com Return-path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 799FE7CB5 for ; Sun, 3 Sep 2017 17:49:04 +0200 (CEST) In-Reply-To: <1498712510-44217-2-git-send-email-jia.guo@intel.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" So far, about hot plug in dpdk, we already have hot plug add/remove api and fail-safe driver to offload the fail-safe work from the app user. But there are still lack of a general event api, since the interrupt event, which hot plug related with, is diversity between each device and driver, such as mlx4, pci driver and others. Use the hot removal event for example, pci drivers not all exposure the remove interrupt, so in order to make user to easy use the hot plug feature for pci driver, something must be done to detect the remove event at the kernel level and offer a new line of interrupt to the user land. Base on the uevent of kobject mechanism in kernel, we could use it to benefit for monitoring the hot plug status of the device which not only uio/vfio of pci bus devices, but also other, such as cpu/usb/pci-express bus devices. The idea is comming as bellow. a.The uevent message form FD monitoring which will be useful. remove@/devices/pci0000:80/0000:80:02.2/0000:82:00.0/0000:83:03.0/0000:84:00.2/uio/uio2 ACTION=remove DEVPATH=/devices/pci0000:80/0000:80:02.2/0000:82:00.0/0000:83:03.0/0000:84:00.2/uio/uio2 SUBSYSTEM=uio MAJOR=243 MINOR=2 DEVNAME=uio2 SEQNUM=11366 b.add uevent monitoring machanism: add several general api to enable uevent monitoring. c.add common uevent handler and uevent failure handler uevent of device should be handler at bus or device layer, and the memory read and write failure when hot removal should be handle correctly before detach behaviors. d.show example how to use uevent monitor enable uevent monitoring in testpmd or fail-safe to show usage. patchset history: v4->v3: move uevent monitor api from eal interrupt to eal device layer. create uevent type and struct in eal device. move uevent handler for each driver to eal layer. add uevent failure handler to process signal fault issue. add example for request and use uevent monitoring in testpmd. v3->v2: refine some return error refine the string searching logic to avoid memory issue v2->v1: remove global variables of hotplug_fd, add uevent_fd in rte_intr_handle to let each pci device self maintain it fd, to fix dual device fd issue. refine some typo error. Jeff Guo (2): eal: add uevent monitor for hot plug app/testpmd: use uevent to monitor hot removal app/test-pmd/testpmd.c | 62 ++++++ lib/librte_eal/common/eal_common_dev.c | 248 ++++++++++++++++++++- lib/librte_eal/common/eal_common_pci.c | 20 ++ lib/librte_eal/common/eal_private.h | 14 ++ lib/librte_eal/common/include/rte_dev.h | 136 +++++++++++ lib/librte_eal/common/include/rte_pci.h | 17 ++ lib/librte_eal/linuxapp/eal/eal_interrupts.c | 28 ++- lib/librte_eal/linuxapp/eal/eal_pci_init.h | 4 + lib/librte_eal/linuxapp/eal/eal_pci_uio.c | 62 ++++++ .../linuxapp/eal/include/exec-env/rte_interrupts.h | 2 +- 10 files changed, 586 insertions(+), 7 deletions(-) -- 2.7.4