On 12/18/18 7:27 PM, Stephen Hemminger wrote: > There already are network trace points for transmit and receive but > nothing for state changes. Add network tracepoints for before and > after netlink callback is done. This is simple (without extack or > other info) but that could be added if useful. Network namespace id > would also be helpful but hard to get a string for it.
That has been a sore spot for a long time. One option is to allocate a namespace id relative to init_net as every namespace is created and then use the nsid in tracepoints. > > This is the result of a conversation about monitoring of link > state changes with BPF. Parsing netlink is hard and unnecessary > because the data exists (unserialized) already in the > callbacks. > > # cd /sys/kernel/debug/tracing > # echo 1 > events/net/net_dev_notifier_entry/enable > # echo 1 > events/net/net_dev_notifier/enable > # ip li set dev eno1 down > # ip li set dev eno1 up > # cat trace > # tracer: nop > # > # _-----=> irqs-off > # / _----=> need-resched > # | / _---=> hardirq/softirq > # || / _--=> preempt-depth > # ||| / delay > # TASK-PID CPU# |||| TIMESTAMP FUNCTION > # | | | |||| | | > ip-3194 [011] .... 74.926831: net_dev_notifier_entry: > dev=eno1 event=GOING_DOWN > ip-3194 [011] .... 74.926838: net_dev_notifier: > dev=eno1 event=GOING_DOWN ret=1 naming the second one 'net_dev_notifier__exit' would align the columns, make this a lot easier to read and better discriminate the entry/exit difference.