From: Kui-Feng Lee <kuifeng@fb.com>
To: <dwarves@vger.kernel.org>, <arnaldo.melo@gmail.com>
Cc: <ast@kernel.org>, <daniel@iogearbox.net>, <andrii@kernel.org>,
<bpf@vger.kernel.org>, Kui-Feng Lee <kuifeng@fb.com>
Subject: [PATCH dwarves v3 1/4] dwarf_loader: Receive per-thread data on worker threads.
Date: Tue, 25 Jan 2022 20:05:06 -0800 [thread overview]
Message-ID: <20220126040509.1862767-2-kuifeng@fb.com> (raw)
In-Reply-To: <20220126040509.1862767-1-kuifeng@fb.com>
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>
---
btf_loader.c | 2 +-
ctf_loader.c | 2 +-
dwarf_loader.c | 4 ++--
dwarves.h | 5 +++--
pahole.c | 3 ++-
pdwtags.c | 3 ++-
pfunct.c | 4 +++-
7 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/btf_loader.c b/btf_loader.c
index 7a5b16ff393e..b61cadd55127 100644
--- a/btf_loader.c
+++ b/btf_loader.c
@@ -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);
diff --git a/ctf_loader.c b/ctf_loader.c
index 7c34739afdce..de6d4dbfce97 100644
--- a/ctf_loader.c
+++ b/ctf_loader.c
@@ -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);
diff --git a/dwarf_loader.c b/dwarf_loader.c
index e30b03c1c541..bf9ea3765419 100644
--- a/dwarf_loader.c
+++ b/dwarf_loader.c
@@ -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;
diff --git a/dwarves.h b/dwarves.h
index 52d162d67456..9a8e4de8843a 100644
--- a/dwarves.h
+++ b/dwarves.h
@@ -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;
diff --git a/pahole.c b/pahole.c
index f3a51cb2fe74..f3eeaaca4cdf 100644
--- a/pahole.c
+++ b/pahole.c
@@ -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;
diff --git a/pdwtags.c b/pdwtags.c
index 2b5ba1bf6745..8b1d6f1c96cb 100644
--- a/pdwtags.c
+++ b/pdwtags.c
@@ -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;
diff --git a/pfunct.c b/pfunct.c
index 5485622e639b..314915b774f4 100644
--- a/pfunct.c
+++ b/pfunct.c
@@ -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) {
--
2.30.2
next prev parent reply other threads:[~2022-01-26 4:06 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-26 4:05 [PATCH dwarves v3 0/4] Parallelize BTF type info generating of pahole Kui-Feng Lee
2022-01-26 4:05 ` Kui-Feng Lee [this message]
2022-01-26 6:10 ` [PATCH dwarves v3 1/4] dwarf_loader: Receive per-thread data on worker threads Andrii Nakryiko
2022-01-26 4:05 ` [PATCH dwarves v3 2/4] dwarf_loader: Prepare and pass per-thread data to " Kui-Feng Lee
2022-01-26 6:13 ` Andrii Nakryiko
2022-01-26 4:05 ` [PATCH dwarves v3 3/4] pahole: Use per-thread btf instances to avoid mutex locking Kui-Feng Lee
2022-01-26 6:07 ` Andrii Nakryiko
2022-01-26 18:39 ` Kui-Feng Lee
2022-01-26 19:54 ` Andrii Nakryiko
2022-01-26 4:05 ` [PATCH dwarves v3 4/4] libbpf: Update libbpf to a new revision Kui-Feng Lee
2022-01-26 6:08 ` Andrii Nakryiko
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=20220126040509.1862767-2-kuifeng@fb.com \
--to=kuifeng@fb.com \
--cc=andrii@kernel.org \
--cc=arnaldo.melo@gmail.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=dwarves@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).