From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f194.google.com (mail-wr0-f194.google.com [209.85.128.194]) by dpdk.org (Postfix) with ESMTP id B582FF04 for ; Tue, 19 Sep 2017 20:44:04 +0200 (CEST) Received: by mail-wr0-f194.google.com with SMTP id n64so257668wrb.2 for ; Tue, 19 Sep 2017 11:44:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=cLRPjRfecGb6FLbdB46Q4WCM0Az0xy+hZEWzKvQfmxk=; b=qNFpu5cpskpMqlb7bPhFnY1yHIA8dP5j1eAz8Q9LIjYyDj4gNtXGNNVtcexR/sW2kl 6RSQHZczSvSZ0dfBjgXBnwofHeY+GDC+zicg2ahcbysy71v7iRT9u+PS/PHHWlTQUCN3 EoWxcbRApX4GXCI5uHdeZVCZbl7Cz6VUA4u+BxrkWTNfkarjzW2KNxfMxUGr9FNd9ap6 yU2yUly48mokO8hsorQa5Wd8u7tXSn6dhmWyaPxgSxF+m6/QJcoccbxBF3rCBAoGjJ8R qzCe+Bb0zKR6M6rKqYif/Y2BFdY+7K/aB2tsPYcKgLf5xMIS4duZ08R90gcHTbbZjIJQ 1Jpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=cLRPjRfecGb6FLbdB46Q4WCM0Az0xy+hZEWzKvQfmxk=; b=RCpWuOyxTnBYiCUFyqGhX59fFE8NFP+T+ptwD22fMHG45OP/na3DFLIhUrAf5lpbh+ Wy819ggyPnJ1dvp1bD6Hfvy+dT/TVmMd0+zeNzAcDNLarR6fPT1tnopReNPAQzQN3Qyy C9Xg5nXARibvTvGVMgBYB/cvY6/f2WKPgtBBdsbMtR1qAZ2q+DqjvjLQutk+PsEMri/l Ww7SLN5CTZsIFRCqL2RDmQ8aIJxVhdLKLB6WvyBRe8QG01jH8UmDpVjob1pr1VKQmFZA IZtCDypGmU1JDvVVilmzsARe2/ykAo09ZYZEcrbk2XcNEyt2EupFEEmUil952d4nTazG hLDg== X-Gm-Message-State: AHPjjUghP+pTLU5vAnm1wXoXW93p8PmiDh6YTRA1Qp8OLxNyXG9moyAv QlJZmFSdOIKoo8VCIMamB9WFqRu0S5NFzru93g2Gvw== X-Google-Smtp-Source: AOwi7QCZYFg1BR6dYD/ux35uGMoYTbSslAkkDLg7rH4t6Tedfje0nbwrcRX6wGD/uY+OIeiLfFkNKzbaCRJtSq1WQD0= X-Received: by 10.223.195.144 with SMTP id p16mr2471195wrf.123.1505846644225; Tue, 19 Sep 2017 11:44:04 -0700 (PDT) MIME-Version: 1.0 Sender: jblunck@gmail.com Received: by 10.28.67.132 with HTTP; Tue, 19 Sep 2017 11:44:03 -0700 (PDT) In-Reply-To: <1505880732-16539-1-git-send-email-jia.guo@intel.com> References: <1504453785-15735-3-git-send-email-jia.guo@intel.com> <1505880732-16539-1-git-send-email-jia.guo@intel.com> From: Jan Blunck Date: Tue, 19 Sep 2017 20:44:03 +0200 X-Google-Sender-Auth: NhbQZpgl4ozIyo26ZZqkIQmzYqo Message-ID: To: Jeff Guo Cc: Stephen Hemminger , Bruce Richardson , Ferruh Yigit , =?UTF-8?Q?Ga=C3=ABtan_Rivet?= , "Ananyev, Konstantin" , Shreyansh Jain , Jingjing Wu , dev , Thomas Monjalon , Helin Zhang Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH v5 0/2] add uevent monitor for hot plug 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, 19 Sep 2017 18:44:04 -0000 On Wed, Sep 20, 2017 at 6:12 AM, Jeff Guo wrote: > 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. > Jeff, We already have libudev. Sorry for catching it that late but I don't believe that replicating the uevent handling belongs in the DPDK. You might want to look into a helper to find the corresponding rte_device for a given devnode though. Also the remap_device function should get removed. There is no synchronization between the polling for the uevent and the rest of the drivers. Therefore there is no guarantee that you can remap to "safe" memory. You should fix the drivers instead. Thanks, Jan > 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: > 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 (2): > eal: add uevent monitor for hot plug > app/testpmd: use uevent to monitor hot removal > > app/test-pmd/testpmd.c | 90 ++++++ > lib/librte_eal/bsdapp/eal/eal_dev.c | 64 ++++ > .../bsdapp/eal/include/exec-env/rte_dev.h | 105 ++++++ > lib/librte_eal/common/eal_common_bus.c | 31 ++ > lib/librte_eal/common/eal_common_dev.c | 223 ++++++++++++- > lib/librte_eal/common/eal_common_pci.c | 69 +++- > lib/librte_eal/common/eal_common_pci_uio.c | 31 +- > lib/librte_eal/common/eal_common_vdev.c | 29 +- > lib/librte_eal/common/eal_private.h | 13 +- > lib/librte_eal/common/include/rte_bus.h | 52 +++ > lib/librte_eal/common/include/rte_dev.h | 102 +++++- > lib/librte_eal/common/include/rte_pci.h | 26 ++ > lib/librte_eal/linuxapp/eal/Makefile | 3 +- > lib/librte_eal/linuxapp/eal/eal_dev.c | 351 +++++++++++++++++++++ > lib/librte_eal/linuxapp/eal/eal_pci.c | 33 ++ > .../linuxapp/eal/include/exec-env/rte_dev.h | 105 ++++++ > 16 files changed, 1318 insertions(+), 9 deletions(-) > 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 >