Re: [PATCH bpf-next 6/6] selftests/bpf: test detaching struct_ops links.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 4/29/24 2:36 PM, Kui-Feng Lee wrote:
@@ -572,6 +576,12 @@ static int bpf_dummy_reg(void *kdata)
  	if (ops->test_2)
  		ops->test_2(4, ops->data);
+ if (ops->do_unreg) {
+		rcu_read_lock();
+		bpf_struct_ops_kvalue_unreg(kdata);

Instead of unreg() immediately before the reg() has returned, the test should reflect more on how the subsystem can use it in practice. The subsystem does not do unreg() during reg().

It also needs to test a case when the link is created and successfully registered to the subsystem. The user space does BPF_LINK_DETACH first and then the subsystem does link->ops->detach() by itself later.

It can create a kfunc in bpf_testmod.c to trigger the subsystem to do link->ops->detach(). The kfunc can be called by a SEC("syscall") bpf prog which is run by bpf_prog_test_run_opts(). The test_progs can then decide on the timing when to do link->ops->detach() to test different cases.

+		rcu_read_unlock();
+	}
+
  	return 0;
  }





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux