BPF List
 help / color / mirror / Atom feed
From: Martin KaFai Lau <martin.lau@linux.dev>
To: Geliang Tang <geliang@kernel.org>
Cc: Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>, Song Liu <song@kernel.org>,
	Yonghong Song <yonghong.song@linux.dev>,
	Matthieu Baerts <matttbe@kernel.org>,
	Eduard Zingerman <eddyz87@gmail.com>,
	John Fastabend <john.fastabend@gmail.com>,
	KP Singh <kpsingh@kernel.org>,
	Stanislav Fomichev <sdf@google.com>, Hao Luo <haoluo@google.com>,
	Geliang Tang <tanggeliang@kylinos.cn>,
	bpf@vger.kernel.org, mptcp@lists.linux.dev,
	Jiri Olsa <olsajiri@gmail.com>
Subject: Re: [PATCH bpf-next v5 2/3] bpf, btf: Add check_btf_kconfigs helper
Date: Thu, 8 Feb 2024 11:53:42 -0800	[thread overview]
Message-ID: <d1b6428e-7ee2-4bb7-a902-8b45d8beed5d@linux.dev> (raw)
In-Reply-To: <ZcSn24Isfsg45jBJ@krava>

On 2/8/24 2:07 AM, Jiri Olsa wrote:
>> +static int check_btf_kconfigs(const struct module *module)
>> +{
>> +	if (!module && IS_ENABLED(CONFIG_DEBUG_INFO_BTF)) {
>> +		pr_err("missing vmlinux BTF, cannot register kfuncs\n");
>> +		return -ENOENT;
>> +	}
>> +	if (module && IS_ENABLED(CONFIG_DEBUG_INFO_BTF_MODULES))
>> +		pr_warn("missing module BTF, cannot register kfuncs\n");
>> +	return 0;
>> +}
>> +
>>   BPF_CALL_4(bpf_btf_find_by_name_kind, char *, name, int, name_sz, u32, kind, int, flags)
>>   {
>>   	struct btf *btf = NULL;
>> @@ -8098,15 +8109,8 @@ static int __register_btf_kfunc_id_set(enum btf_kfunc_hook hook,
>>   	int ret, i;
>>   
>>   	btf = btf_get_module_btf(kset->owner);
>> -	if (!btf) {
>> -		if (!kset->owner && IS_ENABLED(CONFIG_DEBUG_INFO_BTF)) {
>> -			pr_err("missing vmlinux BTF, cannot register kfuncs\n");
>> -			return -ENOENT;
>> -		}
>> -		if (kset->owner && IS_ENABLED(CONFIG_DEBUG_INFO_BTF_MODULES))
>> -			pr_warn("missing module BTF, cannot register kfuncs\n");
>> -		return 0;
>> -	}
>> +	if (!btf)
>> +		return check_btf_kconfigs(kset->owner);
>>   	if (IS_ERR(btf))
>>   		return PTR_ERR(btf);
>>   
>> @@ -8214,15 +8218,8 @@ int register_btf_id_dtor_kfuncs(const struct btf_id_dtor_kfunc *dtors, u32 add_c
>>   	int ret;
>>   
>>   	btf = btf_get_module_btf(owner);
>> -	if (!btf) {
>> -		if (!owner && IS_ENABLED(CONFIG_DEBUG_INFO_BTF)) {
>> -			pr_err("missing vmlinux BTF, cannot register dtor kfuncs\n");
>> -			return -ENOENT;
>> -		}
>> -		if (owner && IS_ENABLED(CONFIG_DEBUG_INFO_BTF_MODULES))
>> -			pr_warn("missing module BTF, cannot register dtor kfuncs\n");
> nit, we do lose the 'dtor' from the message but I think it's ok,
> for the patchset:

I added "const char *feature" argument to check_btf_kconfigs(), so it is like 
check_btf_kconfigs(, "kfunc"), check_btf_kconfigs(, "dtor kfunc"), and 
check_btf_kconfigs(, "struct_ops"). Applied. Thanks.


  reply	other threads:[~2024-02-08 19:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-08  6:24 [PATCH bpf-next v5 0/3] bpf, btf: Add DEBUG_INFO_BTF checks for __register_bpf_struct_ops Geliang Tang
2024-02-08  6:24 ` [PATCH bpf-next v5 1/3] bpf, btf: Fix return value of register_btf_id_dtor_kfuncs Geliang Tang
2024-02-08  6:24 ` [PATCH bpf-next v5 2/3] bpf, btf: Add check_btf_kconfigs helper Geliang Tang
2024-02-08 10:07   ` Jiri Olsa
2024-02-08 19:53     ` Martin KaFai Lau [this message]
2024-02-08  6:24 ` [PATCH bpf-next v5 3/3] bpf, btf: Check btf for register_bpf_struct_ops Geliang Tang
2024-02-08 19:50 ` [PATCH bpf-next v5 0/3] bpf, btf: Add DEBUG_INFO_BTF checks for __register_bpf_struct_ops patchwork-bot+netdevbpf

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=d1b6428e-7ee2-4bb7-a902-8b45d8beed5d@linux.dev \
    --to=martin.lau@linux.dev \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=geliang@kernel.org \
    --cc=haoluo@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=kpsingh@kernel.org \
    --cc=matttbe@kernel.org \
    --cc=mptcp@lists.linux.dev \
    --cc=olsajiri@gmail.com \
    --cc=sdf@google.com \
    --cc=song@kernel.org \
    --cc=tanggeliang@kylinos.cn \
    --cc=yonghong.song@linux.dev \
    /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