Message ID | 1424926669-14202-1-git-send-email-changchun.ouyang@intel.com (mailing list archive) |
---|---|
State | Superseded, archived |
Headers |
Return-Path: <dev-bounces@dpdk.org> X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 7324C568E; Thu, 26 Feb 2015 05:57:59 +0100 (CET) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 4DD413790 for <dev@dpdk.org>; Thu, 26 Feb 2015 05:57:58 +0100 (CET) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga102.jf.intel.com with ESMTP; 25 Feb 2015 20:53:35 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,650,1418112000"; d="scan'208";a="533018900" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by orsmga003.jf.intel.com with ESMTP; 25 Feb 2015 20:48:46 -0800 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id t1Q4vr9F031160; Thu, 26 Feb 2015 12:57:53 +0800 Received: from shecgisg004.sh.intel.com (localhost [127.0.0.1]) by shecgisg004.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id t1Q4voYb014235; Thu, 26 Feb 2015 12:57:53 +0800 Received: (from couyang@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id t1Q4votC014231; Thu, 26 Feb 2015 12:57:50 +0800 From: Ouyang Changchun <changchun.ouyang@intel.com> To: dev@dpdk.org Date: Thu, 26 Feb 2015 12:57:49 +0800 Message-Id: <1424926669-14202-1-git-send-email-changchun.ouyang@intel.com> X-Mailer: git-send-email 1.7.12.2 Subject: [dpdk-dev] [PATCH] tools/dpdk_nic_bind: Fix can't bind virtio-pci issue X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK <dev.dpdk.org> List-Unsubscribe: <http://dpdk.org/ml/options/dev>, <mailto:dev-request@dpdk.org?subject=unsubscribe> List-Archive: <http://dpdk.org/ml/archives/dev/> List-Post: <mailto:dev@dpdk.org> List-Help: <mailto:dev-request@dpdk.org?subject=help> List-Subscribe: <http://dpdk.org/ml/listinfo/dev>, <mailto:dev-request@dpdk.org?subject=subscribe> Errors-To: dev-bounces@dpdk.org Sender: "dev" <dev-bounces@dpdk.org> |
Commit Message
Ouyang Changchun
Feb. 26, 2015, 4:57 a.m. UTC
In virtio test, on guest
1. Bind virtio port to igb_uio driver;
2. Remove igb_uio module;
3. Bind virtio port to virtio-pci driver, it fails and reports:
"Error - no supported modules are loaded"
The tool should check the to-be-bound driver flag, if it is dpdk driver(igb_uio, vfio etc),
and the corresponding module is not loaded, then exit, otherwise, just report a warning,
and continue to bind the non-dpdk driver(like virtio-pci) to dev.
Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
---
tools/dpdk_nic_bind.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
Comments
On Thu, Feb 26, 2015 at 12:57:49PM +0800, Ouyang Changchun wrote: First off, I think the title needs to be changed. How about something like: "dpdk_nic_bind: don't exit if an unused module is missing" > In virtio test, on guest > 1. Bind virtio port to igb_uio driver; > 2. Remove igb_uio module; > 3. Bind virtio port to virtio-pci driver, it fails and reports: > "Error - no supported modules are loaded" > > The tool should check the to-be-bound driver flag, if it is dpdk driver(igb_uio, vfio etc), > and the corresponding module is not loaded, then exit, otherwise, just report a warning, > and continue to bind the non-dpdk driver(like virtio-pci) to dev. This is a good description of the problem. Once you change the title, I think an initial sentence is needed here by way of intro - such as: "The dpdk_nic_bind script will not allow ports to be bound or unbound if none of the kernel modules supported by DPDK is loaded. This patch relaxes this restriction by checking if a DPDK module is actually requested. The example below illustrates this problem:" > > Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com> > --- > tools/dpdk_nic_bind.py | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/tools/dpdk_nic_bind.py b/tools/dpdk_nic_bind.py > index 2483056..8523f82 100755 > --- a/tools/dpdk_nic_bind.py > +++ b/tools/dpdk_nic_bind.py > @@ -175,8 +175,11 @@ def check_modules(): > > # check if we have at least one loaded module > if True not in [mod["Found"] for mod in mods] and b_flag is not None: > - print "Error - no supported modules are loaded" > - sys.exit(1) > + if b_flag in dpdk_drivers: > + print "Error - no supported modules(DPDK driver) are loaded" > + sys.exit(1) > + else: > + print "Warning - no supported modules(DPDK driver) are loaded" > > # change DPDK driver list to only contain drivers that are loaded > dpdk_drivers = [mod["Name"] for mod in mods if mod["Found"]] > -- > 1.8.4.2 > This is a worthwhile change. However, I think it could be made better: * If we try to bind a device to ixgbe, and ixgbe is not loaded, we get no error from the script * If igb_uio is loaded and we try to bind a device to vfio which is not loaded again we get no error from the script. If would be nice if instead of this checking explicitly for DPDK modules, we just check if the module to be bound is present and give an error if not. /Bruce
Hi, > -----Original Message----- > From: Richardson, Bruce > Sent: Tuesday, March 3, 2015 7:44 PM > To: Ouyang, Changchun > Cc: dev@dpdk.org; Cao, Waterman > Subject: Re: [PATCH] tools/dpdk_nic_bind: Fix can't bind virtio-pci issue > > On Thu, Feb 26, 2015 at 12:57:49PM +0800, Ouyang Changchun wrote: > First off, I think the title needs to be changed. How about something like: > "dpdk_nic_bind: don't exit if an unused module is missing" > > > In virtio test, on guest > > 1. Bind virtio port to igb_uio driver; 2. Remove igb_uio module; 3. > > Bind virtio port to virtio-pci driver, it fails and reports: > > "Error - no supported modules are loaded" > > > > The tool should check the to-be-bound driver flag, if it is dpdk > > driver(igb_uio, vfio etc), and the corresponding module is not loaded, > > then exit, otherwise, just report a warning, and continue to bind the non- > dpdk driver(like virtio-pci) to dev. > > This is a good description of the problem. Once you change the title, I think > an initial sentence is needed here by way of intro - such as: > "The dpdk_nic_bind script will not allow ports to be bound or unbound if > none of the kernel modules supported by DPDK is loaded. This patch relaxes > this restriction by checking if a DPDK module is actually requested. The > example below illustrates this problem:" > Will update this description in v2. Thanks > > > > Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com> > > --- > > tools/dpdk_nic_bind.py | 7 +++++-- > > 1 file changed, 5 insertions(+), 2 deletions(-) > > > > diff --git a/tools/dpdk_nic_bind.py b/tools/dpdk_nic_bind.py index > > 2483056..8523f82 100755 > > --- a/tools/dpdk_nic_bind.py > > +++ b/tools/dpdk_nic_bind.py > > @@ -175,8 +175,11 @@ def check_modules(): > > > > # check if we have at least one loaded module > > if True not in [mod["Found"] for mod in mods] and b_flag is not None: > > - print "Error - no supported modules are loaded" > > - sys.exit(1) > > + if b_flag in dpdk_drivers: > > + print "Error - no supported modules(DPDK driver) are loaded" > > + sys.exit(1) > > + else: > > + print "Warning - no supported modules(DPDK driver) are loaded" > > > > # change DPDK driver list to only contain drivers that are loaded > > dpdk_drivers = [mod["Name"] for mod in mods if mod["Found"]] > > -- > > 1.8.4.2 > > > This is a worthwhile change. However, I think it could be made better: > * If we try to bind a device to ixgbe, and ixgbe is not loaded, we get no error > from the script > * If igb_uio is loaded and we try to bind a device to vfio which is not loaded > again we get no error from the script. > > If would be nice if instead of this checking explicitly for DPDK modules, we > just check if the module to be bound is present and give an error if not. > For all these cases, they could be detected in function bind_one, If any module exactly required can't be found/opened, it will go to except branch and raise a error message like: Error: bind failed ..... Cannot open..... Thanks Changchun
diff --git a/tools/dpdk_nic_bind.py b/tools/dpdk_nic_bind.py index 2483056..8523f82 100755 --- a/tools/dpdk_nic_bind.py +++ b/tools/dpdk_nic_bind.py @@ -175,8 +175,11 @@ def check_modules(): # check if we have at least one loaded module if True not in [mod["Found"] for mod in mods] and b_flag is not None: - print "Error - no supported modules are loaded" - sys.exit(1) + if b_flag in dpdk_drivers: + print "Error - no supported modules(DPDK driver) are loaded" + sys.exit(1) + else: + print "Warning - no supported modules(DPDK driver) are loaded" # change DPDK driver list to only contain drivers that are loaded dpdk_drivers = [mod["Name"] for mod in mods if mod["Found"]]