DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] eal: don't crash if one pci device fails
@ 2015-12-03  1:38 Stephen Hemminger
  2015-12-03 10:02 ` Bruce Richardson
  2015-12-03 10:08 ` David Marchand
  0 siblings, 2 replies; 3+ messages in thread
From: Stephen Hemminger @ 2015-12-03  1:38 UTC (permalink / raw)
  To: dev

If there is a failure to setup one pci device, there maybe other
devices that can be initialized. Don't call rte_exit which
is a forced crash, pass the error back to the
application to decide what it wants to do.

Might be good idea to return a positive value for the
number of devices found, but that would break ABI.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/librte_eal/common/eal_common_pci.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
index dcfe947..594ef9c 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -391,12 +391,13 @@ rte_eal_pci_probe(void)
 	struct rte_pci_device *dev = NULL;
 	struct rte_devargs *devargs;
 	int probe_all = 0;
-	int ret = 0;
+	int failed = 0;
 
 	if (rte_eal_devargs_type_count(RTE_DEVTYPE_WHITELISTED_PCI) == 0)
 		probe_all = 1;
 
 	TAILQ_FOREACH(dev, &pci_device_list, next) {
+		int ret = 0;
 
 		/* set devargs in PCI structure */
 		devargs = pci_devargs_lookup(dev);
@@ -409,13 +410,17 @@ rte_eal_pci_probe(void)
 		else if (devargs != NULL &&
 			devargs->type == RTE_DEVTYPE_WHITELISTED_PCI)
 			ret = pci_probe_all_drivers(dev);
-		if (ret < 0)
-			rte_exit(EXIT_FAILURE, "Requested device " PCI_PRI_FMT
-				 " cannot be used\n", dev->addr.domain, dev->addr.bus,
-				 dev->addr.devid, dev->addr.function);
+
+		if (ret < 0) {
+			RTE_LOG(ERR, EAL,
+				"Requested device " PCI_PRI_FMT " cannot be used\n",
+				dev->addr.domain, dev->addr.bus,
+				dev->addr.devid, dev->addr.function);
+			failed = ret;
+		}
 	}
 
-	return 0;
+	return failed;
 }
 
 /* dump one device */
-- 
2.1.4

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] eal: don't crash if one pci device fails
  2015-12-03  1:38 [dpdk-dev] [PATCH] eal: don't crash if one pci device fails Stephen Hemminger
@ 2015-12-03 10:02 ` Bruce Richardson
  2015-12-03 10:08 ` David Marchand
  1 sibling, 0 replies; 3+ messages in thread
From: Bruce Richardson @ 2015-12-03 10:02 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: dev

On Wed, Dec 02, 2015 at 05:38:40PM -0800, Stephen Hemminger wrote:
> If there is a failure to setup one pci device, there maybe other
> devices that can be initialized. Don't call rte_exit which
> is a forced crash, pass the error back to the
> application to decide what it wants to do.
> 
> Might be good idea to return a positive value for the
> number of devices found, but that would break ABI.
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>

The return value from this function gets passed back to rte_eal_init() where
it will still cause an application to terminate. Therefore, I think the 
commit message is a little misleading.

Otherwise all looks ok to me. Will help weed out multiple device failures on
a single pass too.

/Bruce

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] eal: don't crash if one pci device fails
  2015-12-03  1:38 [dpdk-dev] [PATCH] eal: don't crash if one pci device fails Stephen Hemminger
  2015-12-03 10:02 ` Bruce Richardson
@ 2015-12-03 10:08 ` David Marchand
  1 sibling, 0 replies; 3+ messages in thread
From: David Marchand @ 2015-12-03 10:08 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: dev

On Thu, Dec 3, 2015 at 2:38 AM, Stephen Hemminger <
stephen@networkplumber.org> wrote:

> If there is a failure to setup one pci device, there maybe other
> devices that can be initialized. Don't call rte_exit which
> is a forced crash, pass the error back to the
> application to decide what it wants to do.
>
> Might be good idea to return a positive value for the
> number of devices found, but that would break ABI.
>

I don't see how this return code will help the application do something
after this.
You don't know which device probe failed with just this.

rte_eal_pci_probe() returning a != 0 value will trigger a rte_panic in
rte_eal_init() anyway.
So I suppose you want to use rte_eal_pci_probe out of rte_eal_init.
In such a case, why don't you use rte_eal_pci_probe_one ?


-- 
David Marchand

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-12-03 10:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-03  1:38 [dpdk-dev] [PATCH] eal: don't crash if one pci device fails Stephen Hemminger
2015-12-03 10:02 ` Bruce Richardson
2015-12-03 10:08 ` David Marchand

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).