From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f176.google.com (mail-pg1-f176.google.com [209.85.215.176]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F749CB; Mon, 11 Dec 2023 15:38:29 -0800 (PST) Received: by mail-pg1-f176.google.com with SMTP id 41be03b00d2f7-5c66b093b86so4569315a12.0; Mon, 11 Dec 2023 15:38:29 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702337909; x=1702942709; 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=BHpTfcyEiSTL+Iiy4h09/0w/ff7Mj2tSbGaHW/cYLyA=; b=T2Kwi0LCSCwD/ZpCvx58zqth91J+IUDNe5Ys9tf9uYJaAaSpKZ0PMXqEwECQI6sa0E 5OoT3dhnH0y3Am8DCNtuCCCAq55ho+Aw/ERg98cZLhfvnLp29nAqq28B9R3ylaPryk8x dsE4MUOkm1pul/f/oYEfHDokX41fd8l+ISgHathEEO43Uthg5wYcwj2o0h4pmeqdx8qD Du4AKHV0HnY7QkYjuPCso8Cuob+zblECT+Lp9mLHzqTbAxG5pw+6OcmrQ14G/jk4Lagl LW34/4fqsn2lwf/HD/I2qlAMQ+JSl7ZD1NgUM4kBJAA5R9JL3/DmGL918smqpROV3mMe kucA== X-Gm-Message-State: AOJu0YzgXBwycHTZfHhaFZ3j+hJmuo1DPHJlKwI35zr9ohg7oaYmCJnU ZK5HEcXy9NM6IcepJkz5stGZtRnUwvxHWkOndT8= X-Google-Smtp-Source: AGHT+IG6XeG2QHBItXCy7jlLpitpWE5WDX6fF+j8UTcmkqlO011/5wKWPuqSYXO/CiPnBl4Ca/kyQ+uMui58XQRhKF8= X-Received: by 2002:a17:90a:5b08:b0:286:9212:a7cf with SMTP id o8-20020a17090a5b0800b002869212a7cfmr5765857pji.44.1702337908760; Mon, 11 Dec 2023 15:38:28 -0800 (PST) Precedence: bulk X-Mailing-List: linux-perf-users@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20231207011722.1220634-1-irogers@google.com> <20231207011722.1220634-2-irogers@google.com> In-Reply-To: <20231207011722.1220634-2-irogers@google.com> From: Namhyung Kim Date: Mon, 11 Dec 2023 15:38:17 -0800 Message-ID: Subject: Re: [PATCH v6 01/47] perf map: Improve map/unmap parameter names To: Ian Rogers Cc: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Adrian Hunter , Nick Terrell , Kan Liang , Andi Kleen , Kajol Jain , Athira Rajeev , Huacai Chen , Masami Hiramatsu , Vincent Whitchurch , "Steinar H. Gunderson" , Liam Howlett , Miguel Ojeda , Colin Ian King , Dmitrii Dolgov <9erthalion6@gmail.com>, Yang Jihong , Ming Wang , James Clark , K Prateek Nayak , Sean Christopherson , Leo Yan , Ravi Bangoria , German Gomez , Changbin Du , Paolo Bonzini , Li Dong , Sandipan Das , liuwenyu , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Guilherme Amadio Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Dec 6, 2023 at 5:17=E2=80=AFPM Ian Rogers wrot= e: > > The u64 values are either absolute or relative, try to hint better in > the parameter names. > > Suggested-by: Namhyung Kim > Signed-off-by: Ian Rogers > --- > 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) =3D=3D 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) =3D=3D 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=3D` = */ > -- > 2.43.0.rc2.451.g8631bc7472-goog >