On Mon, Jun 01, 2020 at 12:06:34PM -0700, Andrii Nakryiko wrote: > On Sun, May 31, 2020 at 8:10 AM Jiri Olsa <jolsa@xxxxxxxxxx> wrote: > > > > On Fri, May 29, 2020 at 01:48:58PM -0700, Andrii Nakryiko wrote: > > > On Thu, May 28, 2020 at 10:24 AM Jiri Olsa <jolsa@xxxxxxxxxx> wrote: > > > > > > > > On Thu, May 14, 2020 at 03:46:26PM -0700, Andrii Nakryiko wrote: > > > > > > > > SNIP > > > > > > > > > > I was thinking of putting the names in __init section and generate the BTF > > > > > > ids on kernel start, but the build time generation seemed more convenient.. > > > > > > let's see the linking times with 'real size' whitelist and we can reconsider > > > > > > > > > > > > > > > > Being able to record such places where to put BTF ID in code would be > > > > > really nice, as Alexei mentioned. There are many potential use cases > > > > > where it would be good to have BTF IDs just put into arbitrary > > > > > variables/arrays. This would trigger compilation error, if someone > > > > > screws up the name, or function is renamed, or if function can be > > > > > compiled out under some configuration. E.g., assuming some reasonable > > > > > implementation of the macro > > > > > > > > hi, > > > > I'm struggling with this part.. to get some reasonable reference > > > > to function/name into 32 bits? any idea? ;-) > > > > > > > > > > Well, you don't have to store actual pointer, right? E.g, emitting > > > something like this in assembly: > > > > > > .global __BTF_ID___some_function > > > .type __BTF_ID___some_function, @object > > > .size __BTF_ID___some_function, 4 > > > __BTF_ID___some_function: > > > .zero 4 > > > > > > Would reserve 4 bytes and emit __BTF_ID___some_function symbol. If we > > > can then post-process vmlinux image and for all symbols starting with > > > __BTF_ID___ find some_function BTF type id and put it into those 4 > > > bytes, that should work, no? > > > > > > Maybe generalize it to __BTF_ID__{func,struct,typedef}__some_function, > > > whatever, not sure. Just an idea. > > > > nice, so something like below? > > > > it'd be in .S file, or perhaps in inline asm, assuming I'll be > > able to pass macro arguments to asm("") > > I'd do inline asm, there are no arguments you need to pass into > asm("") itself, everything can be done through macro string > interpolation, I think. Having everything in .c file would be way more > convenient and obvious. wil will do it in inline asm thanks, jirka