From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ravi Bangoria <ravi.bangoria@amd.com>
Cc: Hyeonggon Yoo <42.hyeyoo@gmail.com>,
Vlastimil Babka <vbabka@suse.cz>, Leo Yan <leo.yan@linaro.org>,
Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>,
Ian Rogers <irogers@google.com>,
linux-perf-users <linux-perf-users@vger.kernel.org>
Subject: Re: [BUG] perf kmem: Broken because of missing tracepoints
Date: Fri, 6 Jan 2023 14:44:51 -0300 [thread overview]
Message-ID: <Y7heE/e+g9IbefmO@kernel.org> (raw)
In-Reply-To: <Y7haGk30muVMjRhF@kernel.org>
Em Fri, Jan 06, 2023 at 02:27:54PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Fri, Jan 06, 2023 at 06:34:32PM +0530, Ravi Bangoria escreveu:
> > On 06-Jan-23 10:52 AM, Leo Yan wrote:
> > > Hi Ravi, Arnaldo,
> > >
> > > On Thu, Jan 05, 2023 at 01:27:30PM -0300, Arnaldo Carvalho de Melo wrote:
> > >> Em Thu, Jan 05, 2023 at 07:03:25PM +0530, Ravi Bangoria escreveu:
> > >>> Hello,
> > >>>
> > >>> Two tracepoints, kmem:kmalloc_node and kmem:kmem_cache_alloc_node used by perf-
> > >>> kmem tool were removed from kernel by commit 11e9734bcb6a7 ("mm/slab_common:
> > >>> unify NUMA and UMA version of tracepoints"). This causes issue while running
> > >>> perf kmem on latest kernel:
> > >>>
> > >>> $ sudo ./perf kmem record
> > >>> event syntax error: 'kmem:kmalloc_node'
> > >>> \___ unknown tracepoint
> > >>>
> > >>> $ sudo ./perf kmem record
> > >>> event syntax error: 'kmem:kmem_cache_alloc_node'
> > >>> \___ unknown tracepoint
> > >>>
> > >>> Haven't got a chance to debug further. Anyone aware of this?
> > >>
> > >> I didn't notice this so far, would be good to have a fix soon.
> > >
> > > I looked a bit for the issue, so wrote a fix and verified on my
> > > Arm64 machine. Please let me know if this works for you or not,
> > > thanks!
> > >
> > > From b7d26f5543401924ae4ad93daeba66cd7d58eb39 Mon Sep 17 00:00:00 2001
> > > From: Leo Yan <leo.yan@linaro.org>
> > > Date: Fri, 6 Jan 2023 11:16:27 +0800
> > > Subject: [PATCH] perf kmem: Fix tracepoints breakage
> > >
> > > Commit 11e9734bcb6a ("mm/slab_common: unify NUMA and UMA version of
> > > tracepoints") removed tracepoints 'kmalloc_node' and
> > > 'kmem_cache_alloc_node'; the tracepoints 'kmalloc'
> > > and 'kmem_cache_alloc' add an extra field 'node' to present the
> > > memory node to be allocated and replace the two removed tracepoints
> > > respectively.
> > >
> > > The commit introduces ABI breakage, both for the dropped tracepoints and
> > > for the updated tracepoints.
> > >
> > > To fix this issue, perf tool removes the support for the tracepoints
> > > 'kmalloc_node' and 'kmem_cache_alloc_node'; for the two updated
> > > tracepoints this patch reads out the new field 'node', if its value is
> > > NUMA_NO_NODE (-1), we doesn't take it as a cross memory allocation.
> > >
> > > Reported-by: Ravi Bangoria <ravi.bangoria@amd.com>
> > > Fixes: 11e9734bcb6a ("mm/slab_common: unify NUMA and UMA version of tracepoints")
But I'm removing this Fixes: tag (leaving the reference in the 1st
commit log message paragraph tho), and removing the term "ABI", as AFAIK
tracepoints can change and tools have to adapt, right?
Lemme see...
Documentation/bpf/bpf_design_QA.rst
Q: Are tracepoints part of the stable ABI?
------------------------------------------
A: NO. Tracepoints are tied to internal implementation details hence they are
subject to change and can break with newer kernels. BPF programs need to change
accordingly when this happens.
---
> > > Signed-off-by: Leo Yan <leo.yan@linaro.org>
> >
> > Thanks Leo. A quick test shows it fixes the issue.
> >
> > Tested-by: Ravi Bangoria <ravi.bangoria@amd.com>
>
> Thanks, applied.
And I retract that, we need to query for the existence of these
tracepoints and use it if available, as we expect a new perf tool to
work on an older kernel, one where the removed tracepoints may be
available.
Leo, can you try to rework this?
If you look at tools/perf/builtin-sched.c it queries for the existence
of:
static bool schedstat_events_exposed(void)
{
/*
* Select "sched:sched_stat_wait" event to check
* whether schedstat tracepoints are exposed.
*/
return IS_ERR(trace_event__tp_format("sched", "sched_stat_wait")) ?
false : true;
}
/*
* The tracepoints trace_sched_stat_{wait, sleep, iowait}
* are not exposed to user if CONFIG_SCHEDSTATS is not set,
* to prevent "perf sched record" execution failure, determine
* whether to record schedstat events according to actual situation.
*/
const char * const schedstat_args[] = {
"-e", "sched:sched_stat_wait",
"-e", "sched:sched_stat_sleep",
"-e", "sched:sched_stat_iowait",
};
unsigned int schedstat_argc = schedstat_events_exposed() ?
ARRAY_SIZE(schedstat_args) : 0;
So its something along those lines.
Thanks,
- Arnaldo
next prev parent reply other threads:[~2023-01-06 17:45 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-05 13:33 [BUG] perf kmem: Broken because of missing tracepoints Ravi Bangoria
2023-01-05 16:27 ` Arnaldo Carvalho de Melo
2023-01-06 5:22 ` Leo Yan
2023-01-06 13:04 ` Ravi Bangoria
2023-01-06 17:27 ` Arnaldo Carvalho de Melo
2023-01-06 17:44 ` Arnaldo Carvalho de Melo [this message]
2023-01-07 4:13 ` Leo Yan
2023-01-07 18:41 ` Vlastimil Babka
2023-01-08 6:30 ` Leo Yan
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=Y7heE/e+g9IbefmO@kernel.org \
--to=acme@kernel.org \
--cc=42.hyeyoo@gmail.com \
--cc=irogers@google.com \
--cc=jolsa@redhat.com \
--cc=leo.yan@linaro.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=namhyung@kernel.org \
--cc=ravi.bangoria@amd.com \
--cc=vbabka@suse.cz \
/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;
as well as URLs for NNTP newsgroup(s).