Skip to contentSkip to conversation

kernel/linux: introduce vfio_pf kernel module

PATCH NAK [email protected] 9 participants 23 messages Sep 6, 2019 – Nov 15, 2019 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kernel/linux: introduce vfio_pf kernel module

From: Vamsi Attunuru <[email protected]>

The DPDK use case such as VF representer or OVS offload etc would call for PF and VF PCIe devices to bind vfio-pci module to enable IOMMU protection.

In addition to vSwitch use case, unlike, other PCI class of devices, Network class of PCIe devices would have additional responsibility on the PF devices such as promiscuous mode support etc.

The above use cases demand VFIO needs bound to PF and its VF devices. This is use case is not supported in Linux kernel, due to a security issue where it is possible to have DoS in case if VF attached to guest over vfio-pci and netdev kernel driver runs on it and which something VF representer would like to enable it.

Since we can not differentiate, the vfio-pci bounded VF devices runs DPDK application or netdev driver in guest, we can not introduce any scheme to fix DoS case and therefore not have proper support of this in the upstream kernel.

The igb_uio enables such PF and VF binding support for non-iommu devices to make VF representer or OVS offload run on non-iommu devices with DoS vulnerability for netdev driver as VF.

This kernel module, facilitate to enable SRIOV on PF devices, therefore, to run both PF and VF devices in VFIO mode knowing its impacts like igb_uio driver functions of non-iommu devices.

---
 MAINTAINERS                       |   6 +
 config/common_linux               |   1 +
 doc/guides/prog_guide/index.rst   |   1 +
 doc/guides/prog_guide/vfio_pf.rst |  90 ++++++++++
 kernel/linux/Makefile             |   1 +
 kernel/linux/meson.build          |   2 +-
 kernel/linux/vfio_pf/Kbuild       |   2 +
 kernel/linux/vfio_pf/Makefile     |  24 +++
 kernel/linux/vfio_pf/meson.build  |  20 +++
 kernel/linux/vfio_pf/vfio_pf.c    | 360 ++++++++++++++++++++++++++++++++++++++
 10 files changed, 506 insertions(+), 1 deletion(-)
MAINTAINERS +6 -0
index 4100260..49178a5 100644
@@ -288,6 +288,12 @@ M: Anatoly Burakov <[email protected]>
 F: lib/librte_eal/linux/eal/*vfio*
 F: drivers/bus/pci/linux/*vfio*
 
+Linux VFIO_PF
+M: Vamsi Attunuru <[email protected]>
+M: Jerin Jacob <[email protected]>
+F: kernel/linux/vfio_pf/
+F: doc/guides/prog_guide/vfio_pf.rst
+
 FreeBSD EAL (with overlaps)
 M: Bruce Richardson <[email protected]>
 F: lib/librte_eal/freebsd/Makefile
config/common_linux +1 -0
index 6e25255..70f1e79 100644
@@ -11,6 +11,7 @@ CONFIG_RTE_EAL_NUMA_AWARE_HUGEPAGES=y
 CONFIG_RTE_EAL_IGB_UIO=y
 CONFIG_RTE_EAL_VFIO=y
 CONFIG_RTE_KNI_KMOD=y
+CONFIG_RTE_VFIO_PF_KMOD=y
 CONFIG_RTE_LIBRTE_KNI=y
 CONFIG_RTE_LIBRTE_PMD_KNI=y
 CONFIG_RTE_LIBRTE_VHOST=y
doc/guides/prog_guide/index.rst +1 -0
index 692409a..601244c 100644
@@ -43,6 +43,7 @@ Programmer's Guide
     pdump_lib
     multi_proc_support
     kernel_nic_interface
+    vfio_pf
     thread_safety_dpdk_functions
     eventdev
     event_ethernet_rx_adapter
doc/guides/prog_guide/vfio_pf.rst new file +90 -0

90 lines not on this page · raw message

kernel/linux/Makefile +1 -0
index c2c45a3..ea202ec 100644
@@ -5,5 +5,6 @@ include $(RTE_SDK)/mk/rte.vars.mk
 
 DIRS-$(CONFIG_RTE_EAL_IGB_UIO) += igb_uio
 DIRS-$(CONFIG_RTE_KNI_KMOD) += kni
+DIRS-$(CONFIG_RTE_VFIO_PF_KMOD) += vfio_pf
 
 include $(RTE_SDK)/mk/rte.subdir.mk
kernel/linux/meson.build +1 -1
index 1796cc6..50591dd 100644
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2018 Intel Corporation
 
-subdirs = ['igb_uio', 'kni']
+subdirs = ['igb_uio', 'kni', 'vfio_pf']
 
 # if we are cross-compiling we need kernel_dir specified
 if get_option('kernel_dir') == '' and meson.is_cross_build()
kernel/linux/vfio_pf/Kbuild new file +2 -0
new file mode 100644
index 0000000..18365c8
@@ -0,0 +1,2 @@
+ccflags-y := $(MODULE_CFLAGS)
+obj-m := vfio_pf.o
kernel/linux/vfio_pf/Makefile new file +24 -0
new file mode 100644
index 0000000..0ffbc6f
@@ -0,0 +1,24 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(C) 2019 Marvell International Ltd.
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+#
+# module name and path
+#
+MODULE = vfio_pf
+
+#
+# CFLAGS
+#
+MODULE_CFLAGS += -I$(SRCDIR) --param max-inline-insns-single=100
+MODULE_CFLAGS += -I$(RTE_OUTPUT)/include
+MODULE_CFLAGS += -Winline -Wall -Werror
+MODULE_CFLAGS += -include $(RTE_OUTPUT)/include/rte_config.h
+
+#
+# all source are stored in SRCS-y
+#
+SRCS-y := vfio_pf.c
+
+include $(RTE_SDK)/mk/rte.module.mk
kernel/linux/vfio_pf/meson.build new file +20 -0
new file mode 100644
index 0000000..e485e4c
@@ -0,0 +1,20 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(C) 2019 Marvell International Ltd.
+
+mkfile = custom_target('vfio_pf_makefile',
+	output: 'Makefile',
+	command: ['touch', '@OUTPUT@'])
+
+custom_target('vfio_pf',
+	input: ['vfio_pf.c', 'Kbuild'],
+	output: 'vfio_pf.ko',
+	command: ['make', '-C', kernel_dir + '/build',
+		'M=' + meson.current_build_dir(),
+		'src=' + meson.current_source_dir(),
+		'EXTRA_CFLAGS=-I' + meson.current_source_dir() +
+			'/../../../lib/librte_eal/common/include',
+		'modules'],
+	depends: mkfile,
+	install: true,
+	install_dir: kernel_dir + '/extra/dpdk',
+	build_by_default: get_option('enable_kmods'))
kernel/linux/vfio_pf/vfio_pf.c new file +360 -0

360 lines not on this page · raw message

Signature · 1 line
2.8.4
#1 lore raw

06/09/2019 11:12, [email protected]:

Quoted 28 lines

From: Vamsi Attunuru <[email protected]>

The DPDK use case such as VF representer or OVS offload etc would call for PF and VF PCIe devices to bind vfio-pci module to enable IOMMU protection.

In addition to vSwitch use case, unlike, other PCI class of devices, Network class of PCIe devices would have additional responsibility on the PF devices such as promiscuous mode support etc.

The above use cases demand VFIO needs bound to PF and its VF devices. This is use case is not supported in Linux kernel, due to a security issue where it is possible to have DoS in case if VF attached to guest over vfio-pci and netdev kernel driver runs on it and which something VF representer would like to enable it.

Since we can not differentiate, the vfio-pci bounded VF devices runs DPDK application or netdev driver in guest, we can not introduce any scheme to fix DoS case and therefore not have proper support of this in the upstream kernel.

The igb_uio enables such PF and VF binding support for non-iommu devices to make VF representer or OVS offload run on non-iommu devices with DoS vulnerability for netdev driver as VF.

Quoted 6 lines

This kernel module, facilitate to enable SRIOV on PF devices, therefore, to run both PF and VF devices in VFIO mode knowing its impacts like igb_uio driver functions of non-iommu devices.

Sorry I fail to properly understand the explanation above. Please try to split in shorter sentences.

About the request to add an out-of-tree Linux kernel driver, I guess Jerin is well aware that we don't want such anymore.

#2 lore raw
Quoted 38 lines

-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Friday, September 6, 2019 3:15 PM
To: Vamsi Krishna Attunuru <[email protected]>
Cc: [email protected]; Jerin Jacob Kollanukkaran <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v1 1/1] kernel/linux: introduce vfio_pf kernel module

06/09/2019 11:12, [email protected]:

Quoted 29 lines

From: Vamsi Attunuru <[email protected]>

The DPDK use case such as VF representer or OVS offload etc would call for PF and VF PCIe devices to bind vfio-pci module to enable IOMMU protection.

In addition to vSwitch use case, unlike, other PCI class of devices, Network class of PCIe devices would have additional responsibility on the PF devices such as promiscuous mode support etc.

The above use cases demand VFIO needs bound to PF and its VF devices. This is use case is not supported in Linux kernel, due to a security issue where it is possible to have DoS in case if VF attached to guest over vfio-pci and netdev kernel driver runs on it and which something VF representer would like to enable it.

Since we can not differentiate, the vfio-pci bounded VF devices runs DPDK application or netdev driver in guest, we can not introduce any scheme to fix DoS case and therefore not have proper support of this in the upstream kernel.

The igb_uio enables such PF and VF binding support for non-iommu devices to make VF representer or OVS offload run on non-iommu devices with DoS vulnerability for netdev driver as VF.

This kernel module, facilitate to enable SRIOV on PF devices, therefore, to run both PF and VF devices in VFIO mode knowing its impacts like igb_uio driver functions of non-iommu devices.

Quoted 8 lines
Quoted 2 lines

Sorry I fail to properly understand the explanation above. Please try to split in shorter sentences.

About the request to add an out-of-tree Linux kernel driver, I guess Jerin is well aware that we don't want such anymore.

Yes. I am aware of it. I don't like the out of tree modules either. But, This case, I suggested Vamsi to have out of tree module.

Let me describe the issue and let us discuss how to tackle the problem:

# Linux kernel wont allow VFIO PF to have SRIOV enable.

Patches and on going discussion are here:
https://patchwork.kernel.org/patch/10522381/
https://lwn.net/Articles/748526/

Based on my understanding the reason for NOT allowing the VFIO PF to have SRIOV enable is genuine from kernel point of View but not from DPDK point of view.

Here is the sequence to describe the problem
1) Consider Linux kernel allowed VFIO PCI SRIOV enable
2) PF bound to vfio-pci
3) using SRIOV infrastructure of vfio-pci PF driver, VFs are created
4) DPDK application bound to PF and VF, No issue here.
5) Assume DPDK application bound to PF and VF bound To netdev kernel driver. Now, there is a genuine concern From kernel point of view that, DPDK PF can intercept, VF mailbox message or so and deny the Kernel request Or what if DPDK PF application crashes?

To avoid the case (5), (3) is not allowed in stock kernel. Which makes sense IMO.

Now, From DPDK PoV, step 5 is valid as we have Rte_flow's VF action etc used to enable such case. Where, user can program the PF's rte_flow to steer Some traffic to VF, where VF can be, DPDK application or Linux kernel netdev driver.

This patch enables the step (3) to enable step (5) from DPDK PoV. i.e DPDK needs to allow PF to bind to DPDK with VFs.

Why this issue now:
- igb_uio kernel driver is used as enabling step (3) See store_max_vfs() kernel/linux/igb_uio/igb_uio.c This is fine for non-iommu device, IOMMU devices
needs VFIO.
- We would like support VFIO for IOMMU protection And enable step (5) as DPDK supports form the spec level. i.e need to fix feature disparity between iommu vs non-iommu based devices.

Note:
We may not need a brand new kernel module, we could move this logic to igb_uio if maintenance is concern.

-

Quoted 1 line
#3 lore raw

Hi,

We would like to have these support in 19.11. Please let us know if there are any comments or suggestions, we can discuss and address accordingly.

-----Original Message-----
From: Jerin Jacob Kollanukkaran <[email protected]>
Sent: Friday, September 6, 2019 6:58 PM
To: Thomas Monjalon <[email protected]>; Vamsi Krishna Attunuru <[email protected]>
Cc: [email protected]
Subject: RE: [dpdk-dev] [PATCH v1 1/1] kernel/linux: introduce vfio_pf kernel module

Quoted 38 lines

-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Friday, September 6, 2019 3:15 PM
To: Vamsi Krishna Attunuru <[email protected]>
Cc: [email protected]; Jerin Jacob Kollanukkaran <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v1 1/1] kernel/linux: introduce vfio_pf kernel module

06/09/2019 11:12, [email protected]:

Quoted 29 lines

From: Vamsi Attunuru <[email protected]>

The DPDK use case such as VF representer or OVS offload etc would call for PF and VF PCIe devices to bind vfio-pci module to enable IOMMU protection.

In addition to vSwitch use case, unlike, other PCI class of devices, Network class of PCIe devices would have additional responsibility on the PF devices such as promiscuous mode support etc.

The above use cases demand VFIO needs bound to PF and its VF devices. This is use case is not supported in Linux kernel, due to a security issue where it is possible to have DoS in case if VF attached to guest over vfio-pci and netdev kernel driver runs on it and which something VF representer would like to enable it.

Since we can not differentiate, the vfio-pci bounded VF devices runs DPDK application or netdev driver in guest, we can not introduce any scheme to fix DoS case and therefore not have proper support of this in the upstream kernel.

The igb_uio enables such PF and VF binding support for non-iommu devices to make VF representer or OVS offload run on non-iommu devices with DoS vulnerability for netdev driver as VF.

This kernel module, facilitate to enable SRIOV on PF devices, therefore, to run both PF and VF devices in VFIO mode knowing its impacts like igb_uio driver functions of non-iommu devices.

Quoted 8 lines
Quoted 2 lines

Sorry I fail to properly understand the explanation above. Please try to split in shorter sentences.

About the request to add an out-of-tree Linux kernel driver, I guess Jerin is well aware that we don't want such anymore.

Yes. I am aware of it. I don't like the out of tree modules either. But, This case, I suggested Vamsi to have out of tree module.

Let me describe the issue and let us discuss how to tackle the problem:

# Linux kernel wont allow VFIO PF to have SRIOV enable.

Patches and on going discussion are here:
https://patchwork.kernel.org/patch/10522381/
https://lwn.net/Articles/748526/

Based on my understanding the reason for NOT allowing the VFIO PF to have SRIOV enable is genuine from kernel point of View but not from DPDK point of view.

Here is the sequence to describe the problem
1) Consider Linux kernel allowed VFIO PCI SRIOV enable
2) PF bound to vfio-pci
3) using SRIOV infrastructure of vfio-pci PF driver, VFs are created
4) DPDK application bound to PF and VF, No issue here.
5) Assume DPDK application bound to PF and VF bound To netdev kernel driver. Now, there is a genuine concern From kernel point of view that, DPDK PF can intercept, VF mailbox message or so and deny the Kernel request Or what if DPDK PF application crashes?

To avoid the case (5), (3) is not allowed in stock kernel. Which makes sense IMO.

Now, From DPDK PoV, step 5 is valid as we have Rte_flow's VF action etc used to enable such case.
Where, user can program the PF's rte_flow to steer Some traffic to VF, where VF can be, DPDK application or Linux kernel netdev driver.

This patch enables the step (3) to enable step (5) from DPDK PoV. i.e DPDK needs to allow PF to bind to DPDK with VFs.

Why this issue now:
- igb_uio kernel driver is used as enabling step (3) See store_max_vfs() kernel/linux/igb_uio/igb_uio.c This is fine for non-iommu device, IOMMU devices needs VFIO.
- We would like support VFIO for IOMMU protection And enable step (5) as DPDK supports form the spec level.
i.e need to fix feature disparity between iommu vs non-iommu based devices.

Note:
We may not need a brand new kernel module, we could move this logic to igb_uio if maintenance is concern.

-

Quoted 1 line
#4 lore raw
Quoted 83 lines · Vamsi Krishna Attunuru

Hi,

We would like to have these support in 19.11. Please let us know if there are any comments or suggestions, we can discuss and address accordingly.

-----Original Message-----
From: Jerin Jacob Kollanukkaran <[email protected]>
Sent: Friday, September 6, 2019 6:58 PM
To: Thomas Monjalon <[email protected]>; Vamsi Krishna Attunuru <[email protected]>
Cc: [email protected]
Subject: RE: [dpdk-dev] [PATCH v1 1/1] kernel/linux: introduce vfio_pf kernel module

Quoted 38 lines

-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Friday, September 6, 2019 3:15 PM
To: Vamsi Krishna Attunuru <[email protected]>
Cc: [email protected]; Jerin Jacob Kollanukkaran <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v1 1/1] kernel/linux: introduce vfio_pf kernel module

06/09/2019 11:12, [email protected]:

Quoted 29 lines

From: Vamsi Attunuru <[email protected]>

The DPDK use case such as VF representer or OVS offload etc would call for PF and VF PCIe devices to bind vfio-pci module to enable IOMMU protection.

In addition to vSwitch use case, unlike, other PCI class of devices, Network class of PCIe devices would have additional responsibility on the PF devices such as promiscuous mode support etc.

The above use cases demand VFIO needs bound to PF and its VF devices. This is use case is not supported in Linux kernel, due to a security issue where it is possible to have DoS in case if VF attached to guest over vfio-pci and netdev kernel driver runs on it and which something VF representer would like to enable it.

Since we can not differentiate, the vfio-pci bounded VF devices runs DPDK application or netdev driver in guest, we can not introduce any scheme to fix DoS case and therefore not have proper support of this in the upstream kernel.

The igb_uio enables such PF and VF binding support for non-iommu devices to make VF representer or OVS offload run on non-iommu devices with DoS vulnerability for netdev driver as VF.

This kernel module, facilitate to enable SRIOV on PF devices, therefore, to run both PF and VF devices in VFIO mode knowing its impacts like igb_uio driver functions of non-iommu devices.

Quoted 7 lines
Quoted 2 lines

Sorry I fail to properly understand the explanation above. Please try to split in shorter sentences.

About the request to add an out-of-tree Linux kernel driver, I guess Jerin is well aware that we don't want such anymore.

Yes. I am aware of it. I don't like the out of tree modules either. But, This case, I suggested Vamsi to have out of tree module.

Let me describe the issue and let us discuss how to tackle the problem:

# Linux kernel wont allow VFIO PF to have SRIOV enable.

Patches and on going discussion are here:
https://patchwork.kernel.org/patch/10522381/
https://lwn.net/Articles/748526/

Based on my understanding the reason for NOT allowing the VFIO PF to have SRIOV enable is genuine from kernel point of View but not from DPDK point of view.

Here is the sequence to describe the problem
1) Consider Linux kernel allowed VFIO PCI SRIOV enable
2) PF bound to vfio-pci
3) using SRIOV infrastructure of vfio-pci PF driver, VFs are created
4) DPDK application bound to PF and VF, No issue here.
5) Assume DPDK application bound to PF and VF bound To netdev kernel driver. Now, there is a genuine concern From kernel point of view that, DPDK PF can intercept, VF mailbox message or so and deny the Kernel request Or what if DPDK PF application crashes?

To avoid the case (5), (3) is not allowed in stock kernel. Which makes sense IMO.

Now, From DPDK PoV, step 5 is valid as we have Rte_flow's VF action etc used to enable such case.
Where, user can program the PF's rte_flow to steer Some traffic to VF, where VF can be, DPDK application or Linux kernel netdev driver.

This patch enables the step (3) to enable step (5) from DPDK PoV. i.e DPDK needs to allow PF to bind to DPDK with VFs.

Quoted 7 lines

Why this issue now:
- igb_uio kernel driver is used as enabling step (3) See store_max_vfs() kernel/linux/igb_uio/igb_uio.c This is fine for non-iommu device, IOMMU devices needs VFIO.
- We would like support VFIO for IOMMU protection And enable step (5) as DPDK supports form the spec level.
i.e need to fix feature disparity between iommu vs non-iommu based devices.

Note:
We may not need a brand new kernel module, we could move this logic to igb_uio if maintenance is concern.

It is really a problem for not bifurcated drivers and I agree with Jerin above.

One driver could be better, but I'm not sure and I'm afraid it will make too many changes in igb_uio and result in instabilities/bugs. I have no strong opinion if we can take the risk with igb_uio - simply have no enough information if it is widely used or Linux in-kernel drivers are preferred.

#5 lore raw
In reply to Jerin Jacob Kollanukkaran
Quoted 103 lines

-----Original Message-----
From: Jerin Jacob Kollanukkaran <[email protected]>
Sent: Friday, September 6, 2019 6:58 PM
To: Thomas Monjalon <[email protected]>; Vamsi Krishna Attunuru <[email protected]>
Cc: [email protected]
Subject: RE: [dpdk-dev] [PATCH v1 1/1] kernel/linux: introduce vfio_pf kernel module

Quoted 38 lines

-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Friday, September 6, 2019 3:15 PM
To: Vamsi Krishna Attunuru <[email protected]>
Cc: [email protected]; Jerin Jacob Kollanukkaran <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v1 1/1] kernel/linux: introduce vfio_pf kernel module

06/09/2019 11:12, [email protected]:

Quoted 29 lines

From: Vamsi Attunuru <[email protected]>

The DPDK use case such as VF representer or OVS offload etc would call for PF and VF PCIe devices to bind vfio-pci module to enable IOMMU protection.

In addition to vSwitch use case, unlike, other PCI class of devices, Network class of PCIe devices would have additional responsibility on the PF devices such as promiscuous mode support etc.

The above use cases demand VFIO needs bound to PF and its VF devices. This is use case is not supported in Linux kernel, due to a security issue where it is possible to have DoS in case if VF attached to guest over vfio-pci and netdev kernel driver runs on it and which something VF representer would like to enable it.

Since we can not differentiate, the vfio-pci bounded VF devices runs DPDK application or netdev driver in guest, we can not introduce any scheme to fix DoS case and therefore not have proper support of this in the upstream kernel.

The igb_uio enables such PF and VF binding support for non-iommu devices to make VF representer or OVS offload run on non-iommu devices with DoS vulnerability for netdev driver as VF.

This kernel module, facilitate to enable SRIOV on PF devices, therefore, to run both PF and VF devices in VFIO mode knowing its impacts like igb_uio driver functions of non-iommu devices.

Quoted 8 lines
Quoted 2 lines

Sorry I fail to properly understand the explanation above. Please try to split in shorter sentences.

About the request to add an out-of-tree Linux kernel driver, I guess Jerin is well aware that we don't want such anymore.

Yes. I am aware of it. I don't like the out of tree modules either. But, This case, I suggested Vamsi to have out of tree module.

Let me describe the issue and let us discuss how to tackle the problem:

# Linux kernel wont allow VFIO PF to have SRIOV enable.

Patches and on going discussion are here:
https://patchwork.kernel.org/patch/10522381/
https://lwn.net/Articles/748526/

Based on my understanding the reason for NOT allowing the VFIO PF to have SRIOV enable is genuine from kernel point of View but not from DPDK point of view.

Here is the sequence to describe the problem
1) Consider Linux kernel allowed VFIO PCI SRIOV enable
2) PF bound to vfio-pci
3) using SRIOV infrastructure of vfio-pci PF driver, VFs are created
4) DPDK application bound to PF and VF, No issue here.
5) Assume DPDK application bound to PF and VF bound To netdev kernel driver. Now, there is a genuine concern From kernel point of view that, DPDK PF can intercept, VF mailbox message or so and deny the Kernel request Or what if DPDK PF application crashes?

To avoid the case (5), (3) is not allowed in stock kernel. Which makes sense IMO.

Now, From DPDK PoV, step 5 is valid as we have Rte_flow's VF action etc used to enable such case.
Where, user can program the PF's rte_flow to steer Some traffic to VF, where VF can be, DPDK application or Linux kernel netdev driver.

This patch enables the step (3) to enable step (5) from DPDK PoV. i.e DPDK needs to allow PF to bind to DPDK with VFs.

Why this issue now:
- igb_uio kernel driver is used as enabling step (3) See store_max_vfs() kernel/linux/igb_uio/igb_uio.c This is fine for non-iommu device, IOMMU devices needs VFIO.
- We would like support VFIO for IOMMU protection And enable step (5) as DPDK supports form the spec level.
i.e need to fix feature disparity between iommu vs non-iommu based devices.

Quoted 4 lines

Note:
We may not need a brand new kernel module, we could move this logic to igb_uio if maintenance is concern.

@All, we are expecting to merge this in 19.11 release and if any one have comments please respond.

Quoted 25 lines

-

Quoted 1 line
#6 lore raw
In reply to Jerin Jacob Kollanukkaran

We don't get enough attention on this topic.
Let me rephrase the issue and the proposals with more people Cc'ed.

We are talking about SR-IOV VFs in VMs
with a PF managed on the host by DPDK.
The PF driver is either a (1) bifurcated (Mellanox case), or (2) bound to UIO with igb_uio, or (3) bound to VFIO.

In case 1, the PF is still managed by a kernel driver, so no issue.

In case 2, the PF is managed by UIO.
There is no SR-IOV support in upstream UIO,
but the out-of-tree module igb_uio works.
However we would like to drop this legacy module from DPDK. Some (most) Linux distributions do not package igb_uio anyway. The other issue is that igb_uio is using physical addressing, which is not acceptable with OCTEON TX2 for performance reason.

In case 3, the PF is managed by VFIO. This is the case we want to fix. VFIO does not allow to create VFs.
The workaround is to create VFs before binding the PF to VFIO. But since Linux 4.19, VFIO forbids any SR-IOV VF management. There is a security concern about allowing userspace to manage SR-IOV VF messages and taking the responsibility for VFs in the guest.

It is desired to allow the system admin deciding the security levels, by adding a flag in VFIO "let me manage VFs, I know what I am doing". Reference of "recent" discussion: https://lkml.org/lkml/2018/3/6/855
For now, there is no upstream solution merged.

This patch is proposing a solution using an out-of-tree module. In this case, the admin will decide explicitly to bind the PF to vfio_pf. Unfortunately this solution won't work in environments which forbid any out-of-tree module.
Another concern is that it looks like DPDK-only solution.

We have an issue but we do not want to propose a half-solution which would harm other projects and users.
So the question is:
Do we accept this patch as a temporary solution?
Or can we get an agreement soon for an upstream kernel solution?

Thanks for reading and giving your (clear) opinion.

06/09/2019 15:27, Jerin Jacob Kollanukkaran:

Quoted 92 lines

From: Thomas Monjalon <[email protected]>

Quoted 30 lines

06/09/2019 11:12, [email protected]:

Quoted 29 lines

From: Vamsi Attunuru <[email protected]>

The DPDK use case such as VF representer or OVS offload etc would call for PF and VF PCIe devices to bind vfio-pci module to enable IOMMU protection.

In addition to vSwitch use case, unlike, other PCI class of devices, Network class of PCIe devices would have additional responsibility on the PF devices such as promiscuous mode support etc.

The above use cases demand VFIO needs bound to PF and its VF devices. This is use case is not supported in Linux kernel, due to a security issue where it is possible to have DoS in case if VF attached to guest over vfio-pci and netdev kernel driver runs on it and which something VF representer would like to enable it.

Since we can not differentiate, the vfio-pci bounded VF devices runs DPDK application or netdev driver in guest, we can not introduce any scheme to fix DoS case and therefore not have proper support of this in the upstream kernel.

The igb_uio enables such PF and VF binding support for non-iommu devices to make VF representer or OVS offload run on non-iommu devices with DoS vulnerability for netdev driver as VF.

This kernel module, facilitate to enable SRIOV on PF devices, therefore, to run both PF and VF devices in VFIO mode knowing its impacts like igb_uio driver functions of non-iommu devices.

Quoted 8 lines
Quoted 2 lines

Sorry I fail to properly understand the explanation above. Please try to split in shorter sentences.

About the request to add an out-of-tree Linux kernel driver, I guess Jerin is well aware that we don't want such anymore.

Yes. I am aware of it. I don't like the out of tree modules either. But, This case, I suggested Vamsi to have out of tree module.

Let me describe the issue and let us discuss how to tackle the problem:

# Linux kernel wont allow VFIO PF to have SRIOV enable.

Patches and on going discussion are here:
https://patchwork.kernel.org/patch/10522381/
https://lwn.net/Articles/748526/

Based on my understanding the reason for NOT allowing the VFIO PF to have SRIOV enable is genuine from kernel point of View but not from DPDK point of view.

Here is the sequence to describe the problem
1) Consider Linux kernel allowed VFIO PCI SRIOV enable
2) PF bound to vfio-pci
3) using SRIOV infrastructure of vfio-pci PF driver, VFs are created
4) DPDK application bound to PF and VF, No issue here.
5) Assume DPDK application bound to PF and VF bound To netdev kernel driver. Now, there is a genuine concern From kernel point of view that, DPDK PF can intercept, VF mailbox message or so and deny the Kernel request Or what if DPDK PF application crashes?

To avoid the case (5), (3) is not allowed in stock kernel. Which makes sense IMO.

Now, From DPDK PoV, step 5 is valid as we have Rte_flow's VF action etc used to enable such case. Where, user can program the PF's rte_flow to steer Some traffic to VF, where VF can be, DPDK application or Linux kernel netdev driver.

This patch enables the step (3) to enable step (5) from DPDK PoV. i.e DPDK needs to allow PF to bind to DPDK with VFs.

Why this issue now:
- igb_uio kernel driver is used as enabling step (3) See store_max_vfs() kernel/linux/igb_uio/igb_uio.c This is fine for non-iommu device, IOMMU devices
needs VFIO.
- We would like support VFIO for IOMMU protection And enable step (5) as DPDK supports form the spec level. i.e need to fix feature disparity between iommu vs non-iommu based devices.

Note:
We may not need a brand new kernel module, we could move this logic to igb_uio if maintenance is concern.

#7 lore raw

For distros, out-of-tree kernel modules are painful. From my POV, it would be preferable to try and find a solution upstream, even if it is going to be difficult and require a lot of negotiation and work.

Quoted 175 lines · Thomas Monjalon

We don't get enough attention on this topic.
Let me rephrase the issue and the proposals with more people Cc'ed.

We are talking about SR-IOV VFs in VMs
with a PF managed on the host by DPDK.
The PF driver is either a (1) bifurcated (Mellanox case), or (2) bound to UIO with igb_uio, or (3) bound to VFIO.

In case 1, the PF is still managed by a kernel driver, so no issue.

In case 2, the PF is managed by UIO.
There is no SR-IOV support in upstream UIO,
but the out-of-tree module igb_uio works.
However we would like to drop this legacy module from DPDK. Some (most) Linux distributions do not package igb_uio anyway. The other issue is that igb_uio is using physical addressing, which is not acceptable with OCTEON TX2 for performance reason.

In case 3, the PF is managed by VFIO. This is the case we want to fix.
VFIO does not allow to create VFs.
The workaround is to create VFs before binding the PF to VFIO. But since Linux 4.19, VFIO forbids any SR-IOV VF management. There is a security concern about allowing userspace to manage SR-IOV VF messages and taking the responsibility for VFs in the guest.

It is desired to allow the system admin deciding the security levels, by adding a flag in VFIO "let me manage VFs, I know what I am doing". Reference of "recent" discussion:
https://lkml.org/lkml/2018/3/6/855

For now, there is no upstream solution merged.

This patch is proposing a solution using an out-of-tree module. In this case, the admin will decide explicitly to bind the PF to vfio_pf.
Unfortunately this solution won't work in environments which forbid any out-of-tree module.
Another concern is that it looks like DPDK-only solution.

We have an issue but we do not want to propose a half-solution which would harm other projects and users.
So the question is:
Do we accept this patch as a temporary solution?
Or can we get an agreement soon for an upstream kernel solution?

Thanks for reading and giving your (clear) opinion.

06/09/2019 15:27, Jerin Jacob Kollanukkaran:

Quoted 121 lines

From: Thomas Monjalon <
[email protected]

Quoted 56 lines

06/09/2019 11:12,
[email protected]
:

Quoted 45 lines

From: Vamsi Attunuru <
[email protected]

Quoted 1 line

The DPDK use case such as VF representer or OVS offload etc would call
for PF and VF PCIe devices to bind vfio-pci module to enable IOMMU
protection.

In addition to vSwitch use case, unlike, other PCI class of devices,
Network class of PCIe devices would have additional responsibility on
the PF devices such as promiscuous mode support etc.

The above use cases demand VFIO needs bound to PF and its VF devices.
This is use case is not supported in Linux kernel, due to a security
issue where it is possible to have DoS in case if VF attached to guest
over vfio-pci and netdev kernel driver runs on it and which something
VF representer would like to enable it.

Since we can not differentiate, the vfio-pci bounded VF devices runs
DPDK application or netdev driver in guest, we can not introduce any
scheme to fix DoS case and therefore not have proper support of this
in the upstream kernel.

The igb_uio enables such PF and VF binding support for non- iommu
devices to make VF representer or OVS offload run on non-iommu devices
with DoS vulnerability for netdev driver as VF.

This kernel module, facilitate to enable SRIOV on PF devices, therefore, to run both PF and VF devices in VFIO mode knowing its
impacts like igb_uio driver functions of non-iommu devices.

Quoted 6 lines

Signed-off-by: Vamsi Attunuru <
[email protected]

Quoted 1 line

Signed-off-by: Jerin Jacob <
[email protected]

Quoted 1 line
Quoted 6 lines

Sorry I fail to properly understand the explanation above. Please try to split in shorter sentences.

About the request to add an out-of-tree Linux kernel driver, I guess Jerin is well
aware that we don't want such anymore.

Yes. I am aware of it. I don't like the out of tree modules either. But, This case,
I suggested Vamsi to have out of tree module.

Let me describe the issue and let us discuss how to tackle the problem:

# Linux kernel wont allow VFIO PF to have SRIOV enable.

Patches and on going discussion are here:
https://patchwork.kernel.org/patch/10522381/

https://lwn.net/Articles/748526/

Based on my understanding the reason for NOT allowing the VFIO PF to have SRIOV enable is genuine from kernel point of View but not from DPDK point of view.

Here is the sequence to describe the problem
1) Consider Linux kernel allowed VFIO PCI SRIOV enable
2) PF bound to vfio-pci
3) using SRIOV infrastructure of vfio-pci PF driver, VFs are created
4) DPDK application bound to PF and VF, No issue here.
5) Assume DPDK application bound to PF and VF bound To netdev kernel driver. Now, there is a genuine concern From kernel point of view that, DPDK PF can intercept, VF mailbox message or so and deny the Kernel request Or what if DPDK PF application crashes?

To avoid the case (5), (3) is not allowed in stock kernel. Which makes sense IMO.

Now, From DPDK PoV, step 5 is valid as we have Rte_flow's VF action etc used to enable such case. Where, user can program the PF's rte_flow to steer Some traffic to VF, where VF can be, DPDK application or Linux kernel netdev driver.

This patch enables the step (3) to enable step (5) from DPDK PoV. i.e DPDK needs to allow PF to bind to DPDK with VFs.

Why this issue now:
- igb_uio kernel driver is used as enabling step (3) See store_max_vfs() kernel/linux/igb_uio/igb_uio.c This is fine for non-iommu device, IOMMU devices
needs VFIO.
- We would like support VFIO for IOMMU protection And enable step (5) as DPDK supports form the spec level. i.e need to fix feature disparity between iommu vs non-iommu based devices.

Note:
We may not need a brand new kernel module, we could move this logic to igb_uio if maintenance is concern.

Signature · 2 lines
Kind regards,
Luca Boccassi
#8 lore raw
Quoted 2 lines · Luca Boccassi

For distros, out-of-tree kernel modules are painful. From my POV, it

I agree.

Quoted 2 lines

would be preferable to try and find a solution upstream, even if it is going to be difficult and require a lot of negotiation and work.

I understand from RH, They are not packaging out of tree modules, Would like to know which are the distributions packaging existing KNI and IGB_UIO modules?

IMO, packaging 1 module vs N module is the same pain as it a matter of kernel dependency in packaging.
If some reason, we decide to remove the IGB_UIO then we can remove this module as well.

Quoted 180 lines · Thomas Monjalon
Quoted 46 lines

We don't get enough attention on this topic.
Let me rephrase the issue and the proposals with more people Cc'ed.

We are talking about SR-IOV VFs in VMs
with a PF managed on the host by DPDK.
The PF driver is either a (1) bifurcated (Mellanox case), or (2) bound to UIO with igb_uio, or (3) bound to VFIO.

In case 1, the PF is still managed by a kernel driver, so no issue.

In case 2, the PF is managed by UIO.
There is no SR-IOV support in upstream UIO,
but the out-of-tree module igb_uio works.
However we would like to drop this legacy module from DPDK. Some (most) Linux distributions do not package igb_uio anyway. The other issue is that igb_uio is using physical addressing, which is not acceptable with OCTEON TX2 for performance reason.

In case 3, the PF is managed by VFIO. This is the case we want to fix.
VFIO does not allow to create VFs.
The workaround is to create VFs before binding the PF to VFIO. But since Linux 4.19, VFIO forbids any SR-IOV VF management. There is a security concern about allowing userspace to manage SR-IOV VF messages and taking the responsibility for VFs in the guest.

It is desired to allow the system admin deciding the security levels, by adding a flag in VFIO "let me manage VFs, I know what I am doing". Reference of "recent" discussion:
https://lkml.org/lkml/2018/3/6/855

For now, there is no upstream solution merged.

This patch is proposing a solution using an out-of-tree module. In this case, the admin will decide explicitly to bind the PF to vfio_pf.
Unfortunately this solution won't work in environments which forbid any out-of-tree module.
Another concern is that it looks like DPDK-only solution.

We have an issue but we do not want to propose a half-solution which would harm other projects and users.
So the question is:
Do we accept this patch as a temporary solution?
Or can we get an agreement soon for an upstream kernel solution?

Quoted 129 lines

Thanks for reading and giving your (clear) opinion.

06/09/2019 15:27, Jerin Jacob Kollanukkaran:

Quoted 121 lines

From: Thomas Monjalon <
[email protected]

Quoted 56 lines

06/09/2019 11:12,
[email protected]
:

Quoted 45 lines

From: Vamsi Attunuru <
[email protected]

Quoted 1 line

The DPDK use case such as VF representer or OVS offload etc would call
for PF and VF PCIe devices to bind vfio-pci module to enable IOMMU
protection.

In addition to vSwitch use case, unlike, other PCI class of devices,
Network class of PCIe devices would have additional responsibility on
the PF devices such as promiscuous mode support etc.

The above use cases demand VFIO needs bound to PF and its VF devices.
This is use case is not supported in Linux kernel, due to a security
issue where it is possible to have DoS in case if VF attached to guest
over vfio-pci and netdev kernel driver runs on it and which something
VF representer would like to enable it.

Since we can not differentiate, the vfio-pci bounded VF devices runs
DPDK application or netdev driver in guest, we can not introduce any
scheme to fix DoS case and therefore not have proper support of this
in the upstream kernel.

The igb_uio enables such PF and VF binding support for non- iommu
devices to make VF representer or OVS offload run on non-iommu devices
with DoS vulnerability for netdev driver as VF.

This kernel module, facilitate to enable SRIOV on PF devices, therefore, to run both PF and VF devices in VFIO mode knowing its
impacts like igb_uio driver functions of non-iommu devices.

Quoted 6 lines

Signed-off-by: Vamsi Attunuru <
[email protected]

Quoted 1 line

Signed-off-by: Jerin Jacob <
[email protected]

Quoted 1 line
Quoted 6 lines

Sorry I fail to properly understand the explanation above. Please try to split in shorter sentences.

About the request to add an out-of-tree Linux kernel driver, I guess Jerin is well
aware that we don't want such anymore.

Yes. I am aware of it. I don't like the out of tree modules either. But, This case,
I suggested Vamsi to have out of tree module.

Let me describe the issue and let us discuss how to tackle the problem:

# Linux kernel wont allow VFIO PF to have SRIOV enable.

Patches and on going discussion are here:
https://patchwork.kernel.org/patch/10522381/

https://lwn.net/Articles/748526/

Based on my understanding the reason for NOT allowing the VFIO PF to have SRIOV enable is genuine from kernel point of View but not from DPDK point of view.

Here is the sequence to describe the problem
1) Consider Linux kernel allowed VFIO PCI SRIOV enable
2) PF bound to vfio-pci
3) using SRIOV infrastructure of vfio-pci PF driver, VFs are created
4) DPDK application bound to PF and VF, No issue here.
5) Assume DPDK application bound to PF and VF bound To netdev kernel driver. Now, there is a genuine concern From kernel point of view that, DPDK PF can intercept, VF mailbox message or so and deny the Kernel request Or what if DPDK PF application crashes?

To avoid the case (5), (3) is not allowed in stock kernel. Which makes sense IMO.

Now, From DPDK PoV, step 5 is valid as we have Rte_flow's VF action etc used to enable such case. Where, user can program the PF's rte_flow to steer Some traffic to VF, where VF can be, DPDK application or Linux kernel netdev driver.

This patch enables the step (3) to enable step (5) from DPDK PoV. i.e DPDK needs to allow PF to bind to DPDK with VFs.

Why this issue now:
- igb_uio kernel driver is used as enabling step (3) See store_max_vfs() kernel/linux/igb_uio/igb_uio.c This is fine for non-iommu device, IOMMU devices
needs VFIO.
- We would like support VFIO for IOMMU protection And enable step (5) as DPDK supports form the spec level. i.e need to fix feature disparity between iommu vs non-iommu based devices.

Note:
We may not need a brand new kernel module, we could move this logic to igb_uio if maintenance is concern.

--
Kind regards,
Luca Boccassi

#9 lore raw
In reply to Luca Boccassi
Quoted 4 lines · Luca Boccassi

For distros, out-of-tree kernel modules are painful. From my POV, it would be preferable to try and find a solution upstream, even if it is going to be difficult and require a lot of negotiation and work.

I don't think anyone would disagree that getting an up-stream in-kernel solution is the desired end-state. However, even if we accept that, it doesn't necessarily help us as we need to decide on this support on DPDK right now. The factors to take into account are:

* we don't have definite line-of-sight to an in-kernel solution - it may never come
* even if it does eventually materialize, it will be months before it is in a released kernel, more months before it makes it to stable/LTS distros, and more months and years thereafter before it actually makes it into deployed systems from users. Having an out-of-tree module in DPDK makes it available to users much, much sooner.
* there seems to be a real need for this support.

For me, the key point seems to be the last one - if the feature is needed and likely to be used by a reasonable number of users (i.e. not just 1 or 2). If it is needed, then we need to have a path to support it, and, right now, I'm not seeing any such path other than having support in an out-of-tree module in DPDK itself.

My 2c.

/Bruce

Quoted 179 lines · Thomas Monjalon
Quoted 175 lines

We don't get enough attention on this topic.
Let me rephrase the issue and the proposals with more people Cc'ed.

We are talking about SR-IOV VFs in VMs
with a PF managed on the host by DPDK.
The PF driver is either a (1) bifurcated (Mellanox case), or (2) bound to UIO with igb_uio, or (3) bound to VFIO.

In case 1, the PF is still managed by a kernel driver, so no issue.

In case 2, the PF is managed by UIO.
There is no SR-IOV support in upstream UIO,
but the out-of-tree module igb_uio works.
However we would like to drop this legacy module from DPDK. Some (most) Linux distributions do not package igb_uio anyway. The other issue is that igb_uio is using physical addressing, which is not acceptable with OCTEON TX2 for performance reason.

In case 3, the PF is managed by VFIO. This is the case we want to fix.
VFIO does not allow to create VFs.
The workaround is to create VFs before binding the PF to VFIO. But since Linux 4.19, VFIO forbids any SR-IOV VF management. There is a security concern about allowing userspace to manage SR-IOV VF messages and taking the responsibility for VFs in the guest.

It is desired to allow the system admin deciding the security levels, by adding a flag in VFIO "let me manage VFs, I know what I am doing". Reference of "recent" discussion:
https://lkml.org/lkml/2018/3/6/855

For now, there is no upstream solution merged.

This patch is proposing a solution using an out-of-tree module. In this case, the admin will decide explicitly to bind the PF to vfio_pf.
Unfortunately this solution won't work in environments which forbid any out-of-tree module.
Another concern is that it looks like DPDK-only solution.

We have an issue but we do not want to propose a half-solution which would harm other projects and users.
So the question is:
Do we accept this patch as a temporary solution?
Or can we get an agreement soon for an upstream kernel solution?

Thanks for reading and giving your (clear) opinion.

06/09/2019 15:27, Jerin Jacob Kollanukkaran:

Quoted 121 lines

From: Thomas Monjalon <
[email protected]

Quoted 56 lines

06/09/2019 11:12,
[email protected]
:

Quoted 45 lines

From: Vamsi Attunuru <
[email protected]

Quoted 1 line

The DPDK use case such as VF representer or OVS offload etc would call
for PF and VF PCIe devices to bind vfio-pci module to enable IOMMU
protection.

In addition to vSwitch use case, unlike, other PCI class of devices,
Network class of PCIe devices would have additional responsibility on
the PF devices such as promiscuous mode support etc.

The above use cases demand VFIO needs bound to PF and its VF devices.
This is use case is not supported in Linux kernel, due to a security
issue where it is possible to have DoS in case if VF attached to guest
over vfio-pci and netdev kernel driver runs on it and which something
VF representer would like to enable it.

Since we can not differentiate, the vfio-pci bounded VF devices runs
DPDK application or netdev driver in guest, we can not introduce any
scheme to fix DoS case and therefore not have proper support of this
in the upstream kernel.

The igb_uio enables such PF and VF binding support for non- iommu
devices to make VF representer or OVS offload run on non-iommu devices
with DoS vulnerability for netdev driver as VF.

This kernel module, facilitate to enable SRIOV on PF devices, therefore, to run both PF and VF devices in VFIO mode knowing its
impacts like igb_uio driver functions of non-iommu devices.

Quoted 6 lines

Signed-off-by: Vamsi Attunuru <
[email protected]

Quoted 1 line

Signed-off-by: Jerin Jacob <
[email protected]

Quoted 1 line
Quoted 6 lines

Sorry I fail to properly understand the explanation above. Please try to split in shorter sentences.

About the request to add an out-of-tree Linux kernel driver, I guess Jerin is well
aware that we don't want such anymore.

Yes. I am aware of it. I don't like the out of tree modules either. But, This case,
I suggested Vamsi to have out of tree module.

Let me describe the issue and let us discuss how to tackle the problem:

# Linux kernel wont allow VFIO PF to have SRIOV enable.

Patches and on going discussion are here:
https://patchwork.kernel.org/patch/10522381/

https://lwn.net/Articles/748526/

Based on my understanding the reason for NOT allowing the VFIO PF to have SRIOV enable is genuine from kernel point of View but not from DPDK point of view.

Here is the sequence to describe the problem
1) Consider Linux kernel allowed VFIO PCI SRIOV enable
2) PF bound to vfio-pci
3) using SRIOV infrastructure of vfio-pci PF driver, VFs are created
4) DPDK application bound to PF and VF, No issue here.
5) Assume DPDK application bound to PF and VF bound To netdev kernel driver. Now, there is a genuine concern From kernel point of view that, DPDK PF can intercept, VF mailbox message or so and deny the Kernel request Or what if DPDK PF application crashes?

To avoid the case (5), (3) is not allowed in stock kernel. Which makes sense IMO.

Now, From DPDK PoV, step 5 is valid as we have Rte_flow's VF action etc used to enable such case. Where, user can program the PF's rte_flow to steer Some traffic to VF, where VF can be, DPDK application or Linux kernel netdev driver.

This patch enables the step (3) to enable step (5) from DPDK PoV. i.e DPDK needs to allow PF to bind to DPDK with VFs.

Why this issue now:
- igb_uio kernel driver is used as enabling step (3) See store_max_vfs() kernel/linux/igb_uio/igb_uio.c This is fine for non-iommu device, IOMMU devices
needs VFIO.
- We would like support VFIO for IOMMU protection And enable step (5) as DPDK supports form the spec level. i.e need to fix feature disparity between iommu vs non-iommu based devices.

Note:
We may not need a brand new kernel module, we could move this logic to igb_uio if maintenance is concern.

Signature · 2 lines
Kind regards,
Luca Boccassi
#10 lore raw
Quoted 40 lines · Bruce Richardson
Quoted 6 lines · Luca Boccassi

For distros, out-of-tree kernel modules are painful. From my POV, it
would be preferable to try and find a solution upstream, even if it is
going to be difficult and require a lot of negotiation and work.

I don't think anyone would disagree that getting an up-stream in- kernel
solution is the desired end-state. However, even if we accept that, it
doesn't necessarily help us as we need to decide on this support on DPDK
right now. The factors to take into account are:

* we don't have definite line-of-sight to an in-kernel solution - it may
never come
* even if it does eventually materialize, it will be months before it is in
a released kernel, more months before it makes it to stable/LTS
distros,
and more months and years thereafter before it actually makes it
into
deployed systems from users. Having an out-of-tree module in DPDK
makes
it available to users much, much sooner.
* there seems to be a real need for this support.

For me, the key point seems to be the last one - if the feature is needed
and likely to be used by a reasonable number of users (i.e. not just 1 or 2).
If it is needed, then we need to have a path to support it, and, right now,
I'm not seeing any such path other than having support in an out-of- tree
module in DPDK itself.

Quoted 3 lines

My 2c.

/Bruce

That's a fair point - what I'd like to see is, if as a project we want to move toward having no out-of-tree modules, is a firm statement, a concrete plan and commitment via roadmap to keep working to provide a solution upstream, however hard it might be, and not just declare job done and move on once the oot module is accepted. At that point having a module in the interim is acceptable for me.

Quoted 200 lines
Quoted 200 lines · Thomas Monjalon
Quoted 195 lines

We don't get enough attention on this topic.
Let me rephrase the issue and the proposals with more people Cc'ed.

We are talking about SR-IOV VFs in VMs
with a PF managed on the host by DPDK.
The PF driver is either a (1) bifurcated (Mellanox case), or (2) bound to UIO with igb_uio, or (3) bound to VFIO.

In case 1, the PF is still managed by a kernel driver, so no issue.

In case 2, the PF is managed by UIO.
There is no SR-IOV support in upstream UIO,
but the out-of-tree module igb_uio works.
However we would like to drop this legacy module from DPDK. Some (most) Linux distributions do not package igb_uio anyway. The other issue is that igb_uio is using physical addressing, which is not acceptable with OCTEON TX2 for performance reason.

In case 3, the PF is managed by VFIO. This is the case we want to fix.
VFIO does not allow to create VFs.
The workaround is to create VFs before binding the PF to VFIO. But since Linux 4.19, VFIO forbids any SR-IOV VF management. There is a security concern about allowing userspace to manage SR-IOV
VF messages and taking the responsibility for VFs in the guest.

It is desired to allow the system admin deciding the security levels,
by adding a flag in VFIO "let me manage VFs, I know what I am doing".
Reference of "recent" discussion:
https://lkml.org/lkml/2018/3/6/855

For now, there is no upstream solution merged.

This patch is proposing a solution using an out-of-tree module. In this case, the admin will decide explicitly to bind the PF to vfio_pf.
Unfortunately this solution won't work in environments which forbid any out-of-tree module.
Another concern is that it looks like DPDK-only solution.

We have an issue but we do not want to propose a half-solution which would harm other projects and users.
So the question is:
Do we accept this patch as a temporary solution?
Or can we get an agreement soon for an upstream kernel solution?

Thanks for reading and giving your (clear) opinion.

06/09/2019 15:27, Jerin Jacob Kollanukkaran:

Quoted 135 lines

From: Thomas Monjalon <
[email protected]

Quoted 65 lines

06/09/2019 11:12,
[email protected]

:

Quoted 53 lines

From: Vamsi Attunuru <
[email protected]

The DPDK use case such as VF representer or OVS offload etc would call
for PF and VF PCIe devices to bind vfio-pci module to enable
IOMMU
protection.

In addition to vSwitch use case, unlike, other PCI class of devices,
Network class of PCIe devices would have additional responsibility on
the PF devices such as promiscuous mode support etc.

The above use cases demand VFIO needs bound to PF and its VF
devices.
This is use case is not supported in Linux kernel, due to a security
issue where it is possible to have DoS in case if VF attached
to guest
over vfio-pci and netdev kernel driver runs on it and which something
VF representer would like to enable it.

Since we can not differentiate, the vfio-pci bounded VF devices
runs
DPDK application or netdev driver in guest, we can not introduce any
scheme to fix DoS case and therefore not have proper support of
this
in the upstream kernel.

The igb_uio enables such PF and VF binding support for non- iommu
devices to make VF representer or OVS offload run on non- iommu
devices
with DoS vulnerability for netdev driver as VF.

This kernel module, facilitate to enable SRIOV on PF devices,
therefore, to run both PF and VF devices in VFIO mode knowing
its
impacts like igb_uio driver functions of non-iommu devices.

Quoted 7 lines

Signed-off-by: Vamsi Attunuru <
[email protected]

Signed-off-by: Jerin Jacob <
[email protected]

Quoted 7 lines

Sorry I fail to properly understand the explanation above. Please try to split in shorter sentences.

About the request to add an out-of-tree Linux kernel driver, I
guess Jerin is well
aware that we don't want such anymore.

Yes. I am aware of it. I don't like the out of tree modules either.
But, This case,
I suggested Vamsi to have out of tree module.

Let me describe the issue and let us discuss how to tackle the problem:

# Linux kernel wont allow VFIO PF to have SRIOV enable.

Patches and on going discussion are here:
https://patchwork.kernel.org/patch/10522381/

https://lwn.net/Articles/748526/

Based on my understanding the reason for NOT allowing the VFIO PF to have SRIOV enable is genuine from kernel point of View but not from DPDK point of view.

Here is the sequence to describe the problem
1) Consider Linux kernel allowed VFIO PCI SRIOV enable
2) PF bound to vfio-pci
3) using SRIOV infrastructure of vfio-pci PF driver, VFs are created
4) DPDK application bound to PF and VF, No issue here.
5) Assume DPDK application bound to PF and VF bound To netdev kernel driver. Now, there is a genuine concern From kernel point of view that, DPDK PF can intercept, VF mailbox message or so and deny the Kernel request Or what if DPDK PF application crashes?

To avoid the case (5), (3) is not allowed in stock kernel. Which makes sense IMO.

Now, From DPDK PoV, step 5 is valid as we have Rte_flow's VF action etc used to enable such case. Where, user can program the PF's rte_flow to steer Some traffic to VF, where VF can be, DPDK application or Linux kernel netdev driver.

This patch enables the step (3) to enable step (5) from DPDK PoV. i.e DPDK needs to allow PF to bind to DPDK with VFs.

Why this issue now:
- igb_uio kernel driver is used as enabling step (3) See store_max_vfs() kernel/linux/igb_uio/igb_uio.c This is fine for non-iommu device, IOMMU devices
needs VFIO.
- We would like support VFIO for IOMMU protection And enable step (5) as DPDK supports form the spec level. i.e need to fix feature disparity between iommu vs non-iommu based devices.

Note:
We may not need a brand new kernel module, we could move this logic to igb_uio if maintenance is concern.

Signature · 2 lines
Kind regards,
Luca Boccassi
Signature · 2 lines
Kind regards,
Luca Boccassi
#11 lore raw
In reply to Thomas Monjalon
Quoted 36 lines · On Thu, 31 Oct 2019 18:03:53 +0100 Thomas Monjalon <[email protected]> wrote:

We don't get enough attention on this topic.
Let me rephrase the issue and the proposals with more people Cc'ed.

We are talking about SR-IOV VFs in VMs
with a PF managed on the host by DPDK.
The PF driver is either a (1) bifurcated (Mellanox case), or (2) bound to UIO with igb_uio, or (3) bound to VFIO.

In case 1, the PF is still managed by a kernel driver, so no issue.

In case 2, the PF is managed by UIO.
There is no SR-IOV support in upstream UIO,
but the out-of-tree module igb_uio works.
However we would like to drop this legacy module from DPDK. Some (most) Linux distributions do not package igb_uio anyway. The other issue is that igb_uio is using physical addressing, which is not acceptable with OCTEON TX2 for performance reason.

In case 3, the PF is managed by VFIO. This is the case we want to fix. VFIO does not allow to create VFs.
The workaround is to create VFs before binding the PF to VFIO. But since Linux 4.19, VFIO forbids any SR-IOV VF management. There is a security concern about allowing userspace to manage SR-IOV VF messages and taking the responsibility for VFs in the guest.

It is desired to allow the system admin deciding the security levels, by adding a flag in VFIO "let me manage VFs, I know what I am doing". Reference of "recent" discussion: https://lkml.org/lkml/2018/3/6/855
For now, there is no upstream solution merged.

This patch is proposing a solution using an out-of-tree module. In this case, the admin will decide explicitly to bind the PF to vfio_pf. Unfortunately this solution won't work in environments which forbid any out-of-tree module.
Another concern is that it looks like DPDK-only solution.

Quoted 7 lines

We have an issue but we do not want to propose a half-solution which would harm other projects and users.
So the question is:
Do we accept this patch as a temporary solution?
Or can we get an agreement soon for an upstream kernel solution?

Thanks for reading and giving your (clear) opinion.

I'm pretty appalled that anyone would consider shipping this module and actually claiming that it's supported in some way. Seriously, it's disturbing to see a driver that intentionally circumvents a security issue that we all seem to agree exists, but just hand wave that it doesn't apply to dpdk configurations. Ideas have been suggested upstream for for quarantining VFs generated from user owned PFs such that we require an opt-in to make use of them in this way. Nobody seems to be pursuing such ideas upstream. I don't even see upstream proposals to add a scary sounding module option to vfio-pci that would taint the kernel, but make this available. If nothing else, please remove the vfio name from this abomination, it has nothing to do with vfio other than to try to subvert the security and isolation that vfio attempts to provide. Thanks,

Alex

#12 lore raw
Quoted 40 lines · Alex Williamson
Quoted 36 lines · On Thu, 31 Oct 2019 18:03:53 +0100 Thomas Monjalon <[email protected]> wrote:

We don't get enough attention on this topic.
Let me rephrase the issue and the proposals with more people Cc'ed.

We are talking about SR-IOV VFs in VMs
with a PF managed on the host by DPDK.
The PF driver is either a (1) bifurcated (Mellanox case), or (2) bound to UIO with igb_uio, or (3) bound to VFIO.

In case 1, the PF is still managed by a kernel driver, so no issue.

In case 2, the PF is managed by UIO.
There is no SR-IOV support in upstream UIO,
but the out-of-tree module igb_uio works.
However we would like to drop this legacy module from DPDK. Some (most) Linux distributions do not package igb_uio anyway. The other issue is that igb_uio is using physical addressing, which is not acceptable with OCTEON TX2 for performance reason.

In case 3, the PF is managed by VFIO. This is the case we want to fix. VFIO does not allow to create VFs.
The workaround is to create VFs before binding the PF to VFIO. But since Linux 4.19, VFIO forbids any SR-IOV VF management. There is a security concern about allowing userspace to manage SR-IOV VF messages and taking the responsibility for VFs in the guest.

It is desired to allow the system admin deciding the security levels, by adding a flag in VFIO "let me manage VFs, I know what I am doing". Reference of "recent" discussion: https://lkml.org/lkml/2018/3/6/855
For now, there is no upstream solution merged.

This patch is proposing a solution using an out-of-tree module. In this case, the admin will decide explicitly to bind the PF to vfio_pf. Unfortunately this solution won't work in environments which forbid any out-of-tree module.
Another concern is that it looks like DPDK-only solution.

Quoted 7 lines
Quoted 7 lines

We have an issue but we do not want to propose a half-solution which would harm other projects and users.
So the question is:
Do we accept this patch as a temporary solution?
Or can we get an agreement soon for an upstream kernel solution?

Thanks for reading and giving your (clear) opinion.

Thanks, Alex for the feedback.

Quoted 2 lines

I'm pretty appalled that anyone would consider shipping this module and actually claiming that it's supported in some way. Seriously, it's

Actually DPDK already shipping with this hack using the igb_uio module for UIO.

https://git.dpdk.org/dpdk/tree/kernel/linux/igb_uio/igb_uio.c#n44.

Quoted 3 lines

disturbing to see a driver that intentionally circumvents a security issue that we all seem to agree exists, but just hand wave that it doesn't apply to dpdk configurations.

Yes. There is a security issue wrt netdev VFs. That's the reason, I was scared to
submit any patch in upstream on this front. Having said that, OVS-DPDK kind of userland
programs would like to define the fate of the netdev VF packets of the guest as it is vswitch application. So there is a perception change in who is controlling the who.

Quoted 9 lines

Ideas have been suggested
upstream for for quarantining VFs generated from user owned PFs such that we require an opt-in to make use of them in this way. Nobody seems to be pursuing such ideas upstream. I don't even see upstream proposals to add a scary sounding module option to vfio-pci that would taint the kernel, but make this available. If nothing else, please remove the vfio name from this abomination, it has nothing to do with vfio other than to try to subvert the security and isolation that vfio attempts to provide.

Thanks for the feedback. Let's hold on accepting this patch.

We would like to have an upstream solution so that DPDK needs to only focus on userspace.

I will work on submitting a patch for the discussion in Linux upstream. Let see how the discussion goes, Based on the that, We can revisit fate of this module.

Quoted 2 lines

Alex

#13 lore raw

07/11/2019 06:02, Jerin Jacob:

Quoted 12 lines
Quoted 9 lines · Alex Williamson

Ideas have been suggested
upstream for for quarantining VFs generated from user owned PFs such that we require an opt-in to make use of them in this way. Nobody seems to be pursuing such ideas upstream. I don't even see upstream proposals to add a scary sounding module option to vfio-pci that would taint the kernel, but make this available. If nothing else, please remove the vfio name from this abomination, it has nothing to do with vfio other than to try to subvert the security and isolation that vfio attempts to provide.

Quoted 8 lines

Thanks for the feedback. Let's hold on accepting this patch.

We would like to have an upstream solution so that DPDK needs to only focus on userspace.

I will work on submitting a patch for the discussion in Linux upstream. Let see how the discussion goes, Based on the that, We can revisit fate of this module.

Just to be clear, vfio_pf is on hold, i.e. not merged in DPDK 19.11.

#14 lore raw
Quoted 16 lines · Thomas Monjalon

07/11/2019 06:02, Jerin Jacob:

Quoted 14 lines
Quoted 9 lines · Alex Williamson

Ideas have been suggested
upstream for for quarantining VFs generated from user owned PFs such that we require an opt-in to make use of them in this way. Nobody seems to be pursuing such ideas upstream. I don't even see upstream proposals to add a scary sounding module option to vfio-pci that would taint the kernel, but make this available. If nothing else, please remove the vfio name from this abomination, it has nothing to do with vfio other than to try to subvert the security and isolation that vfio attempts to provide.

Thanks for the feedback. Let's hold on accepting this patch.

Quoted 8 lines
Quoted 6 lines

We would like to have an upstream solution so that DPDK needs to only focus on userspace.

I will work on submitting a patch for the discussion in Linux upstream. Let see how the discussion goes, Based on the that, We can revisit fate of this module.

Just to be clear, vfio_pf is on hold, i.e. not merged in DPDK 19.11.

+1

Quoted 2 lines
#15 lore raw
In reply to [email protected]
Quoted 28 lines · On Fri, 6 Sep 2019 14:42:30 +0530 <[email protected]> wrote:

From: Vamsi Attunuru <[email protected]>

The DPDK use case such as VF representer or OVS offload etc would call for PF and VF PCIe devices to bind vfio-pci module to enable IOMMU protection.

In addition to vSwitch use case, unlike, other PCI class of devices, Network class of PCIe devices would have additional responsibility on the PF devices such as promiscuous mode support etc.

The above use cases demand VFIO needs bound to PF and its VF devices. This is use case is not supported in Linux kernel, due to a security issue where it is possible to have DoS in case if VF attached to guest over vfio-pci and netdev kernel driver runs on it and which something VF representer would like to enable it.

Since we can not differentiate, the vfio-pci bounded VF devices runs DPDK application or netdev driver in guest, we can not introduce any scheme to fix DoS case and therefore not have proper support of this in the upstream kernel.

The igb_uio enables such PF and VF binding support for non-iommu devices to make VF representer or OVS offload run on non-iommu devices with DoS vulnerability for netdev driver as VF.

Quoted 6 lines

This kernel module, facilitate to enable SRIOV on PF devices, therefore, to run both PF and VF devices in VFIO mode knowing its impacts like igb_uio driver functions of non-iommu devices.

NAK
Having kernel drivers not in upstream kernel is a long term maintenance and security risk. Please work with upstream kernel developers to get this merged there.

#16 lore raw
Quoted 35 lines · Stephen Hemminger,
Quoted 32 lines · On Fri, 6 Sep 2019 14:42:30 +0530 <[email protected]> wrote:

From: Vamsi Attunuru <[email protected]>

The DPDK use case such as VF representer or OVS offload etc would call for PF and VF PCIe devices to bind vfio-pci module to enable IOMMU protection.

In addition to vSwitch use case, unlike, other PCI class of devices, Network class of PCIe devices would have additional responsibility on the PF devices such as promiscuous mode support etc.

The above use cases demand VFIO needs bound to PF and its VF devices. This is use case is not supported in Linux kernel, due to a security issue where it is possible to have DoS in case if VF attached to guest over vfio-pci and netdev kernel driver runs on it and which something VF representer would like to enable it.

Since we can not differentiate, the vfio-pci bounded VF devices runs DPDK application or netdev driver in guest, we can not introduce any scheme to fix DoS case and therefore not have proper support of this in the upstream kernel.

The igb_uio enables such PF and VF binding support for non-iommu devices to make VF representer or OVS offload run on non-iommu devices with DoS vulnerability for netdev driver as VF.

This kernel module, facilitate to enable SRIOV on PF devices, therefore, to run both PF and VF devices in VFIO mode knowing its impacts like igb_uio driver functions of non-iommu devices.

Quoted 8 lines
Quoted 2 lines

NAK
Having kernel drivers not in upstream kernel is a long term maintenance and security risk. Please work with upstream kernel developers to get this merged there.

There is security issue in attaching DPDK PF driver and netdev bind to VF. So this scheme is not upsteamble to Linux kernel. Since rte_flow had VF action. We need this scheme to support VF action with VFIO. So, Out of tree is the only way as it is DPDK specific feature. Already sent patches to Linux kernel, it make sense to not accept this in upstream. We are already exposing such features through igb-uio for non VFIO device. IMO, there should not be any disparity between igb-uio and VFIO in DPDK.

If we are against out of tree module, let's remove igb-uio as well. We can't have different treatment for similar issues.

#17 lore raw
Quoted 55 lines · On Tue, 8 Oct 2019 20:58:27 +0530 Jerin Jacob <[email protected]> wrote:
Quoted 35 lines · Stephen Hemminger,
Quoted 32 lines · On Fri, 6 Sep 2019 14:42:30 +0530 <[email protected]> wrote:

From: Vamsi Attunuru <[email protected]>

The DPDK use case such as VF representer or OVS offload etc would call for PF and VF PCIe devices to bind vfio-pci module to enable IOMMU protection.

In addition to vSwitch use case, unlike, other PCI class of devices, Network class of PCIe devices would have additional responsibility on the PF devices such as promiscuous mode support etc.

The above use cases demand VFIO needs bound to PF and its VF devices. This is use case is not supported in Linux kernel, due to a security issue where it is possible to have DoS in case if VF attached to guest over vfio-pci and netdev kernel driver runs on it and which something VF representer would like to enable it.

Since we can not differentiate, the vfio-pci bounded VF devices runs DPDK application or netdev driver in guest, we can not introduce any scheme to fix DoS case and therefore not have proper support of this in the upstream kernel.

The igb_uio enables such PF and VF binding support for non-iommu devices to make VF representer or OVS offload run on non-iommu devices with DoS vulnerability for netdev driver as VF.

This kernel module, facilitate to enable SRIOV on PF devices, therefore, to run both PF and VF devices in VFIO mode knowing its impacts like igb_uio driver functions of non-iommu devices.

Quoted 8 lines
Quoted 2 lines

NAK
Having kernel drivers not in upstream kernel is a long term maintenance and security risk. Please work with upstream kernel developers to get this merged there.

There is security issue in attaching DPDK PF driver and netdev bind to VF. So this scheme is not upsteamble to Linux kernel. Since rte_flow had VF action. We need this scheme to support VF action with VFIO. So, Out of tree is the only way as it is DPDK specific feature. Already sent patches to Linux kernel, it make sense to not accept this in upstream. We are already exposing such features through igb-uio for non VFIO device. IMO, there should not be any disparity between igb-uio and VFIO in DPDK.

Quoted 2 lines

If we are against out of tree module, let's remove igb-uio as well. We can't have different treatment for similar issues.

You are right igb-uio is legacy and only exists for users unwilling to change (such as old kernels which don't support vfio noiommu mode). Eventually it should go as well. And the same for KNI.

Understand the pain, but this feels like a child who gets a no answer from one parent and therefore thinks they can ask the other parent and get a yes.

Who is the person in the upstream kernel community that needs to understand what is needed. Maybe another "I know what I am doing" kernel flag is needed like no-iommu mode has.

#18 lore raw
Quoted 59 lines · Stephen Hemminger,
Quoted 1 line · On Tue, 8 Oct 2019 20:58:27 +0530 Jerin Jacob <[email protected]> wrote:

On Tue, 8 Oct, 2019, 8:42 PM Stephen Hemminger, <

[email protected]>

Quoted 40 lines
Quoted 38 lines · wrote:
Quoted 34 lines · On Fri, 6 Sep 2019 14:42:30 +0530 <[email protected]> wrote:

From: Vamsi Attunuru <[email protected]>

The DPDK use case such as VF representer or OVS offload etc would call for PF and VF PCIe devices to bind vfio-pci module to enable IOMMU protection.

In addition to vSwitch use case, unlike, other PCI class of devices, Network class of PCIe devices would have additional responsibility on the PF devices such as promiscuous mode support etc.

The above use cases demand VFIO needs bound to PF and its VF devices. This is use case is not supported in Linux kernel, due to a security issue where it is possible to have DoS in case if VF attached to guest over vfio-pci and netdev kernel driver runs on it and which something VF representer would like to enable it.

Since we can not differentiate, the vfio-pci bounded VF devices runs DPDK application or netdev driver in guest, we can not introduce any scheme to fix DoS case and therefore not have proper support of this in the upstream kernel.

The igb_uio enables such PF and VF binding support for non-iommu devices to make VF representer or OVS offload run on non-iommu devices with DoS vulnerability for netdev driver as VF.

This kernel module, facilitate to enable SRIOV on PF devices, therefore, to run both PF and VF devices in VFIO mode knowing its impacts like igb_uio driver functions of non-iommu devices.

Quoted 7 lines
Quoted 5 lines

NAK
Having kernel drivers not in upstream kernel is a long term maintenance and security risk. Please work with upstream kernel developers to get this merged there.

There is security issue in attaching DPDK PF driver and netdev bind to

VF.

Quoted 2 lines

So this scheme is not upsteamble to Linux kernel. Since rte_flow had VF action. We need this scheme to support VF action with VFIO. So, Out of

tree

Quoted 2 lines

is the only way as it is DPDK specific feature. Already sent patches to Linux kernel, it make sense to not accept this in upstream. We are

already

Quoted 9 lines
Quoted 5 lines

exposing such features through igb-uio for non VFIO device. IMO, there should not be any disparity between igb-uio and VFIO in DPDK.

If we are against out of tree module, let's remove igb-uio as well. We can't have different treatment for similar issues.

You are right igb-uio is legacy and only exists for users unwilling to change (such as old kernels which don't support vfio noiommu mode).

It is NOT completely correct. This specific use case (allowing PF to bind DPDK and VF to have netdev in non VFIO mode allowed by igb-uio) now. So all non upsteamble features are going through igb-uio. That's is the main reason why igb-uio exist.

Eventually it should go as well. And the same for KNI.

Quoted 1 line

Nothing works without timeline. If that's the plan then decide the timeline.Please...

Quoted 9 lines

Understand the pain, but this feels like a child who gets a no answer from one parent and therefore thinks they can ask the other parent and get a yes.

Who is the person in the upstream kernel community that needs to understand what is needed. Maybe another "I know what I am doing" kernel flag is needed
like no-iommu mode has.

no-iommu case is different where we cannot screw Linux netdev driver, you can create a damage to your self that's an acceptable compromise.

In this case, when DPDK PF bound application dies then it will impact netdev VF driver as gets stalled and there is a security issues to VF netdev driver that DPDK PF can intersect the netdev VF mailbox message.

So this case is different where from Kernel PoV there is damange to netdev VF so this can not be accepted in Linux.

One option is to add this piece of code igb-uio instead to adding new driver. What do you say?

It is the problem for all non bifurcated drivers in DPDK not specific to Marvell.

The workaround is to use igb-uio with non VFIO.
We can not support UIO through performance reason hence we need a solution that works for VFIO due to HW accelerated mempool architecture (applicable for all NPU)

We can not have VFIO vs UIO specific features disparity in DPDK. Please have same treatment. Either remove igb-uio hacks from Dpdk or enable non upsteamble features through igb-uio.So that there is no disparity for a specific use case / vendor.

Quoted 1 line
#19 lore raw
Quoted 97 lines · Jerin Jacob
Quoted 59 lines · Stephen Hemminger,
Quoted 55 lines · On Tue, 8 Oct 2019 20:58:27 +0530 Jerin Jacob <[email protected]> wrote:
Quoted 35 lines · Stephen Hemminger,
Quoted 32 lines · On Fri, 6 Sep 2019 14:42:30 +0530 <[email protected]> wrote:

From: Vamsi Attunuru <[email protected]>

The DPDK use case such as VF representer or OVS offload etc would call for PF and VF PCIe devices to bind vfio-pci module to enable IOMMU protection.

In addition to vSwitch use case, unlike, other PCI class of devices, Network class of PCIe devices would have additional responsibility on the PF devices such as promiscuous mode support etc.

The above use cases demand VFIO needs bound to PF and its VF devices. This is use case is not supported in Linux kernel, due to a security issue where it is possible to have DoS in case if VF attached to guest over vfio-pci and netdev kernel driver runs on it and which something VF representer would like to enable it.

Since we can not differentiate, the vfio-pci bounded VF devices runs DPDK application or netdev driver in guest, we can not introduce any scheme to fix DoS case and therefore not have proper support of this in the upstream kernel.

The igb_uio enables such PF and VF binding support for non-iommu devices to make VF representer or OVS offload run on non-iommu devices with DoS vulnerability for netdev driver as VF.

This kernel module, facilitate to enable SRIOV on PF devices, therefore, to run both PF and VF devices in VFIO mode knowing its impacts like igb_uio driver functions of non-iommu devices.

Quoted 8 lines
Quoted 2 lines

NAK
Having kernel drivers not in upstream kernel is a long term maintenance and security risk. Please work with upstream kernel developers to get this merged there.

There is security issue in attaching DPDK PF driver and netdev bind to VF. So this scheme is not upsteamble to Linux kernel. Since rte_flow had VF action. We need this scheme to support VF action with VFIO. So, Out of tree is the only way as it is DPDK specific feature. Already sent patches to Linux kernel, it make sense to not accept this in upstream. We are already exposing such features through igb-uio for non VFIO device. IMO, there should not be any disparity between igb-uio and VFIO in DPDK.

Quoted 5 lines
Quoted 2 lines

If we are against out of tree module, let's remove igb-uio as well. We can't have different treatment for similar issues.

You are right igb-uio is legacy and only exists for users unwilling to change (such as old kernels which don't support vfio noiommu mode).

It is NOT completely correct. This specific use case (allowing PF to bind DPDK and VF to have netdev in non VFIO mode allowed by igb-uio) now. So all non upsteamble features are going through igb-uio. That's is the main reason why igb-uio exist.

Quoted 1 line

Eventually it should go as well. And the same for KNI.

Nothing works without timeline. If that's the plan then decide the timeline.Please...

Quoted 8 lines

Understand the pain, but this feels like a child who gets a no answer from one parent and therefore thinks they can ask the other parent and get a yes.

Who is the person in the upstream kernel community that needs to understand what is needed. Maybe another "I know what I am doing" kernel flag is needed like no-iommu mode has.

no-iommu case is different where we cannot screw Linux netdev driver, you can create a damage to your self that's an acceptable compromise.

In this case, when DPDK PF bound application dies then it will impact netdev VF driver as gets stalled and there is a security issues to VF netdev driver that DPDK PF can intersect the netdev VF mailbox message.

So this case is different where from Kernel PoV there is damange to netdev VF so this can not be accepted in Linux.

Quoted 8 lines

One option is to add this piece of code igb-uio instead to adding new driver. What do you say?

It is the problem for all non bifurcated drivers in DPDK not specific to Marvell.

The workaround is to use igb-uio with non VFIO.
We can not support UIO through performance reason hence we need a solution that works for VFIO due to HW accelerated mempool architecture (applicable for all NPU)

We can not have VFIO vs UIO specific features disparity in DPDK. Please have same treatment. Either remove igb-uio hacks from Dpdk or enable non upsteamble features through igb-uio.So that there is no disparity for a specific use case / vendor.

Andrew Rybchenko already acked this patch and I provided enough data on the need for this patch.
I hope there is no more confusion about the need for this patch.

#20 lore raw
Quoted 12 lines
Quoted 12 lines

no-iommu case is different where we cannot screw Linux netdev driver, you can create a damage to your self that's an acceptable compromise.

In this case, when DPDK PF bound application dies then it will impact netdev VF driver as gets stalled and there is a security issues to VF netdev driver that DPDK PF can intersect the netdev VF mailbox message.

So this case is different where from Kernel PoV there is damange to netdev VF so this can not be accepted in Linux.

One option is to add this piece of code igb-uio instead to adding new driver. What do you say?

It is the problem for all non bifurcated drivers in DPDK not specific to Marvell.

Quoted 8 lines
Quoted 4 lines

The workaround is to use igb-uio with non VFIO.
We can not support UIO through performance reason hence we need a solution that works for VFIO due to HW accelerated mempool architecture (applicable for all NPU)

We can not have VFIO vs UIO specific features disparity in DPDK. Please have same treatment. Either remove igb-uio hacks from Dpdk or enable non upsteamble features through igb-uio.So that there is no disparity for a specific use case / vendor.

Andrew Rybchenko already acked this patch and I provided enough data on the need for this patch.
I hope there is no more confusion about the need for this patch.

I assume no more issue to merge this patch for RC1. If yes, please discuss.

#21 lore raw
Quoted 16 lines · Jerin Jacob
Quoted 16 lines
Quoted 16 lines

no-iommu case is different where we cannot screw Linux netdev driver, you can create a damage to your self that's an acceptable compromise.

In this case, when DPDK PF bound application dies then it will impact netdev VF driver as gets stalled and there is a security issues to VF netdev driver that DPDK PF can intersect the netdev VF mailbox message.

So this case is different where from Kernel PoV there is damange to netdev VF so this can not be accepted in Linux.

One option is to add this piece of code igb-uio instead to adding new driver. What do you say?

It is the problem for all non bifurcated drivers in DPDK not specific to Marvell.

The workaround is to use igb-uio with non VFIO.
We can not support UIO through performance reason hence we need a solution that works for VFIO due to HW accelerated mempool architecture (applicable for all NPU)

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

We can not have VFIO vs UIO specific features disparity in DPDK. Please have same treatment. Either remove igb-uio hacks from Dpdk or enable non upsteamble features through igb-uio.So that there is no disparity for a specific use case / vendor.

Andrew Rybchenko already acked this patch and I provided enough data on the need for this patch.
I hope there is no more confusion about the need for this patch.

I assume no more issue to merge this patch for RC1. If yes, please discuss.

Ping++

#22 lore raw
In reply to Stephen Hemminger
Quoted 10 lines
Quoted 10 lines
Quoted 1 line

There is security issue in attaching DPDK PF driver and netdev bind to VF. So this scheme is not upsteamble to Linux kernel. Since rte_flow had VF action. We need this scheme to support VF action with VFIO. So, Out of tree is the only way as it is DPDK specific feature. Already sent patches to Linux kernel, it make sense to not accept this in upstream. We are already exposing such features through igb-uio for non VFIO device. IMO, there should not be any disparity between igb-uio and VFIO in DPDK.

Quoted 6 lines
Quoted 2 lines

If we are against out of tree module, let's remove igb-uio as well. We can't have different treatment for similar issues.

You are right igb-uio is legacy and only exists for users unwilling to change (such as old kernels which don't support vfio noiommu mode). Eventually it should go as well. And the same for KNI.

+ Techboard

I understand, Everyone would like not to have out of tree kernel modules in dpdk repo.

Is it possible to
a) move existing or new out of tree module or
b) libraries can be used by another project or
c) DPDK device drivers binary FW repo like Linux kernel FW etc(The ones connected to dpdk)

add it in https://www.dpdk.org/hosted-projects/

and use tools like "https://gerrit.googlesource.com/git-repo/"[1] for development and distribution case
[1]
git-repo: tools used by android for a similar situation.