From: Jiri Olsa <jolsa@redhat.com>
To: Andrii Nakryiko <andrii@kernel.org>
Cc: Andrii Nakryiko <andrii.nakryiko@gmail.com>,
Christy Lee <christylee@fb.com>,
Christy Lee <christyc.y.lee@gmail.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
bpf <bpf@vger.kernel.org>,
"linux-perf-use." <linux-perf-users@vger.kernel.org>,
Kernel Team <kernel-team@fb.com>, He Kuang <hekuang@huawei.com>,
Wang Nan <wangnan0@huawei.com>,
Wang ShaoBo <bobo.shaobowang@huawei.com>,
YueHaibing <yuehaibing@huawei.com>
Subject: Re: [PATCH bpf-next 2/2] perf: stop using deprecated bpf__object_next() API
Date: Thu, 13 Jan 2022 16:14:21 +0100 [thread overview]
Message-ID: <YeBBzbfjOgE/wfjK@krava> (raw)
In-Reply-To: <CAPqJDZpZrrg4UBz19H-HyEMk7rzn+PCe=qpYDR0uHvD3nPr4yw@mail.gmail.com>
On Thu, Jan 06, 2022 at 09:54:38AM -0800, Christy Lee wrote:
> Thank you so much, I was able to reproduce the original tests after applying
> the bug fix. I will submit a new patch set with the more detailed comments.
>
> The only deprecated functions that need to be removed after this would be
> bpf_program__set_prep() (how perf sets the bpf prologue) and
> bpf_program__nth_fd() (how perf leverages multi instance bpf). They look a
> little more involved and I'm not sure how to approach those. Jiri, would you
> mind taking a look at those please?
hi,
I checked and here's the way perf uses this interface:
- when bpf object/sources is specified on perf command line
we use bpf_object__open to load it
- user can define parameters in the section name for each bpf program
like:
SEC("lock_page=__lock_page page->flags")
int lock_page(struct pt_regs *ctx, int err, unsigned long flags)
{
return 1;
}
which tells perf to 'prepare' some extra bpf code for the program,
like to put value of 'page->flags' into 'flags' argument above
- perf generates extra prologue code to retrieve this data and does
that before the program is loaded by using bpf_program__set_prep
callback
- now the reason why we use bpf_program__set_prep for that, is because
it allows to create multiple instances for one bpf program
- we need multiple instances for single program, because probe can
result in multiple attach addresses (like for inlined functions)
with possible different ways of getting the arguments we need
to load
I guess you want to get rid of that whole 'struct instances' related
stuff, is that right?
perf would need to load all the needed instances for program manually
and somehow bypass/workaround bpf_object__load.. is there a way to
manually add extra programs to bpf_object?
thoughts? ;-)
thanks,
jirka
next prev parent reply other threads:[~2022-01-13 15:14 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-16 22:21 [PATCH bpf-next 0/2] perf: stop using deprecated bpf APIs Christy Lee
2021-12-16 22:21 ` [PATCH bpf-next 1/2] perf: stop using deprecated bpf_prog_load() API Christy Lee
2021-12-16 22:21 ` [PATCH bpf-next 2/2] perf: stop using deprecated bpf__object_next() API Christy Lee
2021-12-21 8:22 ` Jiri Olsa
2021-12-21 21:58 ` Andrii Nakryiko
2021-12-22 13:44 ` Jiri Olsa
2021-12-22 22:17 ` Andrii Nakryiko
2021-12-29 19:01 ` Christy Lee
2022-01-04 14:40 ` Jiri Olsa
2022-01-05 13:49 ` Jiri Olsa
2022-01-06 17:54 ` Christy Lee
2022-01-06 22:41 ` Jiri Olsa
2022-01-13 15:14 ` Jiri Olsa [this message]
2022-01-14 21:00 ` Andrii Nakryiko
2022-01-17 9:25 ` Jiri Olsa
2022-01-18 23:05 ` Andrii Nakryiko
2022-01-22 20:29 ` Arnaldo Carvalho de Melo
2022-01-06 20:25 ` 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=YeBBzbfjOgE/wfjK@krava \
--to=jolsa@redhat.com \
--cc=acme@kernel.org \
--cc=andrii.nakryiko@gmail.com \
--cc=andrii@kernel.org \
--cc=bobo.shaobowang@huawei.com \
--cc=bpf@vger.kernel.org \
--cc=christyc.y.lee@gmail.com \
--cc=christylee@fb.com \
--cc=hekuang@huawei.com \
--cc=kernel-team@fb.com \
--cc=linux-perf-users@vger.kernel.org \
--cc=wangnan0@huawei.com \
--cc=yuehaibing@huawei.com \
/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