On Wed, Jun 25, 2025 at 2:46 PM Eduard Zingerman <eddyz87@xxxxxxxxx> wrote: > > On Wed, 2025-06-25 at 17:59 +0100, Mykyta Yatsenko wrote: > > From: Mykyta Yatsenko <yatsenko@xxxxxxxx> > > > > Implement support for presetting values for array elements in veristat. > > For example: > > ``` > > sudo ./veristat set_global_vars.bpf.o -G "arr[3] = 1" > > ``` > > Arrays of structures and structure of arrays work, but each individual > > scalar value has to be set separately: `foo[1].bar[2] = value`. > > > > Signed-off-by: Mykyta Yatsenko <yatsenko@xxxxxxxx> > > --- > > This looks great, I have a few minor nits but let's land this patch-set. > Maybe fix error reporting below as a follow-up. > New array offset computation logic is much simpler to grasp. > > Acked-by: Eduard Zingerman <eddyz87@xxxxxxxxx> > Applied to bpf-next as is. Mykyta, please send a quick follow up addressing Eduard's suggestions, and let's cut a new veristat release on Github after that. Thanks! > --- > > Nit: this signals an error: > > $ ./veristat -G " arr[ fff ] = 1" set_global_vars.bpf.o > Processing 'set_global_vars.bpf.o'... > Can't resolve enum value fff > Failed to set global variables -3 > Failed to process 'set_global_vars.bpf.o': -3 > > but this does not: > > $ ./veristat -G " arr[ 11111111111111111111111111111 ] = 1" set_global_vars.bpf.o > Failed to parse value '11111111111111111111111111111' > Processing 'set_global_vars.bpf.o'... > File Program Verdict Duration (us) Insns States Program size Jited size > --------------------- ---------------- ------- ------------- ----- ------ ------------ ---------- > set_global_vars.bpf.o test_set_globals success 27 64 0 82 0 > --------------------- ---------------- ------- ------------- ----- ------ ------------ ---------- > Done. Processed 1 files, 0 programs. Skipped 1 files, 0 programs. > > [...]