Re: [PATCH v3 bpf-next 4/6] bpf: Add BTF_KIND_FLOAT support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 2021-02-20 at 04:49 +0100, Ilya Leoshkevich wrote:
> On the kernel side, introduce a new btf_kind_operations. It is
> similar to that of BTF_KIND_INT, however, it does not need to
> handle encodings and bit offsets. Do not implement printing, since
> the kernel does not know how to format floating-point values.
> 
> Signed-off-by: Ilya Leoshkevich <iii@xxxxxxxxxxxxx>
> ---
>  kernel/bpf/btf.c | 77
> ++++++++++++++++++++++++++++++++++++++++++++++--
>  1 file changed, 75 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c
> index 2efeb5f4b343..813c2bfe284f 100644
> --- a/kernel/bpf/btf.c
> +++ b/kernel/bpf/btf.c

[...]

> +static int btf_float_check_member(struct btf_verifier_env *env,
> +                                 const struct btf_type *struct_type,
> +                                 const struct btf_member *member,
> +                                 const struct btf_type *member_type)
> +{
> +       u64 start_offset_bytes;
> +       u64 end_offset_bytes;
> +       u64 align_bytes;
> +       u64 align_bits;
> +
> +       align_bytes = min_t(u64, sizeof(void *), member_type->size);
> +       align_bits = align_bytes * BITS_PER_BYTE;
> +       if (member->offset % align_bits) {

The kernel test robot's link error is most likely due to this line.
I should be using do_div here.

[...]





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux