From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <stable-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id A7CCBA00C5
	for <public@inbox.dpdk.org>; Wed, 29 Apr 2020 01:58:54 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 372DD1D695;
	Wed, 29 Apr 2020 01:58:52 +0200 (CEST)
Received: from mail-pf1-f196.google.com (mail-pf1-f196.google.com
 [209.85.210.196]) by dpdk.org (Postfix) with ESMTP id E4D811D65A
 for <stable@dpdk.org>; Wed, 29 Apr 2020 01:58:45 +0200 (CEST)
Received: by mail-pf1-f196.google.com with SMTP id r14so194407pfg.2
 for <stable@dpdk.org>; Tue, 28 Apr 2020 16:58:45 -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=i4HrqNdYQKW2eMiIs+/ojqLDAWLUXVYsTcXaZm1fIQ4Nh2BW50oMX9jvXNxgQbTC1g
 a0bFIkV8A2865IFMJZ2qvgDZRebobQVFqQONSjG++ZCRQ9g1bmaN0JWW7HG0Tc+O5aM6
 ylCmApfZ+w99lvmnMi780jWmCmqqSgz7aYX7+eZHx5/E2KWLV+98OERACKCetdP6KFjV
 5D7hekPqYdETQo/QuJ4rEcMwpfjoL/T9fh3EY/OwdpS+WGyehAQKlU6n0keHPgC0n38w
 icdCA18yyswuSX+HswcJVsp1iD/hkjYTWRq7GU1aKcAcj8LLTWEBOwn2w/FeGI4saVbo
 NgxA==
X-Gm-Message-State: AGi0PubMmRxcp07yHUqc8hXfhW0tCGNFQytGlYP0v5eDAvpOnoos0yth
 bXy1hkVkK1/KoZXrODr1f0zpzg==
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-stable] [PATCH v3 6/8] eal: vfio: cleanup the mp sync handle
X-BeenThere: stable@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches for DPDK stable branches <stable.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/stable>,
 <mailto:stable-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/stable/>
List-Post: <mailto:stable@dpdk.org>
List-Help: <mailto:stable-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/stable>,
 <mailto:stable-request@dpdk.org?subject=subscribe>
Errors-To: stable-bounces@dpdk.org
Sender: "stable" <stable-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