* [PATCH bpf-next] selftests/bpf: fix veristat comp mode with new stats
@ 2024-12-20 15:22 Mahe Tardy
2024-12-20 15:40 ` Mykyta Yatsenko
2024-12-30 23:00 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Mahe Tardy @ 2024-12-20 15:22 UTC (permalink / raw)
To: bpf; +Cc: andrii, mykyta.yatsenko5, yatsenko, daniel, john.fastabend,
Mahe Tardy
Commit 82c1f13de315 ("selftests/bpf: Add more stats into veristat")
introduced new stats, added by default in the CSV output, that were not
added to parse_stat_value, used in parse_stats_csv which is used in
comparison mode. Thus it broke comparison mode altogether making it fail
with "Unrecognized stat #7" and EINVAL.
One quirk is that PROG_TYPE and ATTACH_TYPE have been transformed to
strings using libbpf_bpf_prog_type_str and libbpf_bpf_attach_type_str
respectively. Since we might not want to compare those string values, we
just skip the parsing in this patch. We might want to translate it back
to the enum value or compare the string value directly.
Signed-off-by: Mahe Tardy <mahe.tardy@gmail.com>
---
tools/testing/selftests/bpf/veristat.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/bpf/veristat.c b/tools/testing/selftests/bpf/veristat.c
index 9d17b4dfc170..476bf95cf684 100644
--- a/tools/testing/selftests/bpf/veristat.c
+++ b/tools/testing/selftests/bpf/veristat.c
@@ -1672,7 +1672,10 @@ static int parse_stat_value(const char *str, enum stat_id id, struct verif_stats
case TOTAL_STATES:
case PEAK_STATES:
case MAX_STATES_PER_INSN:
- case MARK_READ_MAX_LEN: {
+ case MARK_READ_MAX_LEN:
+ case SIZE:
+ case JITED_SIZE:
+ case STACK: {
long val;
int err, n;
@@ -1685,6 +1688,9 @@ static int parse_stat_value(const char *str, enum stat_id id, struct verif_stats
st->stats[id] = val;
break;
}
+ case PROG_TYPE:
+ case ATTACH_TYPE:
+ break;
default:
fprintf(stderr, "Unrecognized stat #%d\n", id);
return -EINVAL;
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH bpf-next] selftests/bpf: fix veristat comp mode with new stats
2024-12-20 15:22 [PATCH bpf-next] selftests/bpf: fix veristat comp mode with new stats Mahe Tardy
@ 2024-12-20 15:40 ` Mykyta Yatsenko
2024-12-30 23:00 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Mykyta Yatsenko @ 2024-12-20 15:40 UTC (permalink / raw)
To: Mahe Tardy, bpf; +Cc: andrii, yatsenko, daniel, john.fastabend
On 20/12/2024 15:22, Mahe Tardy wrote:
> Commit 82c1f13de315 ("selftests/bpf: Add more stats into veristat")
> introduced new stats, added by default in the CSV output, that were not
> added to parse_stat_value, used in parse_stats_csv which is used in
> comparison mode. Thus it broke comparison mode altogether making it fail
> with "Unrecognized stat #7" and EINVAL.
>
> One quirk is that PROG_TYPE and ATTACH_TYPE have been transformed to
> strings using libbpf_bpf_prog_type_str and libbpf_bpf_attach_type_str
> respectively. Since we might not want to compare those string values, we
> just skip the parsing in this patch. We might want to translate it back
> to the enum value or compare the string value directly.
>
> Signed-off-by: Mahe Tardy <mahe.tardy@gmail.com>
> ---
> tools/testing/selftests/bpf/veristat.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/bpf/veristat.c b/tools/testing/selftests/bpf/veristat.c
> index 9d17b4dfc170..476bf95cf684 100644
> --- a/tools/testing/selftests/bpf/veristat.c
> +++ b/tools/testing/selftests/bpf/veristat.c
> @@ -1672,7 +1672,10 @@ static int parse_stat_value(const char *str, enum stat_id id, struct verif_stats
> case TOTAL_STATES:
> case PEAK_STATES:
> case MAX_STATES_PER_INSN:
> - case MARK_READ_MAX_LEN: {
> + case MARK_READ_MAX_LEN:
> + case SIZE:
> + case JITED_SIZE:
> + case STACK: {
> long val;
> int err, n;
>
> @@ -1685,6 +1688,9 @@ static int parse_stat_value(const char *str, enum stat_id id, struct verif_stats
> st->stats[id] = val;
> break;
> }
> + case PROG_TYPE:
> + case ATTACH_TYPE:
> + break;
> default:
> fprintf(stderr, "Unrecognized stat #%d\n", id);
> return -EINVAL;
> --
> 2.34.1
>
Looks good, thanks!
Tested-by: Mykyta Yatsenko<yatsenko@meta.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH bpf-next] selftests/bpf: fix veristat comp mode with new stats
2024-12-20 15:22 [PATCH bpf-next] selftests/bpf: fix veristat comp mode with new stats Mahe Tardy
2024-12-20 15:40 ` Mykyta Yatsenko
@ 2024-12-30 23:00 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-12-30 23:00 UTC (permalink / raw)
To: Mahe Tardy
Cc: bpf, andrii, mykyta.yatsenko5, yatsenko, daniel, john.fastabend
Hello:
This patch was applied to bpf/bpf-next.git (master)
by Alexei Starovoitov <ast@kernel.org>:
On Fri, 20 Dec 2024 15:22:18 +0000 you wrote:
> Commit 82c1f13de315 ("selftests/bpf: Add more stats into veristat")
> introduced new stats, added by default in the CSV output, that were not
> added to parse_stat_value, used in parse_stats_csv which is used in
> comparison mode. Thus it broke comparison mode altogether making it fail
> with "Unrecognized stat #7" and EINVAL.
>
> One quirk is that PROG_TYPE and ATTACH_TYPE have been transformed to
> strings using libbpf_bpf_prog_type_str and libbpf_bpf_attach_type_str
> respectively. Since we might not want to compare those string values, we
> just skip the parsing in this patch. We might want to translate it back
> to the enum value or compare the string value directly.
>
> [...]
Here is the summary with links:
- [bpf-next] selftests/bpf: fix veristat comp mode with new stats
https://git.kernel.org/bpf/bpf-next/c/9468f39ba478
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-12-30 23:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-20 15:22 [PATCH bpf-next] selftests/bpf: fix veristat comp mode with new stats Mahe Tardy
2024-12-20 15:40 ` Mykyta Yatsenko
2024-12-30 23:00 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox