Re: [PATCH bpf-next v4 05/21] bpf: implement bpf_seq_read() for bpf iterator

2020-05-09 Thread Yonghong Song
On 5/9/20 5:30 PM, Alexei Starovoitov wrote: On Sat, May 09, 2020 at 10:59:04AM -0700, Yonghong Song wrote: + + err = seq->op->show(seq, p); + if (err > 0) { + seq->count = offs; as far as I can see this condition can never happen. I underst

Re: [PATCH bpf-next v4 05/21] bpf: implement bpf_seq_read() for bpf iterator

2020-05-09 Thread Alexei Starovoitov
On Sat, May 09, 2020 at 10:59:04AM -0700, Yonghong Song wrote: > + > + err = seq->op->show(seq, p); > + if (err > 0) { > + seq->count = offs; as far as I can see this condition can never happen. I understand that seq_read() has this logic, but four itera

[PATCH bpf-next v4 05/21] bpf: implement bpf_seq_read() for bpf iterator

2020-05-09 Thread Yonghong Song
bpf iterator uses seq_file to provide a lossless way to transfer data to user space. But we want to call bpf program after all objects have been traversed, and bpf program may write additional data to the seq_file buffer. The current seq_read() does not work for this use case. Besides allowing sto