From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 8A8602B9D for ; Fri, 7 Dec 2018 21:30:10 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Dec 2018 12:30:09 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,327,1539673200"; d="scan'208";a="105775084" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by fmsmga007.fm.intel.com with ESMTP; 07 Dec 2018 12:30:09 -0800 Received: from HASMSX110.ger.corp.intel.com (10.184.198.28) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.408.0; Fri, 7 Dec 2018 12:30:09 -0800 Received: from hasmsx105.ger.corp.intel.com ([169.254.1.69]) by HASMSX110.ger.corp.intel.com ([169.254.6.76]) with mapi id 14.03.0415.000; Fri, 7 Dec 2018 22:30:05 +0200 From: "Stojaczyk, Dariusz" To: Kevin Traynor CC: "stable@dpdk.org" , "Howell, Seth" , "Burakov, Anatoly" Thread-Topic: [PATCH v2] malloc: notify primary process about hotplug in secondary Thread-Index: AQHUjmkBNuIYQYZ0bkaB4xjQSQuPXKVztdIw Date: Fri, 7 Dec 2018 20:30:04 +0000 Message-ID: References: <20181204170610.250124-1-seth.howell@intel.com> <20181207201042.372870-1-seth.howell@intel.com> In-Reply-To: <20181207201042.372870-1-seth.howell@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNjI2Yjc3NmEtYzNjNi00ZWE2LWJhNGYtZDg3ZDNiMzQwZjc5IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiK2pjSEU4bTYrcXFkbmFHcGV2SUp4WXhuVXpMMlwvWGVtK21BbVRcL3dDTk9YdkozVld1V2ZEQlFvVmRwRkIzbXE0In0= x-ctpclassification: CTP_NT x-originating-ip: [10.252.37.80] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-stable] [PATCH v2] malloc: notify primary process about hotplug in secondary 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, 07 Dec 2018 20:30:11 -0000 Hi Kevin, is the merge window for DPDK 18.08.1 and 18.05.2 still open? This= fix is critical for multi-process memory hotplug and you might want to pul= l it in. D. > -----Original Message----- > From: Howell, Seth > Sent: Friday, December 7, 2018 9:11 PM > To: Burakov, Anatoly > Cc: dev@dpdk.org; stable@dpdk.org; Howell, Seth > ; Stojaczyk, Dariusz > Subject: [PATCH v2] malloc: notify primary process about hotplug in > secondary >=20 > 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). >=20 > In the end we'll end up with memory event callbacks fired > in all the processes except the primary, which is a bug. >=20 > 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. >=20 > After this patch, a primary process fires memory event > callbacks before secondary processes start their > synchronizations - both for hotplug and hotremove. >=20 > Fixes: 07dcbfe0101f ("malloc: support multiprocess memory hotplug") >=20 > Signed-off-by: Seth Howell > Signed-off-by: Darek Stojaczyk > --- > lib/librte_eal/common/malloc_mp.c | 8 ++++++++ > 1 file changed, 8 insertions(+) >=20 > 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 > @@ -209,6 +209,8 @@ handle_alloc_request(const struct malloc_mp_req > *m, >=20 > map_addr =3D ms[0]->addr; >=20 > + 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 > * send an asynchronous request and exit this callback. > @@ -258,6 +260,9 @@ handle_request(const struct rte_mp_msg *msg, > const void *peer __rte_unused) > if (m->t =3D=3D REQ_TYPE_ALLOC) { > ret =3D handle_alloc_request(m, entry); > } else if (m->t =3D=3D REQ_TYPE_FREE) { > + eal_memalloc_mem_event_notify(RTE_MEM_EVENT_FREE, > + m->free_req.addr, m->free_req.len); > + > ret =3D malloc_heap_free_pages(m->free_req.addr, > m->free_req.len); > } else { > @@ -436,6 +441,9 @@ handle_sync_response(const struct rte_mp_msg > *request, > memset(&rb_msg, 0, sizeof(rb_msg)); >=20 > /* 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); >=20 > -- > 2.17.2