From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jeff Guo Subject: [PATCH V9 0/5] add uevent mechanism in eal framework Date: Wed, 10 Jan 2018 17:12:19 +0800 Message-ID: <1515575544-2141-1-git-send-email-jia.guo@intel.com> References: <1515555037-9419-4-git-send-email-jia.guo@intel.com> Cc: konstantin.ananyev@intel.com, jblunck@infradead.org, shreyansh.jain@nxp.com, jingjing.wu@intel.com, dev@dpdk.org, jia.guo@intel.com, thomas@monjalon.net, helin.zhang@intel.com, motih@mellanox.com To: stephen@networkplumber.org, bruce.richardson@intel.com, ferruh.yigit@intel.com, gaetan.rivet@6wind.com Return-path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 6728C1B01C for ; Wed, 10 Jan 2018 10:13:31 +0100 (CET) In-Reply-To: <1515555037-9419-4-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 to detect all hotplug event for all driver,now the hotplug interrupt event 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: v9->v8: split the patch set into small and explicit patch v8->v7: 1.use rte_service to replace pthread management. 2.fix defind issue and copyright issue 3.fix some lock issue v7->v6: 1.modify vdev part according to the vdev rework 2.re-define and split the func into common and bus specific code 3.fix some incorrect issue. 4.fix the system hung after send packcet issue. v6->v5: 1.add hot plug policy, in eal, default handle to prepare hot plug work for all pci device, then let app to manage to deside which device need to hot plug. 2.modify to manage event callback in each device. 3.fix some system hung issue when igb_uio release. 4.modify the pci part to the bus-pci base on the bus rework. 5.add hot plug policy in app, show example to use hotplug list to manage to deside which device need to hot plug. v5->v4: 1.Move uevent monitor epolling from eal interrupt to eal device layer. 2.Redefine the eal device API for common, and distinguish between linux and bsd 3.Add failure handler helper api in bus layer.Add function of find device by name. 4.Replace of individual fd bind with single device, use a common fd to polling all device. 5.Add to register hot insertion monitoring and process, add function to auto bind driver befor user add device 6.Refine some coding style and typos issue 7.add new callback to process hot insertion v4->v3: 1.move uevent monitor api from eal interrupt to eal device layer. 2.create uevent type and struct in eal device. 3.move uevent handler for each driver to eal layer. 4.add uevent failure handler to process signal fault issue. 5.add example for request and use uevent monitoring in testpmd. v3->v2: 1.refine some return error 2.refine the string searching logic to avoid memory issue v2->v1: 1.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. 2.refine some typo error. Jeff Guo (5): eal: add uevent monitor api and callback func eal: add uevent pass and process function app/testpmd: use uevent to monitor hotplug pci_uio: add uevent hotplug failure handler in pci pci: add driver auto bind for hot insertion app/test-pmd/testpmd.c | 179 ++++++++++ app/test-pmd/testpmd.h | 9 + drivers/bus/pci/bsd/pci.c | 30 ++ drivers/bus/pci/linux/pci.c | 87 +++++ drivers/bus/pci/pci_common.c | 43 +++ drivers/bus/pci/pci_common_uio.c | 28 ++ drivers/bus/pci/private.h | 12 + drivers/bus/pci/rte_bus_pci.h | 25 ++ drivers/bus/vdev/vdev.c | 36 ++ lib/librte_eal/bsdapp/eal/eal_dev.c | 36 ++ .../bsdapp/eal/include/exec-env/rte_dev.h | 39 +++ lib/librte_eal/common/eal_common_bus.c | 30 ++ lib/librte_eal/common/eal_common_dev.c | 150 +++++++++ lib/librte_eal/common/include/rte_bus.h | 71 ++++ lib/librte_eal/common/include/rte_dev.h | 119 +++++++ lib/librte_eal/linuxapp/eal/Makefile | 3 +- lib/librte_eal/linuxapp/eal/eal_dev.c | 375 +++++++++++++++++++++ .../linuxapp/eal/include/exec-env/rte_dev.h | 39 +++ lib/librte_eal/linuxapp/igb_uio/igb_uio.c | 6 + lib/librte_pci/rte_pci.c | 20 ++ lib/librte_pci/rte_pci.h | 17 + 21 files changed, 1353 insertions(+), 1 deletion(-) create mode 100644 lib/librte_eal/bsdapp/eal/eal_dev.c create mode 100644 lib/librte_eal/bsdapp/eal/include/exec-env/rte_dev.h create mode 100644 lib/librte_eal/linuxapp/eal/eal_dev.c create mode 100644 lib/librte_eal/linuxapp/eal/include/exec-env/rte_dev.h -- 2.7.4