From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D26EDA0C4B; Sat, 13 Nov 2021 04:32:44 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 36DB84115C; Sat, 13 Nov 2021 04:32:23 +0100 (CET) Received: from mail-pg1-f171.google.com (mail-pg1-f171.google.com [209.85.215.171]) by mails.dpdk.org (Postfix) with ESMTP id D741F41145 for ; Sat, 13 Nov 2021 04:32:19 +0100 (CET) Received: by mail-pg1-f171.google.com with SMTP id b4so9572670pgh.10 for ; Fri, 12 Nov 2021 19:32:19 -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=Xkdr8Rlyj2aYG4UrTyAyl/56ikYir+2Z0k3LrjI+gAA=; b=X3ViCX2uVkcjU39IaicXsW6GV7gjLh0UvZX9ChkoUJxDhuk1R4bdcyDdcmnWKbCxfq 1i5paG10cwuuEPJlJHX8+FO3WlqS3toaD6doCUl38TT3WpQwJYsh4UuT2VJC5Ts/4RIS Tw5vBXMGxBzYghS1fDGQOjCcICx+ZACGDN9+KxT1whO6eIYWjz2iWmNQhjapsQAI/Sum hWE0Na0FIRiKfiA5PDey0KHEDRw/3iJc4FhB9Nax4MDt7iLQDbMgi15z2+a+MiEH0zTA 02Hw2PD2+XGbQ3Eaa/xHf40Kh/8O76r7GfvWc930m+xH2AHY+MtKq3dIUlfjtHsHYHG8 a+sg== 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=Xkdr8Rlyj2aYG4UrTyAyl/56ikYir+2Z0k3LrjI+gAA=; b=AIpkF6HHqpU+cggXwH3V9amBp1D2PFYyLkhHKXMR8FVsV8+7jcFk6sH6/hdOC772e4 bvO6kKMjxOlBl2/m62YK6Wx3VFlsoBgwz9fZ/HC5poik1SC6qXgGNdtrTAqr8g/RIfem ikQcX8PiZe7x97zyQgQoMVvqLESeOVO6wgy1pVFwZPvgXuPF+yil41C1sewmefIKt5pb F8LFtLMPrA7YcgaXTBckILSkLWvtmbG64iFMBe1AbIVTa6Cic63sbxDNlObJ2+ObC3bH uaV0vfAieZ+tfsE4UADTO8URAc/tQWed2AXAPJqIaHrCLqDRRH+6IMER9JuYbvmIJr9p 96gw== X-Gm-Message-State: AOAM530KOyaSTW/mOLbKe/oRv1qE8wEpUmPbnzXyR0bZVl7XoVdbgOHb tieNo1mh/jZXypqvb+4UXfUNF0fehR7uHg== X-Google-Smtp-Source: ABdhPJz9C7eJPyqXj8pCCLuc5lc9ODI/WUHzBiq0nZ7jB1mBppv8cAkowUivT55SMBEeKvwVuEFa1Q== X-Received: by 2002:a63:e457:: with SMTP id i23mr11908156pgk.347.1636774338751; Fri, 12 Nov 2021 19:32:18 -0800 (PST) Received: from hermes.local (204-195-33-123.wavecable.com. [204.195.33.123]) by smtp.gmail.com with ESMTPSA id b9sm5999596pgf.15.2021.11.12.19.32.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Nov 2021 19:32:18 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Anatoly Burakov , Dmitry Kozlyuk , Narcisa Ana Maria Vasile , Dmitry Malloy , Pallavi Kadam Subject: [PATCH v5 5/5] eal: malloc: cleanup mp resources Date: Fri, 12 Nov 2021 19:32:09 -0800 Message-Id: <20211113033209.341027-6-stephen@networkplumber.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211113033209.341027-1-stephen@networkplumber.org> References: <20200428235827.15383-1-stephen@networkplumber.org> <20211113033209.341027-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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org The mp action resources in malloc should be cleaned up via rte_eal_cleanup. Signed-off-by: Stephen Hemminger Acked-by: Anatoly Burakov --- lib/eal/common/malloc_heap.c | 6 ++++++ lib/eal/common/malloc_heap.h | 3 +++ lib/eal/common/malloc_mp.c | 12 ++++++++++++ lib/eal/common/malloc_mp.h | 3 +++ lib/eal/linux/eal.c | 1 + lib/eal/windows/eal_mp.c | 7 +++++++ 6 files changed, 32 insertions(+) diff --git a/lib/eal/common/malloc_heap.c b/lib/eal/common/malloc_heap.c index 55aad2711b39..666f770fbf6d 100644 --- a/lib/eal/common/malloc_heap.c +++ b/lib/eal/common/malloc_heap.c @@ -1403,3 +1403,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/eal/common/malloc_heap.h b/lib/eal/common/malloc_heap.h index 3a29d024b4ca..3b2fbc0aa059 100644 --- a/lib/eal/common/malloc_heap.h +++ b/lib/eal/common/malloc_heap.h @@ -85,4 +85,7 @@ malloc_socket_to_heap_id(unsigned int socket_id); int rte_eal_malloc_heap_init(void); +void +rte_eal_malloc_heap_cleanup(void); + #endif /* MALLOC_HEAP_H_ */ diff --git a/lib/eal/common/malloc_mp.c b/lib/eal/common/malloc_mp.c index 2e597a17a2f2..5f6f275b7859 100644 --- a/lib/eal/common/malloc_mp.c +++ b/lib/eal/common/malloc_mp.c @@ -806,3 +806,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/eal/common/malloc_mp.h b/lib/eal/common/malloc_mp.h index 0095062b72f2..c806f7beafe0 100644 --- a/lib/eal/common/malloc_mp.h +++ b/lib/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/eal/linux/eal.c b/lib/eal/linux/eal.c index 1a13a3474e38..ea663fe02b93 100644 --- a/lib/eal/linux/eal.c +++ b/lib/eal/linux/eal.c @@ -1371,6 +1371,7 @@ rte_eal_cleanup(void) /* after this point, any DPDK pointers will become dangling */ rte_eal_memory_detach(); eal_mp_dev_hotplug_cleanup(); + rte_eal_malloc_heap_cleanup(); rte_eal_alarm_cleanup(); rte_trace_save(); eal_trace_fini(); diff --git a/lib/eal/windows/eal_mp.c b/lib/eal/windows/eal_mp.c index f2fa9366f668..a9ebea1da257 100644 --- a/lib/eal/windows/eal_mp.c +++ b/lib/eal/windows/eal_mp.c @@ -87,6 +87,13 @@ register_mp_requests(void) return 0; } +void +register_mp_requests(void) +{ + /* Non-stub function succeeds if multi-process is not supported. */ + EAL_LOG_STUB(); +} + int request_to_primary(struct malloc_mp_req *req) { -- 2.30.2