Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp2436354ioo; Sat, 28 May 2022 13:37:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx/m+vuB9QrmQ8NehvmVax+BV/OHxMUR+vSlP8uy4bLPgwjPJBY1VfRD3RFwLSc63YmbEoj X-Received: by 2002:a05:6a00:cc9:b0:518:c96f:5c8b with SMTP id b9-20020a056a000cc900b00518c96f5c8bmr24598202pfv.59.1653770278397; Sat, 28 May 2022 13:37:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653770278; cv=none; d=google.com; s=arc-20160816; b=b5fKnxiOEtkRy3XZ48Sw+YebyaYnU3ztyCGLmOropCFyZnrhCEyXn9HMjRfpcDhDSj O/sxloMCbb/74pwRy4ZChGJgENhViQC3ykr7EguztIy2Qw8LET5OGLG+4Ufg2Pur7zhl UcWO/eiEEXUAzYKbOan3qABSzohtwSnsxANx2Ro2+L1Cn/C0mNgASC3Hc5NO7RLoR31s tfojvFONuyLWpczkGU4ot1yTwHc05wgSJHeO9OcbPC3M19UrTenGGG6TKItfoIDbzP6a GwsSvxqEodFLBABQmL/mohDtG5iSXj473zeMgRswo5pw+m0mhUh6UFpPX1NoddT8G3Oh Vw3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=9k+k6LIeNkgXZYdCEMHBXVl97mSsV/SkvVikj+URneE=; b=z7mM/MdsRHwvLE6sYSNsfZJqaUgJ4rDXe7YDyNwW19WUdZ6nf8lkXZmeligLdMj8pd 7Czj/VReGEtU8hCWq3CeJoQDVMuB4mgFpKJnFB1a/1SMYsbzOUW+0WrwzFAT128Qru02 DMY8hleR8mlRcmBfB0bTp3vxmQLFJB/k256XmNcxGcUkGENtKwFDLNmguj0gUtvCZXI/ QpQ+OmMfOFL75wcwrhUuC8IWA/y1Y/uPE9xZszqlbkGVJ4ekinov1u3T2zAJrP+kkZ1U plzaZY2tu64GLFbL3dG4mqaGm/qVQii2KtaLqrmHIYZUdlOQEqP85nkwMgG3qXwUlvgW iFkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=O8U2oe3s; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id l15-20020a170902f68f00b0016224867873si11146757plg.477.2022.05.28.13.37.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 May 2022 13:37:58 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=O8U2oe3s; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B4643125799; Sat, 28 May 2022 12:40:09 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352981AbiE0Oy3 (ORCPT + 99 others); Fri, 27 May 2022 10:54:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238872AbiE0Oy2 (ORCPT ); Fri, 27 May 2022 10:54:28 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B135F12E331; Fri, 27 May 2022 07:54:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1653663266; x=1685199266; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=B30RuRFE5S9UQxQhIU/oFdlqy26VTGbgzrAhSIpCMEc=; b=O8U2oe3soier2ccmdsisQPhU3OGQDYDk4TYoMiaLCpv0YigK6050Lqkr oOH+R3i0p6dHS54JpgVSi0PH+2GOObFRiEZRwtHn/G4nfQc4cLgGTGDNJ Uj0LNCrfFxWs5aBlNFt1bLfYISiSg4Ah1M2cSgUnTNahN6xzhPhAjYrIA kIP87HSSrFEOqVmBAJPdGGDGnMvOtd+Xw7cBCDG1nrYKWUJJpulY7hOXS aN/LoMuXzRd0fzbjECp/iPZvbBABsBuKn3MKJEjPKGSNu8jTeakWDzuaT C1i/bTpgX1LFBjwz/rXBYcR7etSGpNFpi4LY8VsKicgNw94xdz3zOsVaK Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10359"; a="273312071" X-IronPort-AV: E=Sophos;i="5.91,255,1647327600"; d="scan'208";a="273312071" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 May 2022 07:54:26 -0700 X-IronPort-AV: E=Sophos;i="5.91,255,1647327600"; d="scan'208";a="550243644" Received: from akleen-mobl1.amr.corp.intel.com (HELO [10.251.21.118]) ([10.251.21.118]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 May 2022 07:54:25 -0700 Message-ID: <76dce5d3-6c69-e403-c4d9-f882967a4467@linux.intel.com> Date: Fri, 27 May 2022 07:54:19 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH v2] perf metrics: Add literal for system TSC frequency Content-Language: en-US To: Peter Zijlstra , Ian Rogers Cc: perry.taylor@intel.com, caleb.biggers@intel.com, kshipra.bopardikar@intel.com, Kan Liang , Zhengjun Xing , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Maxime Coquelin , Alexandre Torgue , James Clark , John Garry , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Stephane Eranian , Thomas Gleixner References: <20220527040407.4193232-1-irogers@google.com> From: Andi Kleen In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/27/2022 2:49 AM, Peter Zijlstra wrote: > On Thu, May 26, 2022 at 09:04:07PM -0700, Ian Rogers wrote: >> Such a literal is useful to calculate things like the average frequency >> [1]. The TSC frequency isn't exposed by sysfs although some experimental >> drivers look to add it [2]. This change computes the value using the >> frequency in /proc/cpuinfo which is accurate at least on Intel >> processors. It would be better to use CPUID if available which is far more accurate. Also I believe newer Intel CPUs drop the frequency in the brand string. BTW it also has the problem that if perf script is run on some other system to compute metrics it won't work. > > This all seems bonghits inspired... and perf actually does expose the > tsc frequency. What do you think is in perf_event_mmap_page::time_* ? That's not really available to perf stat, which is the primary metrics user. -Andi