From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id E205BA04DD;
	Sat,  4 Jan 2020 02:35:49 +0100 (CET)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 670C21D579;
	Sat,  4 Jan 2020 02:34:16 +0100 (CET)
Received: from mail-pg1-f194.google.com (mail-pg1-f194.google.com
 [209.85.215.194]) by dpdk.org (Postfix) with ESMTP id 2150C1D556
 for <dev@dpdk.org>; Sat,  4 Jan 2020 02:34:08 +0100 (CET)
Received: by mail-pg1-f194.google.com with SMTP id b9so24133243pgk.12
 for <dev@dpdk.org>; Fri, 03 Jan 2020 17:34:08 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=networkplumber-org.20150623.gappssmtp.com; s=20150623;
 h=from:to:cc:subject:date:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding;
 bh=QQG5FyzbJ/i5NIOOidQ6T4VEeXPduNZODErhbfaJRh4=;
 b=0WGk7K5l77plyTfzAJRrXmsodUOY5g6EkDnYKK/Lvpud8QVG84nOvB6+CuobRml2K5
 bzfFmPdAsCoVyIFJFdj4YNyai8d3v9gPQzDVQ3UfMTx2hJ+rJp1Q0HWuIFDniS14H9RG
 o4ggYdybT2lfnnUZLoOGBgQpwZsjNUY03lx/2Reg90GyGq0Q2GyA5La9v6Nn0DjLoCB5
 ilEdK6Be8quT7DBcc4jEkbdNRimc5ddJO0RA/TdOmOgX9fzSi3uuF8DV1u7bpdxyyjST
 tEs/h1RB5ptb07P80drF9PguNjA+T2Oze3lOfOTqY1PaVbF/iKOOVP8r6FCEXXCIETjI
 Xzug==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=QQG5FyzbJ/i5NIOOidQ6T4VEeXPduNZODErhbfaJRh4=;
 b=tEILolCVUesFdKa3uBt3/k2K63Jd44S4Kok2hu0tYdotT99JkbsT+5yay7B6EDwakp
 G0iRXo2HemTn1hvp42kEMR7vhos9Z1TGxOaZF/oJVBbLTF30ih33CGT9zLZdAhT8UHsX
 kh4OZA7ABg3QweIXfN5eHsRpDwqdqtSiF243LuNGfh8g7enC5Yut+/LC4vTM1Wga9Zp3
 a1pFGdragkSNjMIABxO5+8iDAxF14Bl/yLZ1jZ4hBF3dJ+ACKq7NH4c3CZKjeB90ea3s
 WhfgOY4RN5DhAHrZDcyViw8oasJAC0eEMW7yFvQ/Re+0h2XBHUnJY4F+Kv33BsCq+mWy
 gvVQ==
X-Gm-Message-State: APjAAAWKM9WzOC3q4aTcOS0G/fdQ4vxRDaAwhKTyaTL3SPG5lfyllne3
 Q+yvXbQgLU8AQLEaQBuijoBN/7Mk9sA=
X-Google-Smtp-Source: APXvYqz8OEvGkSkDXCYv0OrIBSsNnTn0RhYqcdV2fIiuu/MoLltRuE1T47K3mbkabFkC/9VmdXihmg==
X-Received: by 2002:a63:753:: with SMTP id 80mr91742223pgh.95.1578101646893;
 Fri, 03 Jan 2020 17:34:06 -0800 (PST)
Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127])
 by smtp.gmail.com with ESMTPSA id j6sm16212934pjv.10.2020.01.03.17.34.05
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 03 Jan 2020 17:34:06 -0800 (PST)
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>
Date: Fri,  3 Jan 2020 17:33:40 -0800
Message-Id: <20200104013341.19809-14-stephen@networkplumber.org>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20200104013341.19809-1-stephen@networkplumber.org>
References: <20200104013341.19809-1-stephen@networkplumber.org>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Subject: [dpdk-dev] [PATCH 13/14] eal: hotplug: cleanup multiprocess
	resources
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

When rte_eal_cleanup is called, hotplug should unregister the
resources associated with the multi-process server.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/librte_eal/common/hotplug_mp.c | 5 +++++
 lib/librte_eal/common/hotplug_mp.h | 6 ++++++
 lib/librte_eal/linux/eal/eal.c     | 1 +
 3 files changed, 12 insertions(+)

diff --git a/lib/librte_eal/common/hotplug_mp.c b/lib/librte_eal/common/hotplug_mp.c
index ee791903b3b7..a390c01fd41c 100644
--- a/lib/librte_eal/common/hotplug_mp.c
+++ b/lib/librte_eal/common/hotplug_mp.c
@@ -463,3 +463,8 @@ int eal_mp_dev_hotplug_init(void)
 
 	return 0;
 }
+
+void eal_mp_dev_hotplug_cleanup(void)
+{
+	rte_mp_action_unregister(EAL_DEV_MP_ACTION_REQUEST);
+}
diff --git a/lib/librte_eal/common/hotplug_mp.h b/lib/librte_eal/common/hotplug_mp.h
index 8fcf9b52e24c..4848446c852d 100644
--- a/lib/librte_eal/common/hotplug_mp.h
+++ b/lib/librte_eal/common/hotplug_mp.h
@@ -37,6 +37,12 @@ struct eal_dev_mp_req {
 int
 eal_mp_dev_hotplug_init(void);
 
+/**
+ * Unregister all mp action callbacks for hotplug.
+ */
+void
+eal_mp_dev_hotplug_cleanup(void);
+
 /**
  * This is a synchronous wrapper for secondary process send
  * request to primary process, this is invoked when an attach
diff --git a/lib/librte_eal/linux/eal/eal.c b/lib/librte_eal/linux/eal/eal.c
index 9a00a3ed43ab..ef04defbeaa4 100644
--- a/lib/librte_eal/linux/eal/eal.c
+++ b/lib/librte_eal/linux/eal/eal.c
@@ -1343,6 +1343,7 @@ rte_eal_cleanup(void)
 #endif
 	rte_eal_intr_cleanup();
 	rte_eal_alarm_cleanup();
+	eal_mp_dev_hotplug_cleanup();
 	rte_mp_channel_cleanup();
 	eal_plugins_cleanup();
 	eal_cleanup_config(&internal_config);
-- 
2.20.1