Message ID | 20230608084407.140323-1-asavkov@redhat.com |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp144496vqr; Thu, 8 Jun 2023 02:12:00 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4HlHeD9g8megQXw1wdXXiIMPEQGyMN9QsCCkfzUHYvL9lxSKc+7jfo9bj9EcZLjrElaVhG X-Received: by 2002:a05:6359:31c:b0:123:1a41:3d8 with SMTP id ef28-20020a056359031c00b001231a4103d8mr5848779rwb.29.1686215520045; Thu, 08 Jun 2023 02:12:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686215520; cv=none; d=google.com; s=arc-20160816; b=YTkFVKPJ4Gkv/fHr8DZJXkYEAhiUF3OugSXwIjtaWkB+dtnpC01HeAqvvFDbYVyGNN knnaAIfNGwCllXJT03i0tOl1cPiXJ5vip3WGgH53XfffPXqE0RwblkncEAJZXbGgv4XT ZdZaes0ULysi1Fla6bvCb9AwOWYZfRJxYRmN2zRc1Ja2pWU1soCyU9luQ9lfY5MnK1Bd bldsBSKLEG+abiqMi4cNKfaUWJBwseYLl2nfUAVUPIvKTDmKRKLP+69ZW5f+IWwMGAfi 2/SjmvDd0OrQFoE2dg087eNzl57eDeAe8XdYHvWBsZHr2IZeGrTJriYtPLiVWEnUcwpO T96g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=fj2mCkYLNG5L67gHa0q5WGVDFbE4zI2Uml3ICcP6iqo=; b=EPhBeK3SYXxT/8pV3q4eeHphQT3OqzSkIFkspq2fTeZxrsYJETpOnPFwNXK5DF6E2X BgwMgzRIExSCunbySwm8JiZ9RRPIrbSyzF+JaJtycmB7EV2NiE8NFF7jpgmkjJTowIaU HRrZSr3PWjcaFLdzaFbGIdUc72BpvJNCg9xzpV9MD0xj6nO/5Bw5dS9k9idIU5guG/BM dBFib23Ntro4Gt0Rbgs0SSsMlLxafWNG0T8TLfSeKt91smJSWZsdd/bnUNDYIN2LJQUa 0mOpMtPjycZ044EbK4DruNOFM8OV3EItsdYXOMxkJ/e3TAEStTO3s6I19ASBGf+yLZgc vmIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ZYUXH9OA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 67-20020a630246000000b00517a2ca5ecbsi701107pgc.692.2023.06.08.02.11.47; Thu, 08 Jun 2023 02:11:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ZYUXH9OA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235496AbjFHIpM (ORCPT <rfc822;liningstudo@gmail.com> + 99 others); Thu, 8 Jun 2023 04:45:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229589AbjFHIpI (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 8 Jun 2023 04:45:08 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA89F2709 for <linux-kernel@vger.kernel.org>; Thu, 8 Jun 2023 01:44:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686213865; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=fj2mCkYLNG5L67gHa0q5WGVDFbE4zI2Uml3ICcP6iqo=; b=ZYUXH9OAr7JYYHT5qHCNrbBnSjUIQVrl0UZZCZe0XwWYNkT/fanpZ10FUD2MDSVAvzqtfN vqavw+hxO2WlqTASvNgv12ZKMwKUwZ3sdzvR7btASwDNVPSxdUrs6m72OPTb2EhR2jxGOm XRN8W74lcHgDzCSVvsQ+1ohTTlfdD8c= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-226-7ktfpiYxMjyevyMBmDPXZQ-1; Thu, 08 Jun 2023 04:44:21 -0400 X-MC-Unique: 7ktfpiYxMjyevyMBmDPXZQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 76463802BF5; Thu, 8 Jun 2023 08:44:20 +0000 (UTC) Received: from samus.usersys.redhat.com (unknown [10.43.17.26]) by smtp.corp.redhat.com (Postfix) with ESMTP id C498C40CFD46; Thu, 8 Jun 2023 08:44:18 +0000 (UTC) From: Artem Savkov <asavkov@redhat.com> To: linux-perf-users@vger.kernel.org, Arnaldo Carvalho de Melo <acme@kernel.org>, Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org>, Ingo Molnar <mingo@redhat.com>, Mark Rutland <mark.rutland@arm.com>, Alexander Shishkin <alexander.shishkin@linux.intel.com>, Jiri Olsa <jolsa@kernel.org>, Ian Rogers <irogers@google.com>, Adrian Hunter <adrian.hunter@intel.com>, linux-kernel@vger.kernel.org, Artem Savkov <asavkov@redhat.com> Subject: [PATCH v2 0/2] perf tools: annotation browser from c2c tui Date: Thu, 8 Jun 2023 10:44:05 +0200 Message-Id: <20230608084407.140323-1-asavkov@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768125124843541485?= X-GMAIL-MSGID: =?utf-8?q?1768125124843541485?= |
Series |
perf tools: annotation browser from c2c tui
|
|
Message
Artem Savkov
June 8, 2023, 8:44 a.m. UTC
These patches add ability to start annotation browser from c2c report tui. The idea comes from Arnaldo's "Profiling Data Structures" talk [1]. [1]: http://vger.kernel.org/~acme/prez/linux-plumbers-2022/ v1->v2: Addressed comments from Namhyung Kim - No longer saving evsel for each hist entry, using evlist__first instead. - Factored out preparations to call annotation browser to do_annotate() function - Other small fixes and adjustments. Artem Savkov (2): perf util: move symbol__new_unresolved() to util/symbol.c perf tools: allow running annotation browser from c2c-report tools/perf/builtin-c2c.c | 73 +++++++++++++++++++++++++++++++--- tools/perf/ui/browsers/hists.c | 22 ---------- tools/perf/util/symbol.c | 22 ++++++++++ tools/perf/util/symbol.h | 1 + 4 files changed, 91 insertions(+), 27 deletions(-)
Comments
On Thu, Jun 08, 2023 at 10:44:05AM +0200, Artem Savkov wrote: > These patches add ability to start annotation browser from c2c report > tui. The idea comes from Arnaldo's "Profiling Data Structures" talk [1]. > > [1]: http://vger.kernel.org/~acme/prez/linux-plumbers-2022/ So what are the plans for doing IP to datatype::member resolution and deleting this C2C abomination? /me still regretting ever letting c2c happen..
Hi Peter, On Thu, Jun 8, 2023 at 6:25 AM Peter Zijlstra <peterz@infradead.org> wrote: > > On Thu, Jun 08, 2023 at 10:44:05AM +0200, Artem Savkov wrote: > > These patches add ability to start annotation browser from c2c report > > tui. The idea comes from Arnaldo's "Profiling Data Structures" talk [1]. > > > > [1]: http://vger.kernel.org/~acme/prez/linux-plumbers-2022/ > > So what are the plans for doing IP to datatype::member resolution and > deleting this C2C abomination? I'm working on it and hoping to post an RFC soonish.. but no plan to kill c2c entirely :) Thanks, Namhyung > > /me still regretting ever letting c2c happen..
Hello, On Thu, Jun 8, 2023 at 1:44 AM Artem Savkov <asavkov@redhat.com> wrote: > > These patches add ability to start annotation browser from c2c report > tui. The idea comes from Arnaldo's "Profiling Data Structures" talk [1]. I was thinking about how it works and realized that it didn't collect samples by symbol. Then I'm not sure if the result is meaningful. I think it'd show a random symbol that touched the cache line first. The same cache line can be accessed from other locations but it cannot know where they are. Also different instructions in a function (symbol) would access a different cache line. The annotate output just shows any memory access. So it might be good to check the instruction at the point but others should not be considered related. Hmm.. I suspect even the same instruction will hit the different cache lines at different times. Then probably the annotation won't work well in terms of correlating cache lines. Thanks, Namhyung > > [1]: http://vger.kernel.org/~acme/prez/linux-plumbers-2022/ > > v1->v2: Addressed comments from Namhyung Kim > - No longer saving evsel for each hist entry, using evlist__first > instead. > - Factored out preparations to call annotation browser to do_annotate() > function > - Other small fixes and adjustments. > > Artem Savkov (2): > perf util: move symbol__new_unresolved() to util/symbol.c > perf tools: allow running annotation browser from c2c-report > > tools/perf/builtin-c2c.c | 73 +++++++++++++++++++++++++++++++--- > tools/perf/ui/browsers/hists.c | 22 ---------- > tools/perf/util/symbol.c | 22 ++++++++++ > tools/perf/util/symbol.h | 1 + > 4 files changed, 91 insertions(+), 27 deletions(-) > > -- > 2.40.1 >
On Thu, Jun 08, 2023 at 02:09:06PM -0700, Namhyung Kim wrote: > Hello, > > On Thu, Jun 8, 2023 at 1:44 AM Artem Savkov <asavkov@redhat.com> wrote: > > > > These patches add ability to start annotation browser from c2c report > > tui. The idea comes from Arnaldo's "Profiling Data Structures" talk [1]. > > I was thinking about how it works and realized that it didn't collect > samples by symbol. Then I'm not sure if the result is meaningful. > I think it'd show a random symbol that touched the cache line > first. The same cache line can be accessed from other locations > but it cannot know where they are. > > Also different instructions in a function (symbol) would access a > different cache line. The annotate output just shows any memory > access. So it might be good to check the instruction at the point > but others should not be considered related. > > Hmm.. I suspect even the same instruction will hit the different > cache lines at different times. Then probably the annotation > won't work well in terms of correlating cache lines. The annotation hotkey is only added to the cacheline detailed view where we do have symbol instruction information. The idea is to give the user ability to quickly jump to source code/disassembly directly from c2c TUI. The hit percentages in annotation view don't make much sense in this case though, so maybe it is better to use dummy evsel so that none are shown. > Thanks, > Namhyung > > > > > [1]: http://vger.kernel.org/~acme/prez/linux-plumbers-2022/ > > > > v1->v2: Addressed comments from Namhyung Kim > > - No longer saving evsel for each hist entry, using evlist__first > > instead. > > - Factored out preparations to call annotation browser to do_annotate() > > function > > - Other small fixes and adjustments. > > > > Artem Savkov (2): > > perf util: move symbol__new_unresolved() to util/symbol.c > > perf tools: allow running annotation browser from c2c-report > > > > tools/perf/builtin-c2c.c | 73 +++++++++++++++++++++++++++++++--- > > tools/perf/ui/browsers/hists.c | 22 ---------- > > tools/perf/util/symbol.c | 22 ++++++++++ > > tools/perf/util/symbol.h | 1 + > > 4 files changed, 91 insertions(+), 27 deletions(-) > > > > -- > > 2.40.1 > > >
Em Fri, Jun 09, 2023 at 10:37:31AM +0200, Artem Savkov escreveu: > On Thu, Jun 08, 2023 at 02:09:06PM -0700, Namhyung Kim wrote: > > Hello, > > > > On Thu, Jun 8, 2023 at 1:44 AM Artem Savkov <asavkov@redhat.com> wrote: > > > > > > These patches add ability to start annotation browser from c2c report > > > tui. The idea comes from Arnaldo's "Profiling Data Structures" talk [1]. > > > > I was thinking about how it works and realized that it didn't collect > > samples by symbol. Then I'm not sure if the result is meaningful. > > I think it'd show a random symbol that touched the cache line > > first. The same cache line can be accessed from other locations > > but it cannot know where they are. > > > > Also different instructions in a function (symbol) would access a > > different cache line. The annotate output just shows any memory > > access. So it might be good to check the instruction at the point > > but others should not be considered related. > > > > Hmm.. I suspect even the same instruction will hit the different > > cache lines at different times. Then probably the annotation > > won't work well in terms of correlating cache lines. > > The annotation hotkey is only added to the cacheline detailed view where > we do have symbol instruction information. The idea is to give the user > ability to quickly jump to source code/disassembly directly from c2c > TUI. > > The hit percentages in annotation view don't make much sense in this > case though, so maybe it is better to use dummy evsel so that none are > shown. Yes, the point is just to reuse the source browser, if there is no annotation data applicable, don't use any. - Arnaldo > > Thanks, > > Namhyung > > > > > > > > [1]: http://vger.kernel.org/~acme/prez/linux-plumbers-2022/ > > > > > > v1->v2: Addressed comments from Namhyung Kim > > > - No longer saving evsel for each hist entry, using evlist__first > > > instead. > > > - Factored out preparations to call annotation browser to do_annotate() > > > function > > > - Other small fixes and adjustments. > > > > > > Artem Savkov (2): > > > perf util: move symbol__new_unresolved() to util/symbol.c > > > perf tools: allow running annotation browser from c2c-report > > > > > > tools/perf/builtin-c2c.c | 73 +++++++++++++++++++++++++++++++--- > > > tools/perf/ui/browsers/hists.c | 22 ---------- > > > tools/perf/util/symbol.c | 22 ++++++++++ > > > tools/perf/util/symbol.h | 1 + > > > 4 files changed, 91 insertions(+), 27 deletions(-) > > > > > > -- > > > 2.40.1 > > > > > > > -- > Artem >
Em Wed, Jun 14, 2023 at 03:38:35PM -0300, Arnaldo Carvalho de Melo escreveu: > Em Fri, Jun 09, 2023 at 10:37:31AM +0200, Artem Savkov escreveu: > > On Thu, Jun 08, 2023 at 02:09:06PM -0700, Namhyung Kim wrote: > > > On Thu, Jun 8, 2023 at 1:44 AM Artem Savkov <asavkov@redhat.com> wrote: > > > > These patches add ability to start annotation browser from c2c report > > > > tui. The idea comes from Arnaldo's "Profiling Data Structures" talk [1]. > > > I was thinking about how it works and realized that it didn't collect > > > samples by symbol. Then I'm not sure if the result is meaningful. > > > I think it'd show a random symbol that touched the cache line > > > first. The same cache line can be accessed from other locations > > > but it cannot know where they are. > > > Also different instructions in a function (symbol) would access a > > > different cache line. The annotate output just shows any memory > > > access. So it might be good to check the instruction at the point > > > but others should not be considered related. > > > Hmm.. I suspect even the same instruction will hit the different > > > cache lines at different times. Then probably the annotation > > > won't work well in terms of correlating cache lines. > > The annotation hotkey is only added to the cacheline detailed view where > > we do have symbol instruction information. The idea is to give the user > > ability to quickly jump to source code/disassembly directly from c2c > > TUI. > > The hit percentages in annotation view don't make much sense in this > > case though, so maybe it is better to use dummy evsel so that none are > > shown. > Yes, the point is just to reuse the source browser, if there is no > annotation data applicable, don't use any. I tried to work on having the annotation browser, both --stdio2 and the TUI to work with evsels without annotation data, just so that we could simply navigate source code or disassembly functions using the more compact form we have in perf than the original one from objdump. - Arnaldo
On Wed, Jun 14, 2023 at 03:38:35PM -0300, Arnaldo Carvalho de Melo wrote: > Em Fri, Jun 09, 2023 at 10:37:31AM +0200, Artem Savkov escreveu: > > On Thu, Jun 08, 2023 at 02:09:06PM -0700, Namhyung Kim wrote: > > > Hello, > > > > > > On Thu, Jun 8, 2023 at 1:44 AM Artem Savkov <asavkov@redhat.com> wrote: > > > > > > > > These patches add ability to start annotation browser from c2c report > > > > tui. The idea comes from Arnaldo's "Profiling Data Structures" talk [1]. > > > > > > I was thinking about how it works and realized that it didn't collect > > > samples by symbol. Then I'm not sure if the result is meaningful. > > > I think it'd show a random symbol that touched the cache line > > > first. The same cache line can be accessed from other locations > > > but it cannot know where they are. > > > > > > Also different instructions in a function (symbol) would access a > > > different cache line. The annotate output just shows any memory > > > access. So it might be good to check the instruction at the point > > > but others should not be considered related. > > > > > > Hmm.. I suspect even the same instruction will hit the different > > > cache lines at different times. Then probably the annotation > > > won't work well in terms of correlating cache lines. > > > > The annotation hotkey is only added to the cacheline detailed view where > > we do have symbol instruction information. The idea is to give the user > > ability to quickly jump to source code/disassembly directly from c2c > > TUI. > > > > The hit percentages in annotation view don't make much sense in this > > case though, so maybe it is better to use dummy evsel so that none are > > shown. > > Yes, the point is just to reuse the source browser, if there is no > annotation data applicable, don't use any. > Ok, should be as easy as the following diff. I'll include it in v3 if there si more feedback. --- diff --git b/tools/perf/builtin-c2c.c a/tools/perf/builtin-c2c.c index dce8604837aec..c856ce7a50740 100644 --- b/tools/perf/builtin-c2c.c +++ a/tools/perf/builtin-c2c.c @@ -2701,7 +2701,11 @@ static int perf_c2c__browse_cacheline(struct hist_entry *he) switch (key) { case 'a': - do_annotate(browser, evlist__first(c2c.evlist)); + /* + * We don't need percentage info so use 'dummy:HG' + * evsel which is last in evlist. + */ + do_annotate(browser, evlist__last(c2c.evlist)); break; case 's': c2c.symbol_full = !c2c.symbol_full;