aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2021-10-14 17:37:25 -0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2021-10-14 17:37:25 -0300
commita9c99e98815f06bd034b2b32ce0a5114891f2370 (patch)
tree877d229cb66ab4be221d9bd5e4bac27bc7ce1811
parentcc6c7d473d51832490aa7b743a0ed7f7f9e05592 (diff)
downloaddwarves-a9c99e98815f06bd034b2b32ce0a5114891f2370.tar.gz
dwarves: Introduce conf_load->thread_exit() callback
Will be called when a thread exits, initially only in the DWARF loader, so that pahole can call the btf_encoder associated with the exiting thread to do the dedup as the last step done in parallel. Then we'll iterate the btf_encoders list and combine everything into the first btf_encoder instance that gets then written to disk. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r--dwarf_loader.c3
-rw-r--r--dwarves.h2
2 files changed, 5 insertions, 0 deletions
diff --git a/dwarf_loader.c b/dwarf_loader.c
index 48e1bf0..fc79770 100644
--- a/dwarf_loader.c
+++ b/dwarf_loader.c
@@ -2791,6 +2791,9 @@ static void *dwarf_cus__process_cu_thread(void *arg)
goto out_abort;
}
+ if (dcus->conf->thread_exit && dcus->conf->thread_exit() != 0)
+ goto out_abort;
+
return (void *)DWARF_CB_OK;
out_abort:
return (void *)DWARF_CB_ABORT;
diff --git a/dwarves.h b/dwarves.h
index 30d33fa..c523993 100644
--- a/dwarves.h
+++ b/dwarves.h
@@ -37,6 +37,7 @@ struct btf;
struct conf_fprintf;
/** struct conf_load - load configuration
+ * @thread_exit - called at the end of a thread, 1st user: BTF encoder dedup
* @extra_dbg_info - keep original debugging format extra info
* (e.g. DWARF's decl_{line,file}, id, etc)
* @fixup_silly_bitfields - Fixup silly things such as "int foo:32;"
@@ -47,6 +48,7 @@ struct conf_fprintf;
struct conf_load {
enum load_steal_kind (*steal)(struct cu *cu,
struct conf_load *conf);
+ int (*thread_exit)(void);
void *cookie;
char *format_path;
int nr_jobs;