DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] dev: don't try to rollback a device attach that failed
@ 2018-11-21 19:05 Darek Stojaczyk
  2018-11-25 12:10 ` Thomas Monjalon
  0 siblings, 1 reply; 2+ messages in thread
From: Darek Stojaczyk @ 2018-11-21 19:05 UTC (permalink / raw)
  To: dev; +Cc: Darek Stojaczyk, qi.z.zhang

If a device fails to attach before it's plugged,
the subsequent rollback will still try to detach it,
causing a segfault. Unplugging a device that wasn't
plugged isn't really supported, so this patch adds
an extra error check to prevent that from happening.

While here, fix this also for normal (non-rollback)
detach, which could also theoretically segfault on
non-plugged device.

Fixes: 244d5130719c ("eal: enable hotplug on multi-process")
Cc: qi.z.zhang@intel.com

Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
---
 lib/librte_eal/common/hotplug_mp.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/lib/librte_eal/common/hotplug_mp.c b/lib/librte_eal/common/hotplug_mp.c
index 7c9fcc46c..d9e6790da 100644
--- a/lib/librte_eal/common/hotplug_mp.c
+++ b/lib/librte_eal/common/hotplug_mp.c
@@ -264,6 +264,19 @@ static void __handle_primary_request(void *param)
 			goto quit;
 		}
 
+		if (!rte_dev_is_probed(dev)) {
+			if (req->t == EAL_DEV_REQ_TYPE_ATTACH_ROLLBACK) {
+				/**
+				 * Don't fail the rollback just because there's
+				 * nothing to do.
+				 */
+				ret = 0;
+			} else
+				ret = -ENODEV;
+
+			goto quit;
+		}
+
 		ret = local_dev_remove(dev);
 quit:
 		free(da->args);
-- 
2.17.1

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

* Re: [dpdk-dev] [PATCH] dev: don't try to rollback a device attach that failed
  2018-11-21 19:05 [dpdk-dev] [PATCH] dev: don't try to rollback a device attach that failed Darek Stojaczyk
@ 2018-11-25 12:10 ` Thomas Monjalon
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Monjalon @ 2018-11-25 12:10 UTC (permalink / raw)
  To: Darek Stojaczyk; +Cc: dev, qi.z.zhang

21/11/2018 20:05, Darek Stojaczyk:
> If a device fails to attach before it's plugged,
> the subsequent rollback will still try to detach it,
> causing a segfault. Unplugging a device that wasn't
> plugged isn't really supported, so this patch adds
> an extra error check to prevent that from happening.
> 
> While here, fix this also for normal (non-rollback)
> detach, which could also theoretically segfault on
> non-plugged device.
> 
> Fixes: 244d5130719c ("eal: enable hotplug on multi-process")
> Cc: qi.z.zhang@intel.com
> 
> Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>

Applied, thanks

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

end of thread, other threads:[~2018-11-25 12:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-21 19:05 [dpdk-dev] [PATCH] dev: don't try to rollback a device attach that failed Darek Stojaczyk
2018-11-25 12:10 ` Thomas Monjalon

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