Re: [PATCH bpf-next v4 1/8] btf: Add a new kfunc set which allows to mark a function to be sleepable
From: Alexei Starovoitov
Date: Fri Jul 22 2022 - 12:20:57 EST
On Thu, Jul 21, 2022 at 7:13 PM Yosry Ahmed <yosryahmed@xxxxxxxxxx> wrote:
>
> From: Benjamin Tissoires <benjamin.tissoires@xxxxxxxxxx>
>
> This allows to declare a kfunc as sleepable and prevents its use in
> a non sleepable program.
>
> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@xxxxxxxxxx>
> Signed-off-by: Yosry Ahmed <yosryahmed@xxxxxxxxxx>
> ---
> include/linux/btf.h | 2 ++
> kernel/bpf/btf.c | 13 +++++++++++--
> 2 files changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/include/linux/btf.h b/include/linux/btf.h
> index 1bfed7fa0428..6e7517573d9e 100644
> --- a/include/linux/btf.h
> +++ b/include/linux/btf.h
> @@ -18,6 +18,7 @@ enum btf_kfunc_type {
> BTF_KFUNC_TYPE_RELEASE,
> BTF_KFUNC_TYPE_RET_NULL,
> BTF_KFUNC_TYPE_KPTR_ACQUIRE,
> + BTF_KFUNC_TYPE_SLEEPABLE,
> BTF_KFUNC_TYPE_MAX,
> };
This patch needs refactoring using the new BTF_ID_FLAGS scheme.
When you do that please update the Documentation/bpf/kfuncs.rst as well.
Thanks!