From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0067.outbound.protection.outlook.com [104.47.34.67]) by dpdk.org (Postfix) with ESMTP id 963BB7ED8 for ; Thu, 27 Apr 2017 09:30:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=gthn2FHuUMBh4G1DWBa3Lg8d979Vw0SQwWA3KDSzQ14=; b=TdRiGPHpkm2tXRrXL3mCU/tcwhPvpbQD+S5MFWu5kw3J+aJe8oJsmkNW9Td4HrYYeVuht0aci8CI4C5ya/7KMEKFb8kpqHS+r43mRkzAqtYEJp/SU9CbV/Ht730gIlqiy9xmkO/jpclepeiCmCwC6w4HZ+2V8CZEH6rrfq1RNH0= Received: from BY2PR0701MB2101.namprd07.prod.outlook.com (10.163.156.154) by BY2PR0701MB2101.namprd07.prod.outlook.com (10.163.156.154) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1047.13; Thu, 27 Apr 2017 07:30:41 +0000 Received: from BY2PR0701MB2101.namprd07.prod.outlook.com ([10.163.156.154]) by BY2PR0701MB2101.namprd07.prod.outlook.com ([10.163.156.154]) with mapi id 15.01.1047.019; Thu, 27 Apr 2017 07:30:41 +0000 From: "Prathyusha, Guduri" To: "Tu, LijuanX A" 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+VR5nRmMI8Le0RKq3YEicQoOMyQAGUTNGAC3kKnAAAHUy6A== Date: Thu, 27 Apr 2017 07:30:40 +0000 Message-ID: References: <38D041F150D4184C8114E499040E62343DBC1438@SHSMSX103.ccr.corp.intel.com> , <38D041F150D4184C8114E499040E62343DBC19F2@SHSMSX103.ccr.corp.intel.com> In-Reply-To: <38D041F150D4184C8114E499040E62343DBC19F2@SHSMSX103.ccr.corp.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=cavium.com; x-originating-ip: [132.245.59.53] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; BY2PR0701MB2101; 7:EiU6Y9lnIdWWDrQnNk51WapR7049FmCBkuEqKX9MaILDET1ejq2H/7kKHqQJ2619Dc5NcEPMu6cJWebVUaiRa8UR1Ep9GIGyJ4CFj8Sfrk1HbYd0Vg/8BEI506f1GC5eD0nkUPWC9Us1IdoaUiLeslCURdLeQpvY6ZIS5MmB9+AGkXWx3YuZ7wqfx8fy02LwbVu4pGwzk/i2mORojx2lZYXl17MieV2YkcoSjXVa5i5AY4/GlZDiy5zMFpdh2iFcvMVQy4aQP49KsjjsvFn6794ROLZ+QeCkh289dww1G9AEQk7/Nw8yQTHEQYGYfvnoU032cOg8lTWdfU6JNUwW5A== x-ms-office365-filtering-correlation-id: 8e3b8afc-a706-4f43-e968-08d48d3f4ede x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254075)(201703131423075)(201703031133081)(201702281549075); SRVR:BY2PR0701MB2101; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(158342451672863)(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(3002001)(6041248)(20161123564025)(20161123560025)(20161123555025)(20161123562025)(201703131423075)(201702281528075)(201703061421075)(6072148); SRVR:BY2PR0701MB2101; BCL:0; PCL:0; RULEID:; SRVR:BY2PR0701MB2101; x-forefront-prvs: 029097202E x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39450400003)(39840400002)(39850400002)(39400400002)(39410400002)(13464003)(45984002)(377454003)(33656002)(6916009)(66066001)(2950100002)(4326008)(7696004)(3660700001)(3280700002)(8936002)(102836003)(3846002)(6116002)(53546009)(25786009)(5660300001)(2906002)(74316002)(122556002)(110136004)(7906003)(38730400002)(8676002)(53376002)(81166006)(189998001)(2900100001)(229853002)(7736002)(53936002)(77096006)(6506006)(86362001)(606005)(236005)(9686003)(54896002)(6306002)(55016002)(54356999)(76176999)(99286003)(6436002)(54906002)(50986999)(6246003)(5890100001)(966004); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR0701MB2101; H:BY2PR0701MB2101.namprd07.prod.outlook.com; FPR:; SPF:None; MLV:sfv; LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Apr 2017 07:30:40.9327 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR0701MB2101 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.15 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 07:30:43 -0000 Hi LijuanX A, Thanks for verifying it. I have already submitted a formal patch for the sa= me http://dpdk.org/dev/patchwork/patch/23921/ Regards, Prathyusha ________________________________ From: Tu, LijuanX A 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, Pei= peiX 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, 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 Hi Guduri, I am a tester from intel dpdk team. I get a issues on usertools/dpdk-devbin= d.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 b= ack 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. 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 reg= ression 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 dri= ver. - # Before unbinding it, overwrite driver_override with empty string so = that - # the device can be bound to any other driver - filename =3D "/sys/bus/pci/devices/%s/driver_override" % dev_id - if os.path.exists(filename): - try: - f =3D 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 =3D "/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 dri= ver. + # Before unbinding it, overwrite driver_override with empty string so = that + # the device can be bound to any other driver + filename =3D "/sys/bus/pci/devices/%s/driver_override" % dev_id + if os.path.exists(filename): + try: + f =3D 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=3DFalse): """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 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 # 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: Wed Mar 22 19:41:29 2017 +0530 usertools: use optimized driver override scheme to bind commit c3ce205d5729867bd1c4c4429a80e01a528d5905 Author: Guduri Prathyusha Date: Wed Mar 22 19:41:28 2017 +0530 usertools: optimize lspci invocation