From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id EFA4DA00BE; Wed, 29 Apr 2020 01:15:36 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id AF1101D66C; Wed, 29 Apr 2020 01:14:46 +0200 (CEST) Received: from mail-pl1-f194.google.com (mail-pl1-f194.google.com [209.85.214.194]) by dpdk.org (Postfix) with ESMTP id BC4DB1D649 for ; Wed, 29 Apr 2020 01:14:38 +0200 (CEST) Received: by mail-pl1-f194.google.com with SMTP id c21so95713plz.4 for ; Tue, 28 Apr 2020 16:14:38 -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=A0YsfnmAGAC8zy3k9FjyYg5Ott247hG2qGL4g4NcAAA=; b=fkAsILt5aXieO6i29pZZ2K7NRZkdAunuEcHxv0AbRdWVktvOmC7TI1jnA1DWDmvVPh SZotKXjtYljO1FvGN4avLEhFu262cUFHxNz7clxYND9kLM45z7yS6807MjtcdOtLVshH ILiKZ2APGAj0BtWyBykdOqH4Ez7Vs91FdYBf4xoto0M+dGVDcNBeH5aKTehaF4uW1EQf gsvSPKG1Zn45kDVd4tuTVLU7Pdl8YdV5fWpnKIJFLMcqpLCOiOvX8ZlWWCRUgjE4CkbM 8ZXURBDiJD+XhN5Okgu72iv/zSnKTG0M5yH2BDtidxn3vW92NanV82zHU1V2v7GUX+1S jePQ== 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=A0YsfnmAGAC8zy3k9FjyYg5Ott247hG2qGL4g4NcAAA=; b=H9pYpjTznf0G4HUWPLmFJL3uV4gHXq1odmVs+AkQlADYjSsNgj4fomXXKcL+uDEuam e1aNQBJbzyxozNDFrvKbpt2SaiArAoDCppFIAXIB61MkVq7zJkWHe6sbQxTDPt0DZanN 8/UiuNUOu7Lfk0rRIaXVBCMeSxrsTc1vPWrdH35TkWLgYp/sdoV+XSAP5S0P2qZfQubd 2aT0ndGu633eo0in8LRi6tfFJSL9g+/Jz0j3pu+U+NlSU9r6ewukUCiy/uO9eehQArgZ 45BxVAF9PgXkXnLV0g3yU9ZU+8kyQIMBdIJCvexT+Pjr8XvpmwslhN1EfJrX4Ek/V3l3 PerA== X-Gm-Message-State: AGi0PubrN4MJPniupGnMF6TnjmrCplg5Wm5iM5fA0iDXYhXPVLht/vC9 6OTnKxkFQqwfPnMnwiNw6CpM6KEpaFoukA== X-Google-Smtp-Source: APiQypJ4LxrSTmtIhYypX7eIahm9cbbK9lqWd0wyJbAkoLmUaOF0S77nLOghT9iBhWNNt/nunZ79KQ== X-Received: by 2002:a17:902:6b0a:: with SMTP id o10mr30523609plk.32.1588115677450; Tue, 28 Apr 2020 16:14:37 -0700 (PDT) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id l64sm3230454pjb.44.2020.04.28.16.14.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Apr 2020 16:14:36 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Anatoly Burakov Date: Tue, 28 Apr 2020 16:14:15 -0700 Message-Id: <20200428231415.17985-9-stephen@networkplumber.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200428231415.17985-1-stephen@networkplumber.org> References: <20200104013341.19809-1-stephen@networkplumber.org> <20200428231415.17985-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2 8/8] eal: malloc: cleanup mp resources X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The mp action resources in malloc should be cleaned up via rte_eal_cleanup. Signed-off-by: Stephen Hemminger Acked-by: Anatoly Burakov --- lib/librte_eal/common/malloc_heap.c | 6 ++++++ lib/librte_eal/common/malloc_heap.h | 3 +++ lib/librte_eal/common/malloc_mp.c | 12 ++++++++++++ lib/librte_eal/common/malloc_mp.h | 3 +++ lib/librte_eal/linux/eal.c | 1 + 5 files changed, 25 insertions(+) diff --git a/lib/librte_eal/common/malloc_heap.c b/lib/librte_eal/common/malloc_heap.c index 842eb9de75a1..13c673f363a9 100644 --- a/lib/librte_eal/common/malloc_heap.c +++ b/lib/librte_eal/common/malloc_heap.c @@ -1362,3 +1362,9 @@ rte_eal_malloc_heap_init(void) /* add all IOVA-contiguous areas to the heap */ return rte_memseg_contig_walk(malloc_add_seg, NULL); } + +void +rte_eal_malloc_heap_cleanup(void) +{ + unregister_mp_requests(); +} diff --git a/lib/librte_eal/common/malloc_heap.h b/lib/librte_eal/common/malloc_heap.h index 772736b53f3c..ffad1b61e246 100644 --- a/lib/librte_eal/common/malloc_heap.h +++ b/lib/librte_eal/common/malloc_heap.h @@ -100,6 +100,9 @@ malloc_socket_to_heap_id(unsigned int socket_id); int rte_eal_malloc_heap_init(void); +void +rte_eal_malloc_heap_cleanup(void); + #ifdef __cplusplus } #endif diff --git a/lib/librte_eal/common/malloc_mp.c b/lib/librte_eal/common/malloc_mp.c index 1f212f834993..a9a9e8a45221 100644 --- a/lib/librte_eal/common/malloc_mp.c +++ b/lib/librte_eal/common/malloc_mp.c @@ -749,3 +749,15 @@ register_mp_requests(void) } return 0; } + +void +unregister_mp_requests(void) +{ + if (rte_eal_process_type() == RTE_PROC_PRIMARY) { + rte_mp_action_unregister(MP_ACTION_REQUEST); + } else { + rte_mp_action_unregister(MP_ACTION_SYNC); + rte_mp_action_unregister(MP_ACTION_ROLLBACK); + rte_mp_action_unregister(MP_ACTION_RESPONSE); + } +} diff --git a/lib/librte_eal/common/malloc_mp.h b/lib/librte_eal/common/malloc_mp.h index 2b86b76f6848..fb3d18c4e458 100644 --- a/lib/librte_eal/common/malloc_mp.h +++ b/lib/librte_eal/common/malloc_mp.h @@ -63,6 +63,9 @@ struct malloc_mp_req { int register_mp_requests(void); +void +unregister_mp_requests(void); + int request_to_primary(struct malloc_mp_req *req); diff --git a/lib/librte_eal/linux/eal.c b/lib/librte_eal/linux/eal.c index ffb0678b864a..abd478c9ceb0 100644 --- a/lib/librte_eal/linux/eal.c +++ b/lib/librte_eal/linux/eal.c @@ -1351,6 +1351,7 @@ rte_eal_cleanup(void) #endif rte_eal_alarm_cleanup(); eal_mp_dev_hotplug_cleanup(); + rte_eal_malloc_heap_cleanup(); rte_mp_channel_cleanup(); rte_trace_save(); eal_trace_fini(); -- 2.20.1