From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 48B02A0032;
	Sat, 13 Nov 2021 18:23:25 +0100 (CET)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 1F29B41152;
	Sat, 13 Nov 2021 18:23:09 +0100 (CET)
Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com
 [209.85.214.169])
 by mails.dpdk.org (Postfix) with ESMTP id EDF4141141
 for <dev@dpdk.org>; Sat, 13 Nov 2021 18:23:05 +0100 (CET)
Received: by mail-pl1-f169.google.com with SMTP id t21so10973017plr.6
 for <dev@dpdk.org>; Sat, 13 Nov 2021 09:23:05 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=networkplumber-org.20210112.gappssmtp.com; s=20210112;
 h=from:to:cc:subject:date:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding;
 bh=iXB1LawRGPVXn8R02W+aV0pR1MKqhc8JED0X0sX0iDM=;
 b=fulBCFGFAGTUeZHWqwRw1YRl0Eoq9k5gu6GxGS7lpTxvNV6HD6Zo5ZuhbRSnAa10At
 K8hjDjzR6ZHI8UrTz1NvVQcoSxJGhmQfn9YyEL/4+HSAVc+HsSVmyO85h4b3DcGHjPuO
 Lj1Rq2hP4nHeLE1pYVVNgxzdvGliZ8mU6hKzdxBkY9nZsbRMNzm3nD37vGewtHYSutqi
 NmUo8k0G380e+bC86kdFnbrX5gR9z9huMZtBL59hOpk3RL6Q5qtoaEpQjFPdvyea7sT5
 WtwmD/zqQqUajJM8L6rmZ7Au7WUbeaLDG+qkLp2sIB9hoLUlm278GUESUPvqlnHcQQja
 zkcA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=iXB1LawRGPVXn8R02W+aV0pR1MKqhc8JED0X0sX0iDM=;
 b=HB9bDrIuR6vla/GZlO4dW9ggqnhJt4a6134FpOrzyoFLgopnaJxrtWSH1+J2gUrZVi
 Cq41lVpb1qi/mpgEMAtEez1b4LmsCgunTiyFLxV6zacvmuB9bx5gOSRvgzhQk5GFxP4y
 BDqqUT0aXVRPbwz3IzWsjf69wDM+ZDg5m38MMLbMKfpox9hyLAXbvgJuP9qu2Kv9N72r
 YEME/WOMW/nbLVKtirHSWrSyJ9qnPLVY6mA43O8XbhU+6DeebrRZ7S7N5dVCi4pwd70k
 E5ELR+5q2lMmBAUlA9B8jFGKkB+gdJaZwhObrbsGgo/MwZQr/2GqAKcWz/14d8mfnTZY
 Ru7A==
X-Gm-Message-State: AOAM533H+lLFY9/tvsoHh5VfyHuoTfSSQ/dc+L31AGZ/MUxLv/RcrOZ6
 61yNt6sbzFUmRVo11Dcone6FICvp12nLGQ==
X-Google-Smtp-Source: ABdhPJwLbnXC18HOrCpoOYXOD6wwwVn1xGYkfN4dmb8s7v5J1xc/7sMkaQiWHeSiRGySM0zPCodilQ==
X-Received: by 2002:a17:90b:1643:: with SMTP id
 il3mr46900815pjb.182.1636824184652; 
 Sat, 13 Nov 2021 09:23:04 -0800 (PST)
Received: from hermes.local (204-195-33-123.wavecable.com. [204.195.33.123])
 by smtp.gmail.com with ESMTPSA id u19sm9658370pfl.185.2021.11.13.09.23.03
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sat, 13 Nov 2021 09:23:04 -0800 (PST)
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>
Subject: [PATCH v6 4/5] eal: hotplug: cleanup multiprocess resources
Date: Sat, 13 Nov 2021 09:22:56 -0800
Message-Id: <20211113172257.6543-5-stephen@networkplumber.org>
X-Mailer: git-send-email 2.30.2
In-Reply-To: <20211113172257.6543-1-stephen@networkplumber.org>
References: <20200428235827.15383-1-stephen@networkplumber.org>
 <20211113172257.6543-1-stephen@networkplumber.org>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
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

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/eal/common/hotplug_mp.c | 5 +++++
 lib/eal/common/hotplug_mp.h | 6 ++++++
 lib/eal/linux/eal.c         | 1 +
 3 files changed, 12 insertions(+)

diff --git a/lib/eal/common/hotplug_mp.c b/lib/eal/common/hotplug_mp.c
index bf55056f59c0..bde0de196ef5 100644
--- a/lib/eal/common/hotplug_mp.c
+++ b/lib/eal/common/hotplug_mp.c
@@ -462,3 +462,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/eal/common/hotplug_mp.h b/lib/eal/common/hotplug_mp.h
index 8fcf9b52e24c..4848446c852d 100644
--- a/lib/eal/common/hotplug_mp.h
+++ b/lib/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/eal/linux/eal.c b/lib/eal/linux/eal.c
index ad8f130b509d..1a13a3474e38 100644
--- a/lib/eal/linux/eal.c
+++ b/lib/eal/linux/eal.c
@@ -1370,6 +1370,7 @@ rte_eal_cleanup(void)
 	rte_mp_channel_cleanup();
 	/* after this point, any DPDK pointers will become dangling */
 	rte_eal_memory_detach();
+	eal_mp_dev_hotplug_cleanup();
 	rte_eal_alarm_cleanup();
 	rte_trace_save();
 	eal_trace_fini();
-- 
2.30.2