From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 45E1FA046B for ; Thu, 25 Jul 2019 15:48:25 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C54231C33B; Thu, 25 Jul 2019 15:48:23 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id B42D81C336 for ; Thu, 25 Jul 2019 15:48:21 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Jul 2019 06:48:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,306,1559545200"; d="scan'208";a="369134134" Received: from silpixa00399498.ir.intel.com (HELO silpixa00399498.ger.corp.intel.com) ([10.237.223.125]) by fmsmga005.fm.intel.com with ESMTP; 25 Jul 2019 06:48:19 -0700 From: Anatoly Burakov To: dev@dpdk.org Cc: thomas@monjalon.net, john.mcnamara@intel.com, stephen@networkplumber.org Date: Thu, 25 Jul 2019 14:48:15 +0100 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: Subject: [dpdk-dev] [PATCH v2 0/3] Small usability improvements for devbind 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Over the course of using devbind, i find myself frequently bumping up against two common errors (with the assumption being that i'm not the only person who hits these errors). First happens when i forget to specify the driver. The error message in this case looks something like the following: anatoly@xxxx:~$ sudo DPDK/usertools/dpdk-devbind.py -b 08:00.0 08:00.1 Error: bind failed for 0000:08:00.1 - Cannot open /sys/bus/pci/drivers/08:00.0/bind Error: unbind failed for 0000:08:00.1 - Cannot open /sys/bus/pci/drivers//unbind This is confusing to anyone who isn't intimately familiar with how driver binding through sysfs works. The first patch in this series changes the error message to instead look like the following: anatoly@xxxx:~$ sudo DPDK/usertools/dpdk-devbind.py -b 08:00.0 08:00.1 ERROR: Driver '08:00.0' does not look like a valid driver. Did you forget to specify the driver to bind devices to? We do that by assuming that no one in their right mind will name their PCI driver with something that looks like a PCI address, so we check if the driver string is actually a valid device string. If it is, we error out. The second error i often come across is forgetting to load the driver. This error looks something like this: anatoly@xxxx:~$ sudo DPDK/usertools/dpdk-devbind.py -b vfio-pci 08:00.1 Error: bind failed for 0000:08:00.1 - Cannot open /sys/bus/pci/drivers/vfio-pci/bind This too isn't very informative. The second patch in this patchset changes this error to look like this instead: anatoly@xxxx:~$ sudo DPDK/usertools/dpdk-devbind.py -b vfio-pci 08:00.1 ERROR: Driver 'vfio-pci' is not loaded. Nice and informative! Additionally, since we're outputting our new error messages to stderr, i took the liberty of adjusting all the rest of the error messages to also output to stderr. v2: - Addressed Stephen's feedbkac - Added new patch adjusting error output to stderr Anatoly Burakov (3): usertools/devbind: add error on forgetting to specify driver usertools/devbind: check if module is loaded before binding usertools/devbind: print all errors to stderr usertools/dpdk-devbind.py | 144 ++++++++++++++++++++++---------------- 1 file changed, 83 insertions(+), 61 deletions(-) -- 2.17.1