DPDK patches and discussions
 help / color / mirror / Atom feed
From: Anatoly Burakov <anatoly.burakov@intel.com>
To: dev@dpdk.org
Cc: thomas@monjalon.net, john.mcnamara@intel.com, stephen@networkplumber.org
Subject: [dpdk-dev] [PATCH v4 0/3] Small usability improvements for devbind
Date: Thu, 25 Jul 2019 15:21:07 +0100	[thread overview]
Message-ID: <cover.1564064436.git.anatoly.burakov@intel.com> (raw)
In-Reply-To: <cover.1564062922.git.anatoly.burakov@intel.com>

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.

v4:
- Corrected mixing of tabs and spaces in the first patch as well

v3:
- Corrected mixing of tabs and spaces. Spaces all the way down!

v2:
- Addressed Stephen's feedback
- 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

  reply	other threads:[~2019-07-25 14:21 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-24 15:34 [dpdk-dev] [PATCH 0/2] " Anatoly Burakov
2019-07-24 15:34 ` [dpdk-dev] [PATCH 1/2] usertools/devbind: add error on forgetting to specify driver Anatoly Burakov
2019-07-24 16:29   ` Stephen Hemminger
2019-07-24 16:47     ` Burakov, Anatoly
2019-07-24 15:34 ` [dpdk-dev] [PATCH 2/2] usertools/devbind: check if module is loaded before binding Anatoly Burakov
2019-07-24 16:28   ` Stephen Hemminger
2019-07-24 16:47     ` Burakov, Anatoly
2019-07-25 13:48 ` [dpdk-dev] [PATCH v2 0/3] Small usability improvements for devbind Anatoly Burakov
2019-07-25 13:55   ` [dpdk-dev] [PATCH v3 " Anatoly Burakov
2019-07-25 14:21     ` Anatoly Burakov [this message]
2019-07-30 21:52       ` [dpdk-dev] [PATCH v4 " Thomas Monjalon
2019-07-25 14:21     ` [dpdk-dev] [PATCH v4 1/3] usertools/devbind: add error on forgetting to specify driver Anatoly Burakov
2019-07-25 14:21     ` [dpdk-dev] [PATCH v4 2/3] usertools/devbind: check if module is loaded before binding Anatoly Burakov
2019-07-25 14:21     ` [dpdk-dev] [PATCH v4 3/3] usertools/devbind: print all errors to stderr Anatoly Burakov
2019-07-25 13:55   ` [dpdk-dev] [PATCH v3 1/3] usertools/devbind: add error on forgetting to specify driver Anatoly Burakov
2019-07-25 13:55   ` [dpdk-dev] [PATCH v3 2/3] usertools/devbind: check if module is loaded before binding Anatoly Burakov
2019-07-25 13:55   ` [dpdk-dev] [PATCH v3 3/3] usertools/devbind: print all errors to stderr Anatoly Burakov
2019-07-25 13:48 ` [dpdk-dev] [PATCH v2 1/3] usertools/devbind: add error on forgetting to specify driver Anatoly Burakov
2019-07-25 13:48 ` [dpdk-dev] [PATCH v2 2/3] usertools/devbind: check if module is loaded before binding Anatoly Burakov
2019-07-25 13:48 ` [dpdk-dev] [PATCH v2 3/3] usertools/devbind: print all errors to stderr Anatoly Burakov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1564064436.git.anatoly.burakov@intel.com \
    --to=anatoly.burakov@intel.com \
    --cc=dev@dpdk.org \
    --cc=john.mcnamara@intel.com \
    --cc=stephen@networkplumber.org \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).