From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 98B691B490 for ; Fri, 4 Jan 2019 14:27:15 +0100 (CET) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E50708666F; Fri, 4 Jan 2019 13:27:14 +0000 (UTC) Received: from ktraynor.remote.csb (ovpn-117-13.ams2.redhat.com [10.36.117.13]) by smtp.corp.redhat.com (Postfix) with ESMTP id 579945C1A1; Fri, 4 Jan 2019 13:27:13 +0000 (UTC) From: Kevin Traynor To: Seth Howell Cc: Darek Stojaczyk , Anatoly Burakov , dpdk stable Date: Fri, 4 Jan 2019 13:24:13 +0000 Message-Id: <20190104132455.15170-31-ktraynor@redhat.com> In-Reply-To: <20190104132455.15170-1-ktraynor@redhat.com> References: <20190104132455.15170-1-ktraynor@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Fri, 04 Jan 2019 13:27:15 +0000 (UTC) Subject: [dpdk-stable] patch 'malloc: notify primary process about hotplug in secondary' has been queued to LTS release 18.11.1 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Jan 2019 13:27:16 -0000 Hi, FYI, your patch has been queued to LTS release 18.11.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 01/11/19. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Thanks. Kevin Traynor --- >>From 6d1a887d2e88ea5d46735d893e31ed8d247103c5 Mon Sep 17 00:00:00 2001 From: Seth Howell Date: Fri, 7 Dec 2018 13:10:42 -0700 Subject: [PATCH] malloc: notify primary process about hotplug in secondary [ upstream commit fba0ca227453ee6a60f674884531fb3817ca8a17 ] When secondary process hotplugs memory, it sends a request to primary, which then performs the real mmap() and sends sync requests to all secondary processes. Upon receiving such sync request, each secondary process will notify the upper layers of hotplugged memory (and will call all locally registered event callbacks). In the end we'll end up with memory event callbacks fired in all the processes except the primary, which is a bug. This gets critical if memory is hotplugged while a VFIO device is attached, as the VFIO memory registration - which is done from a memory event callback present in the primary process only - is never called. After this patch, a primary process fires memory event callbacks before secondary processes start their synchronizations - both for hotplug and hotremove. Fixes: 07dcbfe0101f ("malloc: support multiprocess memory hotplug") Signed-off-by: Seth Howell Signed-off-by: Darek Stojaczyk Reviewed-by: Anatoly Burakov --- lib/librte_eal/common/malloc_mp.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/librte_eal/common/malloc_mp.c b/lib/librte_eal/common/malloc_mp.c index 5f2d4e0be..f3a13353b 100644 --- a/lib/librte_eal/common/malloc_mp.c +++ b/lib/librte_eal/common/malloc_mp.c @@ -210,4 +210,6 @@ handle_alloc_request(const struct malloc_mp_req *m, map_addr = ms[0]->addr; + eal_memalloc_mem_event_notify(RTE_MEM_EVENT_ALLOC, map_addr, alloc_sz); + /* we have succeeded in allocating memory, but we still need to sync * with other processes. however, since DPDK IPC is single-threaded, we @@ -259,4 +261,7 @@ handle_request(const struct rte_mp_msg *msg, const void *peer __rte_unused) ret = handle_alloc_request(m, entry); } else if (m->t == REQ_TYPE_FREE) { + eal_memalloc_mem_event_notify(RTE_MEM_EVENT_FREE, + m->free_req.addr, m->free_req.len); + ret = malloc_heap_free_pages(m->free_req.addr, m->free_req.len); @@ -437,4 +442,7 @@ handle_sync_response(const struct rte_mp_msg *request, /* we've failed to sync, so do a rollback */ + eal_memalloc_mem_event_notify(RTE_MEM_EVENT_FREE, + state->map_addr, state->map_len); + rollback_expand_heap(state->ms, state->ms_len, state->elem, state->map_addr, state->map_len); -- 2.19.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2019-01-04 13:23:08.186953918 +0000 +++ 0031-malloc-notify-primary-process-about-hotplug-in-secon.patch 2019-01-04 13:23:07.000000000 +0000 @@ -1,8 +1,10 @@ -From fba0ca227453ee6a60f674884531fb3817ca8a17 Mon Sep 17 00:00:00 2001 +From 6d1a887d2e88ea5d46735d893e31ed8d247103c5 Mon Sep 17 00:00:00 2001 From: Seth Howell Date: Fri, 7 Dec 2018 13:10:42 -0700 Subject: [PATCH] malloc: notify primary process about hotplug in secondary +[ upstream commit fba0ca227453ee6a60f674884531fb3817ca8a17 ] + When secondary process hotplugs memory, it sends a request to primary, which then performs the real mmap() and sends sync requests to all secondary processes. Upon receiving @@ -23,7 +25,6 @@ synchronizations - both for hotplug and hotremove. Fixes: 07dcbfe0101f ("malloc: support multiprocess memory hotplug") -Cc: stable@dpdk.org Signed-off-by: Seth Howell Signed-off-by: Darek Stojaczyk