From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id B9AB31B6D5 for ; Tue, 3 Apr 2018 12:35:02 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Apr 2018 03:35:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,400,1517904000"; d="scan'208";a="42986457" Received: from jeffguo-z170x-ud5.sh.intel.com (HELO localhost.localdomain) ([10.67.104.10]) by fmsmga004.fm.intel.com with ESMTP; 03 Apr 2018 03:34:58 -0700 From: Jeff Guo To: stephen@networkplumber.org, bruce.richardson@intel.com, ferruh.yigit@intel.com, konstantin.ananyev@intel.com, gaetan.rivet@6wind.com, jingjing.wu@intel.com, thomas@monjalon.net, motih@mellanox.com, harry.van.haaren@intel.com, jianfeng.tan@intel.com Cc: jblunck@infradead.org, shreyansh.jain@nxp.com, dev@dpdk.org, jia.guo@intel.com, helin.zhang@intel.com Date: Tue, 3 Apr 2018 18:33:55 +0800 Message-Id: <1522751639-2315-1-git-send-email-jia.guo@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1522339205-27698-5-git-send-email-jia.guo@intel.com> References: <1522339205-27698-5-git-send-email-jia.guo@intel.com> Subject: [dpdk-dev] [PATCH V18 0/4] add device event monitor framework X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Apr 2018 10:35:03 -0000 About hot plug in dpdk, We already have proactive way to add/remove devices through APIs (rte_eal_hotplug_add/remove), and also have fail-safe driver to offload the fail-safe work from the app user. But there are still lack of a general mechanism to monitor 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 like below. 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 device event monitor framework: add several general api to enable uevent monitoring. c.show example how to use uevent monitor enable uevent monitoring in testpmd to show device event monitor machenism usage. TODO: failure handler mechanism for hot plug and driver auto bind for hot insertion. that would let the next hot plug patch set to cover. patchset history: v18->v17: 1.add feature announcement in release document, fix bsp compile issue. 2.refine socket configuration. 3.remove hotplug policy and detach/attach process from testpmd, let it focus on the device event monitoring which the patch set introduced. v17->v16: 1.add related part of the interrupt handle type adding. 2.add new API into map, fix typo issue, add (void*)-1 value for unregister all callback 3.add new file into meson.build, modify coding sytle and add print info, delete unused part. 4.unregister all user's callback when stop event monitor v16->v15: 1.remove some linux related code out of eal common layer 2.fix some uneasy readble issue. v15->v14: 1.use exist eal interrupt epoll to replace of rte service usage for monitor thread, 2.add new device event handle type in eal interrupt. 3.remove the uevent type check and any policy from eal, let it check and management in user's callback. 4.add "--hot-plug" configure parameter in testpmd to switch the hotplug feature. v14->v13: 1.add __rte_experimental on function defind and fix bsd build issue v13->v12: 1.fix some logic issue and null check issue 2.fix monitor stop func issue v12->v11: 1.identify null param in callback for monitor all devices uevent v11->v10: 1:modify some typo and add experimental tag in new file. 2:modify callback register calling. v10->v9: 1.fix prefix issue. 2.use a common callback lists for all device and all type to replace add callback parameter into device struct. 3.delete some unuse part. 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_uioome typo error.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 (4): eal: add device event handle in interrupt thread eal: add device event monitor framework eal/linux: uevent parse and process app/testpmd: enable device hotplug monitoring app/test-pmd/parameters.c | 5 +- app/test-pmd/testpmd.c | 112 +++++++++++- app/test-pmd/testpmd.h | 2 + doc/guides/rel_notes/release_18_05.rst | 9 + doc/guides/testpmd_app_ug/run_app.rst | 4 + lib/librte_eal/bsdapp/eal/Makefile | 1 + lib/librte_eal/bsdapp/eal/eal_dev.c | 21 +++ lib/librte_eal/bsdapp/eal/meson.build | 1 + lib/librte_eal/common/eal_common_dev.c | 168 ++++++++++++++++++ lib/librte_eal/common/eal_private.h | 15 ++ lib/librte_eal/common/include/rte_dev.h | 94 ++++++++++ lib/librte_eal/common/include/rte_eal_interrupts.h | 1 + lib/librte_eal/linuxapp/eal/Makefile | 1 + lib/librte_eal/linuxapp/eal/eal_dev.c | 196 +++++++++++++++++++++ lib/librte_eal/linuxapp/eal/eal_interrupts.c | 11 +- lib/librte_eal/linuxapp/eal/meson.build | 1 + lib/librte_eal/rte_eal_version.map | 8 + test/test/test_interrupts.c | 39 +++- 18 files changed, 684 insertions(+), 5 deletions(-) create mode 100644 lib/librte_eal/bsdapp/eal/eal_dev.c create mode 100644 lib/librte_eal/linuxapp/eal/eal_dev.c -- 2.7.4