From: Alan Maguire <alan.maguire@oracle.com>
To: Matthew Maurer <mmaurer@google.com>, acme@kernel.org
Cc: rust-for-linux@vger.kernel.org, dwarves@vger.kernel.org,
aliceryhl@google.com
Subject: Re: [PATCH] pahole: Apply CU-level filters early in loading
Date: Wed, 31 Jul 2024 09:57:25 +0100 [thread overview]
Message-ID: <0c0031f6-7f5b-4ec2-9804-c9d576c8302b@oracle.com> (raw)
In-Reply-To: <20240730224350.4039790-1-mmaurer@google.com>
On 30/07/2024 23:43, Matthew Maurer wrote:
> Without this, even with `--lang_exclude=rust` set, running on `vmlinux`
> with `CONFIG_RUST` enabled will lead to errors like:
> die__process_function: tag not supported 0x2f (template_type_parameter)!
> because the filtering doesn't happen until finalization, but unsupported
> tags are reported during loading.
>
> As an added bonus, this should speed up processing of large objects with
> filtered CUs, as their details will no longer be walked.
>
One question on this; if we are always doing early filtering like this,
should the explicit cu__filter() call be removed from pahole_stealer()?
> Signed-off-by: Matthew Maurer <mmaurer@google.com>
> ---
> dwarf_loader.c | 10 ++++++++++
> dwarves.h | 1 +
> pahole.c | 1 +
> 3 files changed, 12 insertions(+)
>
> diff --git a/dwarf_loader.c b/dwarf_loader.c
> index b832c93..c48dfef 100644
> --- a/dwarf_loader.c
> +++ b/dwarf_loader.c
> @@ -2854,6 +2854,16 @@ static int die__process(Dwarf_Die *die, struct cu *cu, struct conf_load *conf)
>
> cu->language = attr_numeric(die, DW_AT_language);
>
> + if (conf->early_cu_filter)
> + cu = (conf->early_cu_filter)(cu);
> +
> + /*
> + * If we filtered this CU out, we still want to keep iterating, but
> + * there's no need to walk the rest of the CU info.
> + */
> + if (cu == NULL)
> + return DWARF_CB_OK;
> +
> if (dwarf_child(die, &child) == 0) {
> int err = die__process_unit(&child, cu, conf);
> if (err)
> diff --git a/dwarves.h b/dwarves.h
> index f5ae79f..92d102b 100644
> --- a/dwarves.h
> +++ b/dwarves.h
> @@ -72,6 +72,7 @@ struct conf_load {
> enum load_steal_kind (*steal)(struct cu *cu,
> struct conf_load *conf,
> void *thr_data);
> + struct cu * (*early_cu_filter)(struct cu *cu);
> int (*thread_exit)(struct conf_load *conf, void *thr_data);
> void *cookie;
> char *format_path;
> diff --git a/pahole.c b/pahole.c
> index 954498d..937b0a1 100644
> --- a/pahole.c
> +++ b/pahole.c
> @@ -3765,6 +3765,7 @@ int main(int argc, char *argv[])
> memset(tab, ' ', sizeof(tab) - 1);
>
> conf_load.steal = pahole_stealer;
> + conf_load.early_cu_filter = cu__filter;
> conf_load.thread_exit = pahole_thread_exit;
>
> if (conf_load.reproducible_build) {
next prev parent reply other threads:[~2024-07-31 8:57 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-30 22:43 [PATCH] pahole: Apply CU-level filters early in loading Matthew Maurer
2024-07-31 8:57 ` Alan Maguire [this message]
2024-07-31 13:26 ` Arnaldo Carvalho de Melo
2024-07-31 17:43 ` Alan Maguire
2024-07-31 18:12 ` Arnaldo Carvalho de Melo
2024-08-01 9:20 ` Alan Maguire
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=0c0031f6-7f5b-4ec2-9804-c9d576c8302b@oracle.com \
--to=alan.maguire@oracle.com \
--cc=acme@kernel.org \
--cc=aliceryhl@google.com \
--cc=dwarves@vger.kernel.org \
--cc=mmaurer@google.com \
--cc=rust-for-linux@vger.kernel.org \
/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).