From mboxrd@z Thu Jan 1 00:00:00 1970 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) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP; 11 May 2016 09:39:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,608,1455004800"; d="scan'208";a="804056675" Received: from fyigit-mobl1.ger.corp.intel.com (HELO [10.237.220.154]) ([10.237.220.154]) by orsmga003.jf.intel.com with ESMTP; 11 May 2016 09:39:14 -0700 To: Olivier Matz , dev@dpdk.org, david.marchand@6wind.com References: <1462810416-6183-1-git-send-email-olivier.matz@6wind.com> Cc: Maxime Leroy From: Ferruh Yigit Message-ID: <57336031.7060509@intel.com> Date: Wed, 11 May 2016 17:39:13 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 MIME-Version: 1.0 In-Reply-To: <1462810416-6183-1-git-send-email-olivier.matz@6wind.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-dev] [PATCH] eal: fix log level/type retrieving on a standard pthread X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 May 2016 16:39:17 -0000 On 5/9/2016 5:13 PM, Olivier Matz wrote: > From: Maxime Leroy > > 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. > > 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. > > 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. > > 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(-) > > diff --git a/lib/librte_eal/common/eal_common_log.c b/lib/librte_eal/common/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 = 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