From mboxrd@z Thu Jan 1 00:00:00 1970 From: Remy Horton Subject: Re: [RFC PATCH v2 2/3] lib: add bitrate statistics library Date: Fri, 28 Oct 2016 15:48:09 +0800 Message-ID: <2c015478-086e-4149-58ca-2b963075eb7a@intel.com> References: <1477616671-9547-1-git-send-email-remy.horton@intel.com> <1477616671-9547-3-git-send-email-remy.horton@intel.com> <20161027181220.752e90ea@xeon-e3> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Cc: dev@dpdk.org To: Stephen Hemminger Return-path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 462C2326B for ; Fri, 28 Oct 2016 09:48:11 +0200 (CEST) In-Reply-To: <20161027181220.752e90ea@xeon-e3> 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 28/10/2016 09:12, Stephen Hemminger wrote: > On Fri, 28 Oct 2016 09:04:30 +0800 > Remy Horton wrote: > >> + >> +struct rte_stats_bitrate_s { >> + uint64_t last_ibytes; >> + uint64_t last_obytes; >> + uint64_t peak_ibits; >> + uint64_t peak_obits; >> + uint64_t ewma_ibits; >> + uint64_t ewma_obits; >> +}; >> + > > Reader/write access of 64 bit values is not safe on 32 bit platforms. > I think you need to add a generation counter (see Linux kernel syncp) > to handle 32 bit architecture. If done correctly, it would be a nop > on 64 bit platforms. I don't see a problem since this is private persistent data that is only read/written from rte_stats_bitrate_calc(), and once calculated it pushes them into the metrics library using rte_metrics_update_metrics(). The idea is that downstream consumers get the values using rte_metrics_get_values() rather than reading rte_stats_bitrate_s directly. Having said that, what you mention quite likley affects the metrics library itself.. :)