Re: [PATCH bpf-next 0/2] libbpf: Implement BTF Generator API

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

 



On Thu, Nov 4, 2021 at 7:58 AM Mauricio Vásquez Bernal
<mauricio@xxxxxxxxxx> wrote:
>
> > > ```
> > > /* reduced version of struct bpf_core_spec */
> > > struct bpf_core_spec_pub {
> > > const struct btf *btf;
> > > __u32 root_type_id;
> > > enum bpf_core_relo_kind kind;
> > > /* raw, low-level spec: 1-to-1 with accessor spec string */ --> we can
> > > also use access_str_off and let the user parse it
> > > int raw_spec[BPF_CORE_SPEC_MAX_LEN];
> >
> > string might be a more "extensible" way, but we'll need to construct
> > that string for each relocation
> >
> > > /* raw spec length */
> > > int raw_len;
> >
> > using string would eliminate the need for this
> >
> > > };
> > >
> > > struct bpf_core_relo_pub {
> > > const char *prog_name; --> if we expose it by program then it's not needed.
> >
> > yep, not sure about per-program yet, but that's minor
> >
> > > int insn_idx;
> > >
> > > bool poison; --> allows the user to understand if the relocation
> > > succeeded or not.
> > >
> > > /* new field offset for field based core relos */
> > > __u32 new_offset;
> > >
> > > // TODO: fields for type and enum-based relos
> >
> > isn't it always just u64 new_value for all types of relos? We can also
> > expose old_value just for completeness
> >
>
> Oh right. We can expose new_val, orig_val and let the user interpret
> their meaning based on the relo_kind.

yep

>
> > >
> > > struct bpf_core_spec_pub local_spec, targ_spec; --> BTFGen only needs
> > > targ_spec, I suppose local spec would be useful for other use cases.
> >
> > targ_spec doesn't seem necessary given we have root_type_id, relo
> > kind, access_string (or raw_spec). What am I missing?
> >
>
> Not sure I follow. root_type, relo kind and access_string are all part
> of bpf_core_spec_pub, there are two instances of this structure,
> targ_spec and local_spec.

Ah, ok, I got a bit confused by the formatting of your response. I got
the impression that we are exposing the same thing twice (and I'm not
talking about local vs target). So never mind.




[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