From patchwork Sat Jan 4 01:33:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 64211 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4A3F6A04DD; Sat, 4 Jan 2020 02:35:57 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2EC4B1D57E; Sat, 4 Jan 2020 02:34:18 +0100 (CET) Received: from mail-pl1-f196.google.com (mail-pl1-f196.google.com [209.85.214.196]) by dpdk.org (Postfix) with ESMTP id 546661D556 for ; Sat, 4 Jan 2020 02:34:09 +0100 (CET) Received: by mail-pl1-f196.google.com with SMTP id a6so18895876plm.3 for ; Fri, 03 Jan 2020 17:34:09 -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=zUaUfoxGHH+ys9CECpeiQUF0L2MGdSRHCXxhmb6J+TY=; b=OcsjPhXiinKARjDHxw9fnSpEpA7+sJLm579e/fa16PzGgF5vZH2F/+qwuTNsU2sN0b sRVRWMzlOd5PZB0MWjf1HB0KgSWWoNiVAPAYqyP0lbTs0wtPKCs4XfD1FhkhZ+v8mrdJ YIAS/uh+5kwj5l5AyKwjEDzIpZNKdNGrnCv++D78JtiNqsGZ/PL6GML7pYJPJ2D+rLVk Ekgsb7CVJidbFFr+s8G7CId3Lyxn7q5KkhqKE2RUQDo6xX5As/j1unA39bPN0OfIaljK 8MCDHOzg32zZy545uh9NFlFbRd91gJMWsddjUpenklZIeVASLzpGnzSACn4AfYhJ2Jrb Ibwg== 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=zUaUfoxGHH+ys9CECpeiQUF0L2MGdSRHCXxhmb6J+TY=; b=m4OLbBZMvTnvYtUh/euYOpn/lQ9eDFiMZkfM1qiiJ/EqH6MMQCrEE+yKU2+eF2eV3Y 4KJeWT9TR6+/4XngskYc7Ib1nKtiMBkiPjGeT3YiYMBYef/lXUObfZX3s/20Y3teYLXp Zk17csnTlTVNuZ7Ogcv0nxyyUdFt0LBpclDdGBgZqlWWry6tC+5tJogdm22ja0jnZBL9 GcpJB3hZTuS9m5CmCR+GGV22IOIr0esKg6I3J1zMBT9HyGOomKhgxFiYVXLzcCDsYCFs d5yZUxcs0ZgM28RE1AfpZxxvtdcvyIav5xKur8EZSZMYzrA+x2vNLXD8NRfSzK1q7QuW ajRg== X-Gm-Message-State: APjAAAVicP/mplCbaJNLKoy6/Hxr21MFlPqo0ROGDpMggKt9PZiXxVLl Mzj99NRyvpB3PeLXrvxdiFgjWTFd49w= X-Google-Smtp-Source: APXvYqxc+7ZNGnm7jemvuUPOzkaGIV+OYsX745XAJ3LuI/8f9NWRKQO5HIOO9aULjEkqZ/apU20QSQ== X-Received: by 2002:a17:902:b901:: with SMTP id bf1mr94118872plb.283.1578101648112; Fri, 03 Jan 2020 17:34:08 -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.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jan 2020 17:34:07 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Date: Fri, 3 Jan 2020 17:33:41 -0800 Message-Id: <20200104013341.19809-15-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 Subject: [dpdk-dev] [PATCH 14/14] 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/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/eal.c b/lib/librte_eal/linux/eal/eal.c index ef04defbeaa4..c660f6fac3f2 100644 --- a/lib/librte_eal/linux/eal/eal.c +++ b/lib/librte_eal/linux/eal/eal.c @@ -1344,6 +1344,7 @@ rte_eal_cleanup(void) rte_eal_intr_cleanup(); rte_eal_alarm_cleanup(); eal_mp_dev_hotplug_cleanup(); + rte_eal_malloc_heap_cleanup(); rte_mp_channel_cleanup(); eal_plugins_cleanup(); eal_cleanup_config(&internal_config);