Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3797072ybb; Tue, 31 Mar 2020 12:10:00 -0700 (PDT) X-Google-Smtp-Source: ADFU+vu/Vhieaok7skdVOtLeOm/U9nulMkK4rCaXZMe9rYLSGSw3kcyGgu7PNRsxq/Ce4yLDmH5d X-Received: by 2002:a05:6830:23ba:: with SMTP id m26mr13912045ots.133.1585681800326; Tue, 31 Mar 2020 12:10:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585681800; cv=none; d=google.com; s=arc-20160816; b=dGO2BCfsh0f/op5I3XuynZzoFz9j9t1PdY8CSRD7C73D6v73IIwBKFpXVGlsZ5bBPY 7OQSZ2nyJMa1GQTEgaMMf3zb4L55hr75clz1ftRoNmpyW+4JEQ1wT+Ei0qcFLwJFyvfr bt6uYpL+iKJEn3kna8wsUVuY2iD20yweJobiwVtmI1dQ6jFBEpSFRCmaRIewUm/pyDGk ba2BqXu5ERdwIltcsGZDiikEZIwkM1mvVrQVio/z2NN+jeBVKywptYHcIHmyFv4l8lej JgYiiB+UWV+RomkVFz6U6V4NUBagBlYEfy7rd/WF4cdf2kO3j34yxmS3WTrx5Nkymm61 zz0A== 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:date:from :dkim-signature; bh=kfxuOLi573qLCPHoRYNlv++6004OLZ/KMbmyRo3d8Kk=; b=Zw52ngYw2L99t4I3j02A0DhDcvPDV24va0UnOzswUZ6nN2YxPsS+iic5KDJF/HwgL9 U0a0QKnzVz5oAVYJWu/KGsHbpdj70G5EG/n9f3cxPoiQFNp+W39v6Bi5PG6VUcTA7aRJ v/MT0wHA84X/3TSEbZFBQkH80jtSmp9R1Yy77cytDnu3d6POy0m6JKpKTPspY8rO+MWq 3B6887JuYO/qS8cbDiXgYMIAf6kGSE3AH8Pzj0XXYZYOsci1RgD5JcFhfRRrxZ2C38oz Z/QdQ/k7a0RXrkR0eUAj58/H6Bzz1GUCdBdHNc8dIlwSMLp79quNEBHuac4uBeYCH4Gt nlQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=pGcQY9OV; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e24si7135888ooh.57.2020.03.31.12.09.42; Tue, 31 Mar 2020 12:10:00 -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=pass header.i=@gmail.com header.s=20161025 header.b=pGcQY9OV; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728428AbgCaTIM (ORCPT + 99 others); Tue, 31 Mar 2020 15:08:12 -0400 Received: from mail-qk1-f195.google.com ([209.85.222.195]:41900 "EHLO mail-qk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726548AbgCaTIM (ORCPT ); Tue, 31 Mar 2020 15:08:12 -0400 Received: by mail-qk1-f195.google.com with SMTP id q188so24277266qke.8 for ; Tue, 31 Mar 2020 12:08:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=kfxuOLi573qLCPHoRYNlv++6004OLZ/KMbmyRo3d8Kk=; b=pGcQY9OVjnVnV1sFaFvIFquoRLmJQInWwu1QcoFwYJEiSXSyXs/asKSi5lqgvPUoUv DhVtm9IljhhHf3poZrN+MmAMzrtVwoaKGnJlX+cG+nqyvcyfWcLsP+gJb8hIQvtFYzLv X9yCeIS2n3LBVJ7Kl5C3KbNKKLEwW7N/Kwy17+hZNjVBasuCWTEMS33tFLBHtukubzSl WtbixzGb/K1haxrznQHUOFnKEzxNG1A6Qv41qg+QRJv5ns+YETne2aKpczDvOPXToarK Np8l2dno6zItLToHba82kaJ0a3nWEJruvtIkJDO+gWgnvry4asfsFITcc0b82+DfXQGa 3+CQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=kfxuOLi573qLCPHoRYNlv++6004OLZ/KMbmyRo3d8Kk=; b=BCV7FaW+QWU1gfanyo+QOBJ9fQmIq9M9YWddhxNGh34ioIevlMNXK8mhbe20N7pEb7 Kx4rFhaYOkl1QqKjW6tk8eYo6o/ohhYRKohV2uuR+c+kMY/ENwLNXcqdPTt3QIDcsQ6e 1ah8XL/FKJg1/74G1i4tP8lzdVjPQWZi40XvFkBaDNqNQfzNW70Bs6lOhDLOiKdNmbxq k3+xcPy5qvUArNb2I6P0hs+Ozdj4A02/3+N9PMxVEZUIKxRn2beHkmvJgtn4S5AGZQTC 6nQ3wKRZtYl87rAx22CJnuUso0FP+zv32/LsxGokhnotmGDDR8LuRbarFpVQfC0MD424 S70Q== X-Gm-Message-State: ANhLgQ3OhBJ9GjekdirKiOukWGWL4cDD4mfn89T4dwfGTyI2HVfRFAKb 8kd/LF6vcVhhvWio48+WdeI= X-Received: by 2002:a37:514:: with SMTP id 20mr6212267qkf.420.1585681688621; Tue, 31 Mar 2020 12:08:08 -0700 (PDT) Received: from quaco.ghostprotocols.net ([179.97.37.151]) by smtp.gmail.com with ESMTPSA id a200sm13387691qkc.13.2020.03.31.12.08.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Mar 2020 12:08:07 -0700 (PDT) From: Arnaldo Carvalho de Melo X-Google-Original-From: Arnaldo Carvalho de Melo Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 54BF3409A3; Tue, 31 Mar 2020 16:08:04 -0300 (-03) Date: Tue, 31 Mar 2020 16:08:04 -0300 To: "Jin, Yao" Cc: jolsa@kernel.org, peterz@infradead.org, mingo@redhat.com, alexander.shishkin@linux.intel.com, Linux-kernel@vger.kernel.org, ak@linux.intel.com, 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: <20200331190804.GK9917@kernel.org> References: <20200309013125.7559-1-yao.jin@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Url: http://acmel.wordpress.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? - 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