dwarf_loader: Receive per-thread data on worker threads

Add arguments to steal and thread_exit callbacks of conf_load to
receive per-thread data.

Signed-off-by: Kui-Feng Lee <kuifeng@fb.com>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: bpf@vger.kernel.org
Cc: dwarves@vger.kernel.org
Link: https://lore.kernel.org/r/20220126192039.2840752-2-kuifeng@fb.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Kui-Feng Lee 2022-01-26 11:20:36 -08:00 committed by Arnaldo Carvalho de Melo
parent 2f7d61b2bf
commit 724c8fddd7
7 changed files with 14 additions and 9 deletions

View File

@ -624,7 +624,7 @@ static int cus__load_btf(struct cus *cus, struct conf_load *conf, const char *fi
* The app stole this cu, possibly deleting it,
* so forget about it
*/
if (conf && conf->steal && conf->steal(cu, conf))
if (conf && conf->steal && conf->steal(cu, conf, NULL))
return 0;
cus__add(cus, cu);

View File

@ -722,7 +722,7 @@ int ctf__load_file(struct cus *cus, struct conf_load *conf,
* The app stole this cu, possibly deleting it,
* so forget about it
*/
if (conf && conf->steal && conf->steal(cu, conf))
if (conf && conf->steal && conf->steal(cu, conf, NULL))
return 0;
cus__add(cus, cu);

View File

@ -2686,7 +2686,7 @@ static int cu__finalize(struct cu *cu, struct conf_load *conf)
{
cu__for_all_tags(cu, class_member__cache_byte_size, conf);
if (conf && conf->steal) {
return conf->steal(cu, conf);
return conf->steal(cu, conf, NULL);
}
return LSK__KEEPIT;
}
@ -2930,7 +2930,7 @@ static void *dwarf_cus__process_cu_thread(void *arg)
goto out_abort;
}
if (dcus->conf->thread_exit && dcus->conf->thread_exit() != 0)
if (dcus->conf->thread_exit && dcus->conf->thread_exit(dcus->conf, NULL) != 0)
goto out_abort;
return (void *)DWARF_CB_OK;

View File

@ -48,8 +48,9 @@ struct conf_fprintf;
*/
struct conf_load {
enum load_steal_kind (*steal)(struct cu *cu,
struct conf_load *conf);
int (*thread_exit)(void);
struct conf_load *conf,
void *thr_data);
int (*thread_exit)(struct conf_load *conf, void *thr_data);
void *cookie;
char *format_path;
int nr_jobs;

View File

@ -2799,7 +2799,8 @@ out:
static struct type_instance *header;
static enum load_steal_kind pahole_stealer(struct cu *cu,
struct conf_load *conf_load)
struct conf_load *conf_load,
void *thr_data)
{
int ret = LSK__DELETE;

View File

@ -72,7 +72,8 @@ static int cu__emit_tags(struct cu *cu)
}
static enum load_steal_kind pdwtags_stealer(struct cu *cu,
struct conf_load *conf_load __maybe_unused)
struct conf_load *conf_load __maybe_unused,
void *thr_data __maybe_unused)
{
cu__emit_tags(cu);
return LSK__DELETE;

View File

@ -489,7 +489,9 @@ int elf_symtabs__show(char *filenames[])
return EXIT_SUCCESS;
}
static enum load_steal_kind pfunct_stealer(struct cu *cu, struct conf_load *conf_load __maybe_unused)
static enum load_steal_kind pfunct_stealer(struct cu *cu,
struct conf_load *conf_load __maybe_unused,
void *thr_data __maybe_unused)
{
if (function_name) {