Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp5278267ybe; Tue, 10 Sep 2019 00:56:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqzMjeokn4DpHtjPVCe/61AFeFmj2UiGvPeKHHtTf2Wq3fModI65iVLnhwTHglfEXJvG3ozG X-Received: by 2002:a17:907:2161:: with SMTP id rl1mr22516038ejb.142.1568102177447; Tue, 10 Sep 2019 00:56:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568102177; cv=none; d=google.com; s=arc-20160816; b=EU9uL8rXba80ktXC2GMAgaEBrMzLYP2Hp96vgga2epb4gn3BEJsCkUSoBNdgzFe+Is 7T9KHtdXcB7wZ3oMYQ+sLS23HrwtmYlYLgX1/hR8R3bIhf9UqoZz0axqVLI+lO6yf3JQ m5G6r75Ecj8Yx089QMbv1dvT+C7DgvpDRAcUg7uLOZhBUM8MjEaNVMhoO7RNf1CHygYI UZrXrxI7tR4y/1FMY++H1IYasD15KbE2MngAohA6fvUYfIfNPOnDIujSgM5MuwVqjLs4 a5U/9YTV/awa6ULMm3GbPmPU1VY+Uk0FVNCoFIysC+YJ01BwAxaGLn0pjESei9WZ/ily A+Rg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=YOe7YToJPDcKmUgpQvi5Ot6J4aQsAl6CENdIYIMvv6A=; b=ZMEQAZfMJQd0bBerxrBv6v6kdn0lR9OegPYxDd6qGLWpHov80hdybgxKEMiDlJeBMu riW2qIRsM1KBK3PWRE+CGG7lhSXxTYTj2sYu8foQ2EJCr9A6GLohniQSTysl00pYQB+G o10jIikVBtQf5WVoxp39/zEfgJ20/hkhJgBtnYjjNNyGfR+fxhBork6c60hMbKR42SyV c/U8kUKnm8QpDDKe/UxA/+AbP211MxOt8K/G3ViwQLwcJQ3JHixEitbS6EpJl7M/oyvX BbTfdg0WnQ3ZnVMSXnshcoAKqUzdbdQLBUh44pyXAyQyMCaDbYxjo3z5/CTgqebXORx1 c9Iw== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id jx9si8549735ejb.218.2019.09.10.00.55.53; Tue, 10 Sep 2019 00:56:17 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730374AbfIINka (ORCPT + 99 others); Mon, 9 Sep 2019 09:40:30 -0400 Received: from mga14.intel.com ([192.55.52.115]:50293 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726698AbfIINk3 (ORCPT ); Mon, 9 Sep 2019 09:40:29 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Sep 2019 06:40:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,484,1559545200"; d="scan'208";a="191514217" Received: from linux.intel.com ([10.54.29.200]) by FMSMGA003.fm.intel.com with ESMTP; 09 Sep 2019 06:40:28 -0700 Received: from [10.251.7.109] (kliang2-mobl.ccr.corp.intel.com [10.251.7.109]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by linux.intel.com (Postfix) with ESMTPS id 581CF580522; Mon, 9 Sep 2019 06:40:27 -0700 (PDT) Subject: Re: [RESEND PATCH V3 3/8] perf/x86/intel: Support hardware TopDown metrics To: Peter Zijlstra , Andi Kleen Cc: acme@kernel.org, mingo@redhat.com, linux-kernel@vger.kernel.org, tglx@linutronix.de, jolsa@kernel.org, eranian@google.com, alexander.shishkin@linux.intel.com References: <20190826144740.10163-1-kan.liang@linux.intel.com> <20190826144740.10163-4-kan.liang@linux.intel.com> <20190828150238.GC17205@worktop.programming.kicks-ass.net> <20190828190445.GQ5447@tassilo.jf.intel.com> <20190831091931.GJ2369@hirez.programming.kicks-ass.net> From: "Liang, Kan" Message-ID: <9ec0a847-2b6b-3422-72bd-ac738f1c0d10@linux.intel.com> Date: Mon, 9 Sep 2019 09:40:26 -0400 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <20190831091931.GJ2369@hirez.programming.kicks-ass.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/31/2019 5:19 AM, Peter Zijlstra wrote: >>> Then there is no mucking about with that odd counter/metrics msr pair >>> reset nonsense. Becuase that really stinks. >> You have to write them to reset the internal counters. > But not for ever read, only on METRIC_OVF. The precision are lost if the counters were running much longer than the measured delta. We have to reset the counters after every read. For example, the worst case is: The previous reading was rounded up and the current reading is rounded down. The error of METRICS is 1/256 - 1/SLOTS, which is related to SLOTS. The error for each Topdown event is (1/256 - 1/SLOTS) * SLOTS. With the SLOTS increasing, the precision will get worse and worse. Therefor, we have to reset the counters periodically. Thanks, Kan