From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id D38D169D8 for ; Thu, 27 Apr 2017 08:42:37 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga105.jf.intel.com with ESMTP; 26 Apr 2017 23:42:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,257,1488873600"; d="scan'208";a="1161557646" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga002.fm.intel.com with ESMTP; 26 Apr 2017 23:42:35 -0700 Received: from fmsmsx158.amr.corp.intel.com (10.18.116.75) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 26 Apr 2017 23:42:35 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by fmsmsx158.amr.corp.intel.com (10.18.116.75) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 26 Apr 2017 23:42:34 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.117]) by shsmsx102.ccr.corp.intel.com ([169.254.2.246]) with mapi id 14.03.0319.002; Thu, 27 Apr 2017 14:42:31 +0800 From: "Tu, LijuanX A" To: "Prathyusha, Guduri" CC: "dev@dpdk.org" , "Chen, WeichunX" , "Liu, Yu Y" , "Xu, Qian Q" , "Liu, Yong" , "Lu, PeipeiX" Thread-Topic: dpdk-devbind can't be used misc with kernel tools Thread-Index: AdK+VR5nRmMI8Le0RKq3YEicQoOMyQAGUTNGACy+9TA= Date: Thu, 27 Apr 2017 06:42:30 +0000 Message-ID: <38D041F150D4184C8114E499040E62343DBC19AB@SHSMSX103.ccr.corp.intel.com> References: <38D041F150D4184C8114E499040E62343DBC1438@SHSMSX103.ccr.corp.intel.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] dpdk-devbind can't be used misc with kernel tools X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Apr 2017 06:42:38 -0000 Hi Prathyusha, The path is OK ,I have verified it. -----Original Message----- From: Prathyusha, Guduri [mailto:Guduri.Prathyusha@cavium.com]=20 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, Pei= peiX 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 su= bmit a formal patch once you confirm. Thanks, Prathyusha From: Tu, LijuanX A 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, Pei= peiX Subject: dpdk-devbind can't be used misc with kernel tools =A0=20 Hi Guduri, =A0 I am a tester from intel dpdk team. I get a issues on usertools/dpdk-devbin= d.py =A0 With the usertools/dpdk-devbind.py , I can't bind driver as expect. =A0 I use the "dpdk-devbind.py" bind pci to igb_uio, then I using kernel tools= =A0 bind pci =A0to ixgbe, I can bind pci to igb_uio successfully ,but it = =A0bind back to ixgbe failed.. /sys/bus/pci/devices/xxxxxx/driver_override is used to bind and unbind devi= ces to drivers in kernels >=3D 3.15 driver_override must be written to nul= l 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 (/s= ys/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 dri= ver. 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. =A0 Bind pci to igb_uio and then =A0bind to ixgbe ,both use "dpdk-devbind.py", = it works well. =A0 Could you . have a look at this as soon as possible ,it block the daily reg= ression test. Thank you very much. Here is the patch to be applied=20 diff --git a/usertools/dpdk-devbind.py b/usertools/dpdk-devbind.py = =20 index bb4d536e0..1dc1065b1 100755 = =20 --- a/usertools/dpdk-devbind.py = =20 +++ b/usertools/dpdk-devbind.py = =20 @@ -386,25 +386,6 @@ def unbind_one(dev_id, force): = =20 "Skipping unbind" % (dev_id)) = =20 return = =20 = =20 - # For kernels > 3.15 driver_override is used to bind a device to a dri= ver.=20 - # Before unbinding it, overwrite driver_override with empty string so = that=20 - # the device can be bound to any other driver = =20 - filename =3D "/sys/bus/pci/devices/%s/driver_override" % dev_id = =20 - if os.path.exists(filename): = =20 - try: = =20 - f =3D open(filename, "w") = =20 - except: = =20 - print("Error: unbind failed for %s - Cannot open %s" = =20 - % (dev_id, filename)) = =20 - sys.exit(1) = =20 - try: = =20 - f.write("\00") = =20 - f.close() = =20 - except: = =20 - print("Error: unbind failed for %s - Cannot open %s" = =20 - % (dev_id, filename)) = =20 - sys.exit(1) = =20 - = =20 # write to /sys to unbind = =20 filename =3D "/sys/bus/pci/drivers/%s/unbind" % dev["Driver_str"] = =20 try: = =20 @@ -507,6 +488,25 @@ def bind_one(dev_id, driver, force): = =20 bind_one(dev_id, saved_driver, force) = =20 return = =20 = =20 + # For kernels > 3.15 driver_override is used to bind a device to a dri= ver.=20 + # Before unbinding it, overwrite driver_override with empty string so = that=20 + # the device can be bound to any other driver = =20 + filename =3D "/sys/bus/pci/devices/%s/driver_override" % dev_id = =20 + if os.path.exists(filename): = =20 + try: = =20 + f =3D open(filename, "w") = =20 + except: = =20 + print("Error: unbind failed for %s - Cannot open %s" = =20 + % (dev_id, filename)) = =20 + sys.exit(1) = =20 + try: = =20 + f.write("\00") = =20 + f.close() = =20 + except: = =20 + print("Error: unbind failed for %s - Cannot open %s" = =20 + % (dev_id, filename)) = =20 + sys.exit(1) = =20 + = =20 = =20 def unbind_all(dev_list, force=3DFalse): =20 """Unbind method, takes a list of device locations""" =A0 =A0 There are my test env and steps:=20 =A0 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 ca= n use kernel tools to bind or unbind PCI-device, such as : steps: # ./dpdk-devbind.py --bind=3Digb_uio 0000:05:00.0 status: 0000:05:00.0 '82599ES 10-Gigabit SFI/SFP+ Network Connection 10fb' drv=3Dig= b_uio unused=3D =A0 # 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=3Dixgb= e,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 Date:=A0=A0 Wed Mar 22 19:41:29 2017 +0530 usertools: use optimized driver override scheme to bind =A0 commit c3ce205d5729867bd1c4c4429a80e01a528d5905 Author: Guduri Prathyusha Date:=A0=A0 Wed Mar 22 19:41:28 2017 +0530 =A0=A0=A0 usertools: optimize lspci invocation =A0 =20