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 B5125A00BE;
	Wed, 29 Apr 2020 01:59:27 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 5490C1D699;
	Wed, 29 Apr 2020 01:58:52 +0200 (CEST)
Received: from mail-pg1-f195.google.com (mail-pg1-f195.google.com
 [209.85.215.195]) by dpdk.org (Postfix) with ESMTP id 5D8B51D67D
 for <dev@dpdk.org>; Wed, 29 Apr 2020 01:58:46 +0200 (CEST)
Received: by mail-pg1-f195.google.com with SMTP id o185so132612pgo.3
 for <dev@dpdk.org>; Tue, 28 Apr 2020 16:58:46 -0700 (PDT)
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=SRzQAEQ47xfzy39dnBWvcBVnmzaCA5jfKtlPrGxK+7U=;
 b=zC6DjJE23ykKOTZaRCWqh/qJ2RrGWoDqQNQq8ZUuIR+LiQ4HZsvA2OCLOepp5SII1F
 H0qtYc3NnkW1O1FCiGlkd0IOe5HN54IEemb/DqhG1LdSRl1IH6BLsaTemymJxdhVz45l
 hxDPcifwAzDlpvZwRAjVbuRvBMDn7s1Tw/uk1s8rZ/A9VHvG5IxiJkQi5wEEq1DYaKBL
 fbDY8EaikAczPFUvVad+ULpa7VLe3aydRF2HkJb99TpI+BpOXjTtsur9up6Prc92kLyK
 C5lB086pMAdQheNois+RricgzbzDJ5iTOQ1b9JI0WfzCsRVgCIGgDbx5KvUFqZw0hJTx
 cvLQ==
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=SRzQAEQ47xfzy39dnBWvcBVnmzaCA5jfKtlPrGxK+7U=;
 b=llhQBS7vnFS6ImpaHiGYsflZf5oWD0pQ+n6Ev52orE94FLJbMgAhe4F+3j+Dk/16Dq
 5BFoKm3+HvBgc7UU3nwMnnValH140MtOXd8kVwAMxcKYMe3quNkLFFWRL1D6H0wAsVxc
 irKbANpNeI7VaXm2OA5JknsGQaYTEB4oVN6r8SYIGAyUTnIQnp0cq/ceTEG6iJuc9tm9
 E1I9Jmyp0I7p6QtG0q9TmimuT/XA5XO09VPie0XbP4IyYH+ww3ASqK8TPtr8jvGMDiLY
 PTcn0mzce7wDFVVHeKpF9N+GD7UGnk0Dtdi/aR563Sl11o0qOPKrmV+cy+/MSZhtmkrY
 kpdg==
X-Gm-Message-State: AGi0PuZU+2c0HaEl2bluzPDO5dsylgLr3gROKBYa3nCVg+SBsC8rOMZf
 J+GUrd1AiQiz6MIVfi1aJ/K4Rx6VoztmVg==
X-Google-Smtp-Source: APiQypKZT2dG3rkAQP45pfmXD/OMT+M2X1Tz4XnyBlJJ9SMPBDH0HvdRu/rcr67t8hXI3hDXmkUFfA==
X-Received: by 2002:aa7:9f48:: with SMTP id h8mr31923984pfr.147.1588118325108; 
 Tue, 28 Apr 2020 16:58:45 -0700 (PDT)
Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127])
 by smtp.gmail.com with ESMTPSA id h193sm16209471pfe.30.2020.04.28.16.58.43
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 28 Apr 2020 16:58:44 -0700 (PDT)
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>, anatoly.burakov@intel.com,
 stable@dpdk.org
Date: Tue, 28 Apr 2020 16:58:25 -0700
Message-Id: <20200428235827.15383-7-stephen@networkplumber.org>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20200428235827.15383-1-stephen@networkplumber.org>
References: <20200104013341.19809-1-stephen@networkplumber.org>
 <20200428235827.15383-1-stephen@networkplumber.org>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Subject: [dpdk-dev] [PATCH v3 6/8] eal: vfio: cleanup the mp sync handle
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 the rte_mp_action for VFIO
should be freed.

Fixes: edf73dd33072 ("ipc: handle unsupported IPC in action register")
Cc: anatoly.burakov@intel.com
Cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 lib/librte_eal/linux/eal.c              | 3 +++
 lib/librte_eal/linux/eal_vfio.h         | 1 +
 lib/librte_eal/linux/eal_vfio_mp_sync.c | 8 ++++++++
 3 files changed, 12 insertions(+)

diff --git a/lib/librte_eal/linux/eal.c b/lib/librte_eal/linux/eal.c
index 27b768b15c4a..7c56dbf49508 100644
--- a/lib/librte_eal/linux/eal.c
+++ b/lib/librte_eal/linux/eal.c
@@ -1346,6 +1346,9 @@ rte_eal_cleanup(void)
 	}
 
 	rte_service_finalize();
+#ifdef VFIO_PRESENT
+	vfio_mp_sync_cleanup();
+#endif
 	rte_eal_alarm_cleanup();
 	rte_mp_channel_cleanup();
 	rte_trace_save();
diff --git a/lib/librte_eal/linux/eal_vfio.h b/lib/librte_eal/linux/eal_vfio.h
index cb2d35fb1206..bf7408a897a7 100644
--- a/lib/librte_eal/linux/eal_vfio.h
+++ b/lib/librte_eal/linux/eal_vfio.h
@@ -132,6 +132,7 @@ int
 vfio_has_supported_extensions(int vfio_container_fd);
 
 int vfio_mp_sync_setup(void);
+void vfio_mp_sync_cleanup(void);
 
 #define EAL_VFIO_MP "eal_vfio_mp_sync"
 
diff --git a/lib/librte_eal/linux/eal_vfio_mp_sync.c b/lib/librte_eal/linux/eal_vfio_mp_sync.c
index 5f2a5fc1d94e..b8ae9c65892e 100644
--- a/lib/librte_eal/linux/eal_vfio_mp_sync.c
+++ b/lib/librte_eal/linux/eal_vfio_mp_sync.c
@@ -120,4 +120,12 @@ vfio_mp_sync_setup(void)
 	return 0;
 }
 
+void
+vfio_mp_sync_cleanup(void)
+{
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+		return;
+
+	rte_mp_action_unregister(EAL_VFIO_MP);
+}
 #endif
-- 
2.20.1