Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2159280pxa; Mon, 3 Aug 2020 08:55:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxBsrGytQ1MNoDB8NcGatc8eYb51U+DVY8zxE+1TmOaGq5mjW6Za0E2/pY7rywmOGs5d4S3 X-Received: by 2002:a17:906:c7d4:: with SMTP id dc20mr18146254ejb.283.1596470137621; Mon, 03 Aug 2020 08:55:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596470137; cv=none; d=google.com; s=arc-20160816; b=sJuVIn4zpHXIizi1gg/HIzW9oJgPnN0Ggj466+htsLnw6uc5mPY3Ctl9F28Bs7qL9n QHM2O52PdQpEaXHhRefWwFsvFDXmPctyWVT5zR2iK7qS7vAcVSYxcEN5gy+OfJ2TxVrE 2yrcwsG8hSmkxd8jWBD/lX2xVjDLhDtIgOpx5cPY7Vh4x3/QqgEHJb0YHl3jCIbEUvfU T+PGwHC8WdCzD4s5TVO1wZQTDWjoC1mtsGv8oJDGOvnDp4xz29X6fs1tcUudAKxRB0JP cSIpr1EePhLbsyRE2E2HBhZN25K+y99ep5JdDzxUb4En0yau3PzCDioHlEMYmYF/vAKP Ynjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=slx0T/61/kBkje+VgygjK5EF0iAmWExpUdKWBN4DQu0=; b=wk801zAU8Bj1dUDmduRvDrVAzNEpmICTQnYt38Y0mLNRZ1tPSdcWHzO08MVzRNa4JT fMGIHSy6Fps2XngU71XTmFdyUqc/6xYOIZElyHJufYOTitE9KDl6vWBiS6v1/ZnKnWPs qkbJBi5gmaB8GmWrW8f1VoqJEeMDV9+b5ZGtBvQS0DTcyAFMdExqXrumtTepKtb6tYga fV+jK09lfXE7RDQPpbpDrGg6UZRxhLYuyPGfNtcg39rlIvoviuj5twoMUk/kGNKVKeft ijgSo7VvEgMAW2ayDh/9xF6AEJ5HSRxI5LYxHrcKZWPkikuZN/2rYfBDIWqdrHnvtiw6 T0BQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=El7SegGh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k19si9725518edx.265.2020.08.03.08.55.15; Mon, 03 Aug 2020 08:55:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=El7SegGh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727874AbgHCPy3 (ORCPT + 99 others); Mon, 3 Aug 2020 11:54:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726606AbgHCPy3 (ORCPT ); Mon, 3 Aug 2020 11:54:29 -0400 Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3DC0C06174A for ; Mon, 3 Aug 2020 08:54:28 -0700 (PDT) Received: by mail-wm1-x341.google.com with SMTP id k20so59436wmi.5 for ; Mon, 03 Aug 2020 08:54:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=slx0T/61/kBkje+VgygjK5EF0iAmWExpUdKWBN4DQu0=; b=El7SegGhgmlVjZSXK9LFNbEa5SXGe5QjXxZBHpKNiLGpFUO+xyZDK4cAnp6mLgWCE8 DyMMwFY40ZmDAKwqZEifdcbuYqhMRLfqFg+o3kRCB1G4aK3f7SP4R2CsAiRGG9F70YhJ ykfhwEEjRxUe5mApbThptFSz7PYIVL6GQsNNHwataU19jpZywK2aAX0qOU1SRVLX8h00 OkVQ39g6OR/wdlqZQIBV34z+LAhI/m2pobjD7J1ktyYHmxSjWK11ZlgJZpU4Whw1WxG0 s0tPnaN8L+nXRHCyhF9211Oz/QUXKyoHyQPoU6SXJcloNqNhJSmTj0+urvF0ofxRmgCT +ZBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=slx0T/61/kBkje+VgygjK5EF0iAmWExpUdKWBN4DQu0=; b=NnLlCoNBk+y6CYBxUQsS0F1EHxdN/7C3gjnMJJmUcEecM/Vk75D8b/bEVZPRYrPSGo QD6VeaMuw2szfp26cB4Rrfx77un7T51o2YUItVhoFP4525FWU3QuJCrJaJ2+tfSshvFF R24J/JOGKVbdTGXu8okReqRFg5LNKkArCwwUgPqfqMtj4slWtKoWmLK/SzntYQMHwotl FkjUdyPwwZolf/8BsegwOzLVr26iPCZjcJEFNIregQBF0RNDxt2MVJvV6gXYrp1LEj/S PJBxW2O0FJ/zbb0d6aiZ4GSVjoj3WG8zWgqHHpAVWivR16Zod4kdssNTTFj7pdbW0U7S tZ/g== X-Gm-Message-State: AOAM532uRyA925I3BJoexag0op0l6RMcuXI6OpYg+upKaQ0Iz6RQw/3f xWULFvrl69fhnNQLTsuYFYvQquMvQkBbe0LemQadOg== X-Received: by 2002:a1c:a914:: with SMTP id s20mr579819wme.76.1596470067410; Mon, 03 Aug 2020 08:54:27 -0700 (PDT) MIME-Version: 1.0 References: <20200729091908.1378911-1-jolsa@kernel.org> <20200801114050.GB377079@li-24c3614c-2adc-11b2-a85c-85f334518bdb.ibm.com> In-Reply-To: <20200801114050.GB377079@li-24c3614c-2adc-11b2-a85c-85f334518bdb.ibm.com> From: Ian Rogers Date: Mon, 3 Aug 2020 08:54:16 -0700 Message-ID: Subject: Re: [PATCHv4 00/19] perf metric: Add support to reuse metric To: "Paul A. Clarke" Cc: Jiri Olsa , Arnaldo Carvalho de Melo , lkml , Ingo Molnar , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Michael Petlan , Andi Kleen , Kajol Jain , John Garry , Stephane Eranian Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Aug 1, 2020 at 4:41 AM Paul A. Clarke wrote: > > On Wed, Jul 29, 2020 at 11:18:49AM +0200, Jiri Olsa wrote: > > this patchset is adding the support to reused metric in > > another metric. > > > > For example, to define IPC by using CPI with change like: > > > > { > > "BriefDescription": "Instructions Per Cycle (per Logical Processor)", > > - "MetricExpr": "INST_RETIRED.ANY / CPU_CLK_UNHALTED.THREAD", > > + "MetricExpr": "1/CPI", > > "MetricGroup": "TopDownL1", > > "MetricName": "IPC" > > }, > > > > I won't be able to find all the possible places we could > > use this at, so I wonder you guys (who was asking for this) > > would try it and come up with comments if there's something > > missing or we could already use it at some places. > > > > It's based on Arnaldo's tmp.perf/core. > > > > v4 changes: > > - removed acks from patch because it changed a bit > > with the last fixes: > > perf metric: Collect referenced metrics in struct metric_ref_node > > - fixed runtime metrics [Kajol Jain] > > - increased recursion depth [Paul A. Clarke] > > - changed patches due to dependencies: > > perf metric: Collect referenced metrics in struct metric_ref_node > > perf metric: Add recursion check when processing nested metrics > > perf metric: Rename struct egroup to metric > > perf metric: Rename group_list to metric_list > > > > Also available in here: > > git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git > > perf/metric > > I built and ran from the above git branch, and things seem to work. > Indeed, I was able to apply my changes to exploit the new capabilities > via modifications to tools/perf/pmu-events/arch/powerpc/power9/metrics.json, > as I posted earlier (and will submit once this set gets merged). > > Tested-by: Paul A. Clarke > > One thing I noted, but which also occurs without these patches, is that > the perf metrics are not computed unless run as root: > -- > $ perf stat --metrics br_misprediction_percent command > > Performance counter stats for 'command': > > 1,823,530,051 pm_br_pred:u > 2,662,705 pm_br_mpred_cmpl:u > > $ /usr/bin/sudo perf stat --metrics br_misprediction_percent command > > Performance counter stats for 'command': > > 1,824,655,269 pm_br_pred # 0.09 br_misprediction_percent > 1,654,466 pm_br_mpred_cmpl > -- > > Is that expected? I don't think it's always been that way. I agree Paul, this seems broken. I've noticed a bunch of issues with printing CSV, per-socket output and so on. Jiri may have a better idea but I plan to look at problems in this area later, and hopefully stick a few tests on it :-) Thanks, Ian > PC