bpftool icon indicating copy to clipboard operation
bpftool copied to clipboard

Support dumping data from a BPF ring buffer

Open qmonnet opened this issue 2 years ago • 4 comments

bpftool map event_pipe dumps data from a perf ring. We don't have any equivalent yet for BPF ring buffers.

qmonnet avatar Jan 08 '23 23:01 qmonnet

@qmonnet It would be a great UX improvement if it just shows an error that this operation is not supported for now instead of showing an empty map

akshatagarwl avatar Jun 27 '23 11:06 akshatagarwl

You mean if trying bpftool map event_pipe id N with map of id N being a BPF ring buffer? I haven't tried it, but I would expect bpftool to display an error, given that we have the following in map_perf_ring.c:

	if (map_info.type != BPF_MAP_TYPE_PERF_EVENT_ARRAY) {
		p_err("map is not a perf event array");
		goto err_close_map;
	}

Or can you provide more details on what you've tried and observed?

qmonnet avatar Jun 27 '23 11:06 qmonnet

@qmonnet I wasn't aware of event_pipe. I was directly trying to dump data using bpftool map dump id N (N being the BPF ring buffer)

akshatagarwl avatar Jun 29 '23 05:06 akshatagarwl

OK I see, yes it would make sense to avoid displaying something empty in that case.

qmonnet avatar Jun 29 '23 12:06 qmonnet