On 5/12/22 3:43 AM, Dave Marchevsky wrote: > Add a test which calls bpf_get_reg_val with an xmm reg after forcing fpu > state save. The test program writes to %xmm10, then calls a BPF program > which forces fpu save and calls bpf_get_reg_val. This guarantees that > !fpregs_state_valid check will succeed, forcing bpf_get_reg_val to fetch > %xmm10's value from task's fpu state. > > A bpf_testmod_save_fpregs kfunc helper is added to bpf_testmod to enable > 'force fpu save'. Existing bpf_dummy_ops test infra is extended to > support calling the kfunc. > > unload_bpf_testmod would often fail with -EAGAIN when running the test > added in this patch, so a single retry w/ 20ms sleep is added. > > Signed-off-by: Dave Marchevsky <davemarchevsky@xxxxxx> > --- > include/linux/bpf.h | 1 + > kernel/trace/bpf_trace.c | 2 +- > net/bpf/bpf_dummy_struct_ops.c | 13 ++++++ > .../selftests/bpf/bpf_testmod/bpf_testmod.c | 13 ++++++ > tools/testing/selftests/bpf/prog_tests/usdt.c | 42 +++++++++++++++++++ > .../selftests/bpf/progs/test_urandom_usdt.c | 24 +++++++++++ > tools/testing/selftests/bpf/test_progs.c | 7 ++++ > 7 files changed, 101 insertions(+), 1 deletion(-) This series wasn't based on latest bpf-next. After rebase, this test causes kernel panic. Investigating, but patches are still worth a look.