From mboxrd@z Thu Jan 1 00:00:00 1970 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) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga105.fm.intel.com with ESMTP; 28 Oct 2016 00:48:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,556,1473145200"; d="scan'208";a="1077096933" Received: from rhorton-mobl.ger.corp.intel.com (HELO [10.239.204.237]) ([10.239.204.237]) by fmsmga002.fm.intel.com with ESMTP; 28 Oct 2016 00:48:09 -0700 To: Stephen Hemminger 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> From: Remy Horton Organization: Intel Shannon Limited Message-ID: <2c015478-086e-4149-58ca-2b963075eb7a@intel.com> Date: Fri, 28 Oct 2016 15:48:09 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: <20161027181220.752e90ea@xeon-e3> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Cc: dev@dpdk.org Subject: Re: [dpdk-dev] [RFC PATCH v2 2/3] lib: add bitrate statistics library 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: Fri, 28 Oct 2016 07:48:11 -0000 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.. :)