Pass the struct syscall_arg, so that we can use the augmented_arg later
in the struct augmentation.
Signed-off-by: Howard Chu <howardchu95@gmail.com>
---
tools/perf/builtin-trace.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 84c7398312d8..4bde40f91531 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -1007,7 +1007,7 @@ static size_t btf_enum_scnprintf(const struct btf_type *type, struct btf *btf, c
}
static size_t trace__btf_scnprintf(struct trace *trace, struct syscall_arg_fmt *arg_fmt, char *bf,
- size_t size, int val, char *type)
+ size_t size, int val, struct syscall_arg *arg, char *type)
{
if (trace->btf == NULL)
return 0;
@@ -1030,7 +1030,7 @@ static size_t trace__btf_scnprintf(struct trace *trace, struct syscall_arg_fmt *
#else // HAVE_LIBBPF_SUPPORT
static size_t trace__btf_scnprintf(struct trace *trace __maybe_unused, struct syscall_arg_fmt *arg_fmt __maybe_unused,
char *bf __maybe_unused, size_t size __maybe_unused, int val __maybe_unused,
- char *type __maybe_unused)
+ struct syscall_arg *arg __maybe_unused, char *type __maybe_unused)
{
return 0;
}
@@ -2284,7 +2284,7 @@ static size_t syscall__scnprintf_args(struct syscall *sc, char *bf, size_t size,
printed += scnprintf(bf + printed, size - printed, "%s: ", field->name);
btf_printed = trace__btf_scnprintf(trace, &sc->arg_fmt[arg.idx], bf + printed,
- size - printed, val, field->type);
+ size - printed, val, &arg, field->type);
if (btf_printed) {
printed += btf_printed;
continue;
@@ -2986,7 +2986,7 @@ static size_t trace__fprintf_tp_fields(struct trace *trace, struct evsel *evsel,
if (trace->show_arg_names)
printed += scnprintf(bf + printed, size - printed, "%s: ", field->name);
- btf_printed = trace__btf_scnprintf(trace, arg, bf + printed, size - printed, val, field->type);
+ btf_printed = trace__btf_scnprintf(trace, arg, bf + printed, size - printed, val, NULL, field->type);
if (btf_printed) {
printed += btf_printed;
continue;
--
2.45.2
On Thu, Aug 15, 2024 at 09:36:21AM +0800, Howard Chu wrote:
> Pass the struct syscall_arg, so that we can use the augmented_arg later
> in the struct augmentation.
Breaks the build with:
builtin-trace.c: In function ‘trace__btf_scnprintf’:
builtin-trace.c:1011:78: error: unused parameter ‘arg’ [-Werror=unused-parameter]
1011 | size_t size, int val, struct syscall_arg *arg, char *type)
| ~~~~~~~~~~~~~~~~~~~~^~~
LD /tmp/build/perf-tools-next/util/perf-util-in.o
LD /tmp/build/perf-tools-next/perf-util-in.o
AR /tmp/build/perf-tools-next/libperf-util.a
GEN /tmp/build/perf-tools-next/python/perf.cpython-312-x86_64-linux-gnu.so
cc1: all warnings being treated as errors
So we either use __maybe_unused at this point or combine it with the
patch where it really gets used. I think the later is better, will do.
- Arnaldo
> Signed-off-by: Howard Chu <howardchu95@gmail.com>
> ---
> tools/perf/builtin-trace.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
> index 84c7398312d8..4bde40f91531 100644
> --- a/tools/perf/builtin-trace.c
> +++ b/tools/perf/builtin-trace.c
> @@ -1007,7 +1007,7 @@ static size_t btf_enum_scnprintf(const struct btf_type *type, struct btf *btf, c
> }
>
> static size_t trace__btf_scnprintf(struct trace *trace, struct syscall_arg_fmt *arg_fmt, char *bf,
> - size_t size, int val, char *type)
> + size_t size, int val, struct syscall_arg *arg, char *type)
> {
> if (trace->btf == NULL)
> return 0;
> @@ -1030,7 +1030,7 @@ static size_t trace__btf_scnprintf(struct trace *trace, struct syscall_arg_fmt *
> #else // HAVE_LIBBPF_SUPPORT
> static size_t trace__btf_scnprintf(struct trace *trace __maybe_unused, struct syscall_arg_fmt *arg_fmt __maybe_unused,
> char *bf __maybe_unused, size_t size __maybe_unused, int val __maybe_unused,
> - char *type __maybe_unused)
> + struct syscall_arg *arg __maybe_unused, char *type __maybe_unused)
> {
> return 0;
> }
> @@ -2284,7 +2284,7 @@ static size_t syscall__scnprintf_args(struct syscall *sc, char *bf, size_t size,
> printed += scnprintf(bf + printed, size - printed, "%s: ", field->name);
>
> btf_printed = trace__btf_scnprintf(trace, &sc->arg_fmt[arg.idx], bf + printed,
> - size - printed, val, field->type);
> + size - printed, val, &arg, field->type);
> if (btf_printed) {
> printed += btf_printed;
> continue;
> @@ -2986,7 +2986,7 @@ static size_t trace__fprintf_tp_fields(struct trace *trace, struct evsel *evsel,
> if (trace->show_arg_names)
> printed += scnprintf(bf + printed, size - printed, "%s: ", field->name);
>
> - btf_printed = trace__btf_scnprintf(trace, arg, bf + printed, size - printed, val, field->type);
> + btf_printed = trace__btf_scnprintf(trace, arg, bf + printed, size - printed, val, NULL, field->type);
> if (btf_printed) {
> printed += btf_printed;
> continue;
> --
> 2.45.2
On Thu, Aug 22, 2024 at 03:00:30PM -0300, Arnaldo Carvalho de Melo wrote:
> On Thu, Aug 15, 2024 at 09:36:21AM +0800, Howard Chu wrote:
> > Pass the struct syscall_arg, so that we can use the augmented_arg later
> > in the struct augmentation.
>
> Breaks the build with:
>
> builtin-trace.c: In function ‘trace__btf_scnprintf’:
> builtin-trace.c:1011:78: error: unused parameter ‘arg’ [-Werror=unused-parameter]
> 1011 | size_t size, int val, struct syscall_arg *arg, char *type)
> | ~~~~~~~~~~~~~~~~~~~~^~~
> LD /tmp/build/perf-tools-next/util/perf-util-in.o
> LD /tmp/build/perf-tools-next/perf-util-in.o
> AR /tmp/build/perf-tools-next/libperf-util.a
> GEN /tmp/build/perf-tools-next/python/perf.cpython-312-x86_64-linux-gnu.so
> cc1: all warnings being treated as errors
>
> So we either use __maybe_unused at this point or combine it with the
> patch where it really gets used. I think the later is better, will do.
So here what I think we should do is to use the patch below, ok? I'm
continuing...
- Arnaldo
---
From 2c1ea68ac3d18109d96bd16e2860e076d2e0d61e Mon Sep 17 00:00:00 2001
From: Arnaldo Carvalho de Melo <acme@redhat.com>
Date: Thu, 22 Aug 2024 15:10:27 -0300
Subject: [PATCH 1/1] perf trace: Pass the richer 'struct syscall_arg' pointer
to trace__btf_scnprintf()
Since we'll need it later in the current patch series and we can get the
syscall_arg_fmt from syscall_arg->fmt.
Based-on-a-patch-by: Howard Chu <howardchu95@gmail.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/lkml/Zsd8vqCrTh5h69rp@x1
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-trace.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 37ca96e130a5862d..a909880bd25e51d1 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -1007,9 +1007,11 @@ static size_t btf_enum_scnprintf(const struct btf_type *type, struct btf *btf, c
return 0;
}
-static size_t trace__btf_scnprintf(struct trace *trace, struct syscall_arg_fmt *arg_fmt, char *bf,
+static size_t trace__btf_scnprintf(struct trace *trace, struct syscall_arg *arg, char *bf,
size_t size, int val, char *type)
{
+ struct syscall_arg_fmt *arg_fmt = arg->fmt;
+
if (trace->btf == NULL)
return 0;
@@ -1029,7 +1031,7 @@ static size_t trace__btf_scnprintf(struct trace *trace, struct syscall_arg_fmt *
}
#else // HAVE_LIBBPF_SUPPORT
-static size_t trace__btf_scnprintf(struct trace *trace __maybe_unused, struct syscall_arg_fmt *arg_fmt __maybe_unused,
+static size_t trace__btf_scnprintf(struct trace *trace __maybe_unused, struct syscall_arg *arg __maybe_unused,
char *bf __maybe_unused, size_t size __maybe_unused, int val __maybe_unused,
char *type __maybe_unused)
{
@@ -2284,7 +2286,7 @@ static size_t syscall__scnprintf_args(struct syscall *sc, char *bf, size_t size,
if (trace->show_arg_names)
printed += scnprintf(bf + printed, size - printed, "%s: ", field->name);
- btf_printed = trace__btf_scnprintf(trace, &sc->arg_fmt[arg.idx], bf + printed,
+ btf_printed = trace__btf_scnprintf(trace, &arg, bf + printed,
size - printed, val, field->type);
if (btf_printed) {
printed += btf_printed;
@@ -2987,7 +2989,7 @@ static size_t trace__fprintf_tp_fields(struct trace *trace, struct evsel *evsel,
if (trace->show_arg_names)
printed += scnprintf(bf + printed, size - printed, "%s: ", field->name);
- btf_printed = trace__btf_scnprintf(trace, arg, bf + printed, size - printed, val, field->type);
+ btf_printed = trace__btf_scnprintf(trace, &syscall_arg, bf + printed, size - printed, val, field->type);
if (btf_printed) {
printed += btf_printed;
continue;
--
2.46.0
Hello,
On Fri, Aug 23, 2024 at 2:13 AM Arnaldo Carvalho de Melo
<acme@kernel.org> wrote:
>
> On Thu, Aug 22, 2024 at 03:00:30PM -0300, Arnaldo Carvalho de Melo wrote:
> > On Thu, Aug 15, 2024 at 09:36:21AM +0800, Howard Chu wrote:
> > > Pass the struct syscall_arg, so that we can use the augmented_arg later
> > > in the struct augmentation.
> >
> > Breaks the build with:
> >
> > builtin-trace.c: In function ‘trace__btf_scnprintf’:
> > builtin-trace.c:1011:78: error: unused parameter ‘arg’ [-Werror=unused-parameter]
> > 1011 | size_t size, int val, struct syscall_arg *arg, char *type)
> > | ~~~~~~~~~~~~~~~~~~~~^~~
> > LD /tmp/build/perf-tools-next/util/perf-util-in.o
> > LD /tmp/build/perf-tools-next/perf-util-in.o
> > AR /tmp/build/perf-tools-next/libperf-util.a
> > GEN /tmp/build/perf-tools-next/python/perf.cpython-312-x86_64-linux-gnu.so
> > cc1: all warnings being treated as errors
> >
> > So we either use __maybe_unused at this point or combine it with the
> > patch where it really gets used. I think the later is better, will do.
>
> So here what I think we should do is to use the patch below, ok? I'm
> continuing...
>
> - Arnaldo
>
> ---
>
> From 2c1ea68ac3d18109d96bd16e2860e076d2e0d61e Mon Sep 17 00:00:00 2001
> From: Arnaldo Carvalho de Melo <acme@redhat.com>
> Date: Thu, 22 Aug 2024 15:10:27 -0300
> Subject: [PATCH 1/1] perf trace: Pass the richer 'struct syscall_arg' pointer
> to trace__btf_scnprintf()
>
> Since we'll need it later in the current patch series and we can get the
> syscall_arg_fmt from syscall_arg->fmt.
>
> Based-on-a-patch-by: Howard Chu <howardchu95@gmail.com>
> Cc: Adrian Hunter <adrian.hunter@intel.com>
> Cc: Ian Rogers <irogers@google.com>
> Cc: Jiri Olsa <jolsa@kernel.org>
> Cc: Kan Liang <kan.liang@linux.intel.com>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Link: https://lore.kernel.org/lkml/Zsd8vqCrTh5h69rp@x1
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> ---
> tools/perf/builtin-trace.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
> index 37ca96e130a5862d..a909880bd25e51d1 100644
> --- a/tools/perf/builtin-trace.c
> +++ b/tools/perf/builtin-trace.c
> @@ -1007,9 +1007,11 @@ static size_t btf_enum_scnprintf(const struct btf_type *type, struct btf *btf, c
> return 0;
> }
>
> -static size_t trace__btf_scnprintf(struct trace *trace, struct syscall_arg_fmt *arg_fmt, char *bf,
> +static size_t trace__btf_scnprintf(struct trace *trace, struct syscall_arg *arg, char *bf,
> size_t size, int val, char *type)
> {
> + struct syscall_arg_fmt *arg_fmt = arg->fmt;
> +
> if (trace->btf == NULL)
> return 0;
>
> @@ -1029,7 +1031,7 @@ static size_t trace__btf_scnprintf(struct trace *trace, struct syscall_arg_fmt *
> }
>
> #else // HAVE_LIBBPF_SUPPORT
> -static size_t trace__btf_scnprintf(struct trace *trace __maybe_unused, struct syscall_arg_fmt *arg_fmt __maybe_unused,
> +static size_t trace__btf_scnprintf(struct trace *trace __maybe_unused, struct syscall_arg *arg __maybe_unused,
> char *bf __maybe_unused, size_t size __maybe_unused, int val __maybe_unused,
> char *type __maybe_unused)
> {
> @@ -2284,7 +2286,7 @@ static size_t syscall__scnprintf_args(struct syscall *sc, char *bf, size_t size,
> if (trace->show_arg_names)
> printed += scnprintf(bf + printed, size - printed, "%s: ", field->name);
>
> - btf_printed = trace__btf_scnprintf(trace, &sc->arg_fmt[arg.idx], bf + printed,
> + btf_printed = trace__btf_scnprintf(trace, &arg, bf + printed,
> size - printed, val, field->type);
> if (btf_printed) {
> printed += btf_printed;
> @@ -2987,7 +2989,7 @@ static size_t trace__fprintf_tp_fields(struct trace *trace, struct evsel *evsel,
> if (trace->show_arg_names)
> printed += scnprintf(bf + printed, size - printed, "%s: ", field->name);
>
> - btf_printed = trace__btf_scnprintf(trace, arg, bf + printed, size - printed, val, field->type);
> + btf_printed = trace__btf_scnprintf(trace, &syscall_arg, bf + printed, size - printed, val, field->type);
> if (btf_printed) {
> printed += btf_printed;
> continue;
> --
> 2.46.0
We pass the syscall_arg to get both format and augmented args, I think
that's the best way to do it.
LGTM, thank you.
Thanks,
Howard
>
© 2016 - 2026 Red Hat, Inc.