DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 1/4] doc: move VFIO driver to be first
@ 2020-11-10 18:09 Anatoly Burakov
  2020-11-10 18:09 ` [dpdk-dev] [PATCH 2/4] doc: reword VFIO and UIO Linux GSG section Anatoly Burakov
                   ` (6 more replies)
  0 siblings, 7 replies; 21+ messages in thread
From: Anatoly Burakov @ 2020-11-10 18:09 UTC (permalink / raw)
  To: dev; +Cc: thomas

Currently, the Linux GSG mentions UIO drivers first. This is not ideal
as for the longest time, the recommended way to use DPDK with hardware
devices has been to use VFIO driver.

This commit simply moves UIO section after VFIO, with minor edits.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 doc/guides/linux_gsg/linux_drivers.rst | 86 +++++++++++++-------------
 1 file changed, 43 insertions(+), 43 deletions(-)

diff --git a/doc/guides/linux_gsg/linux_drivers.rst b/doc/guides/linux_gsg/linux_drivers.rst
index 080b44955a..69ef4ee275 100644
--- a/doc/guides/linux_gsg/linux_drivers.rst
+++ b/doc/guides/linux_gsg/linux_drivers.rst
@@ -12,51 +12,10 @@ Different PMDs may require different kernel drivers in order to work properly.
 Depends on the PMD being used, a corresponding kernel driver should be load
 and bind to the network ports.
 
-UIO
----
-
-A small kernel module to set up the device, map device memory to user-space and register interrupts.
-In many cases, the standard ``uio_pci_generic`` module included in the Linux kernel
-can provide the uio capability. This module can be loaded using the command:
-
-.. code-block:: console
-
-    sudo modprobe uio_pci_generic
-
-.. note::
-
-    ``uio_pci_generic`` module doesn't support the creation of virtual functions.
-
-As an alternative to the ``uio_pci_generic``, there is the ``igb_uio`` module
-which can be found in the repository `dpdk-kmods <http://git.dpdk.org/dpdk-kmods>`_.
-It can be loaded as shown below:
-
-.. code-block:: console
-
-    sudo modprobe uio
-    sudo insmod igb_uio.ko
-
-.. note::
-
-   If UEFI secure boot is enabled, the Linux kernel may disallow the use of
-   UIO on the system. Therefore, devices for use by DPDK should be bound to the
-   ``vfio-pci`` kernel module rather than any UIO-based module.
-   For more details see :ref:`linux_gsg_binding_kernel` below.
-
-.. note::
-
-   If the devices used for DPDK are bound to the ``uio_pci_generic`` kernel module,
-   please make sure that the IOMMU is disabled or passthrough. One can add
-   ``intel_iommu=off`` or ``amd_iommu=off`` or ``intel_iommu=on iommu=pt`` in GRUB
-   command line on x86_64 systems, or add ``iommu.passthrough=1`` on aarch64 system.
-
-Since DPDK release 1.7 onward provides VFIO support, use of UIO is optional
-for platforms that support using VFIO.
-
 VFIO
 ----
 
-A more robust and secure driver in compare to the ``UIO``, relying on IOMMU protection.
+VFIO is a robust and secure driver that relies on IOMMU protection.
 To make use of VFIO, the ``vfio-pci`` module must be loaded:
 
 .. code-block:: console
@@ -111,7 +70,48 @@ This can be done by using the DPDK setup script (called dpdk-setup.sh and locate
 
 .. note::
 
-    VFIO can be used without IOMMU. While this is just as unsafe as using UIO, it does make it possible for the user to keep the degree of device access and programming that VFIO has, in situations where IOMMU is not available.
+    VFIO can be used without IOMMU. While this is unsafe, it does make it possible for the user to keep the degree of device access and programming that VFIO has, in situations where IOMMU is not available.
+
+UIO
+---
+
+In situations where using VFIO is not an option, there are alternative drivers one can use.
+In many cases, the standard ``uio_pci_generic`` module included in the Linux kernel
+can provide the uio capability. This module can be loaded using the command:
+
+.. code-block:: console
+
+    sudo modprobe uio_pci_generic
+
+.. note::
+
+    ``uio_pci_generic`` module doesn't support the creation of virtual functions.
+
+As an alternative to the ``uio_pci_generic``, there is the ``igb_uio`` module
+which can be found in the repository `dpdk-kmods <http://git.dpdk.org/dpdk-kmods>`_.
+It can be loaded as shown below:
+
+.. code-block:: console
+
+    sudo modprobe uio
+    sudo insmod igb_uio.ko
+
+.. note::
+
+   If UEFI secure boot is enabled, the Linux kernel may disallow the use of
+   UIO on the system. Therefore, devices for use by DPDK should be bound to the
+   ``vfio-pci`` kernel module rather than any UIO-based module.
+   For more details see :ref:`linux_gsg_binding_kernel` below.
+
+.. note::
+
+   If the devices used for DPDK are bound to the ``uio_pci_generic`` kernel module,
+   please make sure that the IOMMU is disabled or passthrough. One can add
+   ``intel_iommu=off`` or ``amd_iommu=off`` or ``intel_iommu=on iommu=pt`` in GRUB
+   command line on x86_64 systems, or add ``iommu.passthrough=1`` on aarch64 system.
+
+Since DPDK release 1.7 onward provides VFIO support, use of UIO is optional
+for platforms that support using VFIO.
 
 .. _bifurcated_driver:
 
-- 
2.17.1

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dpdk-dev] [PATCH 2/4] doc: reword VFIO and UIO Linux GSG section
  2020-11-10 18:09 [dpdk-dev] [PATCH 1/4] doc: move VFIO driver to be first Anatoly Burakov
@ 2020-11-10 18:09 ` Anatoly Burakov
  2020-11-10 18:09 ` [dpdk-dev] [PATCH 3/4] doc: add VFIO no-IOMMU " Anatoly Burakov
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 21+ messages in thread
From: Anatoly Burakov @ 2020-11-10 18:09 UTC (permalink / raw)
  To: dev; +Cc: thomas

Make sure that we always prioritize VFIO over UIO. Also, minor wording
corrections and improvements.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 doc/guides/linux_gsg/linux_drivers.rst | 88 ++++++++++++++------------
 1 file changed, 49 insertions(+), 39 deletions(-)

diff --git a/doc/guides/linux_gsg/linux_drivers.rst b/doc/guides/linux_gsg/linux_drivers.rst
index 69ef4ee275..34fd2f8652 100644
--- a/doc/guides/linux_gsg/linux_drivers.rst
+++ b/doc/guides/linux_gsg/linux_drivers.rst
@@ -9,8 +9,8 @@ Linux Drivers
 =============
 
 Different PMDs may require different kernel drivers in order to work properly.
-Depends on the PMD being used, a corresponding kernel driver should be load
-and bind to the network ports.
+Depends on the PMD being used, a corresponding kernel driver should be loaded,
+and network ports should be bound to that driver.
 
 VFIO
 ----
@@ -22,23 +22,22 @@ To make use of VFIO, the ``vfio-pci`` module must be loaded:
 
     sudo modprobe vfio-pci
 
-Note that in order to use VFIO, your kernel must support it.
-VFIO kernel modules have been included in the Linux kernel since version 3.6.0 and are usually present by default,
-however please consult your distributions documentation to make sure that is the case.
+VFIO kernel is usually present by default in all distributions, however please
+consult your distributions documentation to make sure that is the case.
 
-The ``vfio-pci`` module since Linux version 5.7 supports the creation of virtual
-functions. After the PF is bound to vfio-pci module, the user can create the VFs
-by sysfs interface, and these VFs are bound to vfio-pci module automatically.
+Since Linux version 5.7, the ``vfio-pci`` module supports the creation of virtual functions.
+After the PF is bound to ``vfio-pci`` module, the user can create the VFs using the ``sysfs`` interface,
+and these VFs will be bound to ``vfio-pci`` module automatically.
 
-When the PF is bound to vfio-pci, it has initial VF token generated by random. For
-security reason, this token is write only, the user can't read it from the kernel
-directly. To access the VF, the user needs to start the PF with token parameter to
-setup a VF token in UUID format, then the VF can be accessed with this new token.
+When the PF is bound to ``vfio-pci``, by default it will have a randomly
+generated VF token. For security reasons, this token is write only, so the user
+cannot read it from the kernel directly. To access the VFs, the user needs to
+create a new token, and use it to initialize both VF and PF devices. The tokens
+are in UUID format, so any UUID generation tool can be used to create a new
+token.
 
-Since the ``vfio-pci`` module uses the VF token as internal data to provide the
-collaboration between SR-IOV PF and VFs, so DPDK can use the same VF token for all
-PF devices which bound to one application. This VF token can be specified by the EAL
-parameter ``--vfio-vf-token``.
+This VF token can be passed to DPDK by using EAL parameter ``--vfio-vf-token``.
+The token will be used for all PF and VF ports within the application.
 
 .. code-block:: console
 
@@ -59,14 +58,22 @@ parameter ``--vfio-vf-token``.
         <build_dir>/app/dpdk-testpmd -l 26-29 -n 4 -w 86:02.0 \
          --vfio-vf-token=14d63f20-8445-11ea-8900-1f9ce7d5650d --file-prefix=vf0 -- -i
 
-Also, to use VFIO, both kernel and BIOS must support and be configured to use IO virtualization (such as Intel® VT-d).
+To make use of full VFIO functionality, both kernel and BIOS must support and be configured to use IO virtualization (such as Intel® VT-d).
 
 .. note::
 
-    ``vfio-pci`` module doesn't support the creation of virtual functions before Linux version 5.7.
+    Linux versions earlier than version 3.6 do not support VFIO.
+
+.. note::
+
+    Linux versions earlier than version 5.7 do not support the creation of virtual functions.
+
+.. note::
+    In most cases, specifying "iommu=on" as kernel parameter should be enough to
+    configure the Linux kernel to use IOMMU.
 
 For proper operation of VFIO when running DPDK applications as a non-privileged user, correct permissions should also be set up.
-This can be done by using the DPDK setup script (called dpdk-setup.sh and located in the usertools directory).
+This can be done by using the DPDK setup script (called ``dpdk-setup.sh`` and located in the usertools directory).
 
 .. note::
 
@@ -77,7 +84,7 @@ UIO
 
 In situations where using VFIO is not an option, there are alternative drivers one can use.
 In many cases, the standard ``uio_pci_generic`` module included in the Linux kernel
-can provide the uio capability. This module can be loaded using the command:
+can be used as a substitute for VFIO. This module can be loaded using the command:
 
 .. code-block:: console
 
@@ -106,12 +113,13 @@ It can be loaded as shown below:
 .. note::
 
    If the devices used for DPDK are bound to the ``uio_pci_generic`` kernel module,
-   please make sure that the IOMMU is disabled or passthrough. One can add
+   please make sure that the IOMMU is disabled or is in passthrough mode. One can add
    ``intel_iommu=off`` or ``amd_iommu=off`` or ``intel_iommu=on iommu=pt`` in GRUB
    command line on x86_64 systems, or add ``iommu.passthrough=1`` on aarch64 system.
 
-Since DPDK release 1.7 onward provides VFIO support, use of UIO is optional
-for platforms that support using VFIO.
+.. note::
+   Using UIO drivers is inherently unsafe do to this method lacking IOMMU
+   protection, and can only be done by root user.
 
 .. _bifurcated_driver:
 
@@ -145,36 +153,38 @@ Binding and Unbinding Network Ports to/from the Kernel Modules
 
 .. note::
 
-    PMDs Which use the bifurcated driver should not be unbind from their kernel drivers. this section is for PMDs which use the UIO or VFIO drivers.
+    PMDs Which use the bifurcated driver should not be unbound from their kernel drivers. This section is for PMDs which use the UIO or VFIO drivers.
 
 As of release 1.4, DPDK applications no longer automatically unbind all supported network ports from the kernel driver in use.
-Instead, in case the PMD being used use the UIO or VFIO drivers, all ports that are to be used by an DPDK application must be bound to the
-``uio_pci_generic``, ``igb_uio`` or ``vfio-pci`` module before the application is run.
+Instead, in case the PMD being used use the VFIO or UIO drivers, all ports that are to be used by an DPDK application must be bound to the
+``vfio-pci``, ``uio_pci_generic``, or ``igb_uio`` module before the application is run.
 For such PMDs, any network ports under Linux* control will be ignored and cannot be used by the application.
 
-To bind ports to the ``uio_pci_generic``, ``igb_uio`` or ``vfio-pci`` module for DPDK use,
-and then subsequently return ports to Linux* control,
-a utility script called dpdk-devbind.py is provided in the usertools subdirectory.
-This utility can be used to provide a view of the current state of the network ports on the system,
-and to bind and unbind those ports from the different kernel modules, including the uio and vfio modules.
-The following are some examples of how the script can be used.
-A full description of the script and its parameters can be obtained by calling the script with the ``--help`` or ``--usage`` options.
-Note that the uio or vfio kernel modules to be used, should be loaded into the kernel before
+To bind ports to the ``vfio-pci``, ``uio_pci_generic`` or ``igb_uio`` module for
+DPDK use, or to return ports to Linux* control, a utility script called
+``dpdk-devbind.py`` is provided in the ``usertools`` subdirectory. This utility can be
+used to provide a view of the current state of the network ports on the system,
+and to bind and unbind those ports from the different kernel modules, including
+the vfio and uio modules. The following are some examples of how the script can
+be used. A full description of the script and its parameters can be obtained by
+calling the script with the ``--help`` or ``--usage`` options. Note that the uio
+or vfio kernel modules to be used, should be loaded into the kernel before
 running the ``dpdk-devbind.py`` script.
 
 .. warning::
 
-    Due to the way VFIO works, there are certain limitations to which devices can be used with VFIO.
-    Mainly it comes down to how IOMMU groups work.
-    Any Virtual Function device can be used with VFIO on its own, but physical devices will require either all ports bound to VFIO,
-    or some of them bound to VFIO while others not being bound to anything at all.
+    Due to the way VFIO works, there are certain limitations to which devices
+    can be used with VFIO. Mainly it comes down to how IOMMU groups work. Any
+    Virtual Function device can usually be used with VFIO on its own, but
+    physical devices may require either all ports bound to VFIO, or some of them
+    bound to VFIO while others not being bound to anything at all.
 
     If your device is behind a PCI-to-PCI bridge, the bridge will then be part of the IOMMU group in which your device is in.
     Therefore, the bridge driver should also be unbound from the bridge PCI device for VFIO to work with devices behind the bridge.
 
 .. warning::
 
-    While any user can run the dpdk-devbind.py script to view the status of the network ports,
+    While any user can run the ``dpdk-devbind.py`` script to view the status of the network ports,
     binding or unbinding network ports requires root privileges.
 
 To see the status of all network ports on the system:
-- 
2.17.1

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dpdk-dev] [PATCH 3/4] doc: add VFIO no-IOMMU Linux GSG section
  2020-11-10 18:09 [dpdk-dev] [PATCH 1/4] doc: move VFIO driver to be first Anatoly Burakov
  2020-11-10 18:09 ` [dpdk-dev] [PATCH 2/4] doc: reword VFIO and UIO Linux GSG section Anatoly Burakov
@ 2020-11-10 18:09 ` Anatoly Burakov
  2020-11-10 18:09 ` [dpdk-dev] [PATCH 4/4] doc: add VFIO troubleshooting section Anatoly Burakov
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 21+ messages in thread
From: Anatoly Burakov @ 2020-11-10 18:09 UTC (permalink / raw)
  To: dev; +Cc: thomas

Currently, we have no documentation on how to use VFIO in no-IOMMU mode.
Add such documentation.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 doc/guides/linux_gsg/linux_drivers.rst | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/doc/guides/linux_gsg/linux_drivers.rst b/doc/guides/linux_gsg/linux_drivers.rst
index 34fd2f8652..4148602a63 100644
--- a/doc/guides/linux_gsg/linux_drivers.rst
+++ b/doc/guides/linux_gsg/linux_drivers.rst
@@ -75,9 +75,30 @@ To make use of full VFIO functionality, both kernel and BIOS must support and be
 For proper operation of VFIO when running DPDK applications as a non-privileged user, correct permissions should also be set up.
 This can be done by using the DPDK setup script (called ``dpdk-setup.sh`` and located in the usertools directory).
 
+VFIO no-IOMMU mode
+------------------
+
+If there is no IOMMU available on the system, VFIO can still be used, but it has
+to be loaded with an additional module parameter:
+
+.. code-block:: console
+
+    # modprobe vfio enable_unsafe_noiomu_mode=1
+
+Alternatively, one can also enable this option in an already loaded kernel module:
+
+.. code-block:: console
+
+    # echo 1 > /sys/module/vfio/parameters/enable_unsafe_noiomu_mode
+
+After that, VFIO can be used with hardware devices as usual.
+
 .. note::
 
-    VFIO can be used without IOMMU. While this is unsafe, it does make it possible for the user to keep the degree of device access and programming that VFIO has, in situations where IOMMU is not available.
+    Since no-IOMMU mode forgoes IOMMU protection, it is inherently unsafe. That
+    said, it does make it possible for the user to keep the degree of device
+    access and programming that VFIO has, in situations where IOMMU is not
+    available.
 
 UIO
 ---
-- 
2.17.1

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dpdk-dev] [PATCH 4/4] doc: add VFIO troubleshooting section
  2020-11-10 18:09 [dpdk-dev] [PATCH 1/4] doc: move VFIO driver to be first Anatoly Burakov
  2020-11-10 18:09 ` [dpdk-dev] [PATCH 2/4] doc: reword VFIO and UIO Linux GSG section Anatoly Burakov
  2020-11-10 18:09 ` [dpdk-dev] [PATCH 3/4] doc: add VFIO no-IOMMU " Anatoly Burakov
@ 2020-11-10 18:09 ` Anatoly Burakov
  2020-11-18 15:37 ` [dpdk-dev] [PATCH v2 1/4] doc: move VFIO driver to be first Anatoly Burakov
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 21+ messages in thread
From: Anatoly Burakov @ 2020-11-10 18:09 UTC (permalink / raw)
  To: dev; +Cc: thomas

There are common problems with VFIO that get asked over and over on the
mailing list. Document common problems with VFIO and how to fix them or
at least figure out what went wrong.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 doc/guides/linux_gsg/linux_drivers.rst | 43 ++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/doc/guides/linux_gsg/linux_drivers.rst b/doc/guides/linux_gsg/linux_drivers.rst
index 4148602a63..e30d91ea78 100644
--- a/doc/guides/linux_gsg/linux_drivers.rst
+++ b/doc/guides/linux_gsg/linux_drivers.rst
@@ -247,3 +247,46 @@ To restore device ``82:00.0`` to its original kernel binding:
 .. code-block:: console
 
     ./usertools/dpdk-devbind.py --bind=ixgbe 82:00.0
+
+Troubleshooting VFIO
+--------------------
+
+In certain situations, using ``dpdk-devbind.py`` script to bing a device to VFIO
+driver will fail. The first place to check is the kernel messages:
+
+.. code-block:: console
+
+    # dmesg | tail
+    ...
+    [ 1297.875090] vfio-pci: probe of 0000:31:00.0 failed with error -22
+    ...
+
+In most cases, the "error -22" indicates that the VFIO subsystem couldn't be
+enabled because there is no IOMMU support. To check whether the kernel has been
+booted with correct parameters, one can check the kernel command-line:
+
+.. code-block:: console
+
+    # cat /proc/cmdline
+
+Please refer to earlier sections on how to configure kernel parameters correctly
+for your system.
+
+If the kernel is configured correctly, one also has to make sure that the BIOS
+configuration has virtualization features (such as Intel® VT-d). There is no
+standard way to check if the platform is configured correctly, so please check
+with your platform documentation to see if it has such features, and how to
+enable them.
+
+In certain distributions, default kernel configuration is such that the no-IOMMU
+mode is disabled altogether at compile time. This can be checked in the boot
+configuration of your system:
+
+.. code-block:: console
+
+    # cat /boot/config-$(uname -r) | grep NOIOMMU
+    # CONFIG_VFIO_NOIOMMU is not set
+
+If ``CONFIG_VFIO_NOIOMMU`` is not enabled in the kernel configuration, VFIO
+driver will not support the no-IOMMU mode, and other alternatives (such as UIO
+drivers) will have to be used.
-- 
2.17.1

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dpdk-dev] [PATCH v2 1/4] doc: move VFIO driver to be first
  2020-11-10 18:09 [dpdk-dev] [PATCH 1/4] doc: move VFIO driver to be first Anatoly Burakov
                   ` (2 preceding siblings ...)
  2020-11-10 18:09 ` [dpdk-dev] [PATCH 4/4] doc: add VFIO troubleshooting section Anatoly Burakov
@ 2020-11-18 15:37 ` Anatoly Burakov
  2020-11-18 18:24   ` David Marchand
                     ` (4 more replies)
  2020-11-18 15:37 ` [dpdk-dev] [PATCH v2 2/4] doc: reword VFIO and UIO Linux GSG section Anatoly Burakov
                   ` (2 subsequent siblings)
  6 siblings, 5 replies; 21+ messages in thread
From: Anatoly Burakov @ 2020-11-18 15:37 UTC (permalink / raw)
  To: dev; +Cc: thomas, john.mcnamara

Currently, the Linux GSG mentions UIO drivers first. This is not ideal
as for the longest time, the recommended way to use DPDK with hardware
devices has been to use VFIO driver.

This commit simply moves UIO section after VFIO, with minor edits.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 doc/guides/linux_gsg/linux_drivers.rst | 86 +++++++++++++-------------
 1 file changed, 43 insertions(+), 43 deletions(-)

diff --git a/doc/guides/linux_gsg/linux_drivers.rst b/doc/guides/linux_gsg/linux_drivers.rst
index 080b44955a..69ef4ee275 100644
--- a/doc/guides/linux_gsg/linux_drivers.rst
+++ b/doc/guides/linux_gsg/linux_drivers.rst
@@ -12,51 +12,10 @@ Different PMDs may require different kernel drivers in order to work properly.
 Depends on the PMD being used, a corresponding kernel driver should be load
 and bind to the network ports.
 
-UIO
----
-
-A small kernel module to set up the device, map device memory to user-space and register interrupts.
-In many cases, the standard ``uio_pci_generic`` module included in the Linux kernel
-can provide the uio capability. This module can be loaded using the command:
-
-.. code-block:: console
-
-    sudo modprobe uio_pci_generic
-
-.. note::
-
-    ``uio_pci_generic`` module doesn't support the creation of virtual functions.
-
-As an alternative to the ``uio_pci_generic``, there is the ``igb_uio`` module
-which can be found in the repository `dpdk-kmods <http://git.dpdk.org/dpdk-kmods>`_.
-It can be loaded as shown below:
-
-.. code-block:: console
-
-    sudo modprobe uio
-    sudo insmod igb_uio.ko
-
-.. note::
-
-   If UEFI secure boot is enabled, the Linux kernel may disallow the use of
-   UIO on the system. Therefore, devices for use by DPDK should be bound to the
-   ``vfio-pci`` kernel module rather than any UIO-based module.
-   For more details see :ref:`linux_gsg_binding_kernel` below.
-
-.. note::
-
-   If the devices used for DPDK are bound to the ``uio_pci_generic`` kernel module,
-   please make sure that the IOMMU is disabled or passthrough. One can add
-   ``intel_iommu=off`` or ``amd_iommu=off`` or ``intel_iommu=on iommu=pt`` in GRUB
-   command line on x86_64 systems, or add ``iommu.passthrough=1`` on aarch64 system.
-
-Since DPDK release 1.7 onward provides VFIO support, use of UIO is optional
-for platforms that support using VFIO.
-
 VFIO
 ----
 
-A more robust and secure driver in compare to the ``UIO``, relying on IOMMU protection.
+VFIO is a robust and secure driver that relies on IOMMU protection.
 To make use of VFIO, the ``vfio-pci`` module must be loaded:
 
 .. code-block:: console
@@ -111,7 +70,48 @@ This can be done by using the DPDK setup script (called dpdk-setup.sh and locate
 
 .. note::
 
-    VFIO can be used without IOMMU. While this is just as unsafe as using UIO, it does make it possible for the user to keep the degree of device access and programming that VFIO has, in situations where IOMMU is not available.
+    VFIO can be used without IOMMU. While this is unsafe, it does make it possible for the user to keep the degree of device access and programming that VFIO has, in situations where IOMMU is not available.
+
+UIO
+---
+
+In situations where using VFIO is not an option, there are alternative drivers one can use.
+In many cases, the standard ``uio_pci_generic`` module included in the Linux kernel
+can provide the uio capability. This module can be loaded using the command:
+
+.. code-block:: console
+
+    sudo modprobe uio_pci_generic
+
+.. note::
+
+    ``uio_pci_generic`` module doesn't support the creation of virtual functions.
+
+As an alternative to the ``uio_pci_generic``, there is the ``igb_uio`` module
+which can be found in the repository `dpdk-kmods <http://git.dpdk.org/dpdk-kmods>`_.
+It can be loaded as shown below:
+
+.. code-block:: console
+
+    sudo modprobe uio
+    sudo insmod igb_uio.ko
+
+.. note::
+
+   If UEFI secure boot is enabled, the Linux kernel may disallow the use of
+   UIO on the system. Therefore, devices for use by DPDK should be bound to the
+   ``vfio-pci`` kernel module rather than any UIO-based module.
+   For more details see :ref:`linux_gsg_binding_kernel` below.
+
+.. note::
+
+   If the devices used for DPDK are bound to the ``uio_pci_generic`` kernel module,
+   please make sure that the IOMMU is disabled or passthrough. One can add
+   ``intel_iommu=off`` or ``amd_iommu=off`` or ``intel_iommu=on iommu=pt`` in GRUB
+   command line on x86_64 systems, or add ``iommu.passthrough=1`` on aarch64 system.
+
+Since DPDK release 1.7 onward provides VFIO support, use of UIO is optional
+for platforms that support using VFIO.
 
 .. _bifurcated_driver:
 
-- 
2.17.1

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dpdk-dev] [PATCH v2 2/4] doc: reword VFIO and UIO Linux GSG section
  2020-11-10 18:09 [dpdk-dev] [PATCH 1/4] doc: move VFIO driver to be first Anatoly Burakov
                   ` (3 preceding siblings ...)
  2020-11-18 15:37 ` [dpdk-dev] [PATCH v2 1/4] doc: move VFIO driver to be first Anatoly Burakov
@ 2020-11-18 15:37 ` Anatoly Burakov
  2020-11-18 15:37 ` [dpdk-dev] [PATCH v2 3/4] doc: add VFIO no-IOMMU " Anatoly Burakov
  2020-11-18 15:37 ` [dpdk-dev] [PATCH v2 4/4] doc: add VFIO troubleshooting section Anatoly Burakov
  6 siblings, 0 replies; 21+ messages in thread
From: Anatoly Burakov @ 2020-11-18 15:37 UTC (permalink / raw)
  To: dev; +Cc: thomas, john.mcnamara

Make sure that we always prioritize VFIO over UIO. Also, minor wording
corrections and improvements.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---

Notes:
    v2:
    - Fix formatting for VF token section
    - Some more typo and formatting fixes

 doc/guides/linux_gsg/linux_drivers.rst | 131 +++++++++++++++----------
 1 file changed, 80 insertions(+), 51 deletions(-)

diff --git a/doc/guides/linux_gsg/linux_drivers.rst b/doc/guides/linux_gsg/linux_drivers.rst
index 69ef4ee275..a3f443db2c 100644
--- a/doc/guides/linux_gsg/linux_drivers.rst
+++ b/doc/guides/linux_gsg/linux_drivers.rst
@@ -9,8 +9,8 @@ Linux Drivers
 =============
 
 Different PMDs may require different kernel drivers in order to work properly.
-Depends on the PMD being used, a corresponding kernel driver should be load
-and bind to the network ports.
+Depending on the PMD being used, a corresponding kernel driver should be loaded,
+and network ports should be bound to that driver.
 
 VFIO
 ----
@@ -22,51 +22,77 @@ To make use of VFIO, the ``vfio-pci`` module must be loaded:
 
     sudo modprobe vfio-pci
 
-Note that in order to use VFIO, your kernel must support it.
-VFIO kernel modules have been included in the Linux kernel since version 3.6.0 and are usually present by default,
-however please consult your distributions documentation to make sure that is the case.
+VFIO kernel is usually present by default in all distributions, however please
+consult your distributions documentation to make sure that is the case.
 
-The ``vfio-pci`` module since Linux version 5.7 supports the creation of virtual
-functions. After the PF is bound to vfio-pci module, the user can create the VFs
-by sysfs interface, and these VFs are bound to vfio-pci module automatically.
+Since Linux version 5.7, the ``vfio-pci`` module supports the creation of virtual functions.
+After the PF is bound to ``vfio-pci`` module, the user can create the VFs using the ``sysfs`` interface,
+and these VFs will be bound to ``vfio-pci`` module automatically.
 
-When the PF is bound to vfio-pci, it has initial VF token generated by random. For
-security reason, this token is write only, the user can't read it from the kernel
-directly. To access the VF, the user needs to start the PF with token parameter to
-setup a VF token in UUID format, then the VF can be accessed with this new token.
+When the PF is bound to ``vfio-pci``, by default it will have a randomly
+generated VF token. For security reasons, this token is write only, so the user
+cannot read it from the kernel directly. To access the VFs, the user needs to
+create a new token, and use it to initialize both VF and PF devices. The tokens
+are in UUID format, so any UUID generation tool can be used to create a new
+token.
 
-Since the ``vfio-pci`` module uses the VF token as internal data to provide the
-collaboration between SR-IOV PF and VFs, so DPDK can use the same VF token for all
-PF devices which bound to one application. This VF token can be specified by the EAL
-parameter ``--vfio-vf-token``.
+This VF token can be passed to DPDK by using EAL parameter ``--vfio-vf-token``.
+The token will be used for all PF and VF ports within the application.
 
-.. code-block:: console
+1. Generate the VF token by uuid command
 
-    1. Generate the VF token by uuid command
-        14d63f20-8445-11ea-8900-1f9ce7d5650d
+   .. code-block:: console
 
-    2. sudo modprobe vfio-pci enable_sriov=1
+      14d63f20-8445-11ea-8900-1f9ce7d5650d
 
-    2. ./usertools/dpdk-devbind.py -b vfio-pci 0000:86:00.0
+2. Load the ``vfio-pci`` module with ``enable_sriov`` parameter set
 
-    3. echo 2 > /sys/bus/pci/devices/0000:86:00.0/sriov_numvfs
+   .. code-block:: console
 
-    4. Start the PF:
-        <build_dir>/app/dpdk-testpmd -l 22-25 -n 4 -w 86:00.0 \
-         --vfio-vf-token=14d63f20-8445-11ea-8900-1f9ce7d5650d --file-prefix=pf -- -i
+      sudo modprobe vfio-pci enable_sriov=1
 
-    5. Start the VF:
-        <build_dir>/app/dpdk-testpmd -l 26-29 -n 4 -w 86:02.0 \
-         --vfio-vf-token=14d63f20-8445-11ea-8900-1f9ce7d5650d --file-prefix=vf0 -- -i
+3. Bind the PCI devices to ``vfio-pci`` driver
 
-Also, to use VFIO, both kernel and BIOS must support and be configured to use IO virtualization (such as Intel® VT-d).
+   .. code-block:: console
+
+      ./usertools/dpdk-devbind.py -b vfio-pci 0000:86:00.0
+
+4. Create the desired number of VF devices
+
+   .. code-block:: console
+
+      echo 2 > /sys/bus/pci/devices/0000:86:00.0/sriov_numvfs
+
+5. Start the DPDK application that will manage the PF device
+
+   .. code-block:: console
+
+      <build_dir>/app/dpdk-testpmd -l 22-25 -n 4 -w 86:00.0 \
+      --vfio-vf-token=14d63f20-8445-11ea-8900-1f9ce7d5650d --file-prefix=pf -- -i
+
+6. Start the DPDK application that will manage the VF device
+
+   .. code-block:: console
+
+      <build_dir>/app/dpdk-testpmd -l 26-29 -n 4 -w 86:02.0 \
+      --vfio-vf-token=14d63f20-8445-11ea-8900-1f9ce7d5650d --file-prefix=vf0 -- -i
+
+To make use of full VFIO functionality, both kernel and BIOS must support and be configured to use IO virtualization (such as Intel® VT-d).
+
+.. note::
+
+    Linux versions earlier than version 3.6 do not support VFIO.
 
 .. note::
 
-    ``vfio-pci`` module doesn't support the creation of virtual functions before Linux version 5.7.
+    Linux versions earlier than version 5.7 do not support the creation of virtual functions.
+
+.. note::
+    In most cases, specifying "iommu=on" as kernel parameter should be enough to
+    configure the Linux kernel to use IOMMU.
 
 For proper operation of VFIO when running DPDK applications as a non-privileged user, correct permissions should also be set up.
-This can be done by using the DPDK setup script (called dpdk-setup.sh and located in the usertools directory).
+This can be done by using the DPDK setup script (called ``dpdk-setup.sh`` and located in the usertools directory).
 
 .. note::
 
@@ -77,7 +103,7 @@ UIO
 
 In situations where using VFIO is not an option, there are alternative drivers one can use.
 In many cases, the standard ``uio_pci_generic`` module included in the Linux kernel
-can provide the uio capability. This module can be loaded using the command:
+can be used as a substitute for VFIO. This module can be loaded using the command:
 
 .. code-block:: console
 
@@ -106,12 +132,13 @@ It can be loaded as shown below:
 .. note::
 
    If the devices used for DPDK are bound to the ``uio_pci_generic`` kernel module,
-   please make sure that the IOMMU is disabled or passthrough. One can add
+   please make sure that the IOMMU is disabled or is in passthrough mode. One can add
    ``intel_iommu=off`` or ``amd_iommu=off`` or ``intel_iommu=on iommu=pt`` in GRUB
    command line on x86_64 systems, or add ``iommu.passthrough=1`` on aarch64 system.
 
-Since DPDK release 1.7 onward provides VFIO support, use of UIO is optional
-for platforms that support using VFIO.
+.. note::
+   Using UIO drivers is inherently unsafe do to this method lacking IOMMU
+   protection, and can only be done by root user.
 
 .. _bifurcated_driver:
 
@@ -145,36 +172,38 @@ Binding and Unbinding Network Ports to/from the Kernel Modules
 
 .. note::
 
-    PMDs Which use the bifurcated driver should not be unbind from their kernel drivers. this section is for PMDs which use the UIO or VFIO drivers.
+    PMDs Which use the bifurcated driver should not be unbound from their kernel drivers. This section is for PMDs which use the UIO or VFIO drivers.
 
 As of release 1.4, DPDK applications no longer automatically unbind all supported network ports from the kernel driver in use.
-Instead, in case the PMD being used use the UIO or VFIO drivers, all ports that are to be used by an DPDK application must be bound to the
-``uio_pci_generic``, ``igb_uio`` or ``vfio-pci`` module before the application is run.
+Instead, in case the PMD being used use the VFIO or UIO drivers, all ports that are to be used by an DPDK application must be bound to the
+``vfio-pci``, ``uio_pci_generic``, or ``igb_uio`` module before the application is run.
 For such PMDs, any network ports under Linux* control will be ignored and cannot be used by the application.
 
-To bind ports to the ``uio_pci_generic``, ``igb_uio`` or ``vfio-pci`` module for DPDK use,
-and then subsequently return ports to Linux* control,
-a utility script called dpdk-devbind.py is provided in the usertools subdirectory.
-This utility can be used to provide a view of the current state of the network ports on the system,
-and to bind and unbind those ports from the different kernel modules, including the uio and vfio modules.
-The following are some examples of how the script can be used.
-A full description of the script and its parameters can be obtained by calling the script with the ``--help`` or ``--usage`` options.
-Note that the uio or vfio kernel modules to be used, should be loaded into the kernel before
+To bind ports to the ``vfio-pci``, ``uio_pci_generic`` or ``igb_uio`` module for
+DPDK use, or to return ports to Linux* control, a utility script called
+``dpdk-devbind.py`` is provided in the ``usertools`` subdirectory. This utility can be
+used to provide a view of the current state of the network ports on the system,
+and to bind and unbind those ports from the different kernel modules, including
+the vfio and uio modules. The following are some examples of how the script can
+be used. A full description of the script and its parameters can be obtained by
+calling the script with the ``--help`` or ``--usage`` options. Note that the uio
+or vfio kernel modules to be used, should be loaded into the kernel before
 running the ``dpdk-devbind.py`` script.
 
 .. warning::
 
-    Due to the way VFIO works, there are certain limitations to which devices can be used with VFIO.
-    Mainly it comes down to how IOMMU groups work.
-    Any Virtual Function device can be used with VFIO on its own, but physical devices will require either all ports bound to VFIO,
-    or some of them bound to VFIO while others not being bound to anything at all.
+    Due to the way VFIO works, there are certain limitations to which devices
+    can be used with VFIO. Mainly it comes down to how IOMMU groups work. Any
+    Virtual Function device can usually be used with VFIO on its own, but
+    physical devices may require either all ports bound to VFIO, or some of them
+    bound to VFIO while others not being bound to anything at all.
 
     If your device is behind a PCI-to-PCI bridge, the bridge will then be part of the IOMMU group in which your device is in.
     Therefore, the bridge driver should also be unbound from the bridge PCI device for VFIO to work with devices behind the bridge.
 
 .. warning::
 
-    While any user can run the dpdk-devbind.py script to view the status of the network ports,
+    While any user can run the ``dpdk-devbind.py`` script to view the status of the network ports,
     binding or unbinding network ports requires root privileges.
 
 To see the status of all network ports on the system:
-- 
2.17.1

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dpdk-dev] [PATCH v2 3/4] doc: add VFIO no-IOMMU Linux GSG section
  2020-11-10 18:09 [dpdk-dev] [PATCH 1/4] doc: move VFIO driver to be first Anatoly Burakov
                   ` (4 preceding siblings ...)
  2020-11-18 15:37 ` [dpdk-dev] [PATCH v2 2/4] doc: reword VFIO and UIO Linux GSG section Anatoly Burakov
@ 2020-11-18 15:37 ` Anatoly Burakov
  2020-11-18 15:37 ` [dpdk-dev] [PATCH v2 4/4] doc: add VFIO troubleshooting section Anatoly Burakov
  6 siblings, 0 replies; 21+ messages in thread
From: Anatoly Burakov @ 2020-11-18 15:37 UTC (permalink / raw)
  To: dev; +Cc: thomas, john.mcnamara

Currently, we have no documentation on how to use VFIO in no-IOMMU mode.
Add such documentation.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---

Notes:
    v2:
    - Fixed the noiommu parameter name

 doc/guides/linux_gsg/linux_drivers.rst | 28 +++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/doc/guides/linux_gsg/linux_drivers.rst b/doc/guides/linux_gsg/linux_drivers.rst
index a3f443db2c..741b17a644 100644
--- a/doc/guides/linux_gsg/linux_drivers.rst
+++ b/doc/guides/linux_gsg/linux_drivers.rst
@@ -94,9 +94,35 @@ To make use of full VFIO functionality, both kernel and BIOS must support and be
 For proper operation of VFIO when running DPDK applications as a non-privileged user, correct permissions should also be set up.
 This can be done by using the DPDK setup script (called ``dpdk-setup.sh`` and located in the usertools directory).
 
+VFIO no-IOMMU mode
+------------------
+
+If there is no IOMMU available on the system, VFIO can still be used, but it has
+to be loaded with an additional module parameter:
+
+.. code-block:: console
+
+    modprobe vfio enable_unsafe_noiommu_mode=1
+
+Alternatively, one can also enable this option in an already loaded kernel module:
+
+.. code-block:: console
+
+    echo 1 > /sys/module/vfio/parameters/enable_unsafe_noiommu_mode
+
+After that, VFIO can be used with hardware devices as usual.
+
 .. note::
 
-    VFIO can be used without IOMMU. While this is unsafe, it does make it possible for the user to keep the degree of device access and programming that VFIO has, in situations where IOMMU is not available.
+    It may be required to unload all VFIO related-modules before probing the
+    module again with ``enable_unsafe_noiommu_mode=1`` parameter.
+
+.. warning::
+
+    Since no-IOMMU mode forgoes IOMMU protection, it is inherently unsafe. That
+    said, it does make it possible for the user to keep the degree of device
+    access and programming that VFIO has, in situations where IOMMU is not
+    available.
 
 UIO
 ---
-- 
2.17.1

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dpdk-dev] [PATCH v2 4/4] doc: add VFIO troubleshooting section
  2020-11-10 18:09 [dpdk-dev] [PATCH 1/4] doc: move VFIO driver to be first Anatoly Burakov
                   ` (5 preceding siblings ...)
  2020-11-18 15:37 ` [dpdk-dev] [PATCH v2 3/4] doc: add VFIO no-IOMMU " Anatoly Burakov
@ 2020-11-18 15:37 ` Anatoly Burakov
  6 siblings, 0 replies; 21+ messages in thread
From: Anatoly Burakov @ 2020-11-18 15:37 UTC (permalink / raw)
  To: dev; +Cc: thomas, john.mcnamara

There are common problems with VFIO that get asked over and over on the
mailing list. Document common problems with VFIO and how to fix them or
at least figure out what went wrong.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 doc/guides/linux_gsg/linux_drivers.rst | 43 ++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/doc/guides/linux_gsg/linux_drivers.rst b/doc/guides/linux_gsg/linux_drivers.rst
index 741b17a644..57001c67ee 100644
--- a/doc/guides/linux_gsg/linux_drivers.rst
+++ b/doc/guides/linux_gsg/linux_drivers.rst
@@ -271,3 +271,46 @@ To restore device ``82:00.0`` to its original kernel binding:
 .. code-block:: console
 
     ./usertools/dpdk-devbind.py --bind=ixgbe 82:00.0
+
+Troubleshooting VFIO
+--------------------
+
+In certain situations, using ``dpdk-devbind.py`` script to bing a device to VFIO
+driver may fail. The first place to check is the kernel messages:
+
+.. code-block:: console
+
+    # dmesg | tail
+    ...
+    [ 1297.875090] vfio-pci: probe of 0000:31:00.0 failed with error -22
+    ...
+
+In most cases, the ``error -22`` indicates that the VFIO subsystem couldn't be
+enabled because there is no IOMMU support. To check whether the kernel has been
+booted with correct parameters, one can check the kernel command-line:
+
+.. code-block:: console
+
+    cat /proc/cmdline
+
+Please refer to earlier sections on how to configure kernel parameters correctly
+for your system.
+
+If the kernel is configured correctly, one also has to make sure that the BIOS
+configuration has virtualization features (such as Intel® VT-d). There is no
+standard way to check if the platform is configured correctly, so please check
+with your platform documentation to see if it has such features, and how to
+enable them.
+
+In certain distributions, default kernel configuration is such that the no-IOMMU
+mode is disabled altogether at compile time. This can be checked in the boot
+configuration of your system:
+
+.. code-block:: console
+
+    # cat /boot/config-$(uname -r) | grep NOIOMMU
+    # CONFIG_VFIO_NOIOMMU is not set
+
+If ``CONFIG_VFIO_NOIOMMU`` is not enabled in the kernel configuration, VFIO
+driver will not support the no-IOMMU mode, and other alternatives (such as UIO
+drivers) will have to be used.
-- 
2.17.1

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [dpdk-dev] [PATCH v2 1/4] doc: move VFIO driver to be first
  2020-11-18 15:37 ` [dpdk-dev] [PATCH v2 1/4] doc: move VFIO driver to be first Anatoly Burakov
@ 2020-11-18 18:24   ` David Marchand
  2020-11-19 11:04     ` Burakov, Anatoly
  2020-11-19 11:32   ` [dpdk-dev] [PATCH v3 " Anatoly Burakov
                     ` (3 subsequent siblings)
  4 siblings, 1 reply; 21+ messages in thread
From: David Marchand @ 2020-11-18 18:24 UTC (permalink / raw)
  To: Anatoly Burakov; +Cc: dev, Thomas Monjalon, Mcnamara, John

On Wed, Nov 18, 2020 at 4:38 PM Anatoly Burakov
<anatoly.burakov@intel.com> wrote:
>
> Currently, the Linux GSG mentions UIO drivers first. This is not ideal
> as for the longest time, the recommended way to use DPDK with hardware
> devices has been to use VFIO driver.
>
> This commit simply moves UIO section after VFIO, with minor edits.
>
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>

This series does not apply on rc4, could you rebase it?
Thanks.


-- 
David Marchand


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [dpdk-dev] [PATCH v2 1/4] doc: move VFIO driver to be first
  2020-11-18 18:24   ` David Marchand
@ 2020-11-19 11:04     ` Burakov, Anatoly
  0 siblings, 0 replies; 21+ messages in thread
From: Burakov, Anatoly @ 2020-11-19 11:04 UTC (permalink / raw)
  To: David Marchand; +Cc: dev, Thomas Monjalon, Mcnamara, John

On 18-Nov-20 6:24 PM, David Marchand wrote:
> On Wed, Nov 18, 2020 at 4:38 PM Anatoly Burakov
> <anatoly.burakov@intel.com> wrote:
>>
>> Currently, the Linux GSG mentions UIO drivers first. This is not ideal
>> as for the longest time, the recommended way to use DPDK with hardware
>> devices has been to use VFIO driver.
>>
>> This commit simply moves UIO section after VFIO, with minor edits.
>>
>> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> 
> This series does not apply on rc4, could you rebase it?
> Thanks.
> 

Sure, will do.

-- 
Thanks,
Anatoly

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dpdk-dev] [PATCH v3 1/4] doc: move VFIO driver to be first
  2020-11-18 15:37 ` [dpdk-dev] [PATCH v2 1/4] doc: move VFIO driver to be first Anatoly Burakov
  2020-11-18 18:24   ` David Marchand
@ 2020-11-19 11:32   ` Anatoly Burakov
  2020-11-23 17:22     ` Ferruh Yigit
  2020-11-19 11:32   ` [dpdk-dev] [PATCH v3 2/4] doc: reword VFIO and UIO Linux GSG section Anatoly Burakov
                     ` (2 subsequent siblings)
  4 siblings, 1 reply; 21+ messages in thread
From: Anatoly Burakov @ 2020-11-19 11:32 UTC (permalink / raw)
  To: dev; +Cc: thomas, john.mcnamara

Currently, the Linux GSG mentions UIO drivers first. This is not ideal
as for the longest time, the recommended way to use DPDK with hardware
devices has been to use VFIO driver.

This commit simply moves UIO section after VFIO, with minor edits.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 doc/guides/linux_gsg/linux_drivers.rst | 86 +++++++++++++-------------
 1 file changed, 43 insertions(+), 43 deletions(-)

diff --git a/doc/guides/linux_gsg/linux_drivers.rst b/doc/guides/linux_gsg/linux_drivers.rst
index ef8798569a..9cd97dd39e 100644
--- a/doc/guides/linux_gsg/linux_drivers.rst
+++ b/doc/guides/linux_gsg/linux_drivers.rst
@@ -12,51 +12,10 @@ Different PMDs may require different kernel drivers in order to work properly.
 Depends on the PMD being used, a corresponding kernel driver should be load
 and bind to the network ports.
 
-UIO
----
-
-A small kernel module to set up the device, map device memory to user-space and register interrupts.
-In many cases, the standard ``uio_pci_generic`` module included in the Linux kernel
-can provide the uio capability. This module can be loaded using the command:
-
-.. code-block:: console
-
-    sudo modprobe uio_pci_generic
-
-.. note::
-
-    ``uio_pci_generic`` module doesn't support the creation of virtual functions.
-
-As an alternative to the ``uio_pci_generic``, there is the ``igb_uio`` module
-which can be found in the repository `dpdk-kmods <http://git.dpdk.org/dpdk-kmods>`_.
-It can be loaded as shown below:
-
-.. code-block:: console
-
-    sudo modprobe uio
-    sudo insmod igb_uio.ko
-
-.. note::
-
-   If UEFI secure boot is enabled, the Linux kernel may disallow the use of
-   UIO on the system. Therefore, devices for use by DPDK should be bound to the
-   ``vfio-pci`` kernel module rather than any UIO-based module.
-   For more details see :ref:`linux_gsg_binding_kernel` below.
-
-.. note::
-
-   If the devices used for DPDK are bound to the ``uio_pci_generic`` kernel module,
-   please make sure that the IOMMU is disabled or passthrough. One can add
-   ``intel_iommu=off`` or ``amd_iommu=off`` or ``intel_iommu=on iommu=pt`` in GRUB
-   command line on x86_64 systems, or add ``iommu.passthrough=1`` on aarch64 system.
-
-Since DPDK release 1.7 onward provides VFIO support, use of UIO is optional
-for platforms that support using VFIO.
-
 VFIO
 ----
 
-A more robust and secure driver in compare to the ``UIO``, relying on IOMMU protection.
+VFIO is a robust and secure driver that relies on IOMMU protection.
 To make use of VFIO, the ``vfio-pci`` module must be loaded:
 
 .. code-block:: console
@@ -111,7 +70,48 @@ This can be done by using the DPDK setup script (called dpdk-setup.sh and locate
 
 .. note::
 
-    VFIO can be used without IOMMU. While this is just as unsafe as using UIO, it does make it possible for the user to keep the degree of device access and programming that VFIO has, in situations where IOMMU is not available.
+    VFIO can be used without IOMMU. While this is unsafe, it does make it possible for the user to keep the degree of device access and programming that VFIO has, in situations where IOMMU is not available.
+
+UIO
+---
+
+In situations where using VFIO is not an option, there are alternative drivers one can use.
+In many cases, the standard ``uio_pci_generic`` module included in the Linux kernel
+can provide the uio capability. This module can be loaded using the command:
+
+.. code-block:: console
+
+    sudo modprobe uio_pci_generic
+
+.. note::
+
+    ``uio_pci_generic`` module doesn't support the creation of virtual functions.
+
+As an alternative to the ``uio_pci_generic``, there is the ``igb_uio`` module
+which can be found in the repository `dpdk-kmods <http://git.dpdk.org/dpdk-kmods>`_.
+It can be loaded as shown below:
+
+.. code-block:: console
+
+    sudo modprobe uio
+    sudo insmod igb_uio.ko
+
+.. note::
+
+   If UEFI secure boot is enabled, the Linux kernel may disallow the use of
+   UIO on the system. Therefore, devices for use by DPDK should be bound to the
+   ``vfio-pci`` kernel module rather than any UIO-based module.
+   For more details see :ref:`linux_gsg_binding_kernel` below.
+
+.. note::
+
+   If the devices used for DPDK are bound to the ``uio_pci_generic`` kernel module,
+   please make sure that the IOMMU is disabled or passthrough. One can add
+   ``intel_iommu=off`` or ``amd_iommu=off`` or ``intel_iommu=on iommu=pt`` in GRUB
+   command line on x86_64 systems, or add ``iommu.passthrough=1`` on aarch64 system.
+
+Since DPDK release 1.7 onward provides VFIO support, use of UIO is optional
+for platforms that support using VFIO.
 
 .. _bifurcated_driver:
 
-- 
2.17.1

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dpdk-dev] [PATCH v3 2/4] doc: reword VFIO and UIO Linux GSG section
  2020-11-18 15:37 ` [dpdk-dev] [PATCH v2 1/4] doc: move VFIO driver to be first Anatoly Burakov
  2020-11-18 18:24   ` David Marchand
  2020-11-19 11:32   ` [dpdk-dev] [PATCH v3 " Anatoly Burakov
@ 2020-11-19 11:32   ` Anatoly Burakov
  2020-11-19 11:32   ` [dpdk-dev] [PATCH v3 3/4] doc: add VFIO no-IOMMU " Anatoly Burakov
  2020-11-19 11:32   ` [dpdk-dev] [PATCH v3 4/4] doc: add VFIO troubleshooting section Anatoly Burakov
  4 siblings, 0 replies; 21+ messages in thread
From: Anatoly Burakov @ 2020-11-19 11:32 UTC (permalink / raw)
  To: dev; +Cc: thomas, john.mcnamara

Make sure that we always prioritize VFIO over UIO. Also, minor wording
corrections and improvements.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---

Notes:
    v3:
    - Rebase on top of rc4
    - Add a label for instructions for running as non-root, and refer to it
    
    v2:
    - Fix formatting for VF token section
    - Some more typo and formatting fixes

 doc/guides/linux_gsg/enable_func.rst   |   2 +
 doc/guides/linux_gsg/linux_drivers.rst | 138 +++++++++++++++----------
 2 files changed, 88 insertions(+), 52 deletions(-)

diff --git a/doc/guides/linux_gsg/enable_func.rst b/doc/guides/linux_gsg/enable_func.rst
index aab32252ea..a8b07b11df 100644
--- a/doc/guides/linux_gsg/enable_func.rst
+++ b/doc/guides/linux_gsg/enable_func.rst
@@ -59,6 +59,8 @@ The application can then determine what action to take, if any, if the HPET is n
     These generic APIs can work with either TSC or HPET time sources, depending on what is requested by an application call to ``rte_eal_hpet_init()``,
     if any, and on what is available on the system at runtime.
 
+.. _Running_Without_Root_Privileges:
+
 Running DPDK Applications Without Root Privileges
 --------------------------------------------------------
 
diff --git a/doc/guides/linux_gsg/linux_drivers.rst b/doc/guides/linux_gsg/linux_drivers.rst
index 9cd97dd39e..19ac61d8f9 100644
--- a/doc/guides/linux_gsg/linux_drivers.rst
+++ b/doc/guides/linux_gsg/linux_drivers.rst
@@ -9,8 +9,8 @@ Linux Drivers
 =============
 
 Different PMDs may require different kernel drivers in order to work properly.
-Depends on the PMD being used, a corresponding kernel driver should be load
-and bind to the network ports.
+Depending on the PMD being used, a corresponding kernel driver should be loaded,
+and network ports should be bound to that driver.
 
 VFIO
 ----
@@ -22,51 +22,82 @@ To make use of VFIO, the ``vfio-pci`` module must be loaded:
 
     sudo modprobe vfio-pci
 
-Note that in order to use VFIO, your kernel must support it.
-VFIO kernel modules have been included in the Linux kernel since version 3.6.0 and are usually present by default,
-however please consult your distributions documentation to make sure that is the case.
+VFIO kernel is usually present by default in all distributions, however please
+consult your distributions documentation to make sure that is the case.
 
-The ``vfio-pci`` module since Linux version 5.7 supports the creation of virtual
-functions. After the PF is bound to vfio-pci module, the user can create the VFs
-by sysfs interface, and these VFs are bound to vfio-pci module automatically.
+Since Linux version 5.7, the ``vfio-pci`` module supports the creation of
+virtual functions. After the PF is bound to ``vfio-pci`` module, the user can
+create the VFs using the ``sysfs`` interface, and these VFs will be bound to
+``vfio-pci`` module automatically.
 
-When the PF is bound to vfio-pci, it has initial VF token generated by random. For
-security reason, this token is write only, the user can't read it from the kernel
-directly. To access the VF, the user needs to start the PF with token parameter to
-setup a VF token in UUID format, then the VF can be accessed with this new token.
+When the PF is bound to ``vfio-pci``, by default it will have a randomly
+generated VF token. For security reasons, this token is write only, so the user
+cannot read it from the kernel directly. To access the VFs, the user needs to
+create a new token, and use it to initialize both VF and PF devices. The tokens
+are in UUID format, so any UUID generation tool can be used to create a new
+token.
 
-Since the ``vfio-pci`` module uses the VF token as internal data to provide the
-collaboration between SR-IOV PF and VFs, so DPDK can use the same VF token for all
-PF devices which bound to one application. This VF token can be specified by the EAL
-parameter ``--vfio-vf-token``.
+This VF token can be passed to DPDK by using EAL parameter ``--vfio-vf-token``.
+The token will be used for all PF and VF ports within the application.
 
-.. code-block:: console
+1. Generate the VF token by uuid command
 
-    1. Generate the VF token by uuid command
-        14d63f20-8445-11ea-8900-1f9ce7d5650d
+   .. code-block:: console
 
-    2. sudo modprobe vfio-pci enable_sriov=1
+      14d63f20-8445-11ea-8900-1f9ce7d5650d
 
-    2. ./usertools/dpdk-devbind.py -b vfio-pci 0000:86:00.0
+2. Load the ``vfio-pci`` module with ``enable_sriov`` parameter set
 
-    3. echo 2 > /sys/bus/pci/devices/0000:86:00.0/sriov_numvfs
+   .. code-block:: console
 
-    4. Start the PF:
-        <build_dir>/app/dpdk-testpmd -l 22-25 -n 4 -a 86:00.0 \
-         --vfio-vf-token=14d63f20-8445-11ea-8900-1f9ce7d5650d --file-prefix=pf -- -i
+      sudo modprobe vfio-pci enable_sriov=1
 
-    5. Start the VF:
-        <build_dir>/app/dpdk-testpmd -l 26-29 -n 4 -a 86:02.0 \
-         --vfio-vf-token=14d63f20-8445-11ea-8900-1f9ce7d5650d --file-prefix=vf0 -- -i
+3. Bind the PCI devices to ``vfio-pci`` driver
 
-Also, to use VFIO, both kernel and BIOS must support and be configured to use IO virtualization (such as Intel® VT-d).
+   .. code-block:: console
+
+      ./usertools/dpdk-devbind.py -b vfio-pci 0000:86:00.0
+
+4. Create the desired number of VF devices
+
+   .. code-block:: console
+
+      echo 2 > /sys/bus/pci/devices/0000:86:00.0/sriov_numvfs
+
+5. Start the DPDK application that will manage the PF device
+
+   .. code-block:: console
+
+      <build_dir>/app/dpdk-testpmd -l 22-25 -n 4 -a 86:00.0 \
+      --vfio-vf-token=14d63f20-8445-11ea-8900-1f9ce7d5650d --file-prefix=pf -- -i
+
+6. Start the DPDK application that will manage the VF device
+
+   .. code-block:: console
+
+      <build_dir>/app/dpdk-testpmd -l 26-29 -n 4 -a 86:02.0 \
+      --vfio-vf-token=14d63f20-8445-11ea-8900-1f9ce7d5650d --file-prefix=vf0 -- -i
+
+To make use of full VFIO functionality, both kernel and BIOS must support and be configured to use IO virtualization (such as Intel® VT-d).
+
+.. note::
+
+    Linux versions earlier than version 3.6 do not support VFIO.
 
 .. note::
 
-    ``vfio-pci`` module doesn't support the creation of virtual functions before Linux version 5.7.
+    Linux versions earlier than version 5.7 do not support the creation of
+    virtual functions within the VFIO framework.
+
+.. note::
+    In most cases, specifying "iommu=on" as kernel parameter should be enough to
+    configure the Linux kernel to use IOMMU.
 
-For proper operation of VFIO when running DPDK applications as a non-privileged user, correct permissions should also be set up.
-This can be done by using the DPDK setup script (called dpdk-setup.sh and located in the usertools directory).
+For proper operation of VFIO when running DPDK applications as a non-privileged
+user, correct permissions should also be set up. This can be done by using the
+DPDK setup script (called ``dpdk-setup.sh`` and located in the ``usertools``
+directory). For more information, please refer to
+:ref:`Running_Without_Root_Privileges`.
 
 .. note::
 
@@ -77,7 +108,7 @@ UIO
 
 In situations where using VFIO is not an option, there are alternative drivers one can use.
 In many cases, the standard ``uio_pci_generic`` module included in the Linux kernel
-can provide the uio capability. This module can be loaded using the command:
+can be used as a substitute for VFIO. This module can be loaded using the command:
 
 .. code-block:: console
 
@@ -106,12 +137,13 @@ It can be loaded as shown below:
 .. note::
 
    If the devices used for DPDK are bound to the ``uio_pci_generic`` kernel module,
-   please make sure that the IOMMU is disabled or passthrough. One can add
+   please make sure that the IOMMU is disabled or is in passthrough mode. One can add
    ``intel_iommu=off`` or ``amd_iommu=off`` or ``intel_iommu=on iommu=pt`` in GRUB
    command line on x86_64 systems, or add ``iommu.passthrough=1`` on aarch64 system.
 
-Since DPDK release 1.7 onward provides VFIO support, use of UIO is optional
-for platforms that support using VFIO.
+.. note::
+   Using UIO drivers is inherently unsafe do to this method lacking IOMMU
+   protection, and can only be done by root user.
 
 .. _bifurcated_driver:
 
@@ -145,36 +177,38 @@ Binding and Unbinding Network Ports to/from the Kernel Modules
 
 .. note::
 
-    PMDs Which use the bifurcated driver should not be unbind from their kernel drivers. this section is for PMDs which use the UIO or VFIO drivers.
+    PMDs Which use the bifurcated driver should not be unbound from their kernel drivers. This section is for PMDs which use the UIO or VFIO drivers.
 
 As of release 1.4, DPDK applications no longer automatically unbind all supported network ports from the kernel driver in use.
-Instead, in case the PMD being used use the UIO or VFIO drivers, all ports that are to be used by an DPDK application must be bound to the
-``uio_pci_generic``, ``igb_uio`` or ``vfio-pci`` module before the application is run.
+Instead, in case the PMD being used use the VFIO or UIO drivers, all ports that are to be used by an DPDK application must be bound to the
+``vfio-pci``, ``uio_pci_generic``, or ``igb_uio`` module before the application is run.
 For such PMDs, any network ports under Linux* control will be ignored and cannot be used by the application.
 
-To bind ports to the ``uio_pci_generic``, ``igb_uio`` or ``vfio-pci`` module for DPDK use,
-and then subsequently return ports to Linux* control,
-a utility script called dpdk-devbind.py is provided in the usertools subdirectory.
-This utility can be used to provide a view of the current state of the network ports on the system,
-and to bind and unbind those ports from the different kernel modules, including the uio and vfio modules.
-The following are some examples of how the script can be used.
-A full description of the script and its parameters can be obtained by calling the script with the ``--help`` or ``--usage`` options.
-Note that the uio or vfio kernel modules to be used, should be loaded into the kernel before
+To bind ports to the ``vfio-pci``, ``uio_pci_generic`` or ``igb_uio`` module for
+DPDK use, or to return ports to Linux* control, a utility script called
+``dpdk-devbind.py`` is provided in the ``usertools`` subdirectory. This utility can be
+used to provide a view of the current state of the network ports on the system,
+and to bind and unbind those ports from the different kernel modules, including
+the vfio and uio modules. The following are some examples of how the script can
+be used. A full description of the script and its parameters can be obtained by
+calling the script with the ``--help`` or ``--usage`` options. Note that the uio
+or vfio kernel modules to be used, should be loaded into the kernel before
 running the ``dpdk-devbind.py`` script.
 
 .. warning::
 
-    Due to the way VFIO works, there are certain limitations to which devices can be used with VFIO.
-    Mainly it comes down to how IOMMU groups work.
-    Any Virtual Function device can be used with VFIO on its own, but physical devices will require either all ports bound to VFIO,
-    or some of them bound to VFIO while others not being bound to anything at all.
+    Due to the way VFIO works, there are certain limitations to which devices
+    can be used with VFIO. Mainly it comes down to how IOMMU groups work. Any
+    Virtual Function device can usually be used with VFIO on its own, but
+    physical devices may require either all ports bound to VFIO, or some of them
+    bound to VFIO while others not being bound to anything at all.
 
     If your device is behind a PCI-to-PCI bridge, the bridge will then be part of the IOMMU group in which your device is in.
     Therefore, the bridge driver should also be unbound from the bridge PCI device for VFIO to work with devices behind the bridge.
 
 .. warning::
 
-    While any user can run the dpdk-devbind.py script to view the status of the network ports,
+    While any user can run the ``dpdk-devbind.py`` script to view the status of the network ports,
     binding or unbinding network ports requires root privileges.
 
 To see the status of all network ports on the system:
-- 
2.17.1

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dpdk-dev] [PATCH v3 3/4] doc: add VFIO no-IOMMU Linux GSG section
  2020-11-18 15:37 ` [dpdk-dev] [PATCH v2 1/4] doc: move VFIO driver to be first Anatoly Burakov
                     ` (2 preceding siblings ...)
  2020-11-19 11:32   ` [dpdk-dev] [PATCH v3 2/4] doc: reword VFIO and UIO Linux GSG section Anatoly Burakov
@ 2020-11-19 11:32   ` Anatoly Burakov
  2020-11-27 15:47     ` Bruce Richardson
  2020-11-19 11:32   ` [dpdk-dev] [PATCH v3 4/4] doc: add VFIO troubleshooting section Anatoly Burakov
  4 siblings, 1 reply; 21+ messages in thread
From: Anatoly Burakov @ 2020-11-19 11:32 UTC (permalink / raw)
  To: dev; +Cc: thomas, john.mcnamara

Currently, we have no documentation on how to use VFIO in no-IOMMU mode.
Add such documentation.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---

Notes:
    v2:
    - Fixed the noiommu parameter name

 doc/guides/linux_gsg/linux_drivers.rst | 28 +++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/doc/guides/linux_gsg/linux_drivers.rst b/doc/guides/linux_gsg/linux_drivers.rst
index 19ac61d8f9..9c61850dbb 100644
--- a/doc/guides/linux_gsg/linux_drivers.rst
+++ b/doc/guides/linux_gsg/linux_drivers.rst
@@ -99,9 +99,35 @@ DPDK setup script (called ``dpdk-setup.sh`` and located in the ``usertools``
 directory). For more information, please refer to
 :ref:`Running_Without_Root_Privileges`.
 
+VFIO no-IOMMU mode
+------------------
+
+If there is no IOMMU available on the system, VFIO can still be used, but it has
+to be loaded with an additional module parameter:
+
+.. code-block:: console
+
+    modprobe vfio enable_unsafe_noiommu_mode=1
+
+Alternatively, one can also enable this option in an already loaded kernel module:
+
+.. code-block:: console
+
+    echo 1 > /sys/module/vfio/parameters/enable_unsafe_noiommu_mode
+
+After that, VFIO can be used with hardware devices as usual.
+
 .. note::
 
-    VFIO can be used without IOMMU. While this is unsafe, it does make it possible for the user to keep the degree of device access and programming that VFIO has, in situations where IOMMU is not available.
+    It may be required to unload all VFIO related-modules before probing the
+    module again with ``enable_unsafe_noiommu_mode=1`` parameter.
+
+.. warning::
+
+    Since no-IOMMU mode forgoes IOMMU protection, it is inherently unsafe. That
+    said, it does make it possible for the user to keep the degree of device
+    access and programming that VFIO has, in situations where IOMMU is not
+    available.
 
 UIO
 ---
-- 
2.17.1

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dpdk-dev] [PATCH v3 4/4] doc: add VFIO troubleshooting section
  2020-11-18 15:37 ` [dpdk-dev] [PATCH v2 1/4] doc: move VFIO driver to be first Anatoly Burakov
                     ` (3 preceding siblings ...)
  2020-11-19 11:32   ` [dpdk-dev] [PATCH v3 3/4] doc: add VFIO no-IOMMU " Anatoly Burakov
@ 2020-11-19 11:32   ` Anatoly Burakov
  2020-11-27 15:30     ` Thomas Monjalon
                       ` (2 more replies)
  4 siblings, 3 replies; 21+ messages in thread
From: Anatoly Burakov @ 2020-11-19 11:32 UTC (permalink / raw)
  To: dev; +Cc: thomas, john.mcnamara

There are common problems with VFIO that get asked over and over on the
mailing list. Document common problems with VFIO and how to fix them or
at least figure out what went wrong.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 doc/guides/linux_gsg/linux_drivers.rst | 43 ++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/doc/guides/linux_gsg/linux_drivers.rst b/doc/guides/linux_gsg/linux_drivers.rst
index 9c61850dbb..f3c06c68d1 100644
--- a/doc/guides/linux_gsg/linux_drivers.rst
+++ b/doc/guides/linux_gsg/linux_drivers.rst
@@ -276,3 +276,46 @@ To restore device ``82:00.0`` to its original kernel binding:
 .. code-block:: console
 
     ./usertools/dpdk-devbind.py --bind=ixgbe 82:00.0
+
+Troubleshooting VFIO
+--------------------
+
+In certain situations, using ``dpdk-devbind.py`` script to bing a device to VFIO
+driver may fail. The first place to check is the kernel messages:
+
+.. code-block:: console
+
+    # dmesg | tail
+    ...
+    [ 1297.875090] vfio-pci: probe of 0000:31:00.0 failed with error -22
+    ...
+
+In most cases, the ``error -22`` indicates that the VFIO subsystem couldn't be
+enabled because there is no IOMMU support. To check whether the kernel has been
+booted with correct parameters, one can check the kernel command-line:
+
+.. code-block:: console
+
+    cat /proc/cmdline
+
+Please refer to earlier sections on how to configure kernel parameters correctly
+for your system.
+
+If the kernel is configured correctly, one also has to make sure that the BIOS
+configuration has virtualization features (such as Intel® VT-d). There is no
+standard way to check if the platform is configured correctly, so please check
+with your platform documentation to see if it has such features, and how to
+enable them.
+
+In certain distributions, default kernel configuration is such that the no-IOMMU
+mode is disabled altogether at compile time. This can be checked in the boot
+configuration of your system:
+
+.. code-block:: console
+
+    # cat /boot/config-$(uname -r) | grep NOIOMMU
+    # CONFIG_VFIO_NOIOMMU is not set
+
+If ``CONFIG_VFIO_NOIOMMU`` is not enabled in the kernel configuration, VFIO
+driver will not support the no-IOMMU mode, and other alternatives (such as UIO
+drivers) will have to be used.
-- 
2.17.1

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [dpdk-dev] [PATCH v3 1/4] doc: move VFIO driver to be first
  2020-11-19 11:32   ` [dpdk-dev] [PATCH v3 " Anatoly Burakov
@ 2020-11-23 17:22     ` Ferruh Yigit
  0 siblings, 0 replies; 21+ messages in thread
From: Ferruh Yigit @ 2020-11-23 17:22 UTC (permalink / raw)
  To: Anatoly Burakov, dev; +Cc: thomas, john.mcnamara

On 11/19/2020 11:32 AM, Anatoly Burakov wrote:
> Currently, the Linux GSG mentions UIO drivers first. This is not ideal
> as for the longest time, the recommended way to use DPDK with hardware
> devices has been to use VFIO driver.
> 
> This commit simply moves UIO section after VFIO, with minor edits.
> 
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>

Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [dpdk-dev] [PATCH v3 4/4] doc: add VFIO troubleshooting section
  2020-11-19 11:32   ` [dpdk-dev] [PATCH v3 4/4] doc: add VFIO troubleshooting section Anatoly Burakov
@ 2020-11-27 15:30     ` Thomas Monjalon
  2020-11-27 15:57       ` Burakov, Anatoly
  2020-11-27 15:49     ` Bruce Richardson
  2020-11-27 16:29     ` Kevin Traynor
  2 siblings, 1 reply; 21+ messages in thread
From: Thomas Monjalon @ 2020-11-27 15:30 UTC (permalink / raw)
  To: Anatoly Burakov; +Cc: dev, john.mcnamara

19/11/2020 12:32, Anatoly Burakov:
> There are common problems with VFIO that get asked over and over on the
> mailing list. Document common problems with VFIO and how to fix them or
> at least figure out what went wrong.
> 
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>

Thanks for the effort.
It hope there will be some reviews for 21.02.
It seems too late for 20.11.




^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [dpdk-dev] [PATCH v3 3/4] doc: add VFIO no-IOMMU Linux GSG section
  2020-11-19 11:32   ` [dpdk-dev] [PATCH v3 3/4] doc: add VFIO no-IOMMU " Anatoly Burakov
@ 2020-11-27 15:47     ` Bruce Richardson
  0 siblings, 0 replies; 21+ messages in thread
From: Bruce Richardson @ 2020-11-27 15:47 UTC (permalink / raw)
  To: Anatoly Burakov; +Cc: dev, thomas, john.mcnamara

On Thu, Nov 19, 2020 at 11:32:31AM +0000, Anatoly Burakov wrote:
> Currently, we have no documentation on how to use VFIO in no-IOMMU mode.
> Add such documentation.
> 
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> ---
> 
> Notes:
>     v2:
>     - Fixed the noiommu parameter name
> 
>  doc/guides/linux_gsg/linux_drivers.rst | 28 +++++++++++++++++++++++++-
>  1 file changed, 27 insertions(+), 1 deletion(-)
> 
This looks good to me. This info is good to have in the GSG.

Acked-by: Bruce Richardson <bruce.richardson@intel.com>


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [dpdk-dev] [PATCH v3 4/4] doc: add VFIO troubleshooting section
  2020-11-19 11:32   ` [dpdk-dev] [PATCH v3 4/4] doc: add VFIO troubleshooting section Anatoly Burakov
  2020-11-27 15:30     ` Thomas Monjalon
@ 2020-11-27 15:49     ` Bruce Richardson
  2020-11-27 16:29     ` Kevin Traynor
  2 siblings, 0 replies; 21+ messages in thread
From: Bruce Richardson @ 2020-11-27 15:49 UTC (permalink / raw)
  To: Anatoly Burakov; +Cc: dev, thomas, john.mcnamara

On Thu, Nov 19, 2020 at 11:32:32AM +0000, Anatoly Burakov wrote:
> There are common problems with VFIO that get asked over and over on the
> mailing list. Document common problems with VFIO and how to fix them or
> at least figure out what went wrong.
> 
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> ---

One typo spotted below.

Acked-by: Bruce Richardson <bruce.richardson@intel.com>

>  doc/guides/linux_gsg/linux_drivers.rst | 43 ++++++++++++++++++++++++++
>  1 file changed, 43 insertions(+)
> 
> diff --git a/doc/guides/linux_gsg/linux_drivers.rst b/doc/guides/linux_gsg/linux_drivers.rst
> index 9c61850dbb..f3c06c68d1 100644
> --- a/doc/guides/linux_gsg/linux_drivers.rst
> +++ b/doc/guides/linux_gsg/linux_drivers.rst
> @@ -276,3 +276,46 @@ To restore device ``82:00.0`` to its original kernel binding:
>  .. code-block:: console
>  
>      ./usertools/dpdk-devbind.py --bind=ixgbe 82:00.0
> +
> +Troubleshooting VFIO
> +--------------------
> +
> +In certain situations, using ``dpdk-devbind.py`` script to bing a device to VFIO

typo: s/bing/bind/


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [dpdk-dev] [PATCH v3 4/4] doc: add VFIO troubleshooting section
  2020-11-27 15:30     ` Thomas Monjalon
@ 2020-11-27 15:57       ` Burakov, Anatoly
  0 siblings, 0 replies; 21+ messages in thread
From: Burakov, Anatoly @ 2020-11-27 15:57 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev, john.mcnamara

On 27-Nov-20 3:30 PM, Thomas Monjalon wrote:
> 19/11/2020 12:32, Anatoly Burakov:
>> There are common problems with VFIO that get asked over and over on the
>> mailing list. Document common problems with VFIO and how to fix them or
>> at least figure out what went wrong.
>>
>> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> 
> Thanks for the effort.
> It hope there will be some reviews for 21.02.
> It seems too late for 20.11.
> 
> 
> 

All but one patch seems to be acked now. Is it still possible to get it 
into LTS? Or maybe we'll get it into 21.02 and backport it then? Seems 
like a missed opportunity for good documentation.

-- 
Thanks,
Anatoly

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [dpdk-dev] [PATCH v3 4/4] doc: add VFIO troubleshooting section
  2020-11-19 11:32   ` [dpdk-dev] [PATCH v3 4/4] doc: add VFIO troubleshooting section Anatoly Burakov
  2020-11-27 15:30     ` Thomas Monjalon
  2020-11-27 15:49     ` Bruce Richardson
@ 2020-11-27 16:29     ` Kevin Traynor
  2020-11-27 17:27       ` Thomas Monjalon
  2 siblings, 1 reply; 21+ messages in thread
From: Kevin Traynor @ 2020-11-27 16:29 UTC (permalink / raw)
  To: Anatoly Burakov, dev; +Cc: thomas, john.mcnamara

On 19/11/2020 11:32, Anatoly Burakov wrote:
> There are common problems with VFIO that get asked over and over on the
> mailing list. Document common problems with VFIO and how to fix them or
> at least figure out what went wrong.
> 
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> ---
>  doc/guides/linux_gsg/linux_drivers.rst | 43 ++++++++++++++++++++++++++
>  1 file changed, 43 insertions(+)
> 
> diff --git a/doc/guides/linux_gsg/linux_drivers.rst b/doc/guides/linux_gsg/linux_drivers.rst
> index 9c61850dbb..f3c06c68d1 100644
> --- a/doc/guides/linux_gsg/linux_drivers.rst
> +++ b/doc/guides/linux_gsg/linux_drivers.rst
> @@ -276,3 +276,46 @@ To restore device ``82:00.0`` to its original kernel binding:
>  .. code-block:: console
>  
>      ./usertools/dpdk-devbind.py --bind=ixgbe 82:00.0
> +
> +Troubleshooting VFIO
> +--------------------
> +
> +In certain situations, using ``dpdk-devbind.py`` script to bing a device to VFIO
> +driver may fail. The first place to check is the kernel messages:
> +
> +.. code-block:: console
> +
> +    # dmesg | tail
> +    ...
> +    [ 1297.875090] vfio-pci: probe of 0000:31:00.0 failed with error -22
> +    ...
> +
> +In most cases, the ``error -22`` indicates that the VFIO subsystem couldn't be
> +enabled because there is no IOMMU support. To check whether the kernel has been
> +booted with correct parameters, one can check the kernel command-line:
> +
> +.. code-block:: console
> +
> +    cat /proc/cmdline
> +
> +Please refer to earlier sections on how to configure kernel parameters correctly
> +for your system.
> +
> +If the kernel is configured correctly, one also has to make sure that the BIOS
> +configuration has virtualization features (such as Intel® VT-d). There is no
> +standard way to check if the platform is configured correctly, so please check
> +with your platform documentation to see if it has such features, and how to
> +enable them.
> +
> +In certain distributions, default kernel configuration is such that the no-IOMMU
> +mode is disabled altogether at compile time. This can be checked in the boot
> +configuration of your system:
> +
> +.. code-block:: console
> +
> +    # cat /boot/config-$(uname -r) | grep NOIOMMU
> +    # CONFIG_VFIO_NOIOMMU is not set
> +
> +If ``CONFIG_VFIO_NOIOMMU`` is not enabled in the kernel configuration, VFIO
> +driver will not support the no-IOMMU mode, and other alternatives (such as UIO
> +drivers) will have to be used.
> 

Good to have some debug hints and it avoids a backport ;-)

With Bruce's s/bing/bind/

Acked-by: Kevin Traynor <ktraynor@redhat.com>


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [dpdk-dev] [PATCH v3 4/4] doc: add VFIO troubleshooting section
  2020-11-27 16:29     ` Kevin Traynor
@ 2020-11-27 17:27       ` Thomas Monjalon
  0 siblings, 0 replies; 21+ messages in thread
From: Thomas Monjalon @ 2020-11-27 17:27 UTC (permalink / raw)
  To: Anatoly Burakov; +Cc: dev, john.mcnamara, Kevin Traynor, bruce.richardson

27/11/2020 17:29, Kevin Traynor:
> On 19/11/2020 11:32, Anatoly Burakov wrote:
> > There are common problems with VFIO that get asked over and over on the
> > mailing list. Document common problems with VFIO and how to fix them or
> > at least figure out what went wrong.
> > 
> > Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
[...]
> With Bruce's s/bing/bind/
> 
> Acked-by: Kevin Traynor <ktraynor@redhat.com>

Series applied with some formatting adjustments, thanks





^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2020-11-27 17:27 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-10 18:09 [dpdk-dev] [PATCH 1/4] doc: move VFIO driver to be first Anatoly Burakov
2020-11-10 18:09 ` [dpdk-dev] [PATCH 2/4] doc: reword VFIO and UIO Linux GSG section Anatoly Burakov
2020-11-10 18:09 ` [dpdk-dev] [PATCH 3/4] doc: add VFIO no-IOMMU " Anatoly Burakov
2020-11-10 18:09 ` [dpdk-dev] [PATCH 4/4] doc: add VFIO troubleshooting section Anatoly Burakov
2020-11-18 15:37 ` [dpdk-dev] [PATCH v2 1/4] doc: move VFIO driver to be first Anatoly Burakov
2020-11-18 18:24   ` David Marchand
2020-11-19 11:04     ` Burakov, Anatoly
2020-11-19 11:32   ` [dpdk-dev] [PATCH v3 " Anatoly Burakov
2020-11-23 17:22     ` Ferruh Yigit
2020-11-19 11:32   ` [dpdk-dev] [PATCH v3 2/4] doc: reword VFIO and UIO Linux GSG section Anatoly Burakov
2020-11-19 11:32   ` [dpdk-dev] [PATCH v3 3/4] doc: add VFIO no-IOMMU " Anatoly Burakov
2020-11-27 15:47     ` Bruce Richardson
2020-11-19 11:32   ` [dpdk-dev] [PATCH v3 4/4] doc: add VFIO troubleshooting section Anatoly Burakov
2020-11-27 15:30     ` Thomas Monjalon
2020-11-27 15:57       ` Burakov, Anatoly
2020-11-27 15:49     ` Bruce Richardson
2020-11-27 16:29     ` Kevin Traynor
2020-11-27 17:27       ` Thomas Monjalon
2020-11-18 15:37 ` [dpdk-dev] [PATCH v2 2/4] doc: reword VFIO and UIO Linux GSG section Anatoly Burakov
2020-11-18 15:37 ` [dpdk-dev] [PATCH v2 3/4] doc: add VFIO no-IOMMU " Anatoly Burakov
2020-11-18 15:37 ` [dpdk-dev] [PATCH v2 4/4] doc: add VFIO troubleshooting section Anatoly Burakov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).