Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1801142ybl; Sat, 31 Aug 2019 02:31:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqwyuCr5uydL5nbXaVPNuDnLvxGt0vESPuzY9mjCqXq9Np17TW3y9Y6Oaz3OcDqDdeujJTBu X-Received: by 2002:a17:902:7616:: with SMTP id k22mr19859801pll.315.1567243874110; Sat, 31 Aug 2019 02:31:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567243874; cv=none; d=google.com; s=arc-20160816; b=nh3pYFEiU82Jnnp1fHuvG21Nzp3tCrogWRaNwQP+tx96uvHAgJS/gPv+EvufEiE/iT cATUUV1pxweAkMG2duU5vRyY/P+PZrQX9L6G7WWweyQgcZHCXsjPZuQ4RNHiFr2XDn6U 0QQ7gVnrTKLJkgj3OA+w9ZfOjw0poF+HAIgWDExKFYdjqZfbh0XiQVbWz/eVQfTPezC5 dRjdThJJFOzCPmz+e8ZDA5jOGsKmALLF+7nFOrdik32CAQcN3+Nsufv1ucpBJocXTbOo lRmXXcSeP5GXY7hOBeYtwmHI/jhBO4zcsP2Ef9WXWUzo+h/sVBPECagKdAdzbq0BDlKt hjMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=KmR/c4ArTiru3qyk+20TYV+nkGr/yqWbxKniMkdJ5RQ=; b=mh0XEyqUY28q5rhjNZ2j4VCB68ArdWzSZ98ES8ryM7GThH96GAOLMUu7E4J1W5WSHi GIKaEtYvJtSTXzxAgKppQuRZYJdJJL3yLhW65dNWrAWBUX4K4kPlaooOIaAz2I6HUIqL M7nrNUnOr2J5xzTYpeb9Cy5cm0+ng0xOpSwEMbp9vEa3QG3EexYeTalUcItSmVHaftDc mM8Ptc//qyFuwM8qAdcH1jPuAT94jyXqZYigE7WEIrttmUCi9DtGXJqaoip2G65ihOMV flvUsh5YoGdn/6GK8X/3aMYq7AbBgfXjHRFJ0SeUAbhh633Ree8c/+FSLUa1gAXCzH3s whFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=Z5GopLAK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a26si6483246pgb.276.2019.08.31.02.30.57; Sat, 31 Aug 2019 02:31:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=Z5GopLAK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726354AbfHaJ32 (ORCPT + 99 others); Sat, 31 Aug 2019 05:29:28 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:41068 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726184AbfHaJ32 (ORCPT ); Sat, 31 Aug 2019 05:29:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=KmR/c4ArTiru3qyk+20TYV+nkGr/yqWbxKniMkdJ5RQ=; b=Z5GopLAK//pWlmGZC0W1UOjiM Q8o7ry9QSbPDGazdsuNAy0nl7ihSFMqZQcjds4bMS2mdw/meSo+bzAgQxHW7I/sK5VPZIJbbRnps6 TxvovqVkyTmvE9KEiC/cs0FCXMF4v+9LCYIFZSXuTe9uvS8aCHEzwtBPK8bikCGPN4iZrosrvemKH U5TifBQzUyt0LrQc8WdQczV+emqbFC/+3aqPiEz6pA9l7Yg5u60dQTzqtT4rS3jjRMlqQgB0z7vWC lACy0RJTvfehGz/91ri+DNlJGg0zwNXP0nPhzLcMska/y18yST1iySUHebhcJvVXBxwfUn7oLTy/s AKy0+s8lQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1i3zhD-0004WD-Mj; Sat, 31 Aug 2019 09:29:23 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 0E794300B8D; Sat, 31 Aug 2019 11:28:47 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id ED7C729B2CD2F; Sat, 31 Aug 2019 11:29:21 +0200 (CEST) Date: Sat, 31 Aug 2019 11:29:21 +0200 From: Peter Zijlstra To: Stephane Eranian Cc: Andi Kleen , "Liang, Kan" , Arnaldo Carvalho de Melo , Ingo Molnar , LKML , Thomas Gleixner , Jiri Olsa , Alexander Shishkin Subject: Re: [RESEND PATCH V3 3/8] perf/x86/intel: Support hardware TopDown metrics Message-ID: <20190831092921.GK2369@hirez.programming.kicks-ass.net> References: <20190826144740.10163-1-kan.liang@linux.intel.com> <20190826144740.10163-4-kan.liang@linux.intel.com> <20190831003110.GA5447@tassilo.jf.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Aug 31, 2019 at 02:13:05AM -0700, Stephane Eranian wrote: > With PERF_METRICS, the delta is always since previous read. If you read > frequently enough you do not lose precision. You always loose precision, the whole fraction of 255 looses the fractional part; consider: 255 * 1 / 8 31.87500000000000000000 255 * 7 / 8 223.12500000000000000000 31 * 8 / 255 .97254901960784313725 223 * 8 / 255 6.99607843137254901960 Now, we can make reconstruction use normal 'round-nearest' and then we'd get 1 and 7 back, but there's always cases where you loose things. Also, with 255 being an odd number, round-nearest is actually 'hard' :/