Re: libtraceevent -- undefined functions

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

 



On Mon, 5 Sep 2022 12:29:16 -0400
Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:

> So looking at the first line:
> 
>                 __entry->pfn != -1UL ? pfn_to_page(__entry->pfn) : NULL,
> 
> The pfn_to_page() must be a macro expanded to that huge output. 
> 
> The thing is, there's no way that user space can know what the result of
> that pfn_to_page is, as that information is hidden inside the kernel.
> 
> I do not see that expanding like the above in the latest kernel. I'm
> guessing the kernel you have has that crazy expansion of pfn_to_page() though.
> 
> Probably the best thing that user space can do is to just do what it does
> now and simply output the event fields. We do not want to have the output
> showing all that builtin_constant_p() and size_of() callers.

Yeah, on 5.14 it looks like this:

#define pfn_to_page __pfn_to_page

#define __pfn_to_page(pfn)      (vmemmap + (pfn))

#define vmemmap                 ((struct page *)VMEMMAP_START - (memstart_addr >> PAGE_SHIFT))

#define VMEMMAP_START           (-(UL(1) << (VA_BITS - VMEMMAP_SHIFT)))

#define VA_BITS                 (CONFIG_ARM64_VA_BITS)

#define VMEMMAP_SHIFT   (PAGE_SHIFT - STRUCT_PAGE_MAX_SHIFT)

#define PAGE_SHIFT              CONFIG_ARM64_PAGE_SHIFT

#define STRUCT_PAGE_MAX_SHIFT    (order_base_2(sizeof(struct page)))

#define order_base_2(n)                         \
(                                               \
        __builtin_constant_p(n) ? (             \
                ((n) == 0 || (n) == 1) ? 0 :    \
                ilog2((n) - 1) + 1) :           \
        __order_base_2(n)                       \
)

#define ilog2(n) \
( \
        __builtin_constant_p(n) ?       \
        ((n) < 2 ? 0 :                  \
         63 - __builtin_clzll(n)) :     \
        (sizeof(n) <= 4) ?              \
        __ilog2_u32(n) :                \
        __ilog2_u64(n)                  \
 )

and so on.

Thus, the pfn_to_page() macro gets expanded to some God awful expression.

There's not much we can do about this from the libtraceevent perspective :-/

-- Steve



[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux