public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
From: Martin KaFai Lau <martin.lau@linux.dev>
To: Aditi Ghag <aditi.ghag@isovalent.com>
Cc: sdf@google.com, void@manifault.com,
	Martin KaFai Lau <martin.lau@kernel.org>,
	bpf@vger.kernel.org
Subject: Re: [PATCH v8 bpf-next 09/10] bpf: Add kfunc filter function to 'struct btf_kfunc_id_set'
Date: Fri, 19 May 2023 01:25:41 -0700	[thread overview]
Message-ID: <93530368-5ef2-4f88-3ed2-ceb88b23935d@linux.dev> (raw)
In-Reply-To: <20230517175942.528375-1-aditi.ghag@isovalent.com>

On 5/17/23 10:59 AM, Aditi Ghag wrote:
>   static int btf_populate_kfunc_set(struct btf *btf, enum btf_kfunc_hook hook,
> -				  struct btf_id_set8 *add_set)
> +				  const struct btf_kfunc_id_set *kset)
>   {
> +	struct btf_kfunc_hook_filter *hook_filter;
> +	struct btf_id_set8 *add_set = kset->set;
>   	bool vmlinux_set = !btf_is_module(btf);
> +	bool add_filter = !!kset->filter;
>   	struct btf_kfunc_set_tab *tab;
>   	struct btf_id_set8 *set;
>   	u32 set_cnt;
> @@ -7737,6 +7747,20 @@ static int btf_populate_kfunc_set(struct btf *btf, enum btf_kfunc_hook hook,
>   		return 0;
>   
>   	tab = btf->kfunc_set_tab;
> +
> +	if (tab && add_filter) {
> +		int i;
> +
> +		hook_filter = &tab->hook_filters[hook];
> +		for (i = 0; i < hook_filter->nr_filters; i++) {
> +			if (hook_filter->filters[i] == kset->filter)
> +				add_filter = false;

Just noticed that this missed a "break;" that can save some unnecessary loops.

It seems it needs to respin one more time to clarify the patch 1 commit message. 
Please also move patch 9 before patch 6 adding the 'bpf: Add bpf_sock_destroy 
kfunc'. Patch 6 requires patch 9 to be safe. Then the patch 10 selftests can be 
combined with patch 8 selftests as the last patch of the set.

Others lgtm.

> +		}
> +
> +		if (add_filter && hook_filter->nr_filters == BTF_KFUNC_FILTER_MAX_CNT)
> +			return -E2BIG;
> +	}
> +
>   	if (!tab) {
>   		tab = kzalloc(sizeof(*tab), GFP_KERNEL | __GFP_NOWARN);
>   		if (!tab)


      reply	other threads:[~2023-05-19  8:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-17 17:59 [PATCH v8 bpf-next 09/10] bpf: Add kfunc filter function to 'struct btf_kfunc_id_set' Aditi Ghag
2023-05-19  8:25 ` Martin KaFai Lau [this message]

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=93530368-5ef2-4f88-3ed2-ceb88b23935d@linux.dev \
    --to=martin.lau@linux.dev \
    --cc=aditi.ghag@isovalent.com \
    --cc=bpf@vger.kernel.org \
    --cc=martin.lau@kernel.org \
    --cc=sdf@google.com \
    --cc=void@manifault.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