DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] app/testpmd: fix device hotplug remove
@ 2019-10-24  1:03 Di ChenxuX
  2019-10-24 11:28 ` Iremonger, Bernard
                   ` (3 more replies)
  0 siblings, 4 replies; 20+ messages in thread
From: Di ChenxuX @ 2019-10-24  1:03 UTC (permalink / raw)
  To: dev; +Cc: Wenzhuo Lu, Yang Qiming, Di ChenxuX

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")

Signed-off-by: Di ChenxuX <chenxux.di@intel.com>
---
 app/test-pmd/testpmd.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 5701f3141..a264644a1 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -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);
-- 
2.17.1


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

* Re: [dpdk-dev] [PATCH] app/testpmd: fix device hotplug remove
  2019-10-24  1:03 [dpdk-dev] [PATCH] app/testpmd: fix device hotplug remove Di ChenxuX
@ 2019-10-24 11:28 ` Iremonger, Bernard
  2019-10-24 17:24 ` Ferruh Yigit
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 20+ messages in thread
From: Iremonger, Bernard @ 2019-10-24 11:28 UTC (permalink / raw)
  To: Di, ChenxuX, dev; +Cc: Lu, Wenzhuo, Yang, Qiming, Di, ChenxuX

> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Di ChenxuX
> Sent: Thursday, October 24, 2019 2:03 AM
> To: dev@dpdk.org
> Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Yang, Qiming
> <qiming.yang@intel.com>; Di, ChenxuX <chenxux.di@intel.com>
> Subject: [dpdk-dev] [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")
> 
> Signed-off-by: Di ChenxuX <chenxux.di@intel.com>

Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>


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

* Re: [dpdk-dev] [PATCH] app/testpmd: fix device hotplug remove
  2019-10-24  1:03 [dpdk-dev] [PATCH] app/testpmd: fix device hotplug remove Di ChenxuX
  2019-10-24 11:28 ` Iremonger, Bernard
@ 2019-10-24 17:24 ` Ferruh Yigit
  2019-10-25  1:48   ` Di, ChenxuX
  2019-10-28  5:51 ` Yang, Qiming
  2019-11-06  5:08 ` [dpdk-dev] [PATCH v2] net/i40e: " Di ChenxuX
  3 siblings, 1 reply; 20+ messages in thread
From: Ferruh Yigit @ 2019-10-24 17:24 UTC (permalink / raw)
  To: Di ChenxuX, dev; +Cc: Wenzhuo Lu, Yang Qiming

On 10/24/2019 2:03 AM, Di ChenxuX wrote:
> 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?

> 
> Fixes: ac89d46096d5 ("net/i40e: release port upon close")
> 
> Signed-off-by: Di ChenxuX <chenxux.di@intel.com>
> ---
>  app/test-pmd/testpmd.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
> index 5701f3141..a264644a1 100644
> --- a/app/test-pmd/testpmd.c
> +++ b/app/test-pmd/testpmd.c
> @@ -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);
> 


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

* Re: [dpdk-dev] [PATCH] app/testpmd: fix device hotplug remove
  2019-10-24 17:24 ` Ferruh Yigit
@ 2019-10-25  1:48   ` Di, ChenxuX
  2019-10-27 22:35     ` Thomas Monjalon
  2019-10-29 12:13     ` Ferruh Yigit
  0 siblings, 2 replies; 20+ messages in thread
From: Di, ChenxuX @ 2019-10-25  1:48 UTC (permalink / raw)
  To: Yigit, Ferruh, dev; +Cc: Lu, Wenzhuo, Yang, Qiming

Hi, Ferruh

> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Friday, October 25, 2019 1:24 AM
> To: Di, ChenxuX <chenxux.di@intel.com>; dev@dpdk.org
> Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Yang, Qiming
> <qiming.yang@intel.com>
> Subject: Re: [dpdk-dev] [PATCH] app/testpmd: fix device hotplug remove
> 
> On 10/24/2019 2:03 AM, Di ChenxuX wrote:
> > 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)


> 
> >
> > Fixes: ac89d46096d5 ("net/i40e: release port upon close")
> >
> > Signed-off-by: Di ChenxuX <chenxux.di@intel.com>
> > ---
> >  app/test-pmd/testpmd.c | 1 -
> >  1 file changed, 1 deletion(-)
> >
> > diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index
> > 5701f3141..a264644a1 100644
> > --- a/app/test-pmd/testpmd.c
> > +++ b/app/test-pmd/testpmd.c
> > @@ -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);
> >


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

* Re: [dpdk-dev] [PATCH] app/testpmd: fix device hotplug remove
  2019-10-25  1:48   ` Di, ChenxuX
@ 2019-10-27 22:35     ` Thomas Monjalon
  2019-10-29 12:13     ` Ferruh Yigit
  1 sibling, 0 replies; 20+ messages in thread
From: Thomas Monjalon @ 2019-10-27 22:35 UTC (permalink / raw)
  To: Di, ChenxuX; +Cc: dev, Yigit, Ferruh, Lu, Wenzhuo, Yang, Qiming

25/10/2019 03:48, Di, ChenxuX:
> From: Yigit, Ferruh
> > On 10/24/2019 2:03 AM, Di ChenxuX wrote:
> > > 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)
> 
> 
> > 
> > >
> > > Fixes: ac89d46096d5 ("net/i40e: release port upon close")
> > >
> > > Signed-off-by: Di ChenxuX <chenxux.di@intel.com>
> > > ---
> > >  app/test-pmd/testpmd.c | 1 -
> > >  1 file changed, 1 deletion(-)
> > >
> > > diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index
> > > 5701f3141..a264644a1 100644
> > > --- a/app/test-pmd/testpmd.c
> > > +++ b/app/test-pmd/testpmd.c
> > > @@ -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.



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

* Re: [dpdk-dev] [PATCH] app/testpmd: fix device hotplug remove
  2019-10-24  1:03 [dpdk-dev] [PATCH] app/testpmd: fix device hotplug remove Di ChenxuX
  2019-10-24 11:28 ` Iremonger, Bernard
  2019-10-24 17:24 ` Ferruh Yigit
@ 2019-10-28  5:51 ` Yang, Qiming
  2019-11-05 13:54   ` Ferruh Yigit
  2019-11-06  5:08 ` [dpdk-dev] [PATCH v2] net/i40e: " Di ChenxuX
  3 siblings, 1 reply; 20+ messages in thread
From: Yang, Qiming @ 2019-10-28  5:51 UTC (permalink / raw)
  To: Di, ChenxuX, dev; +Cc: Lu, Wenzhuo

Hi,

> -----Original Message-----
> From: Di, ChenxuX
> Sent: Thursday, October 24, 2019 9:03 AM
> To: dev@dpdk.org
> Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Yang, Qiming
> <qiming.yang@intel.com>; Di, ChenxuX <chenxux.di@intel.com>
> 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")
> 
> Signed-off-by: Di ChenxuX <chenxux.di@intel.com>
> ---
>  app/test-pmd/testpmd.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index
> 5701f3141..a264644a1 100644
> --- a/app/test-pmd/testpmd.c
> +++ b/app/test-pmd/testpmd.c
> @@ -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);
> --
> 2.17.1

NACK, this patch is not acceptable.

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

* Re: [dpdk-dev] [PATCH] app/testpmd: fix device hotplug remove
  2019-10-25  1:48   ` Di, ChenxuX
  2019-10-27 22:35     ` Thomas Monjalon
@ 2019-10-29 12:13     ` Ferruh Yigit
  1 sibling, 0 replies; 20+ messages in thread
From: Ferruh Yigit @ 2019-10-29 12:13 UTC (permalink / raw)
  To: Di, ChenxuX, dev; +Cc: Lu, Wenzhuo, Yang, Qiming, Jeff Guo

On 10/25/2019 2:48 AM, Di, ChenxuX wrote:
> Hi, Ferruh
> 
>> -----Original Message-----
>> From: Yigit, Ferruh
>> Sent: Friday, October 25, 2019 1:24 AM
>> To: Di, ChenxuX <chenxux.di@intel.com>; dev@dpdk.org
>> Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Yang, Qiming
>> <qiming.yang@intel.com>
>> Subject: Re: [dpdk-dev] [PATCH] app/testpmd: fix device hotplug remove
>>
>> On 10/24/2019 2:03 AM, Di ChenxuX wrote:
>>> 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!

'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?

> 	...
> 	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)
> 
> 
>>
>>>
>>> Fixes: ac89d46096d5 ("net/i40e: release port upon close")
>>>
>>> Signed-off-by: Di ChenxuX <chenxux.di@intel.com>
>>> ---
>>>  app/test-pmd/testpmd.c | 1 -
>>>  1 file changed, 1 deletion(-)
>>>
>>> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index
>>> 5701f3141..a264644a1 100644
>>> --- a/app/test-pmd/testpmd.c
>>> +++ b/app/test-pmd/testpmd.c
>>> @@ -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);
>>>
> 


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

* Re: [dpdk-dev] [PATCH] app/testpmd: fix device hotplug remove
  2019-10-28  5:51 ` Yang, Qiming
@ 2019-11-05 13:54   ` Ferruh Yigit
  2019-11-05 23:30     ` Ye Xiaolong
  0 siblings, 1 reply; 20+ messages in thread
From: Ferruh Yigit @ 2019-11-05 13:54 UTC (permalink / raw)
  To: Yang, Qiming, Di, ChenxuX, dev; +Cc: Lu, Wenzhuo

On 10/28/2019 5:51 AM, Yang, Qiming wrote:
> Hi,
> 
>> -----Original Message-----
>> From: Di, ChenxuX
>> Sent: Thursday, October 24, 2019 9:03 AM
>> To: dev@dpdk.org
>> Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Yang, Qiming
>> <qiming.yang@intel.com>; Di, ChenxuX <chenxux.di@intel.com>
>> 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")
>>
>> Signed-off-by: Di ChenxuX <chenxux.di@intel.com>
>> ---
>>  app/test-pmd/testpmd.c | 1 -
>>  1 file changed, 1 deletion(-)
>>
>> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index
>> 5701f3141..a264644a1 100644
>> --- a/app/test-pmd/testpmd.c
>> +++ b/app/test-pmd/testpmd.c
>> @@ -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);
>> --
>> 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

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

* Re: [dpdk-dev] [PATCH] app/testpmd: fix device hotplug remove
  2019-11-05 13:54   ` Ferruh Yigit
@ 2019-11-05 23:30     ` Ye Xiaolong
  0 siblings, 0 replies; 20+ messages in thread
From: Ye Xiaolong @ 2019-11-05 23:30 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: Yang, Qiming, Di, ChenxuX, dev, Lu, Wenzhuo

Hi, Ferruh

On 11/05, Ferruh Yigit wrote:
>On 10/28/2019 5:51 AM, Yang, Qiming wrote:
>> Hi,
>> 
>>> -----Original Message-----
>>> From: Di, ChenxuX
>>> Sent: Thursday, October 24, 2019 9:03 AM
>>> To: dev@dpdk.org
>>> Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Yang, Qiming
>>> <qiming.yang@intel.com>; Di, ChenxuX <chenxux.di@intel.com>
>>> 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")
>>>
>>> Signed-off-by: Di ChenxuX <chenxux.di@intel.com>
>>> ---
>>>  app/test-pmd/testpmd.c | 1 -
>>>  1 file changed, 1 deletion(-)
>>>
>>> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index
>>> 5701f3141..a264644a1 100644
>>> --- a/app/test-pmd/testpmd.c
>>> +++ b/app/test-pmd/testpmd.c
>>> @@ -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);
>>> --
>>> 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?

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

>
>Thanks,
>ferruh

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

* [dpdk-dev] [PATCH v2] net/i40e: fix device hotplug remove
  2019-10-24  1:03 [dpdk-dev] [PATCH] app/testpmd: fix device hotplug remove Di ChenxuX
                   ` (2 preceding siblings ...)
  2019-10-28  5:51 ` Yang, Qiming
@ 2019-11-06  5:08 ` Di ChenxuX
  2019-11-07  2:50   ` Ye Xiaolong
  2019-11-07  6:23   ` [dpdk-dev] [PATCH v3] " Di ChenxuX
  3 siblings, 2 replies; 20+ messages in thread
From: Di ChenxuX @ 2019-11-06  5:08 UTC (permalink / raw)
  To: dev; +Cc: Wenzhuo Lu, Yang Qiming, ferruh.yigit, 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")

Signed-off-by: Di ChenxuX <chenxux.di@intel.com>

v2:
change the code in driver.
---
 drivers/net/i40e/i40e_ethdev.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 77a46832c..64842867d 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -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 = {
-- 
2.17.1


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

* Re: [dpdk-dev] [PATCH v2] net/i40e: fix device hotplug remove
  2019-11-06  5:08 ` [dpdk-dev] [PATCH v2] net/i40e: " Di ChenxuX
@ 2019-11-07  2:50   ` Ye Xiaolong
  2019-11-07  3:00     ` Di, ChenxuX
  2019-11-07  6:23   ` [dpdk-dev] [PATCH v3] " Di ChenxuX
  1 sibling, 1 reply; 20+ messages in thread
From: Ye Xiaolong @ 2019-11-07  2:50 UTC (permalink / raw)
  To: Di ChenxuX; +Cc: dev, Wenzhuo Lu, Yang Qiming, ferruh.yigit

On 11/06, Di ChenxuX wrote:
>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")
>
>Signed-off-by: Di ChenxuX <chenxux.di@intel.com>
>
>v2:
>change the code in driver.
>---
> drivers/net/i40e/i40e_ethdev.c | 12 +-----------
> 1 file changed, 1 insertion(+), 11 deletions(-)
>
>diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
>index 77a46832c..64842867d 100644
>--- a/drivers/net/i40e/i40e_ethdev.c
>+++ b/drivers/net/i40e/i40e_ethdev.c
>@@ -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);

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


> }
> 
> static struct rte_pci_driver rte_i40e_pmd = {
>-- 
>2.17.1
>

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

* Re: [dpdk-dev] [PATCH v2] net/i40e: fix device hotplug remove
  2019-11-07  2:50   ` Ye Xiaolong
@ 2019-11-07  3:00     ` Di, ChenxuX
  2019-11-07  3:11       ` Ye Xiaolong
  0 siblings, 1 reply; 20+ messages in thread
From: Di, ChenxuX @ 2019-11-07  3:00 UTC (permalink / raw)
  To: Ye, Xiaolong; +Cc: dev, Lu, Wenzhuo, Yang, Qiming, Yigit, Ferruh

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 

> -----Original Message-----
> From: Ye, Xiaolong
> Sent: Thursday, November 7, 2019 10:50 AM
> To: Di, ChenxuX <chenxux.di@intel.com>
> Cc: dev@dpdk.org; Lu, Wenzhuo <wenzhuo.lu@intel.com>; Yang, Qiming
> <qiming.yang@intel.com>; Yigit, Ferruh <ferruh.yigit@intel.com>
> Subject: Re: [dpdk-dev] [PATCH v2] net/i40e: fix device hotplug remove
> 
> On 11/06, Di ChenxuX wrote:
> >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")
> >
> >Signed-off-by: Di ChenxuX <chenxux.di@intel.com>
> >
> >v2:
> >change the code in driver.
> >---
> > drivers/net/i40e/i40e_ethdev.c | 12 +-----------
> > 1 file changed, 1 insertion(+), 11 deletions(-)
> >
> >diff --git a/drivers/net/i40e/i40e_ethdev.c
> >b/drivers/net/i40e/i40e_ethdev.c index 77a46832c..64842867d 100644
> >--- a/drivers/net/i40e/i40e_ethdev.c
> >+++ b/drivers/net/i40e/i40e_ethdev.c
> >@@ -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);
> 
> 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
> 
> 
> > }
> >
> > static struct rte_pci_driver rte_i40e_pmd = {
> >--
> >2.17.1
> >

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

* Re: [dpdk-dev] [PATCH v2] net/i40e: fix device hotplug remove
  2019-11-07  3:00     ` Di, ChenxuX
@ 2019-11-07  3:11       ` Ye Xiaolong
  2019-11-07  5:45         ` Di, ChenxuX
  0 siblings, 1 reply; 20+ messages in thread
From: Ye Xiaolong @ 2019-11-07  3:11 UTC (permalink / raw)
  To: Di, ChenxuX; +Cc: dev, Lu, Wenzhuo, Yang, Qiming, Yigit, Ferruh

Hi,

On 11/07, Di, ChenxuX wrote:
>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.

>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

>
>Thanks
>Di Chenxu 
>
>> -----Original Message-----
>> From: Ye, Xiaolong
>> Sent: Thursday, November 7, 2019 10:50 AM
>> To: Di, ChenxuX <chenxux.di@intel.com>
>> Cc: dev@dpdk.org; Lu, Wenzhuo <wenzhuo.lu@intel.com>; Yang, Qiming
>> <qiming.yang@intel.com>; Yigit, Ferruh <ferruh.yigit@intel.com>
>> Subject: Re: [dpdk-dev] [PATCH v2] net/i40e: fix device hotplug remove
>> 
>> On 11/06, Di ChenxuX wrote:
>> >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")
>> >
>> >Signed-off-by: Di ChenxuX <chenxux.di@intel.com>
>> >
>> >v2:
>> >change the code in driver.
>> >---
>> > drivers/net/i40e/i40e_ethdev.c | 12 +-----------
>> > 1 file changed, 1 insertion(+), 11 deletions(-)
>> >
>> >diff --git a/drivers/net/i40e/i40e_ethdev.c
>> >b/drivers/net/i40e/i40e_ethdev.c index 77a46832c..64842867d 100644
>> >--- a/drivers/net/i40e/i40e_ethdev.c
>> >+++ b/drivers/net/i40e/i40e_ethdev.c
>> >@@ -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);
>> 
>> 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
>> 
>> 
>> > }
>> >
>> > static struct rte_pci_driver rte_i40e_pmd = {
>> >--
>> >2.17.1
>> >

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

* Re: [dpdk-dev] [PATCH v2] net/i40e: fix device hotplug remove
  2019-11-07  3:11       ` Ye Xiaolong
@ 2019-11-07  5:45         ` Di, ChenxuX
  2019-11-07  5:45           ` Ye Xiaolong
  0 siblings, 1 reply; 20+ messages in thread
From: Di, ChenxuX @ 2019-11-07  5:45 UTC (permalink / raw)
  To: Ye, Xiaolong; +Cc: dev, Lu, Wenzhuo, Yang, Qiming, Yigit, Ferruh

Hi,

> -----Original Message-----
> From: Ye, Xiaolong
> Sent: Thursday, November 7, 2019 11:11 AM
> To: Di, ChenxuX <chenxux.di@intel.com>
> Cc: dev@dpdk.org; Lu, Wenzhuo <wenzhuo.lu@intel.com>; Yang, Qiming
> <qiming.yang@intel.com>; Yigit, Ferruh <ferruh.yigit@intel.com>
> Subject: Re: [dpdk-dev] [PATCH v2] net/i40e: fix device hotplug remove
> 
> Hi,
> 
> On 11/07, Di, ChenxuX wrote:
> >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.

> >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.
> 

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

> Thanks,
> Xiaolong
> 
> >
> >Thanks
> >Di Chenxu
> >
> >> -----Original Message-----
> >> From: Ye, Xiaolong
> >> Sent: Thursday, November 7, 2019 10:50 AM
> >> To: Di, ChenxuX <chenxux.di@intel.com>
> >> Cc: dev@dpdk.org; Lu, Wenzhuo <wenzhuo.lu@intel.com>; Yang, Qiming
> >> <qiming.yang@intel.com>; Yigit, Ferruh <ferruh.yigit@intel.com>
> >> Subject: Re: [dpdk-dev] [PATCH v2] net/i40e: fix device hotplug
> >> remove
> >>
> >> On 11/06, Di ChenxuX wrote:
> >> >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")
> >> >
> >> >Signed-off-by: Di ChenxuX <chenxux.di@intel.com>
> >> >
> >> >v2:
> >> >change the code in driver.
> >> >---
> >> > drivers/net/i40e/i40e_ethdev.c | 12 +-----------
> >> > 1 file changed, 1 insertion(+), 11 deletions(-)
> >> >
> >> >diff --git a/drivers/net/i40e/i40e_ethdev.c
> >> >b/drivers/net/i40e/i40e_ethdev.c index 77a46832c..64842867d 100644
> >> >--- a/drivers/net/i40e/i40e_ethdev.c
> >> >+++ b/drivers/net/i40e/i40e_ethdev.c
> >> >@@ -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);
> >>
> >> 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
> >>
> >>
> >> > }
> >> >
> >> > static struct rte_pci_driver rte_i40e_pmd = {
> >> >--
> >> >2.17.1
> >> >

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

* Re: [dpdk-dev] [PATCH v2] net/i40e: fix device hotplug remove
  2019-11-07  5:45         ` Di, ChenxuX
@ 2019-11-07  5:45           ` Ye Xiaolong
  2019-11-07  6:02             ` Di, ChenxuX
  0 siblings, 1 reply; 20+ messages in thread
From: Ye Xiaolong @ 2019-11-07  5:45 UTC (permalink / raw)
  To: Di, ChenxuX; +Cc: dev, Lu, Wenzhuo, Yang, Qiming, Yigit, Ferruh

On 11/07, Di, ChenxuX wrote:
>Hi,
>
>> -----Original Message-----
>> From: Ye, Xiaolong
>> Sent: Thursday, November 7, 2019 11:11 AM
>> To: Di, ChenxuX <chenxux.di@intel.com>
>> Cc: dev@dpdk.org; Lu, Wenzhuo <wenzhuo.lu@intel.com>; Yang, Qiming
>> <qiming.yang@intel.com>; Yigit, Ferruh <ferruh.yigit@intel.com>
>> Subject: Re: [dpdk-dev] [PATCH v2] net/i40e: fix device hotplug remove
>> 
>> Hi,
>> 
>> On 11/07, Di, ChenxuX wrote:
>> >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.

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.

>
>> >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.
>> 
>
>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
>
>Thx
>Di Chenxu
>
>> Thanks,
>> Xiaolong
>> 
>> >
>> >Thanks
>> >Di Chenxu
>> >
>> >> -----Original Message-----
>> >> From: Ye, Xiaolong
>> >> Sent: Thursday, November 7, 2019 10:50 AM
>> >> To: Di, ChenxuX <chenxux.di@intel.com>
>> >> Cc: dev@dpdk.org; Lu, Wenzhuo <wenzhuo.lu@intel.com>; Yang, Qiming
>> >> <qiming.yang@intel.com>; Yigit, Ferruh <ferruh.yigit@intel.com>
>> >> Subject: Re: [dpdk-dev] [PATCH v2] net/i40e: fix device hotplug
>> >> remove
>> >>
>> >> On 11/06, Di ChenxuX wrote:
>> >> >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")
>> >> >
>> >> >Signed-off-by: Di ChenxuX <chenxux.di@intel.com>
>> >> >
>> >> >v2:
>> >> >change the code in driver.
>> >> >---
>> >> > drivers/net/i40e/i40e_ethdev.c | 12 +-----------
>> >> > 1 file changed, 1 insertion(+), 11 deletions(-)
>> >> >
>> >> >diff --git a/drivers/net/i40e/i40e_ethdev.c
>> >> >b/drivers/net/i40e/i40e_ethdev.c index 77a46832c..64842867d 100644
>> >> >--- a/drivers/net/i40e/i40e_ethdev.c
>> >> >+++ b/drivers/net/i40e/i40e_ethdev.c
>> >> >@@ -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);
>> >>
>> >> 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
>> >>
>> >>
>> >> > }
>> >> >
>> >> > static struct rte_pci_driver rte_i40e_pmd = {
>> >> >--
>> >> >2.17.1
>> >> >

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

* Re: [dpdk-dev] [PATCH v2] net/i40e: fix device hotplug remove
  2019-11-07  5:45           ` Ye Xiaolong
@ 2019-11-07  6:02             ` Di, ChenxuX
  0 siblings, 0 replies; 20+ messages in thread
From: Di, ChenxuX @ 2019-11-07  6:02 UTC (permalink / raw)
  To: Ye, Xiaolong; +Cc: dev, Lu, Wenzhuo, Yang, Qiming, Yigit, Ferruh



> -----Original Message-----
> From: Ye, Xiaolong
> Sent: Thursday, November 7, 2019 1:46 PM
> To: Di, ChenxuX <chenxux.di@intel.com>
> Cc: dev@dpdk.org; Lu, Wenzhuo <wenzhuo.lu@intel.com>; Yang, Qiming
> <qiming.yang@intel.com>; Yigit, Ferruh <ferruh.yigit@intel.com>
> Subject: Re: [dpdk-dev] [PATCH v2] net/i40e: fix device hotplug remove
> 
> On 11/07, Di, ChenxuX wrote:
> >Hi,
> >
> >> -----Original Message-----
> >> From: Ye, Xiaolong
> >> Sent: Thursday, November 7, 2019 11:11 AM
> >> To: Di, ChenxuX <chenxux.di@intel.com>
> >> Cc: dev@dpdk.org; Lu, Wenzhuo <wenzhuo.lu@intel.com>; Yang, Qiming
> >> <qiming.yang@intel.com>; Yigit, Ferruh <ferruh.yigit@intel.com>
> >> Subject: Re: [dpdk-dev] [PATCH v2] net/i40e: fix device hotplug
> >> remove
> >>
> >> Hi,
> >>
> >> On 11/07, Di, ChenxuX wrote:
> >> >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.
> 
> 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

> >
> >> >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.
> >>
> >
> >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.

> 
> Thanks,
> Xiaolong
> >
> >Thx
> >Di Chenxu
> >
> >> Thanks,
> >> Xiaolong
> >>
> >> >
> >> >Thanks
> >> >Di Chenxu
> >> >
> >> >> -----Original Message-----
> >> >> From: Ye, Xiaolong
> >> >> Sent: Thursday, November 7, 2019 10:50 AM
> >> >> To: Di, ChenxuX <chenxux.di@intel.com>
> >> >> Cc: dev@dpdk.org; Lu, Wenzhuo <wenzhuo.lu@intel.com>; Yang, Qiming
> >> >> <qiming.yang@intel.com>; Yigit, Ferruh <ferruh.yigit@intel.com>
> >> >> Subject: Re: [dpdk-dev] [PATCH v2] net/i40e: fix device hotplug
> >> >> remove
> >> >>
> >> >> On 11/06, Di ChenxuX wrote:
> >> >> >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")
> >> >> >
> >> >> >Signed-off-by: Di ChenxuX <chenxux.di@intel.com>
> >> >> >
> >> >> >v2:
> >> >> >change the code in driver.
> >> >> >---
> >> >> > drivers/net/i40e/i40e_ethdev.c | 12 +-----------
> >> >> > 1 file changed, 1 insertion(+), 11 deletions(-)
> >> >> >
> >> >> >diff --git a/drivers/net/i40e/i40e_ethdev.c
> >> >> >b/drivers/net/i40e/i40e_ethdev.c index 77a46832c..64842867d
> >> >> >100644
> >> >> >--- a/drivers/net/i40e/i40e_ethdev.c
> >> >> >+++ b/drivers/net/i40e/i40e_ethdev.c
> >> >> >@@ -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);
> >> >>
> >> >> 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
> >> >>
> >> >>
> >> >> > }
> >> >> >
> >> >> > static struct rte_pci_driver rte_i40e_pmd = {
> >> >> >--
> >> >> >2.17.1
> >> >> >

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

* [dpdk-dev] [PATCH v3] net/i40e: fix device hotplug remove
  2019-11-06  5:08 ` [dpdk-dev] [PATCH v2] net/i40e: " Di ChenxuX
  2019-11-07  2:50   ` Ye Xiaolong
@ 2019-11-07  6:23   ` Di ChenxuX
  2019-11-11  8:42     ` Ye Xiaolong
  2019-11-12  5:56     ` [dpdk-dev] [PATCH v4] " Di ChenxuX
  1 sibling, 2 replies; 20+ messages in thread
From: Di ChenxuX @ 2019-11-07  6:23 UTC (permalink / raw)
  To: dev; +Cc: Yang Qiming, 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")

Signed-off-by: Di ChenxuX <chenxux.di@intel.com>

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(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 77a46832c..d67c08c0f 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -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 = {
-- 
2.17.1


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

* Re: [dpdk-dev] [PATCH v3] net/i40e: fix device hotplug remove
  2019-11-07  6:23   ` [dpdk-dev] [PATCH v3] " Di ChenxuX
@ 2019-11-11  8:42     ` Ye Xiaolong
  2019-11-12  5:56     ` [dpdk-dev] [PATCH v4] " Di ChenxuX
  1 sibling, 0 replies; 20+ messages in thread
From: Ye Xiaolong @ 2019-11-11  8:42 UTC (permalink / raw)
  To: Di ChenxuX; +Cc: dev, Yang Qiming

On 11/07, Di ChenxuX wrote:
>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")
>
>Signed-off-by: Di ChenxuX <chenxux.di@intel.com>
>
>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(-)
>
>diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
>index 77a46832c..d67c08c0f 100644
>--- a/drivers/net/i40e/i40e_ethdev.c
>+++ b/drivers/net/i40e/i40e_ethdev.c
>@@ -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
> 	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 = {
>-- 
>2.17.1
>

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

* [dpdk-dev] [PATCH v4] net/i40e: fix device hotplug remove
  2019-11-07  6:23   ` [dpdk-dev] [PATCH v3] " Di ChenxuX
  2019-11-11  8:42     ` Ye Xiaolong
@ 2019-11-12  5:56     ` Di ChenxuX
  2019-11-13  2:11       ` Ye Xiaolong
  1 sibling, 1 reply; 20+ messages in thread
From: Di ChenxuX @ 2019-11-12  5:56 UTC (permalink / raw)
  To: dev; +Cc: Yang Qiming, 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")

Signed-off-by: Di ChenxuX <chenxux.di@intel.com>

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(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 77a46832c..497bc7082 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -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 = {
-- 
2.17.1


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

* Re: [dpdk-dev] [PATCH v4] net/i40e: fix device hotplug remove
  2019-11-12  5:56     ` [dpdk-dev] [PATCH v4] " Di ChenxuX
@ 2019-11-13  2:11       ` Ye Xiaolong
  0 siblings, 0 replies; 20+ messages in thread
From: Ye Xiaolong @ 2019-11-13  2:11 UTC (permalink / raw)
  To: Di ChenxuX; +Cc: dev, Yang Qiming

On 11/12, Di ChenxuX wrote:
>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")
>
>Signed-off-by: Di ChenxuX <chenxux.di@intel.com>
>
>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.
>---

Acked-by: Xiaolong Ye <xiaolong.ye@intel.com>

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

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

end of thread, other threads:[~2019-11-13  2:15 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-24  1:03 [dpdk-dev] [PATCH] app/testpmd: fix device hotplug remove Di ChenxuX
2019-10-24 11:28 ` Iremonger, Bernard
2019-10-24 17:24 ` Ferruh Yigit
2019-10-25  1:48   ` Di, ChenxuX
2019-10-27 22:35     ` Thomas Monjalon
2019-10-29 12:13     ` Ferruh Yigit
2019-10-28  5:51 ` Yang, Qiming
2019-11-05 13:54   ` Ferruh Yigit
2019-11-05 23:30     ` Ye Xiaolong
2019-11-06  5:08 ` [dpdk-dev] [PATCH v2] net/i40e: " Di ChenxuX
2019-11-07  2:50   ` Ye Xiaolong
2019-11-07  3:00     ` Di, ChenxuX
2019-11-07  3:11       ` Ye Xiaolong
2019-11-07  5:45         ` Di, ChenxuX
2019-11-07  5:45           ` Ye Xiaolong
2019-11-07  6:02             ` Di, ChenxuX
2019-11-07  6:23   ` [dpdk-dev] [PATCH v3] " Di ChenxuX
2019-11-11  8:42     ` Ye Xiaolong
2019-11-12  5:56     ` [dpdk-dev] [PATCH v4] " Di ChenxuX
2019-11-13  2:11       ` Ye Xiaolong

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