DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] dpdk-devbind can't be used misc with kernel tools
@ 2017-04-26  6:19 Tu, LijuanX A
  2017-04-26  9:26 ` Prathyusha, Guduri
  0 siblings, 1 reply; 5+ messages in thread
From: Tu, LijuanX A @ 2017-04-26  6:19 UTC (permalink / raw)
  To: gprathyusha
  Cc: dev, Chen, WeichunX, Liu, Yu Y, Xu, Qian Q, Liu, Yong, Lu, PeipeiX

Hi Guduri,

I am a tester from intel dpdk team. I get a issues on usertools/dpdk-devbind.py

With the usertools/dpdk-devbind.py , I can't bind driver as expect.

I use the "dpdk-devbind.py" bind pci to igb_uio, then I using kernel tools  bind pci  to ixgbe,
I can bind pci to igb_uio successfully ,but it  bind back to ixgbe failed..

Bind pci to igb_uio and then  bind to ixgbe ,both use "dpdk-devbind.py", it works well.

Could you . have a look at this as soon as possible ,it block the daily regression test.
Thank you very much.


There are my test env and steps:

dpdk commit eba33e87ad37626604be7186e746751f99691084
Components: usertools/dpdk-devbind.py
kernel: 4.8.6-300.fc25.x86_64
driver: ixgbe
version: 5.0.4
firmware-version: 0x61bf0001
Expect: we can use dpdk-devbind.py to bind or unbind PCI-device, we also can use kernel tools to bind or unbind PCI-device, such as :
steps:
# ./dpdk-devbind.py --bind=igb_uio 0000:05:00.0
status:
0000:05:00.0 '82599ES 10-Gigabit SFI/SFP+ Network Connection 10fb' drv=igb_uio unused=

# echo "8086 10fd" >/sys/bus/pci/drivers/ixgbe/new_id
# echo "0000:05:00.0" >/sys/bus/pci/devices/0000\:05\:00.0/driver/unbind
# echo "0000:05:00.0" >/sys/bus/pci/drivers/ixgbe/
# echo "0000:05:00.0" >/sys/bus/pci/drivers/ixgbe/bind
-bash: echo: write error: No such device
status
0000:05:00.0 '82599ES 10-Gigabit SFI/SFP+ Network Connection' unused=ixgbe,igb_uio
Result:
It can't bind to ixgbe, expect it can bind to ixgbe.
I think the related commit are ::
commit 2fc3502935700243d9a6d903166e6fd11e429843
Author: Guduri Prathyusha <gprathyusha@caviumnetworks.com>
Date:   Wed Mar 22 19:41:29 2017 +0530
usertools: use optimized driver override scheme to bind

commit c3ce205d5729867bd1c4c4429a80e01a528d5905
Author: Guduri Prathyusha <gprathyusha@caviumnetworks.com>
Date:   Wed Mar 22 19:41:28 2017 +0530
    usertools: optimize lspci invocation

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

* Re: [dpdk-dev] dpdk-devbind can't be used misc with kernel tools
  2017-04-26  6:19 [dpdk-dev] dpdk-devbind can't be used misc with kernel tools Tu, LijuanX A
@ 2017-04-26  9:26 ` Prathyusha, Guduri
  2017-04-27  6:42   ` Tu, LijuanX A
  2017-04-27  7:16   ` Tu, LijuanX A
  0 siblings, 2 replies; 5+ messages in thread
From: Prathyusha, Guduri @ 2017-04-26  9:26 UTC (permalink / raw)
  To: Tu, LijuanX A
  Cc: dev, Chen, WeichunX, Liu, Yu Y, Xu, Qian Q, Liu, Yong, Lu, PeipeiX


Hi LijuanX A

Response inline...

Kindly apply the patch below (inline) and let me know the result. I will submit a formal patch once you confirm.

Thanks,
Prathyusha




From: Tu, LijuanX A <lijuanx.a.tu@intel.com>
Sent: Wednesday, April 26, 2017 11:49 AM
To: Prathyusha, Guduri
Cc: dev@dpdk.org; Chen, WeichunX; Liu, Yu Y; Xu, Qian Q; Liu, Yong; Lu, PeipeiX
Subject: dpdk-devbind can't be used misc with kernel tools
  

Hi Guduri,
 
I am a tester from intel dpdk team. I get a issues on usertools/dpdk-devbind.py
 
With the usertools/dpdk-devbind.py , I can’t bind driver as expect.
 
I use the “dpdk-devbind.py” bind pci to igb_uio, then I using kernel tools  bind pci  to ixgbe,
I can bind pci to igb_uio successfully ,but it  bind back to ixgbe failed..

/sys/bus/pci/devices/xxxxxx/driver_override is used to bind and unbind devices to drivers in kernels  >= 3.15
driver_override must be written to null for a device to bind to a driver. In the current script, null is written before unbinding a device.
Hence when you bind a device using script and unbind using kernel tools (/sys/bus/pci/drivers/xx/new_id, >>/sys/bus/pci/devices/xx/driver/unbind, /sys/bus/pci/drivers/xx/bind), driver_override is still set to the previous driver.
To avoid this, writing null to driver_override after binding a device to a driver. This will let the kernel tools unbind after binding using the dpdk script.
 
Bind pci to igb_uio and then  bind to ixgbe ,both use “dpdk-devbind.py”, it works well.
 
Could you . have a look at this as soon as possible ,it block the daily regression test.
Thank you very much.

Here is the patch to be applied 

diff --git a/usertools/dpdk-devbind.py b/usertools/dpdk-devbind.py              
index bb4d536e0..1dc1065b1 100755                                               
--- a/usertools/dpdk-devbind.py                                                 
+++ b/usertools/dpdk-devbind.py                                                 
@@ -386,25 +386,6 @@ def unbind_one(dev_id, force):                             
               "Skipping unbind" % (dev_id))                                    
         return                                                                 
                                                                                
-    # For kernels > 3.15 driver_override is used to bind a device to a driver. 
-    # Before unbinding it, overwrite driver_override with empty string so that 
-    # the device can be bound to any other driver                              
-    filename = "/sys/bus/pci/devices/%s/driver_override" % dev_id              
-    if os.path.exists(filename):                                               
-        try:                                                                   
-            f = open(filename, "w")                                            
-        except:                                                                
-            print("Error: unbind failed for %s - Cannot open %s"               
-                  % (dev_id, filename))                                        
-            sys.exit(1)                                                        
-        try:                                                                   
-            f.write("\00")                                                     
-            f.close()                                                          
-        except:                                                                
-            print("Error: unbind failed for %s - Cannot open %s"               
-                  % (dev_id, filename))                                        
-            sys.exit(1)                                                        
-                                                                               
     # write to /sys to unbind                                                  
     filename = "/sys/bus/pci/drivers/%s/unbind" % dev["Driver_str"]            
     try:                                                                       
@@ -507,6 +488,25 @@ def bind_one(dev_id, driver, force):                       
             bind_one(dev_id, saved_driver, force)                              
         return                                                                 
                                                                                
+    # For kernels > 3.15 driver_override is used to bind a device to a driver. 
+    # Before unbinding it, overwrite driver_override with empty string so that 
+    # the device can be bound to any other driver                              
+    filename = "/sys/bus/pci/devices/%s/driver_override" % dev_id              
+    if os.path.exists(filename):                                               
+        try:                                                                   
+            f = open(filename, "w")                                            
+        except:                                                                
+            print("Error: unbind failed for %s - Cannot open %s"               
+                  % (dev_id, filename))                                        
+            sys.exit(1)                                                        
+        try:                                                                   
+            f.write("\00")                                                     
+            f.close()                                                          
+        except:                                                                
+            print("Error: unbind failed for %s - Cannot open %s"               
+                  % (dev_id, filename))                                        
+            sys.exit(1)                                                        
+                                                                               
                                                                                
 def unbind_all(dev_list, force=False):  
     """Unbind method, takes a list of device locations"""
 
 
There are my test env and steps: 
 
dpdk commit eba33e87ad37626604be7186e746751f99691084
Components: usertools/dpdk-devbind.py
kernel: 4.8.6-300.fc25.x86_64
driver: ixgbe
version: 5.0.4
firmware-version: 0x61bf0001
Expect: we can use dpdk-devbind.py to bind or unbind PCI-device, we also can use kernel tools to bind or unbind PCI-device, such as :
steps:
# ./dpdk-devbind.py --bind=igb_uio 0000:05:00.0
status:
0000:05:00.0 '82599ES 10-Gigabit SFI/SFP+ Network Connection 10fb' drv=igb_uio unused=
 
# echo "8086 10fd" >/sys/bus/pci/drivers/ixgbe/new_id
# echo "0000:05:00.0" >/sys/bus/pci/devices/0000\:05\:00.0/driver/unbind
# echo "0000:05:00.0" >/sys/bus/pci/drivers/ixgbe/
# echo "0000:05:00.0" >/sys/bus/pci/drivers/ixgbe/bind
-bash: echo: write error: No such device
status
0000:05:00.0 '82599ES 10-Gigabit SFI/SFP+ Network Connection' unused=ixgbe,igb_uio
Result:
It can't bind to ixgbe, expect it can bind to ixgbe.
I think the related commit are ::
commit 2fc3502935700243d9a6d903166e6fd11e429843
Author: Guduri Prathyusha <gprathyusha@caviumnetworks.com>
Date:   Wed Mar 22 19:41:29 2017 +0530
usertools: use optimized driver override scheme to bind
 
commit c3ce205d5729867bd1c4c4429a80e01a528d5905
Author: Guduri Prathyusha <gprathyusha@caviumnetworks.com>
Date:   Wed Mar 22 19:41:28 2017 +0530
    usertools: optimize lspci invocation
 
   

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

* Re: [dpdk-dev] dpdk-devbind can't be used misc with kernel tools
  2017-04-26  9:26 ` Prathyusha, Guduri
@ 2017-04-27  6:42   ` Tu, LijuanX A
  2017-04-27  7:16   ` Tu, LijuanX A
  1 sibling, 0 replies; 5+ messages in thread
From: Tu, LijuanX A @ 2017-04-27  6:42 UTC (permalink / raw)
  To: Prathyusha, Guduri
  Cc: dev, Chen, WeichunX, Liu, Yu Y, Xu, Qian Q, Liu, Yong, Lu, PeipeiX

Hi Prathyusha,

The path is OK ,I have verified it.

-----Original Message-----
From: Prathyusha, Guduri [mailto:Guduri.Prathyusha@cavium.com] 
Sent: Wednesday, April 26, 2017 5:26 PM
To: Tu, LijuanX A
Cc: dev@dpdk.org; Chen, WeichunX; Liu, Yu Y; Xu, Qian Q; Liu, Yong; Lu, PeipeiX
Subject: Re: dpdk-devbind can't be used misc with kernel tools


Hi LijuanX A

Response inline...

Kindly apply the patch below (inline) and let me know the result. I will submit a formal patch once you confirm.

Thanks,
Prathyusha




From: Tu, LijuanX A <lijuanx.a.tu@intel.com>
Sent: Wednesday, April 26, 2017 11:49 AM
To: Prathyusha, Guduri
Cc: dev@dpdk.org; Chen, WeichunX; Liu, Yu Y; Xu, Qian Q; Liu, Yong; Lu, PeipeiX
Subject: dpdk-devbind can't be used misc with kernel tools
  

Hi Guduri,
 
I am a tester from intel dpdk team. I get a issues on usertools/dpdk-devbind.py
 
With the usertools/dpdk-devbind.py , I can't bind driver as expect.
 
I use the "dpdk-devbind.py" bind pci to igb_uio, then I using kernel tools  bind pci  to ixgbe, I can bind pci to igb_uio successfully ,but it  bind back to ixgbe failed..

/sys/bus/pci/devices/xxxxxx/driver_override is used to bind and unbind devices to drivers in kernels  >= 3.15 driver_override must be written to null for a device to bind to a driver. In the current script, null is written before unbinding a device.
Hence when you bind a device using script and unbind using kernel tools (/sys/bus/pci/drivers/xx/new_id, >>/sys/bus/pci/devices/xx/driver/unbind, /sys/bus/pci/drivers/xx/bind), driver_override is still set to the previous driver.
To avoid this, writing null to driver_override after binding a device to a driver. This will let the kernel tools unbind after binding using the dpdk script.
 
Bind pci to igb_uio and then  bind to ixgbe ,both use "dpdk-devbind.py", it works well.
 
Could you . have a look at this as soon as possible ,it block the daily regression test.
Thank you very much.

Here is the patch to be applied 

diff --git a/usertools/dpdk-devbind.py b/usertools/dpdk-devbind.py              
index bb4d536e0..1dc1065b1 100755                                               
--- a/usertools/dpdk-devbind.py                                                 
+++ b/usertools/dpdk-devbind.py                                                 
@@ -386,25 +386,6 @@ def unbind_one(dev_id, force):                             
               "Skipping unbind" % (dev_id))                                    
         return                                                                 
                                                                                
-    # For kernels > 3.15 driver_override is used to bind a device to a driver. 
-    # Before unbinding it, overwrite driver_override with empty string so that 
-    # the device can be bound to any other driver                              
-    filename = "/sys/bus/pci/devices/%s/driver_override" % dev_id              
-    if os.path.exists(filename):                                               
-        try:                                                                   
-            f = open(filename, "w")                                            
-        except:                                                                
-            print("Error: unbind failed for %s - Cannot open %s"               
-                  % (dev_id, filename))                                        
-            sys.exit(1)                                                        
-        try:                                                                   
-            f.write("\00")                                                     
-            f.close()                                                          
-        except:                                                                
-            print("Error: unbind failed for %s - Cannot open %s"               
-                  % (dev_id, filename))                                        
-            sys.exit(1)                                                        
-                                                                               
     # write to /sys to unbind                                                  
     filename = "/sys/bus/pci/drivers/%s/unbind" % dev["Driver_str"]            
     try:                                                                       
@@ -507,6 +488,25 @@ def bind_one(dev_id, driver, force):                       
             bind_one(dev_id, saved_driver, force)                              
         return                                                                 
                                                                                
+    # For kernels > 3.15 driver_override is used to bind a device to a driver. 
+    # Before unbinding it, overwrite driver_override with empty string so that 
+    # the device can be bound to any other driver                              
+    filename = "/sys/bus/pci/devices/%s/driver_override" % dev_id              
+    if os.path.exists(filename):                                               
+        try:                                                                   
+            f = open(filename, "w")                                            
+        except:                                                                
+            print("Error: unbind failed for %s - Cannot open %s"               
+                  % (dev_id, filename))                                        
+            sys.exit(1)                                                        
+        try:                                                                   
+            f.write("\00")                                                     
+            f.close()                                                          
+        except:                                                                
+            print("Error: unbind failed for %s - Cannot open %s"               
+                  % (dev_id, filename))                                        
+            sys.exit(1)                                                        
+                                                                               
                                                                                
 def unbind_all(dev_list, force=False):  
     """Unbind method, takes a list of device locations"""
 
 
There are my test env and steps: 
 
dpdk commit eba33e87ad37626604be7186e746751f99691084
Components: usertools/dpdk-devbind.py
kernel: 4.8.6-300.fc25.x86_64
driver: ixgbe
version: 5.0.4
firmware-version: 0x61bf0001
Expect: we can use dpdk-devbind.py to bind or unbind PCI-device, we also can use kernel tools to bind or unbind PCI-device, such as :
steps:
# ./dpdk-devbind.py --bind=igb_uio 0000:05:00.0
status:
0000:05:00.0 '82599ES 10-Gigabit SFI/SFP+ Network Connection 10fb' drv=igb_uio unused=
 
# echo "8086 10fd" >/sys/bus/pci/drivers/ixgbe/new_id
# echo "0000:05:00.0" >/sys/bus/pci/devices/0000\:05\:00.0/driver/unbind
# echo "0000:05:00.0" >/sys/bus/pci/drivers/ixgbe/ # echo "0000:05:00.0" >/sys/bus/pci/drivers/ixgbe/bind
-bash: echo: write error: No such device status
0000:05:00.0 '82599ES 10-Gigabit SFI/SFP+ Network Connection' unused=ixgbe,igb_uio
Result:
It can't bind to ixgbe, expect it can bind to ixgbe.
I think the related commit are ::
commit 2fc3502935700243d9a6d903166e6fd11e429843
Author: Guduri Prathyusha <gprathyusha@caviumnetworks.com>
Date:   Wed Mar 22 19:41:29 2017 +0530
usertools: use optimized driver override scheme to bind
 
commit c3ce205d5729867bd1c4c4429a80e01a528d5905
Author: Guduri Prathyusha <gprathyusha@caviumnetworks.com>
Date:   Wed Mar 22 19:41:28 2017 +0530
    usertools: optimize lspci invocation
 
   

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

* Re: [dpdk-dev] dpdk-devbind can't be used misc with kernel tools
  2017-04-26  9:26 ` Prathyusha, Guduri
  2017-04-27  6:42   ` Tu, LijuanX A
@ 2017-04-27  7:16   ` Tu, LijuanX A
  2017-04-27  7:30     ` Prathyusha, Guduri
  1 sibling, 1 reply; 5+ messages in thread
From: Tu, LijuanX A @ 2017-04-27  7:16 UTC (permalink / raw)
  To: Prathyusha, Guduri
  Cc: dev, Chen, WeichunX, Liu, Yu Y, Xu, Qian Q, Liu, Yong, Lu, PeipeiX

Hi Prathyusha,

The patch you created apply failed . I use the patch as attachment.
The tested result is OK ,please create another patch than can apply to DPDK.org

Thanks,
Lijuan

-----Original Message-----
From: Prathyusha, Guduri [mailto:Guduri.Prathyusha@cavium.com] 
Sent: Wednesday, April 26, 2017 5:26 PM
To: Tu, LijuanX A
Cc: dev@dpdk.org; Chen, WeichunX; Liu, Yu Y; Xu, Qian Q; Liu, Yong; Lu, PeipeiX
Subject: Re: dpdk-devbind can't be used misc with kernel tools


Hi LijuanX A

Response inline...

Kindly apply the patch below (inline) and let me know the result. I will submit a formal patch once you confirm.

Thanks,
Prathyusha




From: Tu, LijuanX A <lijuanx.a.tu@intel.com>
Sent: Wednesday, April 26, 2017 11:49 AM
To: Prathyusha, Guduri
Cc: dev@dpdk.org; Chen, WeichunX; Liu, Yu Y; Xu, Qian Q; Liu, Yong; Lu, PeipeiX
Subject: dpdk-devbind can't be used misc with kernel tools
  

Hi Guduri,
 
I am a tester from intel dpdk team. I get a issues on usertools/dpdk-devbind.py
 
With the usertools/dpdk-devbind.py , I can't bind driver as expect.
 
I use the "dpdk-devbind.py" bind pci to igb_uio, then I using kernel tools  bind pci  to ixgbe, I can bind pci to igb_uio successfully ,but it  bind back to ixgbe failed..

/sys/bus/pci/devices/xxxxxx/driver_override is used to bind and unbind devices to drivers in kernels  >= 3.15 driver_override must be written to null for a device to bind to a driver. In the current script, null is written before unbinding a device.
Hence when you bind a device using script and unbind using kernel tools (/sys/bus/pci/drivers/xx/new_id, >>/sys/bus/pci/devices/xx/driver/unbind, /sys/bus/pci/drivers/xx/bind), driver_override is still set to the previous driver.
To avoid this, writing null to driver_override after binding a device to a driver. This will let the kernel tools unbind after binding using the dpdk script.
 
Bind pci to igb_uio and then  bind to ixgbe ,both use "dpdk-devbind.py", it works well.
 
Could you . have a look at this as soon as possible ,it block the daily regression test.
Thank you very much.

Here is the patch to be applied 

diff --git a/usertools/dpdk-devbind.py b/usertools/dpdk-devbind.py              
index bb4d536e0..1dc1065b1 100755                                               
--- a/usertools/dpdk-devbind.py                                                 
+++ b/usertools/dpdk-devbind.py                                                 
@@ -386,25 +386,6 @@ def unbind_one(dev_id, force):                             
               "Skipping unbind" % (dev_id))                                    
         return                                                                 
                                                                                
-    # For kernels > 3.15 driver_override is used to bind a device to a driver. 
-    # Before unbinding it, overwrite driver_override with empty string so that 
-    # the device can be bound to any other driver                              
-    filename = "/sys/bus/pci/devices/%s/driver_override" % dev_id              
-    if os.path.exists(filename):                                               
-        try:                                                                   
-            f = open(filename, "w")                                            
-        except:                                                                
-            print("Error: unbind failed for %s - Cannot open %s"               
-                  % (dev_id, filename))                                        
-            sys.exit(1)                                                        
-        try:                                                                   
-            f.write("\00")                                                     
-            f.close()                                                          
-        except:                                                                
-            print("Error: unbind failed for %s - Cannot open %s"               
-                  % (dev_id, filename))                                        
-            sys.exit(1)                                                        
-                                                                               
     # write to /sys to unbind                                                  
     filename = "/sys/bus/pci/drivers/%s/unbind" % dev["Driver_str"]            
     try:                                                                       
@@ -507,6 +488,25 @@ def bind_one(dev_id, driver, force):                       
             bind_one(dev_id, saved_driver, force)                              
         return                                                                 
                                                                                
+    # For kernels > 3.15 driver_override is used to bind a device to a driver. 
+    # Before unbinding it, overwrite driver_override with empty string so that 
+    # the device can be bound to any other driver                              
+    filename = "/sys/bus/pci/devices/%s/driver_override" % dev_id              
+    if os.path.exists(filename):                                               
+        try:                                                                   
+            f = open(filename, "w")                                            
+        except:                                                                
+            print("Error: unbind failed for %s - Cannot open %s"               
+                  % (dev_id, filename))                                        
+            sys.exit(1)                                                        
+        try:                                                                   
+            f.write("\00")                                                     
+            f.close()                                                          
+        except:                                                                
+            print("Error: unbind failed for %s - Cannot open %s"               
+                  % (dev_id, filename))                                        
+            sys.exit(1)                                                        
+                                                                               
                                                                                
 def unbind_all(dev_list, force=False):  
     """Unbind method, takes a list of device locations"""
 
 
There are my test env and steps: 
 
dpdk commit eba33e87ad37626604be7186e746751f99691084
Components: usertools/dpdk-devbind.py
kernel: 4.8.6-300.fc25.x86_64
driver: ixgbe
version: 5.0.4
firmware-version: 0x61bf0001
Expect: we can use dpdk-devbind.py to bind or unbind PCI-device, we also can use kernel tools to bind or unbind PCI-device, such as :
steps:
# ./dpdk-devbind.py --bind=igb_uio 0000:05:00.0
status:
0000:05:00.0 '82599ES 10-Gigabit SFI/SFP+ Network Connection 10fb' drv=igb_uio unused=
 
# echo "8086 10fd" >/sys/bus/pci/drivers/ixgbe/new_id
# echo "0000:05:00.0" >/sys/bus/pci/devices/0000\:05\:00.0/driver/unbind
# echo "0000:05:00.0" >/sys/bus/pci/drivers/ixgbe/ # echo "0000:05:00.0" >/sys/bus/pci/drivers/ixgbe/bind
-bash: echo: write error: No such device status
0000:05:00.0 '82599ES 10-Gigabit SFI/SFP+ Network Connection' unused=ixgbe,igb_uio
Result:
It can't bind to ixgbe, expect it can bind to ixgbe.
I think the related commit are ::
commit 2fc3502935700243d9a6d903166e6fd11e429843
Author: Guduri Prathyusha <gprathyusha@caviumnetworks.com>
Date:   Wed Mar 22 19:41:29 2017 +0530
usertools: use optimized driver override scheme to bind
 
commit c3ce205d5729867bd1c4c4429a80e01a528d5905
Author: Guduri Prathyusha <gprathyusha@caviumnetworks.com>
Date:   Wed Mar 22 19:41:28 2017 +0530
    usertools: optimize lspci invocation
 
   

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

* Re: [dpdk-dev] dpdk-devbind can't be used misc with kernel tools
  2017-04-27  7:16   ` Tu, LijuanX A
@ 2017-04-27  7:30     ` Prathyusha, Guduri
  0 siblings, 0 replies; 5+ messages in thread
From: Prathyusha, Guduri @ 2017-04-27  7:30 UTC (permalink / raw)
  To: Tu, LijuanX A
  Cc: dev, Chen, WeichunX, Liu, Yu Y, Xu, Qian Q, Liu, Yong, Lu, PeipeiX

Hi LijuanX A,


Thanks for verifying it. I have already submitted a formal patch for the same

http://dpdk.org/dev/patchwork/patch/23921/


Regards,

Prathyusha









________________________________
From: Tu, LijuanX A <lijuanx.a.tu@intel.com>
Sent: Thursday, April 27, 2017 12:46:58 PM
To: Prathyusha, Guduri
Cc: dev@dpdk.org; Chen, WeichunX; Liu, Yu Y; Xu, Qian Q; Liu, Yong; Lu, PeipeiX
Subject: RE: dpdk-devbind can't be used misc with kernel tools

Hi Prathyusha,

The patch you created apply failed . I use the patch as attachment.
The tested result is OK ,please create another patch than can apply to DPDK.org

Thanks,
Lijuan

-----Original Message-----
From: Prathyusha, Guduri [mailto:Guduri.Prathyusha@cavium.com]
Sent: Wednesday, April 26, 2017 5:26 PM
To: Tu, LijuanX A
Cc: dev@dpdk.org; Chen, WeichunX; Liu, Yu Y; Xu, Qian Q; Liu, Yong; Lu, PeipeiX
Subject: Re: dpdk-devbind can't be used misc with kernel tools


Hi LijuanX A

Response inline...

Kindly apply the patch below (inline) and let me know the result. I will submit a formal patch once you confirm.

Thanks,
Prathyusha




From: Tu, LijuanX A <lijuanx.a.tu@intel.com>
Sent: Wednesday, April 26, 2017 11:49 AM
To: Prathyusha, Guduri
Cc: dev@dpdk.org; Chen, WeichunX; Liu, Yu Y; Xu, Qian Q; Liu, Yong; Lu, PeipeiX
Subject: dpdk-devbind can't be used misc with kernel tools


Hi Guduri,

I am a tester from intel dpdk team. I get a issues on usertools/dpdk-devbind.py

With the usertools/dpdk-devbind.py , I can't bind driver as expect.

I use the "dpdk-devbind.py" bind pci to igb_uio, then I using kernel tools  bind pci  to ixgbe, I can bind pci to igb_uio successfully ,but it  bind back to ixgbe failed..

/sys/bus/pci/devices/xxxxxx/driver_override is used to bind and unbind devices to drivers in kernels  >= 3.15 driver_override must be written to null for a device to bind to a driver. In the current script, null is written before unbinding a device.
Hence when you bind a device using script and unbind using kernel tools (/sys/bus/pci/drivers/xx/new_id, >>/sys/bus/pci/devices/xx/driver/unbind, /sys/bus/pci/drivers/xx/bind), driver_override is still set to the previous driver.
To avoid this, writing null to driver_override after binding a device to a driver. This will let the kernel tools unbind after binding using the dpdk script.

Bind pci to igb_uio and then  bind to ixgbe ,both use "dpdk-devbind.py", it works well.

Could you . have a look at this as soon as possible ,it block the daily regression test.
Thank you very much.

Here is the patch to be applied

diff --git a/usertools/dpdk-devbind.py b/usertools/dpdk-devbind.py
index bb4d536e0..1dc1065b1 100755
--- a/usertools/dpdk-devbind.py
+++ b/usertools/dpdk-devbind.py
@@ -386,25 +386,6 @@ def unbind_one(dev_id, force):
               "Skipping unbind" % (dev_id))
         return

-    # For kernels > 3.15 driver_override is used to bind a device to a driver.
-    # Before unbinding it, overwrite driver_override with empty string so that
-    # the device can be bound to any other driver
-    filename = "/sys/bus/pci/devices/%s/driver_override" % dev_id
-    if os.path.exists(filename):
-        try:
-            f = open(filename, "w")
-        except:
-            print("Error: unbind failed for %s - Cannot open %s"
-                  % (dev_id, filename))
-            sys.exit(1)
-        try:
-            f.write("\00")
-            f.close()
-        except:
-            print("Error: unbind failed for %s - Cannot open %s"
-                  % (dev_id, filename))
-            sys.exit(1)
-
     # write to /sys to unbind
     filename = "/sys/bus/pci/drivers/%s/unbind" % dev["Driver_str"]
     try:
@@ -507,6 +488,25 @@ def bind_one(dev_id, driver, force):
             bind_one(dev_id, saved_driver, force)
         return

+    # For kernels > 3.15 driver_override is used to bind a device to a driver.
+    # Before unbinding it, overwrite driver_override with empty string so that
+    # the device can be bound to any other driver
+    filename = "/sys/bus/pci/devices/%s/driver_override" % dev_id
+    if os.path.exists(filename):
+        try:
+            f = open(filename, "w")
+        except:
+            print("Error: unbind failed for %s - Cannot open %s"
+                  % (dev_id, filename))
+            sys.exit(1)
+        try:
+            f.write("\00")
+            f.close()
+        except:
+            print("Error: unbind failed for %s - Cannot open %s"
+                  % (dev_id, filename))
+            sys.exit(1)
+

 def unbind_all(dev_list, force=False):
     """Unbind method, takes a list of device locations"""


There are my test env and steps:

dpdk commit eba33e87ad37626604be7186e746751f99691084
Components: usertools/dpdk-devbind.py
kernel: 4.8.6-300.fc25.x86_64
driver: ixgbe
version: 5.0.4
firmware-version: 0x61bf0001
Expect: we can use dpdk-devbind.py to bind or unbind PCI-device, we also can use kernel tools to bind or unbind PCI-device, such as :
steps:
# ./dpdk-devbind.py --bind=igb_uio 0000:05:00.0
status:
0000:05:00.0 '82599ES 10-Gigabit SFI/SFP+ Network Connection 10fb' drv=igb_uio unused=

# echo "8086 10fd" >/sys/bus/pci/drivers/ixgbe/new_id
# echo "0000:05:00.0" >/sys/bus/pci/devices/0000\:05\:00.0/driver/unbind
# echo "0000:05:00.0" >/sys/bus/pci/drivers/ixgbe/ # echo "0000:05:00.0" >/sys/bus/pci/drivers/ixgbe/bind
-bash: echo: write error: No such device status
0000:05:00.0 '82599ES 10-Gigabit SFI/SFP+ Network Connection' unused=ixgbe,igb_uio
Result:
It can't bind to ixgbe, expect it can bind to ixgbe.
I think the related commit are ::
commit 2fc3502935700243d9a6d903166e6fd11e429843
Author: Guduri Prathyusha <gprathyusha@caviumnetworks.com>
Date:   Wed Mar 22 19:41:29 2017 +0530
usertools: use optimized driver override scheme to bind

commit c3ce205d5729867bd1c4c4429a80e01a528d5905
Author: Guduri Prathyusha <gprathyusha@caviumnetworks.com>
Date:   Wed Mar 22 19:41:28 2017 +0530
    usertools: optimize lspci invocation

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

end of thread, other threads:[~2017-04-27  7:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-26  6:19 [dpdk-dev] dpdk-devbind can't be used misc with kernel tools Tu, LijuanX A
2017-04-26  9:26 ` Prathyusha, Guduri
2017-04-27  6:42   ` Tu, LijuanX A
2017-04-27  7:16   ` Tu, LijuanX A
2017-04-27  7:30     ` Prathyusha, Guduri

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