From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Namhyung Kim <namhyung@kernel.org>
Cc: Ian Rogers <irogers@google.com>,
Kan Liang <kan.liang@linux.intel.com>,
Jiri Olsa <jolsa@kernel.org>,
Adrian Hunter <adrian.hunter@intel.com>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
linux-perf-users@vger.kernel.org,
Dan Carpenter <dan.carpenter@linaro.org>
Subject: Re: [PATCH] perf lock contention: Change stack_id type to s32
Date: Mon, 12 Aug 2024 13:09:36 -0300 [thread overview]
Message-ID: <ZrozwIQcB_viRsKt@x1> (raw)
In-Reply-To: <20240810191704.1948365-1-namhyung@kernel.org>
On Sat, Aug 10, 2024 at 12:17:04PM -0700, Namhyung Kim wrote:
> The bpf_get_stackid() helper returns a signed type to check whether it
> failed to get a stacktrace or not. But it saved the result in u32 and
> checked if the value is negative.
>
> 376 if (needs_callstack) {
> 377 pelem->stack_id = bpf_get_stackid(ctx, &stacks,
> 378 BPF_F_FAST_STACK_CMP | stack_skip);
> --> 379 if (pelem->stack_id < 0)
>
> ./tools/perf/util/bpf_skel/lock_contention.bpf.c:379 contention_begin()
> warn: unsigned 'pelem->stack_id' is never less than zero.
>
> Let's change the type to s32 instead.
>
> Fixes: 6d499a6b3d90 ("perf lock: Print the number of lost entries for BPF")
Thanks, applied to perf-tools-next,
- Arnaldo
> Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> ---
> tools/perf/util/bpf_skel/lock_data.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/perf/util/bpf_skel/lock_data.h b/tools/perf/util/bpf_skel/lock_data.h
> index 36af11faad03..de12892f992f 100644
> --- a/tools/perf/util/bpf_skel/lock_data.h
> +++ b/tools/perf/util/bpf_skel/lock_data.h
> @@ -7,11 +7,11 @@ struct tstamp_data {
> u64 timestamp;
> u64 lock;
> u32 flags;
> - u32 stack_id;
> + s32 stack_id;
> };
>
> struct contention_key {
> - u32 stack_id;
> + s32 stack_id;
> u32 pid;
> u64 lock_addr_or_cgroup;
> };
> --
> 2.46.0.76.ge559c4bf1a-goog
next prev parent reply other threads:[~2024-08-12 16:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <909abbc8-efca-40df-9876-8c36b6942a83@stanley.mountain>
2024-08-10 19:17 ` [PATCH] perf lock contention: Change stack_id type to s32 Namhyung Kim
2024-08-12 14:52 ` kernel test robot
2024-08-12 16:09 ` Arnaldo Carvalho de Melo [this message]
2024-08-12 16:52 ` Arnaldo Carvalho de Melo
2024-08-12 16:57 ` Namhyung Kim
2024-08-12 17:05 ` Arnaldo Carvalho de Melo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZrozwIQcB_viRsKt@x1 \
--to=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=dan.carpenter@linaro.org \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=kan.liang@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox