From: Steven Rostedt <rostedt@goodmis.org>
To: Michael Petlan <mpetlan@redhat.com>
Cc: "linux-trace-users@vger.kernel.org"
<linux-trace-users@vger.kernel.org>,
Linux Trace Devel <linux-trace-devel@vger.kernel.org>
Subject: Re: libtraceevent -- undefined functions
Date: Mon, 5 Sep 2022 12:49:58 -0400 [thread overview]
Message-ID: <20220905124958.683f7bdb@gandalf.local.home> (raw)
In-Reply-To: <20220905122916.76f4abce@gandalf.local.home>
On Mon, 5 Sep 2022 12:29:16 -0400
Steven Rostedt <rostedt@goodmis.org> 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
prev parent reply other threads:[~2022-09-05 16:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <alpine.LRH.2.20.2208301214410.12613@Diego>
2022-09-01 14:07 ` libtraceevent -- undefined functions Steven Rostedt
2022-09-05 15:36 ` Michael Petlan
2022-09-05 16:29 ` Steven Rostedt
2022-09-05 16:49 ` Steven Rostedt [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220905124958.683f7bdb@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=linux-trace-devel@vger.kernel.org \
--cc=linux-trace-users@vger.kernel.org \
--cc=mpetlan@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).