bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christy Lee <christylee@fb.com>
To: <andrii@kernel.org>, <acme@kernel.org>, <jolsa@redhat.com>
Cc: <christylee@fb.com>, <christyc.y.lee@gmail.com>,
	<bpf@vger.kernel.org>, <linux-perf-users@vger.kernel.org>,
	<kernel-team@fb.com>, <wangnan0@huawei.com>,
	<bobo.shaobowang@huawei.com>, <yuehaibing@huawei.com>
Subject: [PATCH bpf-next v2 1/2] perf: stop using deprecated bpf_prog_load() API
Date: Thu, 6 Jan 2022 12:00:31 -0800	[thread overview]
Message-ID: <20220106200032.3067127-2-christylee@fb.com> (raw)
In-Reply-To: <20220106200032.3067127-1-christylee@fb.com>

bpf_prog_load() API is deprecated, remove perf's usage of the deprecated
function.

Signed-off-by: Christy Lee <christylee@fb.com>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
---
 tools/perf/tests/bpf.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/tools/perf/tests/bpf.c b/tools/perf/tests/bpf.c
index 573490530194..57b9591f7cbb 100644
--- a/tools/perf/tests/bpf.c
+++ b/tools/perf/tests/bpf.c
@@ -281,8 +281,8 @@ static int __test__bpf(int idx)
 
 static int check_env(void)
 {
+	LIBBPF_OPTS(bpf_prog_load_opts, opts);
 	int err;
-	unsigned int kver_int;
 	char license[] = "GPL";
 
 	struct bpf_insn insns[] = {
@@ -290,19 +290,13 @@ static int check_env(void)
 		BPF_EXIT_INSN(),
 	};
 
-	err = fetch_kernel_version(&kver_int, NULL, 0);
+	err = fetch_kernel_version(&opts.kern_version, NULL, 0);
 	if (err) {
 		pr_debug("Unable to get kernel version\n");
 		return err;
 	}
-
-/* temporarily disable libbpf deprecation warnings */
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-	err = bpf_load_program(BPF_PROG_TYPE_KPROBE, insns,
-			       ARRAY_SIZE(insns),
-			       license, kver_int, NULL, 0);
-#pragma GCC diagnostic pop
+	err = bpf_prog_load(BPF_PROG_TYPE_KPROBE, NULL, license, insns,
+			    ARRAY_SIZE(insns), &opts);
 	if (err < 0) {
 		pr_err("Missing basic BPF support, skip this test: %s\n",
 		       strerror(errno));
-- 
2.30.2


  reply	other threads:[~2022-01-06 20:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-06 20:00 [PATCH bpf-next v2 0/2] perf: stop using deprecated bpf APIs Christy Lee
2022-01-06 20:00 ` Christy Lee [this message]
2022-01-06 21:24   ` [PATCH bpf-next v2 1/2] perf: stop using deprecated bpf_prog_load() API Andrii Nakryiko
2022-01-06 20:00 ` [PATCH bpf-next v2 2/2] perf: stop using deprecated bpf__object_next() API Christy Lee
2022-01-07  3:21   ` Yonghong Song

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=20220106200032.3067127-2-christylee@fb.com \
    --to=christylee@fb.com \
    --cc=acme@kernel.org \
    --cc=andrii@kernel.org \
    --cc=bobo.shaobowang@huawei.com \
    --cc=bpf@vger.kernel.org \
    --cc=christyc.y.lee@gmail.com \
    --cc=jolsa@redhat.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;
as well as URLs for NNTP newsgroup(s).