2019-08-14 18:14 UTC+0100 ~ Edward Cree <ecree@xxxxxxxxxxxxxx> > On 14/08/2019 17:58, Quentin Monnet wrote: >> 2019-08-14 17:45 UTC+0100 ~ Edward Cree <ecree@xxxxxxxxxxxxxx> >>> This might be a really dumb suggestion, but: you're wanting to collect a >>> summary statistic over an in-kernel data structure in a single syscall, >>> because making a series of syscalls to examine every entry is slow and >>> racy. Isn't that exactly a job for an in-kernel virtual machine, and >>> could you not supply an eBPF program which the kernel runs on each entry >>> in the map, thus supporting people who want to calculate something else >>> (mean, min and max, whatever) instead of count? >>> >> Hi Edward, I like the approach, thanks for the suggestion. >> >> But I did not mention that we were using offloaded maps: Tracing the >> kernel would probably work for programs running on the host, but this is >> not a solution we could extend to hardware offload. > I don't see where "tracing" comes into it; this is a new program type and > a new map op under the bpf() syscall. > Could the user-supplied BPF program not then be passed down to the device > for it to run against its offloaded maps? > Sorry, I misunderstood your suggestion :s (I thought you meant tracing the insert and delete operations). So if I understand correctly, we would use the bpf() syscall to trigger a run of such program on all map entries (for map implementing the new operation), and the context would include pointers to the key and the value for the entry being processed so we can count/sum/compute an average of the values or any other kind of processing? Thanks, Quentin