Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp122430rdf; Thu, 2 Nov 2023 16:01:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHvKwI5SyI7fcma/YPDN5K8WdzF5pgz1w0Rl8+Awi8rJQQIBBiB9LELTK7hIVbGNlcJ/4vY X-Received: by 2002:a17:90a:3c86:b0:27c:fb84:101a with SMTP id g6-20020a17090a3c8600b0027cfb84101amr18157498pjc.29.1698966089092; Thu, 02 Nov 2023 16:01:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698966089; cv=none; d=google.com; s=arc-20160816; b=YGAJtoMH+otfOfShXAgZsq+Rt4aDX8zLois+tmaWpmby6oV+wqnmvfIKDVzHzFm7RC ZRFqJkxFtFNhBEyHzL+MSREC7vvVkACqlJuygyXBB7WAtd2GXKb32gOMr+kHOgn3J943 TaDg7rhPjlNHD5cKF+h+6aXXcxPtNLT72T0v6WmYhm/fEOzHpyzVCgOQJ4tzzsAoDghY M6cKs2765bmQGt6VgVQNYjjulFjOIMRmcafatS1rsoIE1XjAwxTx2qg0qPFlZbLnGnSB iGO5dwOYahBHkoUHS4IP2k+L+75Vq/jP8+gk6cJmPHQYNaNzBApgUjEsj+Ily3PhG1FB f68g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=5a/GtAxkpRNkq4Wv7MJVvEI6nRPwiDosiVmVdshmOnc=; fh=Pbu1BQwhCOAA2d/C0IOLVYR5czI2/+Avx4u+s0uioL8=; b=y2hNmTwGPKub37P62iY2NZxcuLLDFN9ZseSkGjcS90Lu9WZ4fKqa3O+Z21kJ+yBAGR bRFATcAcY0yYVThuAWBp3uhqPltaU3BsoyP3uQ5m3n4GWTBpsLtaC0RX1KEhFdzuj06Z Gn6YPGEgyUmJT1lKSCbIpi1U6gOsJVLsSfasyKjBZtcglvPZHvOSwjLNbT96KNKWzLXM 2mJn+Ugl+3IQhkzWM3zU3V9lZnqV6sJviWLKPmnEgHJg1o1AvHxeYSpLU8HgrLXwpXhw 3Kd5/aEA6/+JvZd7Q2oiZNhLOCfm4/VU4KBaNqictFgwkl+7/iHXl5zC5Nl0tIhqxhyN A2fA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=ktDwKlH7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id kk14-20020a17090b4a0e00b00278eb61c0ebsi578192pjb.118.2023.11.02.16.01.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 16:01:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=ktDwKlH7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 0908783C7585; Thu, 2 Nov 2023 16:01:26 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377548AbjKBXBG (ORCPT + 99 others); Thu, 2 Nov 2023 19:01:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234840AbjKBXBF (ORCPT ); Thu, 2 Nov 2023 19:01:05 -0400 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 193FA193 for ; Thu, 2 Nov 2023 16:01:01 -0700 (PDT) Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-408c6ec1fd1so14095e9.1 for ; Thu, 02 Nov 2023 16:01:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1698966059; x=1699570859; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=5a/GtAxkpRNkq4Wv7MJVvEI6nRPwiDosiVmVdshmOnc=; b=ktDwKlH7HwLUbYAcJ4yuPUgk40Jpo6xHf+DpqGBHRZD67wXFN+sz7PyTRjBEDuQUQl lvC/94kRrn44ZJ2bHaRB6aPUZl5vtaAJOlkPl8i1C9KIJ5sU+LLTH2yKFdTowh69SiyM cfqRtwUT2EyqFY6ZcTE4LYvnrijktoE7T8X97JQsY9n3sGZZkjXOvvV93knqb7vKBqrg AxoqId6egHe1pSB0/c37TMxEDvIQpZSuURd6S38f//Ghs3qYhowjW8VePNK+MllAEofK NHZKA+fw1zdtWjj/uJydm70+tleVBDgjD82fl8QkrMVFWqH0BhTY9qRbzHVuJBmsC0mH D6IA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698966059; x=1699570859; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5a/GtAxkpRNkq4Wv7MJVvEI6nRPwiDosiVmVdshmOnc=; b=Yk5bdjXoPyzScZhtSLWXuYfWwDZHpLmCPBTELJXWqL/bWwUB4866e1zcUywcZL6cAn 01k59o5aborWV5tKczxxhtViinKEeZyNkwu2YIoah7CJYTUWL8sQiaDUx9moxROfKcsm Tu6ATNktOKkxjav6vcvdKReXNZC5GzMNeeWTS2WnBt6eVG/0htQzkvnzWTTEpAyoHX+Z VzQFk/vpHxcj8SvjEawNohyIuQe0QRzd70No3PuUC8dQjj93Ukc+DehnjMHyxdNjPUKa 6bgYgr8eTrdo29WBwiYgRxbK8SEApIyXeQJidgjI7Aan6uVGo9vgk2PS5wZK6Z+cu4rc dpww== X-Gm-Message-State: AOJu0YyQT858nmugpWrN/hdz20ULMTs620kkHiWXC1cKSk1edYBmr0Cr 1F/EqtqqepnkC50oVZRFNmDj4GCNds88/hoJBvM9mQ== X-Received: by 2002:a05:600c:43c5:b0:405:35bf:7362 with SMTP id f5-20020a05600c43c500b0040535bf7362mr128127wmn.0.1698966059275; Thu, 02 Nov 2023 16:00:59 -0700 (PDT) MIME-Version: 1.0 References: <20231102222653.4165959-1-namhyung@kernel.org> <20231102222653.4165959-6-namhyung@kernel.org> In-Reply-To: <20231102222653.4165959-6-namhyung@kernel.org> From: Ian Rogers Date: Thu, 2 Nov 2023 16:00:47 -0700 Message-ID: Subject: Re: [PATCH 5/5] perf annotate: Move offsets to annotated_source To: Namhyung Kim Cc: Arnaldo Carvalho de Melo , Jiri Olsa , Adrian Hunter , Peter Zijlstra , Ingo Molnar , LKML , linux-perf-users@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Thu, 02 Nov 2023 16:01:26 -0700 (PDT) On Thu, Nov 2, 2023 at 3:27=E2=80=AFPM Namhyung Kim w= rote: > > The offsets array keeps pointers to struct annotation_line which is > available in the annotated_source. Let's move it to there. > > Signed-off-by: Namhyung Kim Reviewed-by: Ian Rogers Thanks, Ian > --- > tools/perf/ui/browsers/annotate.c | 4 ++-- > tools/perf/util/annotate.c | 18 +++++++++--------- > tools/perf/util/annotate.h | 2 +- > 3 files changed, 12 insertions(+), 12 deletions(-) > > diff --git a/tools/perf/ui/browsers/annotate.c b/tools/perf/ui/browsers/a= nnotate.c > index 1b42db70c998..163f916fff68 100644 > --- a/tools/perf/ui/browsers/annotate.c > +++ b/tools/perf/ui/browsers/annotate.c > @@ -188,7 +188,7 @@ static void annotate_browser__draw_current_jump(struc= t ui_browser *browser) > * name right after the '<' token and probably treating this lik= e a > * 'call' instruction. > */ > - target =3D notes->offsets[cursor->ops.target.offset]; > + target =3D notes->src->offsets[cursor->ops.target.offset]; > if (target =3D=3D NULL) { > ui_helpline__printf("WARN: jump target inconsistency, pre= ss 'o', notes->offsets[%#x] =3D NULL\n", > cursor->ops.target.offset); > @@ -1006,6 +1006,6 @@ int symbol__tui_annotate(struct map_symbol *ms, str= uct evsel *evsel, > > out_free_offsets: > if(not_annotated) > - zfree(¬es->offsets); > + zfree(¬es->src->offsets); > return ret; > } > diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c > index ee7b8e1848a8..8ab2e1cf63ea 100644 > --- a/tools/perf/util/annotate.c > +++ b/tools/perf/util/annotate.c > @@ -1075,7 +1075,7 @@ static unsigned annotation__count_insn(struct annot= ation *notes, u64 start, u64 > u64 offset; > > for (offset =3D start; offset <=3D end; offset++) { > - if (notes->offsets[offset]) > + if (notes->src->offsets[offset]) > n_insn++; > } > return n_insn; > @@ -1105,7 +1105,7 @@ static void annotation__count_and_fill(struct annot= ation *notes, u64 start, u64 > return; > > for (offset =3D start; offset <=3D end; offset++) { > - struct annotation_line *al =3D notes->offsets[off= set]; > + struct annotation_line *al =3D notes->src->offset= s[offset]; > > if (al && al->cycles && al->cycles->ipc =3D=3D 0.= 0) { > al->cycles->ipc =3D ipc; > @@ -1142,7 +1142,7 @@ void annotation__compute_ipc(struct annotation *not= es, size_t size) > if (ch && ch->cycles) { > struct annotation_line *al; > > - al =3D notes->offsets[offset]; > + al =3D notes->src->offsets[offset]; > if (al && al->cycles =3D=3D NULL) { > al->cycles =3D zalloc(sizeof(*al->cycles)= ); > if (al->cycles =3D=3D NULL) > @@ -2783,7 +2783,7 @@ void annotation__mark_jump_targets(struct annotatio= n *notes, struct symbol *sym) > return; > > for (offset =3D 0; offset < size; ++offset) { > - struct annotation_line *al =3D notes->offsets[offset]; > + struct annotation_line *al =3D notes->src->offsets[offset= ]; > struct disasm_line *dl; > > dl =3D disasm_line(al); > @@ -2791,7 +2791,7 @@ void annotation__mark_jump_targets(struct annotatio= n *notes, struct symbol *sym) > if (!disasm_line__is_valid_local_jump(dl, sym)) > continue; > > - al =3D notes->offsets[dl->ops.target.offset]; > + al =3D notes->src->offsets[dl->ops.target.offset]; > > /* > * FIXME: Oops, no jump target? Buggy disassembler? Or do= we > @@ -2830,7 +2830,7 @@ void annotation__set_offsets(struct annotation *not= es, s64 size) > * E.g. copy_user_generic_unrolled > */ > if (al->offset < size) > - notes->offsets[al->offset] =3D al; > + notes->src->offsets[al->offset] =3D al; > } else > al->idx_asm =3D -1; > } > @@ -3263,8 +3263,8 @@ int symbol__annotate2(struct map_symbol *ms, struct= evsel *evsel, > size_t size =3D symbol__size(sym); > int nr_pcnt =3D 1, err; > > - notes->offsets =3D zalloc(size * sizeof(struct annotation_line *)= ); > - if (notes->offsets =3D=3D NULL) > + notes->src->offsets =3D zalloc(size * sizeof(struct annotation_li= ne *)); > + if (notes->src->offsets =3D=3D NULL) > return ENOMEM; > > if (evsel__is_group_event(evsel)) > @@ -3290,7 +3290,7 @@ int symbol__annotate2(struct map_symbol *ms, struct= evsel *evsel, > return 0; > > out_free_offsets: > - zfree(¬es->offsets); > + zfree(¬es->src->offsets); > return err; > } > > diff --git a/tools/perf/util/annotate.h b/tools/perf/util/annotate.h > index c51ceb857bd6..44af7e71a204 100644 > --- a/tools/perf/util/annotate.h > +++ b/tools/perf/util/annotate.h > @@ -272,6 +272,7 @@ struct annotated_source { > int nr_histograms; > size_t sizeof_sym_hist; > struct sym_hist *histograms; > + struct annotation_line **offsets; > int nr_entries; > int nr_asm_entries; > u16 max_line_len; > @@ -289,7 +290,6 @@ struct annotated_branch { > struct LOCKABLE annotation { > u64 start; > struct annotation_options *options; > - struct annotation_line **offsets; > int nr_events; > int max_jump_sources; > struct { > -- > 2.42.0.869.gea05f2083d-goog >