BPF List
 help / color / mirror / Atom feed
From: Leon Hwang <leon.hwang@linux.dev>
To: Yonghong Song <yonghong.song@linux.dev>,
	Song Chen <chensong_2000@126.com>,
	martin.lau@linux.dev, ast@kernel.org,
	alexei.starovoitov@gmail.com, daniel@iogearbox.net,
	andrii@kernel.org, eddyz87@gmail.com, song@kernel.org,
	john.fastabend@gmail.com, kpsingh@kernel.org, sdf@fomichev.me,
	haoluo@google.com, jolsa@kernel.org, kaitao.cheng@linux.dev
Cc: bpf@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4] btf: reject to register duplicated kfunc
Date: Wed, 3 Jun 2026 10:18:29 +0800	[thread overview]
Message-ID: <6f7bfa86-7f9c-4ac3-baff-88b541e6a48a@linux.dev> (raw)
In-Reply-To: <d4054d34-430c-4360-8392-a21f8ebacff4@linux.dev>

On 3/6/26 01:13, Yonghong Song wrote:
> 
> 
> On 6/2/26 4:07 AM, Song Chen wrote:
[...]
>> +
>> +#ifdef CONFIG_DEBUG_INFO_BTF_MODULES
>> +    mutex_lock(&btf_module_mutex);
>> +    list_for_each_entry_safe(btf_mod, tmp, &btf_modules, list) {
>> +        if (btf_mod->btf == btf)
>> +            continue;
>> +        id = btf_find_by_name_kind(btf_mod->btf, func_name, kind);
>> +        if (id >= 0) {
>> +            pr_err("kfunc %s (id: %d) is already present in module
>> %s.\n",
>> +                    func_name, id, btf_mod->module->name);
>> +            mutex_unlock(&btf_module_mutex);
>> +            return -EINVAL;
> 
> Let us avoid the above mutex_unlock and 'return -EINVAL', just do
>     err = -EINVAL;
>     break;
> 

Better to use guard(mutex)(&btf_module_mutex)?

Thanks,
Leon

>> [...]

  reply	other threads:[~2026-06-03  2:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-02 11:07 [PATCH v4] btf: reject to register duplicated kfunc Song Chen
2026-06-02 11:23 ` sashiko-bot
2026-06-02 11:34 ` Kaitao Cheng
2026-06-02 17:13 ` Yonghong Song
2026-06-03  2:18   ` Leon Hwang [this message]
2026-06-03  9:15     ` Song Chen
2026-06-03  9:11   ` Song Chen

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=6f7bfa86-7f9c-4ac3-baff-88b541e6a48a@linux.dev \
    --to=leon.hwang@linux.dev \
    --cc=alexei.starovoitov@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=chensong_2000@126.com \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=haoluo@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kaitao.cheng@linux.dev \
    --cc=kpsingh@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=sdf@fomichev.me \
    --cc=song@kernel.org \
    --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