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 B2414A0350; Tue, 30 Jun 2020 11:42:19 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id DF9EB1BEA3; Tue, 30 Jun 2020 11:42:18 +0200 (CEST) Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) by dpdk.org (Postfix) with ESMTP id 1F5881023 for ; Tue, 30 Jun 2020 11:42:18 +0200 (CEST) Received: by mail-wm1-f66.google.com with SMTP id j18so18155940wmi.3 for ; Tue, 30 Jun 2020 02:42:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=tv23aXNoZ0B3f9tMVNimxQtTxKzHkc/ZqAmGidpsUTc=; b=BU4zA00RVeEGJkXMlYB20oC+zDLr1c5C4beInp4A8qn8L8AoMzoFnvqNMZ5Jowj2Xl UIZNClTmcY+XGhQqlpI4cEHN+IEyfjJVcPnz5O1X+QaAAbfyMI2skrSVzYqywdLzeVPp jqZsKAxQEyfRMSSOwFwu5ldPufqNEZAUgUDZ7ZgdOrlo7sBqZCLHG4YQKlabKj9hAJRZ A0PflnPxzZaqxSJfR9h861cy2dfqNTHENqi9ltogHsyT/8xGPWAp3/z03/WVphHlds9T V0JVb4OfIX6CZ/Li014hJTKAIHv4r4Dak0vohi72+k/ypK7a09ktRiKsc+WhpC4NVM0m zYnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=tv23aXNoZ0B3f9tMVNimxQtTxKzHkc/ZqAmGidpsUTc=; b=f6yMgy9J+SEsAOis0+IwIF/j1zozxmBsyZkBHu3PHRgkHyBGHH6EcjEapsmsN8iBEW dd+XowDH3wbxrBGPDO5dun2Z31KQaGb93AY+GuLindcQdUMJAzeTWCN6gWTF0Cqh5ds/ llXdpUAsJpRAEi4/aVhiYzYnUpjcq8r6Z1Ug0GT+1NILbemomPNqbXVqIrQgKlQPjgUB Kjle3u3JCdyf7YPFzfI78csL+CMLGLfiqfgs9iwIF7RPcfIdjoqmFcQgdgeybOMlhEyO TZih0yxd31mnZORirFywdabWRgcQLHbgY0YMYCCKXov9KUZ+P/sdw1BKszLyqaLL7rJZ Pb9A== X-Gm-Message-State: AOAM531JoSznrZN3iGb3EpJkm7+JBqbj9VT/H3mlAlI27zv8UHPfkl++ Xwef14AdfwikYtp2EzHKxYhWdw== X-Google-Smtp-Source: ABdhPJwjZR54U2Xz+XVP4AziKlMzVEnzfGPeROq+/gkO557gotSm8yispkfE7HorHh16XSDg+ZnPfA== X-Received: by 2002:a1c:ab56:: with SMTP id u83mr20206917wme.94.1593510137737; Tue, 30 Jun 2020 02:42:17 -0700 (PDT) Received: from 6wind.com (2a01cb0c0005a600345636f7e65ed1a0.ipv6.abo.wanadoo.fr. [2a01:cb0c:5:a600:3456:36f7:e65e:d1a0]) by smtp.gmail.com with ESMTPSA id b62sm2846661wmh.38.2020.06.30.02.42.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jun 2020 02:42:17 -0700 (PDT) Date: Tue, 30 Jun 2020 11:42:16 +0200 From: Olivier Matz To: David Marchand Cc: dev@dpdk.org, jerinjacobk@gmail.com, bruce.richardson@intel.com, mdr@ashroe.eu, thomas@monjalon.net, arybchenko@solarflare.com, ktraynor@redhat.com, ian.stokes@intel.com, i.maximets@ovn.org, Jerin Jacob , Sunil Kumar Kori , Neil Horman , Harini Ramakrishnan , Omar Cardona , Pallavi Kadam , Ranjit Menon Message-ID: <20200630094216.GD5869@platinum> References: <20200610144506.30505-1-david.marchand@redhat.com> <20200626144736.11011-1-david.marchand@redhat.com> <20200626144736.11011-5-david.marchand@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200626144736.11011-5-david.marchand@redhat.com> User-Agent: Mutt/1.10.1 (2018-07-13) Subject: Re: [dpdk-dev] [PATCH v4 4/9] eal: introduce thread uninit helper 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" On Fri, Jun 26, 2020 at 04:47:31PM +0200, David Marchand wrote: > This is a preparation step for dynamically unregistering threads. > > Since we explicitly allocate a per thread trace buffer in > rte_thread_init, add an internal helper to free this buffer. > > Signed-off-by: David Marchand > --- > Note: I preferred renaming the current internal function to free all > threads trace buffers (new name trace_mem_free()) and reuse the previous > name (trace_mem_per_thread_free()) when freeing this buffer for a given > thread. > > Changes since v2: > - added missing stub for windows tracing support, > - moved free symbol to exported (experimental) ABI as a counterpart of > the alloc symbol we already had, > > Changes since v1: > - rebased on master, removed Windows workaround wrt traces support, > > --- > lib/librte_eal/common/eal_common_thread.c | 9 ++++ > lib/librte_eal/common/eal_common_trace.c | 51 +++++++++++++++++++---- > lib/librte_eal/common/eal_thread.h | 5 +++ > lib/librte_eal/common/eal_trace.h | 2 +- > lib/librte_eal/include/rte_trace_point.h | 9 ++++ > lib/librte_eal/rte_eal_version.map | 3 ++ > lib/librte_eal/windows/eal.c | 5 +++ > 7 files changed, 75 insertions(+), 9 deletions(-) [...] > diff --git a/lib/librte_eal/common/eal_common_trace.c b/lib/librte_eal/common/eal_common_trace.c > index 875553d7e5..3e620d76ed 100644 > --- a/lib/librte_eal/common/eal_common_trace.c > +++ b/lib/librte_eal/common/eal_common_trace.c > @@ -101,7 +101,7 @@ eal_trace_fini(void) > { > if (!rte_trace_is_enabled()) > return; > - trace_mem_per_thread_free(); > + trace_mem_free(); > trace_metadata_destroy(); > eal_trace_args_free(); > } > @@ -370,24 +370,59 @@ __rte_trace_mem_per_thread_alloc(void) > rte_spinlock_unlock(&trace->lock); > } > > +static void > +trace_mem_per_thread_free_unlocked(struct thread_mem_meta *meta) > +{ > + if (meta->area == TRACE_AREA_HUGEPAGE) > + eal_free_no_trace(meta->mem); > + else if (meta->area == TRACE_AREA_HEAP) > + free(meta->mem); > +} > + > +void > +__rte_trace_mem_per_thread_free(void) > +{ > + struct trace *trace = trace_obj_get(); > + struct __rte_trace_header *header; > + uint32_t count; > + > + if (RTE_PER_LCORE(trace_mem) == NULL) > + return; > + > + header = RTE_PER_LCORE(trace_mem); nit: header = RTE_PER_LCORE(trace_mem); if (header == NULL) return; [...] > diff --git a/lib/librte_eal/include/rte_trace_point.h b/lib/librte_eal/include/rte_trace_point.h > index 377c2414aa..686b86fdb1 100644 > --- a/lib/librte_eal/include/rte_trace_point.h > +++ b/lib/librte_eal/include/rte_trace_point.h > @@ -230,6 +230,15 @@ __rte_trace_point_fp_is_enabled(void) > __rte_experimental > void __rte_trace_mem_per_thread_alloc(void); > > +/** > + * @internal > + * > + * Free trace memory buffer per thread. > + * > + */ > +__rte_experimental > +void __rte_trace_mem_per_thread_free(void); Maybe the doc comment could be reworded a bit (and the empty line can be removed by the way). > + > /** > * @internal > * > diff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map > index 0d42d44ce9..5831eea4b0 100644 > --- a/lib/librte_eal/rte_eal_version.map > +++ b/lib/librte_eal/rte_eal_version.map > @@ -393,6 +393,9 @@ EXPERIMENTAL { > rte_trace_point_lookup; > rte_trace_regexp; > rte_trace_save; > + > + # added in 20.08 > + __rte_trace_mem_per_thread_free; Is it really needed to export this function?