Skip to contentSkip to conversation

app/testpmd: fix device hotplug remove

PATCH NAK Di ChenxuX 6 participants 20 messages Oct 24, 2019 – Nov 13, 2019 Network drivers

lore
Share & tools
lore

Di ChenxuX

author
#0 lore raw

PATCH 1/1 app/testpmd: fix device hotplug remove

Hotplug remove cause infinite loops. Fix by canceling port_close
before port_detach function when rmv_port_callback.

Fixes ac89d46096d5 ("net/i40e: release port upon close")
---
 app/test-pmd/testpmd.c | 1 -
 1 file changed, 1 deletion(-)
app/test-pmd/testpmd.c +0 -1
index 5701f3141..a264644a1 100644
@@ -2708,7 +2708,6 @@ rmv_port_callback(void *arg)
 	no_link_check = 1;
 	stop_port(port_id);
 	no_link_check = org_no_link_check;
-	close_port(port_id);
 	detach_port_device(port_id);
 	if (need_to_start)
 		start_packet_forwarding(0);
Signature · 1 line
2.17.1
Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Di ChenxuX
Sent: Thursday, October 24, 2019 2:03 AM
To: [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Yang, Qiming <[email protected]>; Di, ChenxuX <[email protected]>
Subject: [dpdk-dev] [PATCH] app/testpmd: fix device hotplug remove

Quoted 6 lines

Hotplug remove cause infinite loops. Fix by canceling port_close before port_detach function when rmv_port_callback.

Fixes ac89d46096d5 ("net/i40e: release port upon close")
#2 lore raw
In reply to Di ChenxuX
Quoted 2 lines · Di ChenxuX

Hotplug remove cause infinite loops. Fix by canceling port_close
before port_detach function when rmv_port_callback.

Can you please give more details/backtrace of how loop happens? How can trigger it?

Quoted 21 lines
Fixes ac89d46096d5 ("net/i40e: release port upon close")
---
 app/test-pmd/testpmd.c | 1 -
 1 file changed, 1 deletion(-)
app/test-pmd/testpmd.c +0 -1
index 5701f3141..a264644a1 100644
@@ -2708,7 +2708,6 @@ rmv_port_callback(void *arg)
 	no_link_check = 1;
 	stop_port(port_id);
 	no_link_check = org_no_link_check;
-	close_port(port_id);
 	detach_port_device(port_id);
 	if (need_to_start)
 		start_packet_forwarding(0);
#3 lore raw

Hi, Ferruh

Quoted 8 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Friday, October 25, 2019 1:24 AM
To: Di, ChenxuX <[email protected]>; [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Yang, Qiming <[email protected]>
Subject: Re: [dpdk-dev] [PATCH] app/testpmd: fix device hotplug remove

Quoted 6 lines
Quoted 2 lines · Di ChenxuX

Hotplug remove cause infinite loops. Fix by canceling port_close before port_detach function when rmv_port_callback.

Can you please give more details/backtrace of how loop happens? How can trigger it?

Here is the test case

Environment
Os: Ubuntu 18.04
Device: X710 nic
Software: qemu

1. Bind pf0 to vfio-pci

	[root@xxxxxxxxx dpdk]# modprobe vfio-pci
	[root@ xxxxxxxxx dpdk]# usertools/dpdk-devbind.py --force --bind=vfio-pci 0000:81:00.0

2. Passthrough PF and start qemu

[root@ xxxxxxxxx dpdk]# taskset -c 0-7 qemu-system-x86_64 -enable-kvm -pidfile /tmp/.vm0.pid -m 10240 -cpu host -smp 8 -name vm0 -monitor unix:/tmp/vm0_monitor.sock,server,nowait -chardev socket,path=/tmp/vm0_qga0.sock,server,nowait,id=vm0_qga0 -device virtio-serial -device virtserialport,chardev=vm0_qga0,name=org.qemu.guest_agent.0 -device e1000,netdev=nttsip1 -netdev user,id=nttsip1,hostfwd=tcp: xxxxxxxxx:6000-:22 -monitor stdio -drive file=/home/image/test_vfio.img -vnc :5 -device vfio-pci,host=0000:81:00.0,id=dev1
3. Log in VM, bind passthrough port 0 to vfio-pci

virtdut. xxxxxxxxx:6000: modprobe -r vfio_iommu_type1 virtdut. xxxxxxxxx:6000: modprobe -r vfio
virtdut. xxxxxxxxx:6000: modprobe vfio enable_unsafe_noiommu_mode=1 virtdut. xxxxxxxxx:6000: modprobe vfio-pci

virtdut. xxxxxxxxx:6000: ./usertools/dpdk-devbind.py -b vfio-pci 0000:00:05.0
4. Start testpmd with "--hot-plug" enable

	virtdut. xxxxxxxxx:6000: ./x86_64-native-linuxapp-gcc/app/testpmd -l 0,1,2,3,4,5,6,7 -n 1 -w 0000:00:05.0  --file-prefix=dpdk_24610_20191014100036   -- -i --hot-plug

5. Remove device from qemu interface

(qemu) device_del dev1

6.before change

	Removing a device...	
	EAL: Driver cannot detach the device (0000:00:05.0)
	EAL: Failed to detach device on primary process
	testpmd: Failed to detach device 0000:00:05.0
	EAL: can not get port by device 0000:00:05.0!
	EAL: can not get port by device 0000:00:05.0!
	...
	EAL: can not get port by device 0000:00:05.0!
	...
	...
 after change:
	Removing a device...
	EAL: Error disabling MSI-X interrupts for fd 47
	EAL: Releasing pci mapped resource for 0000:00:05.0
	EAL: Calling pci_unmap_resource for 0000:00:05.0 at 0x1100800000
	EAL: Calling pci_unmap_resource for 0000:00:05.0 at 0x1101000000
	Device of port 0 is detached
	Now total ports is 0
	Done
	Invalid port_id=0
	EAL: Cannot find device (0000:00:05.0) on bus (pci)
Quoted 22 lines
Quoted 22 lines
Fixes ac89d46096d5 ("net/i40e: release port upon close")
---
 app/test-pmd/testpmd.c | 1 -
 1 file changed, 1 deletion(-)
app/test-pmd/testpmd.c index renamed from app/test-pmd/testpmd.c +0 -0

5701f3141..a264644a1 100644

app/test-pmd/testpmd.c +0 -1
@@ -2708,7 +2708,6 @@ rmv_port_callback(void *arg)
 	no_link_check = 1;
 	stop_port(port_id);
 	no_link_check = org_no_link_check;
-	close_port(port_id);
 	detach_port_device(port_id);
 	if (need_to_start)
 		start_packet_forwarding(0);
#4 lore raw

25/10/2019 03:48, Di, ChenxuX:

Quoted 70 lines

From: Yigit, Ferruh

Quoted 6 lines · Di ChenxuX
Quoted 2 lines

Hotplug remove cause infinite loops. Fix by canceling port_close before port_detach function when rmv_port_callback.

Can you please give more details/backtrace of how loop happens? How can trigger it?

Here is the test case

Environment
Os: Ubuntu 18.04
Device: X710 nic
Software: qemu

1. Bind pf0 to vfio-pci

	[root@xxxxxxxxx dpdk]# modprobe vfio-pci
	[root@ xxxxxxxxx dpdk]# usertools/dpdk-devbind.py --force --bind=vfio-pci 0000:81:00.0

2. Passthrough PF and start qemu

[root@ xxxxxxxxx dpdk]# taskset -c 0-7 qemu-system-x86_64 -enable-kvm -pidfile /tmp/.vm0.pid -m 10240 -cpu host -smp 8 -name vm0 -monitor unix:/tmp/vm0_monitor.sock,server,nowait -chardev socket,path=/tmp/vm0_qga0.sock,server,nowait,id=vm0_qga0 -device virtio-serial -device virtserialport,chardev=vm0_qga0,name=org.qemu.guest_agent.0 -device e1000,netdev=nttsip1 -netdev user,id=nttsip1,hostfwd=tcp: xxxxxxxxx:6000-:22 -monitor stdio -drive file=/home/image/test_vfio.img -vnc :5 -device vfio-pci,host=0000:81:00.0,id=dev1
3. Log in VM, bind passthrough port 0 to vfio-pci

virtdut. xxxxxxxxx:6000: modprobe -r vfio_iommu_type1 virtdut. xxxxxxxxx:6000: modprobe -r vfio
virtdut. xxxxxxxxx:6000: modprobe vfio enable_unsafe_noiommu_mode=1 virtdut. xxxxxxxxx:6000: modprobe vfio-pci

virtdut. xxxxxxxxx:6000: ./usertools/dpdk-devbind.py -b vfio-pci 0000:00:05.0
4. Start testpmd with "--hot-plug" enable

	virtdut. xxxxxxxxx:6000: ./x86_64-native-linuxapp-gcc/app/testpmd -l 0,1,2,3,4,5,6,7 -n 1 -w 0000:00:05.0  --file-prefix=dpdk_24610_20191014100036   -- -i --hot-plug

5. Remove device from qemu interface

(qemu) device_del dev1

6.before change

	Removing a device...	
	EAL: Driver cannot detach the device (0000:00:05.0)
	EAL: Failed to detach device on primary process
	testpmd: Failed to detach device 0000:00:05.0
	EAL: can not get port by device 0000:00:05.0!
	EAL: can not get port by device 0000:00:05.0!
	...
	EAL: can not get port by device 0000:00:05.0!
	...
	...
 after change:
	Removing a device...
	EAL: Error disabling MSI-X interrupts for fd 47
	EAL: Releasing pci mapped resource for 0000:00:05.0
	EAL: Calling pci_unmap_resource for 0000:00:05.0 at 0x1100800000
	EAL: Calling pci_unmap_resource for 0000:00:05.0 at 0x1101000000
	Device of port 0 is detached
	Now total ports is 0
	Done
	Invalid port_id=0
	EAL: Cannot find device (0000:00:05.0) on bus (pci)
Quoted 9 lines
Quoted 9 lines
Fixes ac89d46096d5 ("net/i40e: release port upon close")
---
 app/test-pmd/testpmd.c | 1 -
 1 file changed, 1 deletion(-)
Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
app/test-pmd/testpmd.c index renamed from app/test-pmd/testpmd.c +0 -0

5701f3141..a264644a1 100644

app/test-pmd/testpmd.c +0 -0
Quoted 8 lines

app/test-pmd/testpmd.c rmv_port_callback(void *arg) · line 2713

Quoted 8 lines
app/test-pmd/testpmd.c +0 -1
@@ -2708,7 +2708,6 @@ rmv_port_callback(void *arg)
 	no_link_check = 1;
 	stop_port(port_id);
 	no_link_check = org_no_link_check;
-	close_port(port_id);
 	detach_port_device(port_id);
 	if (need_to_start)
 		start_packet_forwarding(0);

I disagree with this patch.
You are removing a call to the "close" function because it does not work properly with your driver.
Please do not blame the tool which is showing the error.

#5 lore raw
In reply to Di, ChenxuX
Quoted 46 lines · ChenxuX

Hi, Ferruh

Quoted 8 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Friday, October 25, 2019 1:24 AM
To: Di, ChenxuX <[email protected]>; [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Yang, Qiming <[email protected]>
Subject: Re: [dpdk-dev] [PATCH] app/testpmd: fix device hotplug remove

Quoted 6 lines
Quoted 2 lines · Di ChenxuX

Hotplug remove cause infinite loops. Fix by canceling port_close before port_detach function when rmv_port_callback.

Can you please give more details/backtrace of how loop happens? How can trigger it?

Here is the test case

Environment
Os: Ubuntu 18.04
Device: X710 nic
Software: qemu

1. Bind pf0 to vfio-pci

	[root@xxxxxxxxx dpdk]# modprobe vfio-pci
	[root@ xxxxxxxxx dpdk]# usertools/dpdk-devbind.py --force --bind=vfio-pci 0000:81:00.0

2. Passthrough PF and start qemu

[root@ xxxxxxxxx dpdk]# taskset -c 0-7 qemu-system-x86_64 -enable-kvm -pidfile /tmp/.vm0.pid -m 10240 -cpu host -smp 8 -name vm0 -monitor unix:/tmp/vm0_monitor.sock,server,nowait -chardev socket,path=/tmp/vm0_qga0.sock,server,nowait,id=vm0_qga0 -device virtio-serial -device virtserialport,chardev=vm0_qga0,name=org.qemu.guest_agent.0 -device e1000,netdev=nttsip1 -netdev user,id=nttsip1,hostfwd=tcp: xxxxxxxxx:6000-:22 -monitor stdio -drive file=/home/image/test_vfio.img -vnc :5 -device vfio-pci,host=0000:81:00.0,id=dev1
3. Log in VM, bind passthrough port 0 to vfio-pci

virtdut. xxxxxxxxx:6000: modprobe -r vfio_iommu_type1 virtdut. xxxxxxxxx:6000: modprobe -r vfio
virtdut. xxxxxxxxx:6000: modprobe vfio enable_unsafe_noiommu_mode=1 virtdut. xxxxxxxxx:6000: modprobe vfio-pci

virtdut. xxxxxxxxx:6000: ./usertools/dpdk-devbind.py -b vfio-pci 0000:00:05.0
4. Start testpmd with "--hot-plug" enable

	virtdut. xxxxxxxxx:6000: ./x86_64-native-linuxapp-gcc/app/testpmd -l 0,1,2,3,4,5,6,7 -n 1 -w 0000:00:05.0  --file-prefix=dpdk_24610_20191014100036   -- -i --hot-plug

5. Remove device from qemu interface

(qemu) device_del dev1

Quoted 7 lines

6.before change

	Removing a device...	
	EAL: Driver cannot detach the device (0000:00:05.0)
	EAL: Failed to detach device on primary process
	testpmd: Failed to detach device 0000:00:05.0
	EAL: can not get port by device 0000:00:05.0!
	EAL: can not get port by device 0000:00:05.0!

'close()' is failing is a problem and should be fix but we keep getting "RTE_DEV_EVENT_REMOVE" event? Did you able to get the backtrace of the issue?

Quoted 40 lines
	...
	EAL: can not get port by device 0000:00:05.0!
	...
	...
 after change:
	Removing a device...
	EAL: Error disabling MSI-X interrupts for fd 47
	EAL: Releasing pci mapped resource for 0000:00:05.0
	EAL: Calling pci_unmap_resource for 0000:00:05.0 at 0x1100800000
	EAL: Calling pci_unmap_resource for 0000:00:05.0 at 0x1101000000
	Device of port 0 is detached
	Now total ports is 0
	Done
	Invalid port_id=0
	EAL: Cannot find device (0000:00:05.0) on bus (pci)
Quoted 22 lines
Quoted 22 lines
Fixes ac89d46096d5 ("net/i40e: release port upon close")
---
 app/test-pmd/testpmd.c | 1 -
 1 file changed, 1 deletion(-)
app/test-pmd/testpmd.c index renamed from app/test-pmd/testpmd.c +0 -0

5701f3141..a264644a1 100644

app/test-pmd/testpmd.c +0 -1
@@ -2708,7 +2708,6 @@ rmv_port_callback(void *arg)
 	no_link_check = 1;
 	stop_port(port_id);
 	no_link_check = org_no_link_check;
-	close_port(port_id);
 	detach_port_device(port_id);
 	if (need_to_start)
 		start_packet_forwarding(0);
#6 lore raw
In reply to Di ChenxuX

Hi,

Quoted 31 lines

-----Original Message-----
From: Di, ChenxuX
Sent: Thursday, October 24, 2019 9:03 AM
To: [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Yang, Qiming <[email protected]>; Di, ChenxuX <[email protected]>
Subject: [PATCH] app/testpmd: fix device hotplug remove

Hotplug remove cause infinite loops. Fix by canceling port_close before port_detach function when rmv_port_callback.

Fixes ac89d46096d5 ("net/i40e: release port upon close")
---
 app/test-pmd/testpmd.c | 1 -
 1 file changed, 1 deletion(-)
app/test-pmd/testpmd.c index renamed from app/test-pmd/testpmd.c +0 -0

5701f3141..a264644a1 100644

app/test-pmd/testpmd.c +0 -2
@@ -2708,7 +2708,6 @@ rmv_port_callback(void *arg)
 	no_link_check = 1;
 	stop_port(port_id);
 	no_link_check = org_no_link_check;
-	close_port(port_id);
 	detach_port_device(port_id);
 	if (need_to_start)
 		start_packet_forwarding(0);
--
Quoted 1 line

2.17.1

NACK, this patch is not acceptable.

#7 lore raw
Quoted 20 lines · Qiming

Hi,

Quoted 18 lines

-----Original Message-----
From: Di, ChenxuX
Sent: Thursday, October 24, 2019 9:03 AM
To: [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Yang, Qiming <[email protected]>; Di, ChenxuX <[email protected]>
Subject: [PATCH] app/testpmd: fix device hotplug remove

Hotplug remove cause infinite loops. Fix by canceling port_close before port_detach function when rmv_port_callback.

Fixes ac89d46096d5 ("net/i40e: release port upon close")
---
 app/test-pmd/testpmd.c | 1 -
 1 file changed, 1 deletion(-)
Quoted 17 lines
Quoted 13 lines
app/test-pmd/testpmd.c index renamed from app/test-pmd/testpmd.c +0 -0

5701f3141..a264644a1 100644

app/test-pmd/testpmd.c +0 -2
@@ -2708,7 +2708,6 @@ rmv_port_callback(void *arg)
 	no_link_check = 1;
 	stop_port(port_id);
 	no_link_check = org_no_link_check;
-	close_port(port_id);
 	detach_port_device(port_id);
 	if (need_to_start)
 		start_packet_forwarding(0);
--
Quoted 1 line

2.17.1

NACK, this patch is not acceptable.

I can't really follow what is the root cause of the failure here, @Qiming, if it is a driver issue, can you please briefly describe what is wrong in the driver?

Thanks,
ferruh

#8 lore raw

Hi, Ferruh

Quoted 39 lines · Ferruh Yigit
Quoted 20 lines · Qiming

Hi,

Quoted 18 lines

-----Original Message-----
From: Di, ChenxuX
Sent: Thursday, October 24, 2019 9:03 AM
To: [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Yang, Qiming <[email protected]>; Di, ChenxuX <[email protected]>
Subject: [PATCH] app/testpmd: fix device hotplug remove

Hotplug remove cause infinite loops. Fix by canceling port_close before port_detach function when rmv_port_callback.

Fixes ac89d46096d5 ("net/i40e: release port upon close")
---
 app/test-pmd/testpmd.c | 1 -
 1 file changed, 1 deletion(-)
Quoted 17 lines
Quoted 13 lines
app/test-pmd/testpmd.c index renamed from app/test-pmd/testpmd.c +0 -0

5701f3141..a264644a1 100644

app/test-pmd/testpmd.c +0 -2
@@ -2708,7 +2708,6 @@ rmv_port_callback(void *arg)
 	no_link_check = 1;
 	stop_port(port_id);
 	no_link_check = org_no_link_check;
-	close_port(port_id);
 	detach_port_device(port_id);
 	if (need_to_start)
 		start_packet_forwarding(0);
--
Quoted 1 line

2.17.1

NACK, this patch is not acceptable.

Quoted 2 lines

I can't really follow what is the root cause of the failure here, @Qiming, if it is a driver issue, can you please briefly describe what is wrong in the driver?

The real issue lays in i40e driver's remove ops after it adopts the RTE_ETH_DEV_CLOSE_REMOVE flag, I've talked with chenxu and he'll send a new patch to fix this issue this patch tried to solve.

Thanks,
Xiaolong

Quoted 3 lines

Thanks,
ferruh

author
#9 lore raw

PATCH v2 1/1 net/i40e: fix device hotplug remove

In reply to Di ChenxuX

testpmd will occur infinite loops when device hotplug remove. We can fix the issue by using the pci generic remove function

Fixes ac89d46096d5 ("net/i40e: release port upon close")

v2:
change the code in driver.

---
 drivers/net/i40e/i40e_ethdev.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)
drivers/net/i40e/i40e_ethdev.c +1 -11
index 77a46832c..64842867d 100644
@@ -694,17 +694,7 @@ eth_i40e_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 
 static int eth_i40e_pci_remove(struct rte_pci_device *pci_dev)
 {
-	struct rte_eth_dev *ethdev;
-
-	ethdev = rte_eth_dev_allocated(pci_dev->device.name);
-	if (!ethdev)
-		return -ENODEV;
-
-
-	if (ethdev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR)
-		return rte_eth_dev_destroy(ethdev, i40e_vf_representor_uninit);
-	else
-		return rte_eth_dev_destroy(ethdev, eth_i40e_dev_uninit);
+	return rte_eth_dev_pci_generic_remove(pci_dev, eth_i40e_dev_uninit);
 }
 
 static struct rte_pci_driver rte_i40e_pmd = {
Signature · 1 line
2.17.1
#10 lore raw

Re: [dpdk-dev] [PATCH v2] net/i40e: fix device hotplug remove

Quoted 23 lines · Di ChenxuX

testpmd will occur infinite loops when device hotplug remove. We can fix the issue by using the pci generic remove function

Fixes ac89d46096d5 ("net/i40e: release port upon close")

v2:
change the code in driver.
---
drivers/net/i40e/i40e_ethdev.c | 12 +-----------

1 file changed, 1 insertion(+), 11 deletions(-)
drivers/net/i40e/i40e_ethdev.c +0 -2
index 77a46832c..64842867d 100644
@@ -694,17 +694,7 @@ eth_i40e_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 
 static int eth_i40e_pci_remove(struct rte_pci_device *pci_dev)
 {
-	struct rte_eth_dev *ethdev;
-

drivers/net/i40e/i40e_ethdev.c eth_i40e_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, · line 697

Quoted 10 lines
drivers/net/i40e/i40e_ethdev.c +1 -9
-	ethdev = rte_eth_dev_allocated(pci_dev->device.name);
-	if (!ethdev)
-		return -ENODEV;
-
-
-	if (ethdev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR)
-		return rte_eth_dev_destroy(ethdev, i40e_vf_representor_uninit);
-	else
-		return rte_eth_dev_destroy(ethdev, eth_i40e_dev_uninit);
+	return rte_eth_dev_pci_generic_remove(pci_dev, eth_i40e_dev_uninit);

What about i40e_vf_representor_uninit, you also need to take it into consideration.

And you should also call rte_eth_dev_release_port in remove ops in case user detach a port directly without closing it first.

This comment also applies your ixgbe fix.

Thanks,
Xiaolong

Quoted 6 lines
drivers/net/i40e/i40e_ethdev.c +0 -0
 }
 
 static struct rte_pci_driver rte_i40e_pmd = {
Signature · 1 line
2.17.1
#11 lore raw

Re: [dpdk-dev] [PATCH v2] net/i40e: fix device hotplug remove

Hi, Xiaolong

About pf and vf for fm10k, e1000, igb, ixgbe, ice, i40e; only i40e pf and ixgbe vf use Rte_eth_dev_destory() in their remove function, others have already use the generic remove function.

I have send another patch about ixgbe because they fix different commits.

Thanks
Di Chenxu

Quoted 63 lines

-----Original Message-----
From: Ye, Xiaolong
Sent: Thursday, November 7, 2019 10:50 AM
To: Di, ChenxuX <[email protected]>
Cc: [email protected]; Lu, Wenzhuo <[email protected]>; Yang, Qiming <[email protected]>; Yigit, Ferruh <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v2] net/i40e: fix device hotplug remove

Quoted 20 lines · Di ChenxuX

testpmd will occur infinite loops when device hotplug remove. We can fix the issue by using the pci generic remove function

Fixes ac89d46096d5 ("net/i40e: release port upon close")

v2:
change the code in driver.
---
drivers/net/i40e/i40e_ethdev.c | 12 +-----------

1 file changed, 1 insertion(+), 11 deletions(-)
(quoted diff) +0 -0

b/drivers/net/i40e/i40e_ethdev.c index 77a46832c..64842867d 100644

drivers/net/i40e/i40e_ethdev.c +0 -0
@@ -694,17 +694,7 @@ eth_i40e_pci_probe(struct rte_pci_driver *pci_drv
 __rte_unused,
 

drivers/net/i40e/i40e_ethdev.c eth_i40e_pci_probe(struct rte_pci_driver *pci_drv · line 705

Quoted 10 lines
drivers/net/i40e/i40e_ethdev.c +0 -9
 static int eth_i40e_pci_remove(struct rte_pci_device *pci_dev)  {
-	struct rte_eth_dev *ethdev;
-
-	ethdev = rte_eth_dev_allocated(pci_dev->device.name);
-	if (!ethdev)
-		return -ENODEV;
-
-
-	if (ethdev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR)
-		return rte_eth_dev_destroy(ethdev,

i40e_vf_representor_uninit);

drivers/net/i40e/i40e_ethdev.c eth_i40e_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, · line 697

Quoted 3 lines
drivers/net/i40e/i40e_ethdev.c +1 -2
-	else
-		return rte_eth_dev_destroy(ethdev, eth_i40e_dev_uninit);
+	return rte_eth_dev_pci_generic_remove(pci_dev, eth_i40e_dev_uninit);

What about i40e_vf_representor_uninit, you also need to take it into consideration.

And you should also call rte_eth_dev_release_port in remove ops in case user detach a port directly without closing it first.

This comment also applies your ixgbe fix.

Thanks,
Xiaolong

Quoted 6 lines
drivers/net/i40e/i40e_ethdev.c +0 -1
 }
 
 static struct rte_pci_driver rte_i40e_pmd = {
--

2.17.1

#12 lore raw

Re: [dpdk-dev] [PATCH v2] net/i40e: fix device hotplug remove

Hi,

Quoted 3 lines · ChenxuX

Hi, Xiaolong

About pf and vf for fm10k, e1000, igb, ixgbe, ice, i40e; only i40e pf and ixgbe vf use

For fm10k, e1000, igb, ice, please check whether they have called rte_eth_dev_release_port in the remove ops.

Quoted 3 lines

Rte_eth_dev_destory() in their remove function, others have already use the generic remove function.

I have send another patch about ixgbe because they fix different commits.

For i40e and ixgbe, please address the comments I raised in previous mail.

Thanks,
Xiaolong

Quoted 67 lines

Thanks
Di Chenxu

Quoted 63 lines

-----Original Message-----
From: Ye, Xiaolong
Sent: Thursday, November 7, 2019 10:50 AM
To: Di, ChenxuX <[email protected]>
Cc: [email protected]; Lu, Wenzhuo <[email protected]>; Yang, Qiming <[email protected]>; Yigit, Ferruh <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v2] net/i40e: fix device hotplug remove

Quoted 20 lines · Di ChenxuX

testpmd will occur infinite loops when device hotplug remove. We can fix the issue by using the pci generic remove function

Fixes ac89d46096d5 ("net/i40e: release port upon close")

v2:
change the code in driver.
---
drivers/net/i40e/i40e_ethdev.c | 12 +-----------

1 file changed, 1 insertion(+), 11 deletions(-)
(quoted diff) +0 -0

b/drivers/net/i40e/i40e_ethdev.c index 77a46832c..64842867d 100644

drivers/net/i40e/i40e_ethdev.c +0 -0
@@ -694,17 +694,7 @@ eth_i40e_pci_probe(struct rte_pci_driver *pci_drv
 __rte_unused,
 

drivers/net/i40e/i40e_ethdev.c eth_i40e_pci_probe(struct rte_pci_driver *pci_drv · line 705

Quoted 10 lines
drivers/net/i40e/i40e_ethdev.c +0 -9
 static int eth_i40e_pci_remove(struct rte_pci_device *pci_dev)  {
-	struct rte_eth_dev *ethdev;
-
-	ethdev = rte_eth_dev_allocated(pci_dev->device.name);
-	if (!ethdev)
-		return -ENODEV;
-
-
-	if (ethdev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR)
-		return rte_eth_dev_destroy(ethdev,

i40e_vf_representor_uninit);

drivers/net/i40e/i40e_ethdev.c eth_i40e_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, · line 697

Quoted 3 lines
drivers/net/i40e/i40e_ethdev.c +1 -2
-	else
-		return rte_eth_dev_destroy(ethdev, eth_i40e_dev_uninit);
+	return rte_eth_dev_pci_generic_remove(pci_dev, eth_i40e_dev_uninit);

What about i40e_vf_representor_uninit, you also need to take it into consideration.

And you should also call rte_eth_dev_release_port in remove ops in case user detach a port directly without closing it first.

This comment also applies your ixgbe fix.

Thanks,
Xiaolong

Quoted 6 lines
drivers/net/i40e/i40e_ethdev.c +0 -1
 }
 
 static struct rte_pci_driver rte_i40e_pmd = {
--

2.17.1

#13 lore raw

Re: [dpdk-dev] [PATCH v2] net/i40e: fix device hotplug remove

Hi,

Quoted 10 lines

-----Original Message-----
From: Ye, Xiaolong
Sent: Thursday, November 7, 2019 11:11 AM
To: Di, ChenxuX <[email protected]>
Cc: [email protected]; Lu, Wenzhuo <[email protected]>; Yang, Qiming <[email protected]>; Yigit, Ferruh <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v2] net/i40e: fix device hotplug remove

Hi,

Quoted 9 lines
Quoted 4 lines · ChenxuX

Hi, Xiaolong

About pf and vf for fm10k, e1000, igb, ixgbe, ice, i40e; only i40e pf and ixgbe vf use

For fm10k, e1000, igb, ice, please check whether they have called rte_eth_dev_release_port in the remove ops.

The function rte_eth_dev_pci_generic_remove will call rte_eth_dev_release_port After the uninit function of drivers.

Quoted 7 lines
Quoted 1 line

Rte_eth_dev_destory() in their remove function, others have already use the

generic remove function.

Quoted 2 lines

I have send another patch about ixgbe because they fix different commits.

For i40e and ixgbe, please address the comments I raised in previous mail.

When app detach a port without a close, it will call the remove function, What will uninit the port and rte_eth_dev_release_port.

Thx
Di Chenxu

Quoted 72 lines

Thanks,
Xiaolong

Quoted 69 lines

Thanks
Di Chenxu

Quoted 65 lines

-----Original Message-----
From: Ye, Xiaolong
Sent: Thursday, November 7, 2019 10:50 AM
To: Di, ChenxuX <[email protected]>
Cc: [email protected]; Lu, Wenzhuo <[email protected]>; Yang, Qiming <[email protected]>; Yigit, Ferruh <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v2] net/i40e: fix device hotplug remove

Quoted 20 lines · Di ChenxuX

testpmd will occur infinite loops when device hotplug remove. We can fix the issue by using the pci generic remove function

Fixes ac89d46096d5 ("net/i40e: release port upon close")

v2:
change the code in driver.
---
drivers/net/i40e/i40e_ethdev.c | 12 +-----------

1 file changed, 1 insertion(+), 11 deletions(-)
(quoted diff) +0 -0

b/drivers/net/i40e/i40e_ethdev.c index 77a46832c..64842867d 100644

drivers/net/i40e/i40e_ethdev.c +0 -0
@@ -694,17 +694,7 @@ eth_i40e_pci_probe(struct rte_pci_driver
 *pci_drv __rte_unused,
 

drivers/net/i40e/i40e_ethdev.c eth_i40e_pci_probe(struct rte_pci_driver · line 705

Quoted 10 lines
drivers/net/i40e/i40e_ethdev.c +0 -9
 static int eth_i40e_pci_remove(struct rte_pci_device *pci_dev)  {
-	struct rte_eth_dev *ethdev;
-
-	ethdev = rte_eth_dev_allocated(pci_dev->device.name);
-	if (!ethdev)
-		return -ENODEV;
-
-
-	if (ethdev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR)
-		return rte_eth_dev_destroy(ethdev,

i40e_vf_representor_uninit);

drivers/net/i40e/i40e_ethdev.c eth_i40e_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,

Quoted 4 lines
drivers/net/i40e/i40e_ethdev.c +2 -2
-	else
-		return rte_eth_dev_destroy(ethdev, eth_i40e_dev_uninit);
+	return rte_eth_dev_pci_generic_remove(pci_dev,
+eth_i40e_dev_uninit);

What about i40e_vf_representor_uninit, you also need to take it into consideration.

And you should also call rte_eth_dev_release_port in remove ops in case user detach a port directly without closing it first.

This comment also applies your ixgbe fix.

Thanks,
Xiaolong

Quoted 6 lines
drivers/net/i40e/i40e_ethdev.c +0 -0
 }
 

static struct rte_pci_driver rte_i40e_pmd = {
--
2.17.1

#14 lore raw

Re: [dpdk-dev] [PATCH v2] net/i40e: fix device hotplug remove

Quoted 18 lines · ChenxuX

Hi,

Quoted 16 lines

-----Original Message-----
From: Ye, Xiaolong
Sent: Thursday, November 7, 2019 11:11 AM
To: Di, ChenxuX <[email protected]>
Cc: [email protected]; Lu, Wenzhuo <[email protected]>; Yang, Qiming <[email protected]>; Yigit, Ferruh <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v2] net/i40e: fix device hotplug remove

Hi,

Quoted 4 lines · ChenxuX

Hi, Xiaolong

About pf and vf for fm10k, e1000, igb, ixgbe, ice, i40e; only i40e pf and ixgbe vf use

Quoted 6 lines
Quoted 3 lines

For fm10k, e1000, igb, ice, please check whether they have called rte_eth_dev_release_port in the remove ops.

The function rte_eth_dev_pci_generic_remove will call rte_eth_dev_release_port After the uninit function of drivers.

Emm, yes, just double checked, rte_eth_dev_pci_generic_remove will call rte_eth_dev_pci_release which finally invokes rte_eth_dev_release_port.

Quoted 11 lines
Quoted 8 lines
Quoted 2 lines

Rte_eth_dev_destory() in their remove function, others have already use the

generic remove function.

Quoted 2 lines

I have send another patch about ixgbe because they fix different commits.

For i40e and ixgbe, please address the comments I raised in previous mail.

When app detach a port without a close, it will call the remove function, What will uninit the port and rte_eth_dev_release_port.

You'll still need to handle i40e_vf_representor_uninit.

Thanks,
Xiaolong

Quoted 76 lines

Thx
Di Chenxu

Quoted 72 lines

Thanks,
Xiaolong

Quoted 69 lines

Thanks
Di Chenxu

Quoted 65 lines

-----Original Message-----
From: Ye, Xiaolong
Sent: Thursday, November 7, 2019 10:50 AM
To: Di, ChenxuX <[email protected]>
Cc: [email protected]; Lu, Wenzhuo <[email protected]>; Yang, Qiming <[email protected]>; Yigit, Ferruh <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v2] net/i40e: fix device hotplug remove

Quoted 20 lines · Di ChenxuX

testpmd will occur infinite loops when device hotplug remove. We can fix the issue by using the pci generic remove function

Fixes ac89d46096d5 ("net/i40e: release port upon close")

v2:
change the code in driver.
---
drivers/net/i40e/i40e_ethdev.c | 12 +-----------

1 file changed, 1 insertion(+), 11 deletions(-)
(quoted diff) +0 -0

b/drivers/net/i40e/i40e_ethdev.c index 77a46832c..64842867d 100644

drivers/net/i40e/i40e_ethdev.c +0 -0
@@ -694,17 +694,7 @@ eth_i40e_pci_probe(struct rte_pci_driver
 *pci_drv __rte_unused,
 

drivers/net/i40e/i40e_ethdev.c eth_i40e_pci_probe(struct rte_pci_driver · line 705

Quoted 10 lines
drivers/net/i40e/i40e_ethdev.c +0 -9
 static int eth_i40e_pci_remove(struct rte_pci_device *pci_dev)  {
-	struct rte_eth_dev *ethdev;
-
-	ethdev = rte_eth_dev_allocated(pci_dev->device.name);
-	if (!ethdev)
-		return -ENODEV;
-
-
-	if (ethdev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR)
-		return rte_eth_dev_destroy(ethdev,

i40e_vf_representor_uninit);

drivers/net/i40e/i40e_ethdev.c eth_i40e_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,

Quoted 4 lines
drivers/net/i40e/i40e_ethdev.c +2 -2
-	else
-		return rte_eth_dev_destroy(ethdev, eth_i40e_dev_uninit);
+	return rte_eth_dev_pci_generic_remove(pci_dev,
+eth_i40e_dev_uninit);

What about i40e_vf_representor_uninit, you also need to take it into consideration.

And you should also call rte_eth_dev_release_port in remove ops in case user detach a port directly without closing it first.

This comment also applies your ixgbe fix.

Thanks,
Xiaolong

Quoted 6 lines
drivers/net/i40e/i40e_ethdev.c +0 -0
 }
 

static struct rte_pci_driver rte_i40e_pmd = {
--
2.17.1

#15 lore raw

Re: [dpdk-dev] [PATCH v2] net/i40e: fix device hotplug remove

Quoted 34 lines

-----Original Message-----
From: Ye, Xiaolong
Sent: Thursday, November 7, 2019 1:46 PM
To: Di, ChenxuX <[email protected]>
Cc: [email protected]; Lu, Wenzhuo <[email protected]>; Yang, Qiming <[email protected]>; Yigit, Ferruh <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v2] net/i40e: fix device hotplug remove

Quoted 23 lines · ChenxuX

Hi,

Quoted 20 lines

-----Original Message-----
From: Ye, Xiaolong
Sent: Thursday, November 7, 2019 11:11 AM
To: Di, ChenxuX <[email protected]>
Cc: [email protected]; Lu, Wenzhuo <[email protected]>; Yang, Qiming <[email protected]>; Yigit, Ferruh <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v2] net/i40e: fix device hotplug remove

Hi,

Quoted 4 lines · ChenxuX

Hi, Xiaolong

About pf and vf for fm10k, e1000, igb, ixgbe, ice, i40e; only i40e pf and ixgbe vf use

For fm10k, e1000, igb, ice, please check whether they have called rte_eth_dev_release_port in the remove ops.

Quoted 6 lines
Quoted 2 lines

The function rte_eth_dev_pci_generic_remove will call rte_eth_dev_release_port After the uninit function of drivers.

Emm, yes, just double checked, rte_eth_dev_pci_generic_remove will call rte_eth_dev_pci_release which finally invokes rte_eth_dev_release_port.

Ok

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines

Rte_eth_dev_destory() in their remove function, others have already use the

generic remove function.

Quoted 2 lines

I have send another patch about ixgbe because they fix different commits.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

For i40e and ixgbe, please address the comments I raised in previous mail.

When app detach a port without a close, it will call the remove function, What will uninit the port and rte_eth_dev_release_port.

You'll still need to handle i40e_vf_representor_uninit.

Ok,I will modify the code and send a new version later.

Quoted 81 lines

Thanks,
Xiaolong

Quoted 53 lines

Thx
Di Chenxu

Quoted 49 lines

Thanks,
Xiaolong

Quoted 46 lines

Thanks
Di Chenxu

Quoted 42 lines

-----Original Message-----
From: Ye, Xiaolong
Sent: Thursday, November 7, 2019 10:50 AM
To: Di, ChenxuX <[email protected]>
Cc: [email protected]; Lu, Wenzhuo <[email protected]>; Yang, Qiming <[email protected]>; Yigit, Ferruh <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v2] net/i40e: fix device hotplug remove

Quoted 21 lines · Di ChenxuX

testpmd will occur infinite loops when device hotplug remove. We can fix the issue by using the pci generic remove function

Fixes ac89d46096d5 ("net/i40e: release port upon close")

v2:
change the code in driver.
---
drivers/net/i40e/i40e_ethdev.c | 12 +-----------

1 file changed, 1 insertion(+), 11 deletions(-)
(quoted diff) +0 -0

b/drivers/net/i40e/i40e_ethdev.c index 77a46832c..64842867d 100644

drivers/net/i40e/i40e_ethdev.c +0 -0
@@ -694,17 +694,7 @@ eth_i40e_pci_probe(struct rte_pci_driver
 *pci_drv __rte_unused,
 

drivers/net/i40e/i40e_ethdev.c eth_i40e_pci_probe(struct rte_pci_driver · line 705

Quoted 10 lines
drivers/net/i40e/i40e_ethdev.c +0 -9
 static int eth_i40e_pci_remove(struct rte_pci_device *pci_dev)  {
-	struct rte_eth_dev *ethdev;
-
-	ethdev = rte_eth_dev_allocated(pci_dev->device.name);
-	if (!ethdev)
-		return -ENODEV;
-
-
-	if (ethdev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR)
-		return rte_eth_dev_destroy(ethdev,

i40e_vf_representor_uninit);

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

drivers/net/i40e/i40e_ethdev.c eth_i40e_pci_probe(struct rte_pci_driver · line 707

Quoted 2 lines
drivers/net/i40e/i40e_ethdev.c +0 -2
-	else
-		return rte_eth_dev_destroy(ethdev,

eth_i40e_dev_uninit);

Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
Quoted 22 lines

drivers/net/i40e/i40e_ethdev.c eth_i40e_pci_probe(struct rte_pci_driver · line 698

Quoted 2 lines
drivers/net/i40e/i40e_ethdev.c +2 -0
+	return rte_eth_dev_pci_generic_remove(pci_dev,
+eth_i40e_dev_uninit);

What about i40e_vf_representor_uninit, you also need to take it into consideration.

And you should also call rte_eth_dev_release_port in remove ops in case user detach a port directly without closing it first.

This comment also applies your ixgbe fix.

Thanks,
Xiaolong

Quoted 6 lines
drivers/net/i40e/i40e_ethdev.c +0 -0
 }
 

static struct rte_pci_driver rte_i40e_pmd = {
--
2.17.1

author
#16 lore raw

PATCH v3 1/1 net/i40e: fix device hotplug remove

In reply to Di ChenxuX

testpmd will occur infinite loops when device hotplug remove. We can fix the issue by using the pci generic remove function

Fixes ac89d46096d5 ("net/i40e: release port upon close")

v3:
reverted the code about i40e_vf_representor_uninit. v2:
change the code in driver.

---
 drivers/net/i40e/i40e_ethdev.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/i40e/i40e_ethdev.c +3 -3
index 77a46832c..d67c08c0f 100644
@@ -698,13 +698,13 @@ static int eth_i40e_pci_remove(struct rte_pci_device *pci_dev)
 
 	ethdev = rte_eth_dev_allocated(pci_dev->device.name);
 	if (!ethdev)
-		return -ENODEV;
-
+		return 0;
 
 	if (ethdev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR)
 		return rte_eth_dev_destroy(ethdev, i40e_vf_representor_uninit);
 	else
-		return rte_eth_dev_destroy(ethdev, eth_i40e_dev_uninit);
+		return rte_eth_dev_pci_generic_remove(pci_dev,
+						eth_i40e_dev_uninit);
 }
 
 static struct rte_pci_driver rte_i40e_pmd = {
Signature · 1 line
2.17.1
#17 lore raw

Re: [dpdk-dev] [PATCH v3] net/i40e: fix device hotplug remove

Quoted 20 lines · Di ChenxuX

testpmd will occur infinite loops when device hotplug remove. We can fix the issue by using the pci generic remove function

Fixes ac89d46096d5 ("net/i40e: release port upon close")

v3:
reverted the code about i40e_vf_representor_uninit. v2:
change the code in driver.
---
drivers/net/i40e/i40e_ethdev.c | 6 +++---

1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/i40e/i40e_ethdev.c +0 -0
index 77a46832c..d67c08c0f 100644

drivers/net/i40e/i40e_ethdev.c static int eth_i40e_pci_remove(struct rte_pci_device *pci_dev) · line 704

Quoted 9 lines
drivers/net/i40e/i40e_ethdev.c +1 -2
@@ -698,13 +698,13 @@ static int eth_i40e_pci_remove(struct rte_pci_device *pci_dev)
 
 	ethdev = rte_eth_dev_allocated(pci_dev->device.name);
 	if (!ethdev)
-		return -ENODEV;
-
+		return 0;
 
 	if (ethdev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR)
 		return rte_eth_dev_destroy(ethdev, i40e_vf_representor_uninit);

Can we use rte_eth_dev_pci_generic_remove for i40e vf representor as well?

Thanks,
Xiaolong

Quoted 10 lines
drivers/net/i40e/i40e_ethdev.c +2 -1
 	else
-		return rte_eth_dev_destroy(ethdev, eth_i40e_dev_uninit);
+		return rte_eth_dev_pci_generic_remove(pci_dev,
+						eth_i40e_dev_uninit);
 }
 
 static struct rte_pci_driver rte_i40e_pmd = {
Signature · 1 line
2.17.1
author
#18 lore raw

PATCH v4 1/1 net/i40e: fix device hotplug remove

In reply to Di ChenxuX

testpmd will occur infinite loops when device hotplug remove. We can fix the issue by using the pci generic remove function

Fixes ac89d46096d5 ("net/i40e: release port upon close")

v4:
used generic remove function for i40e_vf_representor_uninit. v3:
reverted the code about i40e_vf_representor_uninit. v2:
changed the code in driver.

---
 drivers/net/i40e/i40e_ethdev.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/net/i40e/i40e_ethdev.c +5 -4
index 77a46832c..497bc7082 100644
@@ -698,13 +698,14 @@ static int eth_i40e_pci_remove(struct rte_pci_device *pci_dev)
 
 	ethdev = rte_eth_dev_allocated(pci_dev->device.name);
 	if (!ethdev)
-		return -ENODEV;
-
+		return 0;
 
 	if (ethdev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR)
-		return rte_eth_dev_destroy(ethdev, i40e_vf_representor_uninit);
+		return rte_eth_dev_pci_generic_remove(pci_dev,
+					i40e_vf_representor_uninit);
 	else
-		return rte_eth_dev_destroy(ethdev, eth_i40e_dev_uninit);
+		return rte_eth_dev_pci_generic_remove(pci_dev,
+						eth_i40e_dev_uninit);
 }
 
 static struct rte_pci_driver rte_i40e_pmd = {
Signature · 1 line
2.17.1
Acked-by on v4 1/1 Applied
#19 lore raw

Re: [dpdk-dev] [PATCH v4] net/i40e: fix device hotplug remove

Quoted 7 lines · Di ChenxuX

testpmd will occur infinite loops when device hotplug remove. We can fix the issue by using the pci generic remove function

Fixes ac89d46096d5 ("net/i40e: release port upon close")
Quoted 7 lines

v4:
used generic remove function for i40e_vf_representor_uninit. v3:
reverted the code about i40e_vf_representor_uninit. v2:
changed the code in driver.
---

Applied to dpdk-next-net-intel with changelog removed. Thanks.