Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1304496ybl; Wed, 28 Aug 2019 12:36:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqxHAyY30ZD3ngG7fqNtJ3lz1twZNpjcd/BbUOaOnLNQ+HxBZniDZzK/zhsedY7cb1Uqr8T3 X-Received: by 2002:a17:902:968e:: with SMTP id n14mr5958400plp.312.1567020986434; Wed, 28 Aug 2019 12:36:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567020986; cv=none; d=google.com; s=arc-20160816; b=c5WOup7NPtkRIpxO7AyOJ+4fHyrGJeHauxkktZWu0dsQF7jqoqrjeLwvgZZQVrrDbr JsraCumP1UBgk3obkvO8fHZoy/essL/qknHO//fLt3LrqKjB9vgLYbAk7YMGev77hnj6 nCZ6kFm7UkU6bSJy7BfEH8p0VJYhrMGED4zgfyngT1jdpArV6KUDJ5BDHQql2g7zO1bl 5aWf00CrVkc69lpMAayoOVdSnP+fugsDCda2hoQ/f/PisrJed2DcWVBkvY0na9Sfs0k1 0goGN/6S1xhdvX29ZwtJVWe4Brf0dtbPLldolJ+SQlUGq9pG85a7KFyexhO85wkNx0g9 G4Qw== 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=P54KJvtgsydF2n1WkxH6PnoqBmfx1eF4wpz3wqDuH/A=; b=vTEBmzy6ONf/ZIFf6Hpd8/S+pWe0EbP/NWY5SBTBdaY1KtaI1aor3C88ivNqpp4GTw vesYQ3tmJ0kbnbJYT5NfA2cObsUrccDr6XxGECPDxCT4ezN6kK9QXukvVmQJ0UuBbgzG 7g7FBPD90+uJd/PtEADc+7Fb5YVMnd+nl6V7mwmCPhmB/4duPa5Rx1qRnLBuTpD/OqSm 7cMjqO9RjGEQmLi2Gdnr2UEXz7g1w+H4QclKlbnDvNPQllhMFuPnETZyfXDl2J0n8xwp mrV6Mt25XrVhKb1rGIf7sxvizK+UGvF+08oezHC5wP1E/8a31ny6H7ZodkxIj4TZgBAB 24cA== 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 t14si2680200ply.347.2019.08.28.12.36.09; Wed, 28 Aug 2019 12:36:26 -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 S1726657AbfH1TfF (ORCPT + 99 others); Wed, 28 Aug 2019 15:35:05 -0400 Received: from mga11.intel.com ([192.55.52.93]:11689 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726315AbfH1TfF (ORCPT ); Wed, 28 Aug 2019 15:35:05 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Aug 2019 12:35:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,442,1559545200"; d="scan'208";a="175025884" Received: from linux.intel.com ([10.54.29.200]) by orsmga008.jf.intel.com with ESMTP; 28 Aug 2019 12:35:04 -0700 Received: from [10.254.95.196] (kliang2-mobl.ccr.corp.intel.com [10.254.95.196]) (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 CA4BB580107; Wed, 28 Aug 2019 12:35:03 -0700 (PDT) Subject: Re: [RESEND PATCH V3 3/8] perf/x86/intel: Support hardware TopDown metrics To: Peter Zijlstra 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, ak@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> From: "Liang, Kan" Message-ID: <9e5f9292-9767-d17a-2223-37dff9e759c7@linux.intel.com> Date: Wed, 28 Aug 2019 15:35:02 -0400 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190828150238.GC17205@worktop.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/28/2019 11:02 AM, Peter Zijlstra wrote: >> Reset >> ====== >> >> The PERF_METRICS and Fixed counter 3 have to be reset for each read, >> because: >> - The 8bit metrics ratio values lose precision when the measurement >> period gets longer. > So it musn't be too hot, > >> - The PERF_METRICS may report wrong value if its delta was less than >> 1/255 of SLOTS (Fixed counter 3). The "delta" is actually for the internal counters. Sorry for the confusion. > it also musn't be too cold. But that leaves it unspecified what exactly > is the right range. > > IOW, you want a Goldilocks number of SLOTS. > >> Also, for counting, the -max_period is the initial value of the SLOTS. >> The huge initial value will definitely trigger the issue mentioned >> above. Force initial value as 0 for topdown and slots event counting. > But you just told us that 0 is wrong too (too cold). We set -max_period (0x8000 0000 0001) as initial value of FIXCTR3 for counting. But the internal counters probably starts counting from 0. PERF_METRICS is fraction of internal counters / FIXCTR3. So PERF_METRICS will never works. We have to make FIXCTR3 count from 0 as well. Thanks, Kan