Message ID | 20231207011722.1220634-2-irogers@google.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp4487275vqy; Wed, 6 Dec 2023 17:17:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IF3WlodeBXB0CbnLrmze1keDGsq4mXOb1QrR6+OqGJ8sW6m6mwYZFIG4tkqJgYLAEfx/l0c X-Received: by 2002:a05:6358:730b:b0:170:17eb:204c with SMTP id d11-20020a056358730b00b0017017eb204cmr1829450rwg.53.1701911867213; Wed, 06 Dec 2023 17:17:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701911867; cv=none; d=google.com; s=arc-20160816; b=nBzjuP/1cbm3oL8AuRcGh5z6F8A2hEZoCZIIrxbgd4CbBy6vPx6BOoDg1zlL7Ad+Hk wv4VSlMeFTr8HJeQfaECoC/wczS1PhsKbZODD8tuT17lDG6H1V835oZdzzWqBrvNOcpS pOHB1oNml8bNUutFLblrJocGf43pUBOJyAiY5N+nmpb31ejqcF+qE6etMILEqS9+BUEg QDV1DdrnUYPgm6jdkp6agXO2OmQA1CSbvN15NpNJ5W/NfX2uXcPp94hpOaqsWdUbxmw6 kEbipxmnsonTJZkkj8MeoNHAZNpgybw2EN/9mkRmWxuHMJW8MRTYrcmjhJjpi+vCc8cu NyjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:from:subject:references:mime-version :message-id:in-reply-to:date:dkim-signature; bh=JwUZYyK0Ujy/qNX/TFIi+04XnhZ1QaUR4WIBvLcrqEc=; fh=Io7x3OacpefNRRNKoYAzVE0aWTDwD7FRzyCdD1e3AN4=; b=o+C2RXeC2lEkrkJ7nQa+4cHw190YrBRFiPcG4k6VUoD5KPDxoJSQHRT7oOiB9tDnzP 89Ye7g+g72ZVzIwqjLEivOuNf7QRRKKSen0N0uRmAzQmu7HeVdi6cOFAQMMzePovY3AB P5n1a+mKXY6ukM63P2ZcAAbV3Qrsv0m+tiOf9lJJFZ7ssjKW7YOeREld2StHe3u2C0Xi iVysg8nSi6fdhVrQZ4w1XomGdGKdygl7ZK5XofA91eV/VzcolOgQa64qXX8kth8ZXzYE xhZ49F+EhjJi7+lKkDZajgjyNwREn+HHKWwchDhTeRc10xvb/NiOZDowmtvLIVTiKus3 hoDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=av+IemWZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 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 pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id j2-20020a62e902000000b006ce70be4c40si239552pfh.349.2023.12.06.17.17.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 17:17:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=av+IemWZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 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 pete.vger.email (Postfix) with ESMTP id 06F4C81C57E3; Wed, 6 Dec 2023 17:17:40 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1441985AbjLGBR0 (ORCPT <rfc822;pusanteemu@gmail.com> + 99 others); Wed, 6 Dec 2023 20:17:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1441968AbjLGBRY (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 6 Dec 2023 20:17:24 -0500 Received: from mail-yw1-x1149.google.com (mail-yw1-x1149.google.com [IPv6:2607:f8b0:4864:20::1149]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68F3F10D for <linux-kernel@vger.kernel.org>; Wed, 6 Dec 2023 17:17:30 -0800 (PST) Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-5d7e7e10231so1128767b3.1 for <linux-kernel@vger.kernel.org>; Wed, 06 Dec 2023 17:17:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1701911849; x=1702516649; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=JwUZYyK0Ujy/qNX/TFIi+04XnhZ1QaUR4WIBvLcrqEc=; b=av+IemWZ1ObNifkU9XUiDGYnbgA7KZxdubWFjauvMpPdmtrrEpccv3lLGrt4XC1sVd Zhu0Ul6FryaOfFSG2KLabjS9r2qNlPFE2cT2d7sViiDxThHn+0HFBF9umBj0qBm/MvY8 GCq7rJgTUfeQTkRMqYYap4RAydaUecwaibByJCVEktb6tZDPQxqolOoMIFEclm/rQEP7 7VB2X0j0WoSJROu1zwCOz01dRaB2zYOBb5nhhYDsg9rTyO7doG0WOdm5vfKdBOPAhgOC tmH/NBZSSEM0N9o/1fEmwN/ivoxeGmzoFNsIJIqkE3JsWWY+NT2UMIa1ydPz11Sjlj+8 WbFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701911849; x=1702516649; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=JwUZYyK0Ujy/qNX/TFIi+04XnhZ1QaUR4WIBvLcrqEc=; b=tzotBOy3w321oh+CewVHQn0c68Taz3Lv5GlWBgo7I4m1l4onUXPblZA5eBvSkf4/9K zcqOEO8JGkb+oWGXjOmtzHOdiCyDIn9C6giEP+F5onTAQVVDOVi8e1eOOZF4YcyMS3cE TJRnVhIJQSWJu1sirNIDF5SQVhcUkIla7s3lGvJ+rndMab8ukb/oKMMy/TiH3ysAG5tK ERVIr1sPAqjzxEMD8iwy4H8/maNrq3lbuUL7NYiyBNdHX0zMUXa+lD7WlmUsydjq2mSL d4puXCwB8kFqLE/NaAWuDrJwSuqzuPG/8lfT3KkdgS0qU9w21d1ny8HiOG2wRiAYYue3 hIgw== X-Gm-Message-State: AOJu0YxDsaY+aipl2BCjk+/MrF4DpCqB8yYenGEfGvMQezUiJDR891JP azfJekIuVdm+usEFigp6qRFcbxnZ3FRZ X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:35bf:293e:7696:34e9]) (user=irogers job=sendgmr) by 2002:a81:b658:0:b0:5d3:ffa2:56ec with SMTP id h24-20020a81b658000000b005d3ffa256ecmr126424ywk.1.1701911849559; Wed, 06 Dec 2023 17:17:29 -0800 (PST) Date: Wed, 6 Dec 2023 17:16:35 -0800 In-Reply-To: <20231207011722.1220634-1-irogers@google.com> Message-Id: <20231207011722.1220634-2-irogers@google.com> Mime-Version: 1.0 References: <20231207011722.1220634-1-irogers@google.com> X-Mailer: git-send-email 2.43.0.rc2.451.g8631bc7472-goog Subject: [PATCH v6 01/47] perf map: Improve map/unmap parameter names From: Ian Rogers <irogers@google.com> To: Peter Zijlstra <peterz@infradead.org>, Ingo Molnar <mingo@redhat.com>, Arnaldo Carvalho de Melo <acme@kernel.org>, Mark Rutland <mark.rutland@arm.com>, Alexander Shishkin <alexander.shishkin@linux.intel.com>, Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>, Ian Rogers <irogers@google.com>, Adrian Hunter <adrian.hunter@intel.com>, Nick Terrell <terrelln@fb.com>, Kan Liang <kan.liang@linux.intel.com>, Andi Kleen <ak@linux.intel.com>, Kajol Jain <kjain@linux.ibm.com>, Athira Rajeev <atrajeev@linux.vnet.ibm.com>, Huacai Chen <chenhuacai@kernel.org>, Masami Hiramatsu <mhiramat@kernel.org>, Vincent Whitchurch <vincent.whitchurch@axis.com>, "Steinar H. Gunderson" <sesse@google.com>, Liam Howlett <liam.howlett@oracle.com>, Miguel Ojeda <ojeda@kernel.org>, Colin Ian King <colin.i.king@gmail.com>, Dmitrii Dolgov <9erthalion6@gmail.com>, Yang Jihong <yangjihong1@huawei.com>, Ming Wang <wangming01@loongson.cn>, James Clark <james.clark@arm.com>, K Prateek Nayak <kprateek.nayak@amd.com>, Sean Christopherson <seanjc@google.com>, Leo Yan <leo.yan@linaro.org>, Ravi Bangoria <ravi.bangoria@amd.com>, German Gomez <german.gomez@arm.com>, Changbin Du <changbin.du@huawei.com>, Paolo Bonzini <pbonzini@redhat.com>, Li Dong <lidong@vivo.com>, Sandipan Das <sandipan.das@amd.com>, liuwenyu <liuwenyu7@huawei.com>, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Guilherme Amadio <amadio@gentoo.org> Content-Type: text/plain; charset="UTF-8" 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 pete.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Wed, 06 Dec 2023 17:17:40 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784583938254817850 X-GMAIL-MSGID: 1784583938254817850 |
Series |
maps/threads/dsos memory improvements and fixes
|
|
Commit Message
Ian Rogers
Dec. 7, 2023, 1:16 a.m. UTC
The u64 values are either absolute or relative, try to hint better in
the parameter names.
Suggested-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Ian Rogers <irogers@google.com>
---
tools/perf/util/map.h | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
Comments
On Wed, Dec 6, 2023 at 5:17 PM Ian Rogers <irogers@google.com> wrote: > > The u64 values are either absolute or relative, try to hint better in > the parameter names. > > Suggested-by: Namhyung Kim <namhyung@kernel.org> > Signed-off-by: Ian Rogers <irogers@google.com> > --- > tools/perf/util/map.h | 16 ++++++++-------- > 1 file changed, 8 insertions(+), 8 deletions(-) > > diff --git a/tools/perf/util/map.h b/tools/perf/util/map.h > index 3a3b7757da5f..49756716cb13 100644 > --- a/tools/perf/util/map.h > +++ b/tools/perf/util/map.h > @@ -105,25 +105,25 @@ static inline u64 map__dso_map_ip(const struct map *map, u64 ip) > } > > /* dso rip -> ip */ > -static inline u64 map__dso_unmap_ip(const struct map *map, u64 ip) > +static inline u64 map__dso_unmap_ip(const struct map *map, u64 rip) > { > - return ip + map__start(map) - map__pgoff(map); > + return rip + map__start(map) - map__pgoff(map); > } > > -static inline u64 map__map_ip(const struct map *map, u64 ip) > +static inline u64 map__map_ip(const struct map *map, u64 ip_or_rip) I'm afraid it's gonna be more confusing. Can we say just 'rip'? > { > if ((RC_CHK_ACCESS(map)->mapping_type) == MAPPING_TYPE__DSO) > - return map__dso_map_ip(map, ip); > + return map__dso_map_ip(map, ip_or_rip); > else > - return ip; > + return ip_or_rip; > } > > -static inline u64 map__unmap_ip(const struct map *map, u64 ip) > +static inline u64 map__unmap_ip(const struct map *map, u64 ip_or_rip) Ditto. Thanks, Namhyung > { > if ((RC_CHK_ACCESS(map)->mapping_type) == MAPPING_TYPE__DSO) > - return map__dso_unmap_ip(map, ip); > + return map__dso_unmap_ip(map, ip_or_rip); > else > - return ip; > + return ip_or_rip; > } > > /* rip/ip <-> addr suitable for passing to `objdump --start-address=` */ > -- > 2.43.0.rc2.451.g8631bc7472-goog >
On Mon, Dec 11, 2023 at 3:38 PM Namhyung Kim <namhyung@kernel.org> wrote: > > On Wed, Dec 6, 2023 at 5:17 PM Ian Rogers <irogers@google.com> wrote: > > > > The u64 values are either absolute or relative, try to hint better in > > the parameter names. > > > > Suggested-by: Namhyung Kim <namhyung@kernel.org> > > Signed-off-by: Ian Rogers <irogers@google.com> > > --- > > tools/perf/util/map.h | 16 ++++++++-------- > > 1 file changed, 8 insertions(+), 8 deletions(-) > > > > diff --git a/tools/perf/util/map.h b/tools/perf/util/map.h > > index 3a3b7757da5f..49756716cb13 100644 > > --- a/tools/perf/util/map.h > > +++ b/tools/perf/util/map.h > > @@ -105,25 +105,25 @@ static inline u64 map__dso_map_ip(const struct map *map, u64 ip) > > } > > > > /* dso rip -> ip */ > > -static inline u64 map__dso_unmap_ip(const struct map *map, u64 ip) > > +static inline u64 map__dso_unmap_ip(const struct map *map, u64 rip) > > { > > - return ip + map__start(map) - map__pgoff(map); > > + return rip + map__start(map) - map__pgoff(map); > > } > > > > -static inline u64 map__map_ip(const struct map *map, u64 ip) > > +static inline u64 map__map_ip(const struct map *map, u64 ip_or_rip) > > I'm afraid it's gonna be more confusing. Can we say just 'rip'? Oh.. I think it should be 'ip'. > > > { > > if ((RC_CHK_ACCESS(map)->mapping_type) == MAPPING_TYPE__DSO) > > - return map__dso_map_ip(map, ip); > > + return map__dso_map_ip(map, ip_or_rip); > > else > > - return ip; > > + return ip_or_rip; > > } > > > > -static inline u64 map__unmap_ip(const struct map *map, u64 ip) > > +static inline u64 map__unmap_ip(const struct map *map, u64 ip_or_rip) > > Ditto. > > Thanks, > Namhyung > > > > { > > if ((RC_CHK_ACCESS(map)->mapping_type) == MAPPING_TYPE__DSO) > > - return map__dso_unmap_ip(map, ip); > > + return map__dso_unmap_ip(map, ip_or_rip); > > else > > - return ip; > > + return ip_or_rip; > > } > > > > /* rip/ip <-> addr suitable for passing to `objdump --start-address=` */ > > -- > > 2.43.0.rc2.451.g8631bc7472-goog > >
On Mon, Dec 11, 2023 at 3:39 PM Namhyung Kim <namhyung@kernel.org> wrote: > > On Mon, Dec 11, 2023 at 3:38 PM Namhyung Kim <namhyung@kernel.org> wrote: > > > > On Wed, Dec 6, 2023 at 5:17 PM Ian Rogers <irogers@google.com> wrote: > > > > > > The u64 values are either absolute or relative, try to hint better in > > > the parameter names. > > > > > > Suggested-by: Namhyung Kim <namhyung@kernel.org> > > > Signed-off-by: Ian Rogers <irogers@google.com> > > > --- > > > tools/perf/util/map.h | 16 ++++++++-------- > > > 1 file changed, 8 insertions(+), 8 deletions(-) > > > > > > diff --git a/tools/perf/util/map.h b/tools/perf/util/map.h > > > index 3a3b7757da5f..49756716cb13 100644 > > > --- a/tools/perf/util/map.h > > > +++ b/tools/perf/util/map.h > > > @@ -105,25 +105,25 @@ static inline u64 map__dso_map_ip(const struct map *map, u64 ip) > > > } > > > > > > /* dso rip -> ip */ > > > -static inline u64 map__dso_unmap_ip(const struct map *map, u64 ip) > > > +static inline u64 map__dso_unmap_ip(const struct map *map, u64 rip) > > > { > > > - return ip + map__start(map) - map__pgoff(map); > > > + return rip + map__start(map) - map__pgoff(map); > > > } > > > > > > -static inline u64 map__map_ip(const struct map *map, u64 ip) > > > +static inline u64 map__map_ip(const struct map *map, u64 ip_or_rip) > > > > I'm afraid it's gonna be more confusing. Can we say just 'rip'? > > Oh.. I think it should be 'ip'. But sometimes it is an ip and sometimes it is an rip, hence the long name. I don't think this really affects much so I'd prefer to stick with the intention revealing name if possible. Thanks, Ian > > > > > { > > > if ((RC_CHK_ACCESS(map)->mapping_type) == MAPPING_TYPE__DSO) > > > - return map__dso_map_ip(map, ip); > > > + return map__dso_map_ip(map, ip_or_rip); > > > else > > > - return ip; > > > + return ip_or_rip; > > > } > > > > > > -static inline u64 map__unmap_ip(const struct map *map, u64 ip) > > > +static inline u64 map__unmap_ip(const struct map *map, u64 ip_or_rip) > > > > Ditto. > > > > Thanks, > > Namhyung > > > > > > > { > > > if ((RC_CHK_ACCESS(map)->mapping_type) == MAPPING_TYPE__DSO) > > > - return map__dso_unmap_ip(map, ip); > > > + return map__dso_unmap_ip(map, ip_or_rip); > > > else > > > - return ip; > > > + return ip_or_rip; > > > } > > > > > > /* rip/ip <-> addr suitable for passing to `objdump --start-address=` */ > > > -- > > > 2.43.0.rc2.451.g8631bc7472-goog > > >
On Mon, Dec 11, 2023 at 3:52 PM Ian Rogers <irogers@google.com> wrote: > > On Mon, Dec 11, 2023 at 3:39 PM Namhyung Kim <namhyung@kernel.org> wrote: > > > > On Mon, Dec 11, 2023 at 3:38 PM Namhyung Kim <namhyung@kernel.org> wrote: > > > > > > On Wed, Dec 6, 2023 at 5:17 PM Ian Rogers <irogers@google.com> wrote: > > > > > > > > The u64 values are either absolute or relative, try to hint better in > > > > the parameter names. > > > > > > > > Suggested-by: Namhyung Kim <namhyung@kernel.org> > > > > Signed-off-by: Ian Rogers <irogers@google.com> > > > > --- > > > > tools/perf/util/map.h | 16 ++++++++-------- > > > > 1 file changed, 8 insertions(+), 8 deletions(-) > > > > > > > > diff --git a/tools/perf/util/map.h b/tools/perf/util/map.h > > > > index 3a3b7757da5f..49756716cb13 100644 > > > > --- a/tools/perf/util/map.h > > > > +++ b/tools/perf/util/map.h > > > > @@ -105,25 +105,25 @@ static inline u64 map__dso_map_ip(const struct map *map, u64 ip) > > > > } > > > > > > > > /* dso rip -> ip */ > > > > -static inline u64 map__dso_unmap_ip(const struct map *map, u64 ip) > > > > +static inline u64 map__dso_unmap_ip(const struct map *map, u64 rip) > > > > { > > > > - return ip + map__start(map) - map__pgoff(map); > > > > + return rip + map__start(map) - map__pgoff(map); > > > > } > > > > > > > > -static inline u64 map__map_ip(const struct map *map, u64 ip) > > > > +static inline u64 map__map_ip(const struct map *map, u64 ip_or_rip) > > > > > > I'm afraid it's gonna be more confusing. Can we say just 'rip'? > > > > Oh.. I think it should be 'ip'. > > But sometimes it is an ip and sometimes it is an rip, hence the long > name. I don't think this really affects much so I'd prefer to stick > with the intention revealing name if possible. I don't think the intention is to mix ip and rip. Does it really pass (already mapped) rip to the map function again? I know rip and ip can be identical but it doesn't mean it can use rip to the map function. Thanks, Namhyung
diff --git a/tools/perf/util/map.h b/tools/perf/util/map.h index 3a3b7757da5f..49756716cb13 100644 --- a/tools/perf/util/map.h +++ b/tools/perf/util/map.h @@ -105,25 +105,25 @@ static inline u64 map__dso_map_ip(const struct map *map, u64 ip) } /* dso rip -> ip */ -static inline u64 map__dso_unmap_ip(const struct map *map, u64 ip) +static inline u64 map__dso_unmap_ip(const struct map *map, u64 rip) { - return ip + map__start(map) - map__pgoff(map); + return rip + map__start(map) - map__pgoff(map); } -static inline u64 map__map_ip(const struct map *map, u64 ip) +static inline u64 map__map_ip(const struct map *map, u64 ip_or_rip) { if ((RC_CHK_ACCESS(map)->mapping_type) == MAPPING_TYPE__DSO) - return map__dso_map_ip(map, ip); + return map__dso_map_ip(map, ip_or_rip); else - return ip; + return ip_or_rip; } -static inline u64 map__unmap_ip(const struct map *map, u64 ip) +static inline u64 map__unmap_ip(const struct map *map, u64 ip_or_rip) { if ((RC_CHK_ACCESS(map)->mapping_type) == MAPPING_TYPE__DSO) - return map__dso_unmap_ip(map, ip); + return map__dso_unmap_ip(map, ip_or_rip); else - return ip; + return ip_or_rip; } /* rip/ip <-> addr suitable for passing to `objdump --start-address=` */