Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3840050ybb; Tue, 31 Mar 2020 13:04:50 -0700 (PDT) X-Google-Smtp-Source: APiQypKus4O6N4qKREKj8L2AeolY+6nAt6S0C10e//lER+61HJvdemx/qHTM/Du1z2giOwMoyaWf X-Received: by 2002:a54:4181:: with SMTP id 1mr458555oiy.158.1585685090652; Tue, 31 Mar 2020 13:04:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585685090; cv=none; d=google.com; s=arc-20160816; b=JPs0H9kExwNxRK9fMpfWoWJzkPr4Mm7O7LTR6LCelu4Jqb7buonFyc9WUu3xxPB8L/ GKOhrvkp6GX/qQh4mG/vACy55Fp1WAvxW0QDbkr8ZwVAoMKH0DdraIWlKUTtVTTwB++1 k3oZNqkTCRBeVkX+ZJHLyQcpT7xZmxZ+WYp+hWgb/1eZuo7MyEQhPcJMUMdz8sG7z5w5 t05KYZJ8vtIC1cvOKzABAzBfIdNWq3Ddcgq3Pe1UVZuBDJFI4SWVzZY5jrbE2TOtqxhH kMbLKiLYVsBxOLVfjTppwYEYrER5PZJuN/8hVmb18MmjNYSIaGU/93udcRRLj8gRc/4E 4XRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :ironport-sdr:ironport-sdr; bh=lVx76Sg31/pVXHczlK3lUEZTlwLTl9bmzjhmjFLer2Q=; b=WDk+DurY+eWDMUXb+UJKTNd2ELd6/WPF3HOGpfQsPsBg8H1VTrycvpXk6kwc6qHAYd 6uLsvQuJVKoKJntv+D6DKimZo4eyivbI+u4zO5NLRlJFiQWSFiRwkgmZ2lay5+8SR9kp yLr1+V4qKcTdLpAjqJH1oj4doBxNe0g+h6HN7cJBV38+ciwqElIwC09Mha5jimpgZ/KM 94KsQEXmw+uMJtrsZSC0MWew5U7YCCP4O7HguuHl5XKSI9WHYJ9eqZkHXwTK9CrikUlQ 5ChPvxIw8cuacsKOlyuuG3ATwM+glvss/6SW28ux5OkxtEr9waSWBV75G5RF+8AgQjbI hwxw== 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 g124si1202oia.0.2020.03.31.13.04.37; Tue, 31 Mar 2020 13:04:50 -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 S1727955AbgCaUEO (ORCPT + 99 others); Tue, 31 Mar 2020 16:04:14 -0400 Received: from mga02.intel.com ([134.134.136.20]:20388 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727708AbgCaUEO (ORCPT ); Tue, 31 Mar 2020 16:04:14 -0400 IronPort-SDR: 4NAeKYh1SehZZLjID1VeXR5aVVNkQIg7WaHODs1MZCTI3monmJpxlmuzHEez/2OnQDoFPOWyTv tKqx8jTilWmA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Mar 2020 13:04:12 -0700 IronPort-SDR: tooVZKGD1u1yhUaN6q63MJLEeqF+wgUaco/cA2k/d6/bjK6miEcoFOdizCrHK2IMdkIRKtK1aX 1Ogmm8MG21pw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,328,1580803200"; d="scan'208";a="359618004" Received: from tassilo.jf.intel.com (HELO tassilo.localdomain) ([10.7.201.21]) by fmsmga001.fm.intel.com with ESMTP; 31 Mar 2020 13:04:11 -0700 Received: by tassilo.localdomain (Postfix, from userid 1000) id 1CCCB30178A; Tue, 31 Mar 2020 13:04:11 -0700 (PDT) Date: Tue, 31 Mar 2020 13:04:11 -0700 From: Andi Kleen To: Arnaldo Carvalho de Melo Cc: "Jin, Yao" , jolsa@kernel.org, peterz@infradead.org, mingo@redhat.com, alexander.shishkin@linux.intel.com, Linux-kernel@vger.kernel.org, kan.liang@intel.com, yao.jin@intel.com Subject: Re: [PATCH] perf/x86/pmu-events: Use CPU_CLK_UNHALTED.THREAD in Kernel_Utilization metric Message-ID: <20200331200411.GA397189@tassilo.jf.intel.com> References: <20200309013125.7559-1-yao.jin@linux.intel.com> <20200331190804.GK9917@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200331190804.GK9917@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 31, 2020 at 04:08:04PM -0300, Arnaldo Carvalho de Melo wrote: > Em Mon, Mar 30, 2020 at 08:38:29AM +0800, Jin, Yao escreveu: > > Hi, > > > > Any comments for this patch? > > Can someone help Jin reviewing this x86 specific metric? Looks good to me. Reviewed-by: Andi Kleen > > - Arnaldo > > > Thanks > > Jin Yao > > > > On 3/9/2020 9:31 AM, Jin Yao wrote: > > > The kernel utilization metric does multiplexing currently and is somewhat > > > unreliable. The problem is that it uses two instances of the fixed counter, > > > and the kernel has to multipleplex which causes errors. So should use > > > CPU_CLK_UNHALTED.THREAD instead. > > > > > > Before: > > > > > > # perf stat -M Kernel_Utilization -- sleep 1 > > > > > > Performance counter stats for 'sleep 1': > > > > > > 1,419,425 cpu_clk_unhalted.ref_tsc:k > > > cpu_clk_unhalted.ref_tsc (0.00%) > > > > > > After: > > > > > > # perf stat -M Kernel_Utilization -- sleep 1 > > > > > > Performance counter stats for 'sleep 1': > > > > > > 746,688 cpu_clk_unhalted.thread:k # 0.7 Kernel_Utilization > > > 1,088,348 cpu_clk_unhalted.thread > > > > > > Signed-off-by: Jin Yao > > > --- > > > tools/perf/pmu-events/arch/x86/broadwell/bdw-metrics.json | 2 +- > > > tools/perf/pmu-events/arch/x86/broadwellde/bdwde-metrics.json | 2 +- > > > tools/perf/pmu-events/arch/x86/broadwellx/bdx-metrics.json | 2 +- > > > tools/perf/pmu-events/arch/x86/cascadelakex/clx-metrics.json | 2 +- > > > tools/perf/pmu-events/arch/x86/haswell/hsw-metrics.json | 2 +- > > > tools/perf/pmu-events/arch/x86/haswellx/hsx-metrics.json | 2 +- > > > tools/perf/pmu-events/arch/x86/ivybridge/ivb-metrics.json | 2 +- > > > tools/perf/pmu-events/arch/x86/ivytown/ivt-metrics.json | 2 +- > > > tools/perf/pmu-events/arch/x86/jaketown/jkt-metrics.json | 2 +- > > > tools/perf/pmu-events/arch/x86/sandybridge/snb-metrics.json | 2 +- > > > tools/perf/pmu-events/arch/x86/skylake/skl-metrics.json | 2 +- > > > tools/perf/pmu-events/arch/x86/skylakex/skx-metrics.json | 2 +- > > > 12 files changed, 12 insertions(+), 12 deletions(-) > > > > > > diff --git a/tools/perf/pmu-events/arch/x86/broadwell/bdw-metrics.json b/tools/perf/pmu-events/arch/x86/broadwell/bdw-metrics.json > > > index 45a34ce4fe89..8cdc7c13dc2a 100644 > > > --- a/tools/perf/pmu-events/arch/x86/broadwell/bdw-metrics.json > > > +++ b/tools/perf/pmu-events/arch/x86/broadwell/bdw-metrics.json > > > @@ -297,7 +297,7 @@ > > > }, > > > { > > > "BriefDescription": "Fraction of cycles spent in Kernel mode", > > > - "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC", > > > + "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD", > > > "MetricGroup": "Summary", > > > "MetricName": "Kernel_Utilization" > > > }, > > > diff --git a/tools/perf/pmu-events/arch/x86/broadwellde/bdwde-metrics.json b/tools/perf/pmu-events/arch/x86/broadwellde/bdwde-metrics.json > > > index 961fe4395758..16fd8a7490fc 100644 > > > --- a/tools/perf/pmu-events/arch/x86/broadwellde/bdwde-metrics.json > > > +++ b/tools/perf/pmu-events/arch/x86/broadwellde/bdwde-metrics.json > > > @@ -115,7 +115,7 @@ > > > }, > > > { > > > "BriefDescription": "Fraction of cycles spent in Kernel mode", > > > - "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC", > > > + "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD", > > > "MetricGroup": "Summary", > > > "MetricName": "Kernel_Utilization" > > > }, > > > diff --git a/tools/perf/pmu-events/arch/x86/broadwellx/bdx-metrics.json b/tools/perf/pmu-events/arch/x86/broadwellx/bdx-metrics.json > > > index 746734ce09be..1eb0415fa11a 100644 > > > --- a/tools/perf/pmu-events/arch/x86/broadwellx/bdx-metrics.json > > > +++ b/tools/perf/pmu-events/arch/x86/broadwellx/bdx-metrics.json > > > @@ -297,7 +297,7 @@ > > > }, > > > { > > > "BriefDescription": "Fraction of cycles spent in Kernel mode", > > > - "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC", > > > + "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD", > > > "MetricGroup": "Summary", > > > "MetricName": "Kernel_Utilization" > > > }, > > > diff --git a/tools/perf/pmu-events/arch/x86/cascadelakex/clx-metrics.json b/tools/perf/pmu-events/arch/x86/cascadelakex/clx-metrics.json > > > index f94653229dd4..a2c32db8f14e 100644 > > > --- a/tools/perf/pmu-events/arch/x86/cascadelakex/clx-metrics.json > > > +++ b/tools/perf/pmu-events/arch/x86/cascadelakex/clx-metrics.json > > > @@ -315,7 +315,7 @@ > > > }, > > > { > > > "BriefDescription": "Fraction of cycles spent in Kernel mode", > > > - "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC", > > > + "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD", > > > "MetricGroup": "Summary", > > > "MetricName": "Kernel_Utilization" > > > }, > > > diff --git a/tools/perf/pmu-events/arch/x86/haswell/hsw-metrics.json b/tools/perf/pmu-events/arch/x86/haswell/hsw-metrics.json > > > index 5402cd3120f9..f57c5f3506c2 100644 > > > --- a/tools/perf/pmu-events/arch/x86/haswell/hsw-metrics.json > > > +++ b/tools/perf/pmu-events/arch/x86/haswell/hsw-metrics.json > > > @@ -267,7 +267,7 @@ > > > }, > > > { > > > "BriefDescription": "Fraction of cycles spent in Kernel mode", > > > - "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC", > > > + "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD", > > > "MetricGroup": "Summary", > > > "MetricName": "Kernel_Utilization" > > > }, > > > diff --git a/tools/perf/pmu-events/arch/x86/haswellx/hsx-metrics.json b/tools/perf/pmu-events/arch/x86/haswellx/hsx-metrics.json > > > index 832f3cb40b34..311a005dc35b 100644 > > > --- a/tools/perf/pmu-events/arch/x86/haswellx/hsx-metrics.json > > > +++ b/tools/perf/pmu-events/arch/x86/haswellx/hsx-metrics.json > > > @@ -267,7 +267,7 @@ > > > }, > > > { > > > "BriefDescription": "Fraction of cycles spent in Kernel mode", > > > - "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC", > > > + "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD", > > > "MetricGroup": "Summary", > > > "MetricName": "Kernel_Utilization" > > > }, > > > diff --git a/tools/perf/pmu-events/arch/x86/ivybridge/ivb-metrics.json b/tools/perf/pmu-events/arch/x86/ivybridge/ivb-metrics.json > > > index d69b2a8fc0bc..28e25447d3ef 100644 > > > --- a/tools/perf/pmu-events/arch/x86/ivybridge/ivb-metrics.json > > > +++ b/tools/perf/pmu-events/arch/x86/ivybridge/ivb-metrics.json > > > @@ -285,7 +285,7 @@ > > > }, > > > { > > > "BriefDescription": "Fraction of cycles spent in Kernel mode", > > > - "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC", > > > + "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD", > > > "MetricGroup": "Summary", > > > "MetricName": "Kernel_Utilization" > > > }, > > > diff --git a/tools/perf/pmu-events/arch/x86/ivytown/ivt-metrics.json b/tools/perf/pmu-events/arch/x86/ivytown/ivt-metrics.json > > > index 5f465fd81315..db23db2e98be 100644 > > > --- a/tools/perf/pmu-events/arch/x86/ivytown/ivt-metrics.json > > > +++ b/tools/perf/pmu-events/arch/x86/ivytown/ivt-metrics.json > > > @@ -285,7 +285,7 @@ > > > }, > > > { > > > "BriefDescription": "Fraction of cycles spent in Kernel mode", > > > - "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC", > > > + "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD", > > > "MetricGroup": "Summary", > > > "MetricName": "Kernel_Utilization" > > > }, > > > diff --git a/tools/perf/pmu-events/arch/x86/jaketown/jkt-metrics.json b/tools/perf/pmu-events/arch/x86/jaketown/jkt-metrics.json > > > index 3e909b306003..dbb33e00b72a 100644 > > > --- a/tools/perf/pmu-events/arch/x86/jaketown/jkt-metrics.json > > > +++ b/tools/perf/pmu-events/arch/x86/jaketown/jkt-metrics.json > > > @@ -171,7 +171,7 @@ > > > }, > > > { > > > "BriefDescription": "Fraction of cycles spent in Kernel mode", > > > - "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC", > > > + "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD", > > > "MetricGroup": "Summary", > > > "MetricName": "Kernel_Utilization" > > > }, > > > diff --git a/tools/perf/pmu-events/arch/x86/sandybridge/snb-metrics.json b/tools/perf/pmu-events/arch/x86/sandybridge/snb-metrics.json > > > index 50c053235752..fb2d7b8875f8 100644 > > > --- a/tools/perf/pmu-events/arch/x86/sandybridge/snb-metrics.json > > > +++ b/tools/perf/pmu-events/arch/x86/sandybridge/snb-metrics.json > > > @@ -171,7 +171,7 @@ > > > }, > > > { > > > "BriefDescription": "Fraction of cycles spent in Kernel mode", > > > - "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC", > > > + "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD", > > > "MetricGroup": "Summary", > > > "MetricName": "Kernel_Utilization" > > > }, > > > diff --git a/tools/perf/pmu-events/arch/x86/skylake/skl-metrics.json b/tools/perf/pmu-events/arch/x86/skylake/skl-metrics.json > > > index e7feb60f9fa9..e3afc3178958 100644 > > > --- a/tools/perf/pmu-events/arch/x86/skylake/skl-metrics.json > > > +++ b/tools/perf/pmu-events/arch/x86/skylake/skl-metrics.json > > > @@ -303,7 +303,7 @@ > > > }, > > > { > > > "BriefDescription": "Fraction of cycles spent in Kernel mode", > > > - "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC", > > > + "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD", > > > "MetricGroup": "Summary", > > > "MetricName": "Kernel_Utilization" > > > }, > > > diff --git a/tools/perf/pmu-events/arch/x86/skylakex/skx-metrics.json b/tools/perf/pmu-events/arch/x86/skylakex/skx-metrics.json > > > index 21d7a0c2c2e8..12d1efba79bb 100644 > > > --- a/tools/perf/pmu-events/arch/x86/skylakex/skx-metrics.json > > > +++ b/tools/perf/pmu-events/arch/x86/skylakex/skx-metrics.json > > > @@ -315,7 +315,7 @@ > > > }, > > > { > > > "BriefDescription": "Fraction of cycles spent in Kernel mode", > > > - "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC", > > > + "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD", > > > "MetricGroup": "Summary", > > > "MetricName": "Kernel_Utilization" > > > }, > > > > > -- > > - Arnaldo