diff mbox series

[v4] examples/vdpa: support running in nested virtualization environment

Message ID 20221114030426.1363561-1-chenh@yusur.tech (mailing list archive)
State New
Delegated to: Maxime Coquelin
Headers show
Series [v4] examples/vdpa: support running in nested virtualization environment | expand

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/Intel-compilation success Compilation OK
ci/github-robot: build success github build: passed
ci/intel-Testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS

Commit Message

Hao Chen Nov. 14, 2022, 3:04 a.m. UTC
When we run dpdk vdpa in the nested virtual machine vm-L1 and ping
test in vm-L2, the ping is not good. The reason for troubleshooting is
that the virtio net in vm-L2 sends control information to the vring,
and the qemu back-end device in vm-L1 cannot obtain correct data
from the vring. This problem is related to the opening of the vIOMMU.

This patch add flag RTE_VHOST_USER_IOMMU_SUPPORT to use vhost vIOMMU
, VIRTIO_F_IOMMU_PLATFORM feature will be negotiated successfully if
virtio iommu is used in a nested virtualization environment.

The configuration is as follows:
The host starts iommu, and the kernel parameter is added with
'intel_iommu=on iommu=pt'.
VM-L1's xml add viommu and virtio device adds iommu='on' ats='on'.
VM-L2's xml enables viommu, and adds  parameters
'intel_iommu=on iommu=pt' to kernel.

Then the ping test in vm-L2 is OK.

Signed-off-by: Hao Chen <chenh@yusur.tech>
---
v4:
*Simplify the patch. Set the flags RTE_VHOST_USER_IOMMU_SUPPORT default.

v3:
*Modify mail title.

v2:
*fprintf all string including the eal one.
*remove exit(1).

 examples/vdpa/main.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Maxime Coquelin Jan. 19, 2023, 10:16 a.m. UTC | #1
On 11/14/22 04:04, Hao Chen wrote:
> When we run dpdk vdpa in the nested virtual machine vm-L1 and ping
> test in vm-L2, the ping is not good. The reason for troubleshooting is
> that the virtio net in vm-L2 sends control information to the vring,
> and the qemu back-end device in vm-L1 cannot obtain correct data
> from the vring. This problem is related to the opening of the vIOMMU.
> 
> This patch add flag RTE_VHOST_USER_IOMMU_SUPPORT to use vhost vIOMMU
> , VIRTIO_F_IOMMU_PLATFORM feature will be negotiated successfully if
> virtio iommu is used in a nested virtualization environment.
> 
> The configuration is as follows:
> The host starts iommu, and the kernel parameter is added with
> 'intel_iommu=on iommu=pt'.
> VM-L1's xml add viommu and virtio device adds iommu='on' ats='on'.
> VM-L2's xml enables viommu, and adds  parameters
> 'intel_iommu=on iommu=pt' to kernel.
> 
> Then the ping test in vm-L2 is OK.
> 
> Signed-off-by: Hao Chen <chenh@yusur.tech>
> ---
> v4:
> *Simplify the patch. Set the flags RTE_VHOST_USER_IOMMU_SUPPORT default.
> 
> v3:
> *Modify mail title.
> 
> v2:
> *fprintf all string including the eal one.
> *remove exit(1).
> 
>   examples/vdpa/main.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/examples/vdpa/main.c b/examples/vdpa/main.c
> index 4c7e81d7b6..4d3203f3a7 100644
> --- a/examples/vdpa/main.c
> +++ b/examples/vdpa/main.c
> @@ -214,6 +214,8 @@ start_vdpa(struct vdpa_port *vport)
>   	if (client_mode)
>   		vport->flags |= RTE_VHOST_USER_CLIENT;
>   
> +	vport->flags |= RTE_VHOST_USER_IOMMU_SUPPORT;
> +
>   	if (access(socket_path, F_OK) != -1 && !client_mode) {
>   		RTE_LOG(ERR, VDPA,
>   			"%s exists, please remove it or specify another file and try again.\n",

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime
diff mbox series

Patch

diff --git a/examples/vdpa/main.c b/examples/vdpa/main.c
index 4c7e81d7b6..4d3203f3a7 100644
--- a/examples/vdpa/main.c
+++ b/examples/vdpa/main.c
@@ -214,6 +214,8 @@  start_vdpa(struct vdpa_port *vport)
 	if (client_mode)
 		vport->flags |= RTE_VHOST_USER_CLIENT;
 
+	vport->flags |= RTE_VHOST_USER_IOMMU_SUPPORT;
+
 	if (access(socket_path, F_OK) != -1 && !client_mode) {
 		RTE_LOG(ERR, VDPA,
 			"%s exists, please remove it or specify another file and try again.\n",