From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-it1-f193.google.com (mail-it1-f193.google.com [209.85.166.193]) by dpdk.org (Postfix) with ESMTP id 4DEED2B95 for ; Mon, 8 Apr 2019 10:44:19 +0200 (CEST) Received: by mail-it1-f193.google.com with SMTP id y10so19649184itc.1 for ; Mon, 08 Apr 2019 01:44:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netronome-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=vOI87Jx+5LbcZLF3YAnOD2A6btnvYQsw1SWtLFKDKCA=; b=zbkiZiyZqOO3xDShAUciJumw1GfCS2oIf516x1b/NcIBPE65SgliClJqLJb38j3bO5 gxbxsG5a7W1eA8k4IWoY0uMF7jzIVByzP68tq5pq9Sq8RZFEeEPslWy2jLhbAtpGqnhI 0KXfo/QcttMu+/AHmnb/jlhvaMiSFDGt5ZAGklP28mDdcOql5+WZsL/8BzkbblwDY7n7 AauIAyy31ssSP7f/CLvU9TOwlNQ0UPCc6U9xfkAma/DBBWOV736OD+WPCy/SqvUMJurb fvv6GiKTZv6OUgnJP60Y04EmPQzFxkUiJFK2PtV6jkYGbfaFpYfw3ZOkn7bwV2lFAMDZ iMcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=vOI87Jx+5LbcZLF3YAnOD2A6btnvYQsw1SWtLFKDKCA=; b=kiq87KrbRPj0nM+QYAa365y2mQSFJYZPGCdKLkmIrlOb1kG3VtSeLHmpHzjRETzloM JqkB8Q3kP9XK1yrtJbYbxZyeExNXxQVA7dHifiPFY5nnDMS9eep0lzba19x10kVG2YIS Snjw+h3PNrZR6JABsZthMxbKjlza5S+5Nfo1dr63c/vyzy0xcyT7br6tyagaH4H35Uwl vlMRRW5zfiKJ0WpiARWe72eiDcH5oNOrnrdWfArjKliM0lmNG63CBiXQ89pyJ0Bp4VMk LTTejenmAUIuPiTmezf94mqLjzJaKGItfLadmo4i9jyOk+iE9p6Vptb1DihliHEAn7ts tnoQ== X-Gm-Message-State: APjAAAWhYFnhvWbYv8YA0qaGHdq3E5n9SPfHx71DfDSZOYxPf5yf3Ksj LLslcUq92pGbId2ArDMJYSPkjmSPdCiPSF7SMINeTw== X-Google-Smtp-Source: APXvYqz+0t3YXVnDQY1KtS4hYgQSvwpbLRIEXae9UE+c8gkgU12CE2QA+pLwOQI4TuuLFyZVWiP4ctOvZtaWlDV+pkQ= X-Received: by 2002:a24:a00b:: with SMTP id o11mr21393876ite.120.1554713058674; Mon, 08 Apr 2019 01:44:18 -0700 (PDT) MIME-Version: 1.0 References: <20190403071844.21126-1-tiwei.bie@intel.com> In-Reply-To: <20190403071844.21126-1-tiwei.bie@intel.com> From: Alejandro Lucero Date: Mon, 8 Apr 2019 09:44:07 +0100 Message-ID: To: Tiwei Bie Cc: dev , "Liang, Cunming" , Bruce Richardson Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [RFC 0/3] Add mdev (Mediated device) support in DPDK 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: Mon, 08 Apr 2019 08:44:19 -0000 On Wed, Apr 3, 2019 at 8:19 AM Tiwei Bie wrote: > Hi everyone, > > This is a draft implementation of the mdev (Mediated device [1]) > bus support in DPDK. Mdev is a way to virtualize devices in Linux > kernel. Based on the device-api (mdev_type/device_api), there could > be different types of mdev devices (e.g. vfio-pci). In this RFC, > one mdev bus is introduced to scan the mdev devices in the system > and do the probe based on the device-api. > > Take the mdev devices whose device-api is "vfio-pci" as an example, > in this RFC, these devices will be probed by a mdev driver provided > by PCI bus, which will plug them to the PCI bus. And they will be > probed with the drivers registered on the PCI bus based on VendorID/ > DeviceID/... then. > > +----------+ > | mdev bus | > +----+-----+ > | > +----------------+----+------+------+ > | | | | > mdev_vfio_pci ...... > (device-api: vfio-pci) > > There are also other ways to add mdev device support in DPDK (e.g. > let PCI bus scan /sys/bus/mdev/devices directly). Comments would be > appreciated! > > Hi Tiwei, Thanks for the patchset. I was close to send a patchset with the same mdev support, but I'm glad to see your patchset first because I think it is interesting to see another view of how to implemented this. After going through your patch I was a bit confused about how the mdev device to mdev driver match was done. But then I realized the approach you are following is different to my implementation, likely due to having different purposes. If I understand the idea behind, you want to have same PCI PMD drivers working with devices, PCI devices, created from mediated devices. That is the reason there is just one mdev driver, the one for vfio-pci mediated devices type. My approach was different and I though having specific PMD mdev support was necessary, with the PMD requiring to register a mdev driver. I can see, after reading your patch, it can be perfectly possible to have the same PMDs for "pure" PCI devices and PCI devices made from mediated devices, and if the PMD requires to do something different due to the mediated devices intrinsics, then explicitly supporting that per PMD. I got specific ioctl calls between the PMD and the mediating driver but this can also be done with your approach. I'm working on having a mediated PF, what is a different purpose than the Intel scalable I/O idea, so I will merge this patchset with my code and see if it works. Thanks! > [1] > https://github.com/torvalds/linux/blob/master/Documentation/vfio-mediated-device.txt > > Thanks, > Tiwei > > Tiwei Bie (3): > eal: add a helper for reading string from sysfs > bus/mdev: add mdev bus support > bus/pci: add mdev support > > config/common_base | 5 + > config/common_linux | 1 + > drivers/bus/Makefile | 1 + > drivers/bus/mdev/Makefile | 41 +++ > drivers/bus/mdev/linux/Makefile | 6 + > drivers/bus/mdev/linux/mdev.c | 117 ++++++++ > drivers/bus/mdev/mdev.c | 310 ++++++++++++++++++++++ > drivers/bus/mdev/meson.build | 15 ++ > drivers/bus/mdev/private.h | 90 +++++++ > drivers/bus/mdev/rte_bus_mdev.h | 141 ++++++++++ > drivers/bus/mdev/rte_bus_mdev_version.map | 12 + > drivers/bus/meson.build | 2 +- > drivers/bus/pci/Makefile | 3 + > drivers/bus/pci/linux/Makefile | 4 + > drivers/bus/pci/linux/pci_vfio.c | 35 ++- > drivers/bus/pci/linux/pci_vfio_mdev.c | 305 +++++++++++++++++++++ > drivers/bus/pci/meson.build | 4 +- > drivers/bus/pci/pci_common.c | 17 +- > drivers/bus/pci/private.h | 9 + > drivers/bus/pci/rte_bus_pci.h | 11 +- > lib/librte_eal/common/eal_filesystem.h | 7 + > lib/librte_eal/freebsd/eal/eal.c | 22 ++ > lib/librte_eal/linux/eal/eal.c | 22 ++ > lib/librte_eal/rte_eal_version.map | 1 + > mk/rte.app.mk | 1 + > 25 files changed, 1163 insertions(+), 19 deletions(-) > create mode 100644 drivers/bus/mdev/Makefile > create mode 100644 drivers/bus/mdev/linux/Makefile > create mode 100644 drivers/bus/mdev/linux/mdev.c > create mode 100644 drivers/bus/mdev/mdev.c > create mode 100644 drivers/bus/mdev/meson.build > create mode 100644 drivers/bus/mdev/private.h > create mode 100644 drivers/bus/mdev/rte_bus_mdev.h > create mode 100644 drivers/bus/mdev/rte_bus_mdev_version.map > create mode 100644 drivers/bus/pci/linux/pci_vfio_mdev.c > > -- > 2.17.1 > > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id CC609A0096 for ; Mon, 8 Apr 2019 10:44:21 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A214B2BC9; Mon, 8 Apr 2019 10:44:20 +0200 (CEST) Received: from mail-it1-f193.google.com (mail-it1-f193.google.com [209.85.166.193]) by dpdk.org (Postfix) with ESMTP id 4DEED2B95 for ; Mon, 8 Apr 2019 10:44:19 +0200 (CEST) Received: by mail-it1-f193.google.com with SMTP id y10so19649184itc.1 for ; Mon, 08 Apr 2019 01:44:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netronome-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=vOI87Jx+5LbcZLF3YAnOD2A6btnvYQsw1SWtLFKDKCA=; b=zbkiZiyZqOO3xDShAUciJumw1GfCS2oIf516x1b/NcIBPE65SgliClJqLJb38j3bO5 gxbxsG5a7W1eA8k4IWoY0uMF7jzIVByzP68tq5pq9Sq8RZFEeEPslWy2jLhbAtpGqnhI 0KXfo/QcttMu+/AHmnb/jlhvaMiSFDGt5ZAGklP28mDdcOql5+WZsL/8BzkbblwDY7n7 AauIAyy31ssSP7f/CLvU9TOwlNQ0UPCc6U9xfkAma/DBBWOV736OD+WPCy/SqvUMJurb fvv6GiKTZv6OUgnJP60Y04EmPQzFxkUiJFK2PtV6jkYGbfaFpYfw3ZOkn7bwV2lFAMDZ iMcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=vOI87Jx+5LbcZLF3YAnOD2A6btnvYQsw1SWtLFKDKCA=; b=kiq87KrbRPj0nM+QYAa365y2mQSFJYZPGCdKLkmIrlOb1kG3VtSeLHmpHzjRETzloM JqkB8Q3kP9XK1yrtJbYbxZyeExNXxQVA7dHifiPFY5nnDMS9eep0lzba19x10kVG2YIS Snjw+h3PNrZR6JABsZthMxbKjlza5S+5Nfo1dr63c/vyzy0xcyT7br6tyagaH4H35Uwl vlMRRW5zfiKJ0WpiARWe72eiDcH5oNOrnrdWfArjKliM0lmNG63CBiXQ89pyJ0Bp4VMk LTTejenmAUIuPiTmezf94mqLjzJaKGItfLadmo4i9jyOk+iE9p6Vptb1DihliHEAn7ts tnoQ== X-Gm-Message-State: APjAAAWhYFnhvWbYv8YA0qaGHdq3E5n9SPfHx71DfDSZOYxPf5yf3Ksj LLslcUq92pGbId2ArDMJYSPkjmSPdCiPSF7SMINeTw== X-Google-Smtp-Source: APXvYqz+0t3YXVnDQY1KtS4hYgQSvwpbLRIEXae9UE+c8gkgU12CE2QA+pLwOQI4TuuLFyZVWiP4ctOvZtaWlDV+pkQ= X-Received: by 2002:a24:a00b:: with SMTP id o11mr21393876ite.120.1554713058674; Mon, 08 Apr 2019 01:44:18 -0700 (PDT) MIME-Version: 1.0 References: <20190403071844.21126-1-tiwei.bie@intel.com> In-Reply-To: <20190403071844.21126-1-tiwei.bie@intel.com> From: Alejandro Lucero Date: Mon, 8 Apr 2019 09:44:07 +0100 Message-ID: To: Tiwei Bie Cc: dev , "Liang, Cunming" , Bruce Richardson Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [RFC 0/3] Add mdev (Mediated device) support in DPDK 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Message-ID: <20190408084407.QIMAiA8sLqvlScv-8LCS9vcYWBhGweiZlXfbjkoqNFE@z> On Wed, Apr 3, 2019 at 8:19 AM Tiwei Bie wrote: > Hi everyone, > > This is a draft implementation of the mdev (Mediated device [1]) > bus support in DPDK. Mdev is a way to virtualize devices in Linux > kernel. Based on the device-api (mdev_type/device_api), there could > be different types of mdev devices (e.g. vfio-pci). In this RFC, > one mdev bus is introduced to scan the mdev devices in the system > and do the probe based on the device-api. > > Take the mdev devices whose device-api is "vfio-pci" as an example, > in this RFC, these devices will be probed by a mdev driver provided > by PCI bus, which will plug them to the PCI bus. And they will be > probed with the drivers registered on the PCI bus based on VendorID/ > DeviceID/... then. > > +----------+ > | mdev bus | > +----+-----+ > | > +----------------+----+------+------+ > | | | | > mdev_vfio_pci ...... > (device-api: vfio-pci) > > There are also other ways to add mdev device support in DPDK (e.g. > let PCI bus scan /sys/bus/mdev/devices directly). Comments would be > appreciated! > > Hi Tiwei, Thanks for the patchset. I was close to send a patchset with the same mdev support, but I'm glad to see your patchset first because I think it is interesting to see another view of how to implemented this. After going through your patch I was a bit confused about how the mdev device to mdev driver match was done. But then I realized the approach you are following is different to my implementation, likely due to having different purposes. If I understand the idea behind, you want to have same PCI PMD drivers working with devices, PCI devices, created from mediated devices. That is the reason there is just one mdev driver, the one for vfio-pci mediated devices type. My approach was different and I though having specific PMD mdev support was necessary, with the PMD requiring to register a mdev driver. I can see, after reading your patch, it can be perfectly possible to have the same PMDs for "pure" PCI devices and PCI devices made from mediated devices, and if the PMD requires to do something different due to the mediated devices intrinsics, then explicitly supporting that per PMD. I got specific ioctl calls between the PMD and the mediating driver but this can also be done with your approach. I'm working on having a mediated PF, what is a different purpose than the Intel scalable I/O idea, so I will merge this patchset with my code and see if it works. Thanks! > [1] > https://github.com/torvalds/linux/blob/master/Documentation/vfio-mediated-device.txt > > Thanks, > Tiwei > > Tiwei Bie (3): > eal: add a helper for reading string from sysfs > bus/mdev: add mdev bus support > bus/pci: add mdev support > > config/common_base | 5 + > config/common_linux | 1 + > drivers/bus/Makefile | 1 + > drivers/bus/mdev/Makefile | 41 +++ > drivers/bus/mdev/linux/Makefile | 6 + > drivers/bus/mdev/linux/mdev.c | 117 ++++++++ > drivers/bus/mdev/mdev.c | 310 ++++++++++++++++++++++ > drivers/bus/mdev/meson.build | 15 ++ > drivers/bus/mdev/private.h | 90 +++++++ > drivers/bus/mdev/rte_bus_mdev.h | 141 ++++++++++ > drivers/bus/mdev/rte_bus_mdev_version.map | 12 + > drivers/bus/meson.build | 2 +- > drivers/bus/pci/Makefile | 3 + > drivers/bus/pci/linux/Makefile | 4 + > drivers/bus/pci/linux/pci_vfio.c | 35 ++- > drivers/bus/pci/linux/pci_vfio_mdev.c | 305 +++++++++++++++++++++ > drivers/bus/pci/meson.build | 4 +- > drivers/bus/pci/pci_common.c | 17 +- > drivers/bus/pci/private.h | 9 + > drivers/bus/pci/rte_bus_pci.h | 11 +- > lib/librte_eal/common/eal_filesystem.h | 7 + > lib/librte_eal/freebsd/eal/eal.c | 22 ++ > lib/librte_eal/linux/eal/eal.c | 22 ++ > lib/librte_eal/rte_eal_version.map | 1 + > mk/rte.app.mk | 1 + > 25 files changed, 1163 insertions(+), 19 deletions(-) > create mode 100644 drivers/bus/mdev/Makefile > create mode 100644 drivers/bus/mdev/linux/Makefile > create mode 100644 drivers/bus/mdev/linux/mdev.c > create mode 100644 drivers/bus/mdev/mdev.c > create mode 100644 drivers/bus/mdev/meson.build > create mode 100644 drivers/bus/mdev/private.h > create mode 100644 drivers/bus/mdev/rte_bus_mdev.h > create mode 100644 drivers/bus/mdev/rte_bus_mdev_version.map > create mode 100644 drivers/bus/pci/linux/pci_vfio_mdev.c > > -- > 2.17.1 > >