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>
This commit is contained in:
Arnaldo Carvalho de Melo 2021-10-14 17:37:25 -03:00
parent cc6c7d473d
commit a9c99e9881
2 changed files with 5 additions and 0 deletions

View File

@ -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;

View File

@ -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;