Re: [PATCH bpf-next v7 2/4] selftests/bpf: Add test for recursive attachment of tracing progs

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

 



> On Mon, Dec 11, 2023 at 01:30:33PM +0100, Jiri Olsa wrote:
> > +		/*
> > +		 * The first prog in the chain is going to be attached to the target
> > +		 * fentry program, the second one to the previous in the chain.
> > +		 */
> > +		if (i == 0) {
> > +			prog = tracing_chain[0]->progs.recursive_attach;
> > +			prev_fd = bpf_program__fd(target_skel->progs.test1);
> > +			err = bpf_program__set_attach_target(prog, prev_fd, "test1");
> > +		} else {
> > +			prog = tracing_chain[i]->progs.recursive_attach;

> perhaps also the bpf_program__set_attach_target call does not need to be
> in the if path, I think it should work with NULL for attach_func_name as
> long as we provide attach_prog_fd

Just have tried that, but it didn't work -- when loading, libbpf tried
to search for XXX in BTF.

> I wonder now with just 2 skels the test might be easier to read
> without the loop, but I dont have strong opinion about that

Yeah, I was pondering that too. But eventually I came to the conclusion
that the difference for readability would be marginal, and went with
keeping the loop.




[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