From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ferruh Yigit Subject: Re: [PATCH] eal: fix log level/type retrieving on a standard pthread Date: Wed, 11 May 2016 17:39:13 +0100 Message-ID: <57336031.7060509@intel.com> References: <1462810416-6183-1-git-send-email-olivier.matz@6wind.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Cc: Maxime Leroy To: Olivier Matz , dev@dpdk.org, david.marchand@6wind.com Return-path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 6BFC95A8F for ; Wed, 11 May 2016 18:39:16 +0200 (CEST) In-Reply-To: <1462810416-6183-1-git-send-email-olivier.matz@6wind.com> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 5/9/2016 5:13 PM, Olivier Matz wrote: > From: Maxime Leroy >=20 > The functions rte_log_cur_msg_loglevel() and rte_log_cur_msg_logtype() > return the current log level/type for the message being processed. They > are used when implementing a user-defined logging stream. >=20 > The current log levels and types were stored in a table indexed by the > lcore_id, only returning a valid value for dataplane threads. Setting > and getting these values in a non dataplane thread was ignored, using > the global value instead. >=20 > To fix this issue, a per-thread variable could be used (with > RTE_DEFINE_PER_LCORE), allowing any pthread to set and retrieve its > current log level or type. >=20 > Signed-off-by: Maxime Leroy > Signed-off-by: Olivier Matz > --- > lib/librte_eal/common/eal_common_log.c | 25 +++++++------------------ > 1 file changed, 7 insertions(+), 18 deletions(-) >=20 > diff --git a/lib/librte_eal/common/eal_common_log.c b/lib/librte_eal/co= mmon/eal_common_log.c > index 64aa79f..9526095 100644 > --- a/lib/librte_eal/common/eal_common_log.c > +++ b/lib/librte_eal/common/eal_common_log.c > @@ -98,9 +98,10 @@ static int history_enabled =3D 1; > struct log_cur_msg { > uint32_t loglevel; /**< log level - see rte_log.h */ > uint32_t logtype; /**< log type - see rte_log.h */ > -} __rte_cache_aligned; Removing alignment seems not related the main purpose of the patch. Is this intentional? <...> I have tested with custom code, non-EAL thread have lcore_id value UINT32_MAX, which is > RTE_MAX_LCORE and rte_log_cur_msg_loglevel gives default log level as described in commit log. With this patch each thread gets its own log level. Reviewed-by: Ferruh Yigit