From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Hemminger Subject: Re: [PATCH net-next] net: add network device notifier trace points Date: Wed, 19 Dec 2018 07:43:25 -0800 Message-ID: <20181219074325.522206ac@xeon-e3> References: <20181219022706.10611-1-sthemmin@microsoft.com> <20181219083643.7f724e59@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org, Stephen Hemminger , Daniel Borkmann , Alexei Starovoitov , Arnaldo Carvalho de Melo , Steven Rostedt To: Jesper Dangaard Brouer Return-path: Received: from mail-pg1-f196.google.com ([209.85.215.196]:38578 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728901AbeLSPol (ORCPT ); Wed, 19 Dec 2018 10:44:41 -0500 Received: by mail-pg1-f196.google.com with SMTP id g189so9611014pgc.5 for ; Wed, 19 Dec 2018 07:44:40 -0800 (PST) In-Reply-To: <20181219083643.7f724e59@redhat.com> Sender: netdev-owner@vger.kernel.org List-ID: On Wed, 19 Dec 2018 08:36:43 +0100 Jesper Dangaard Brouer wrote: > On Tue, 18 Dec 2018 18:27:06 -0800 > Stephen Hemminger wrote: > > > This is the result of a conversation about monitoring of link > > state changes with BPF. > > If you want to use this from BPF then you are in for a surprise. As > tracepoints BPF cannot read these "__string" constructs, here the netdev > name. I tried a lot of different tricks that didn't work, see [1], > until Alexei explained that it simply isn't supported. > > I instead recommend adding the ifindex to the tracepoint. The__string > and __assign_str is also a performance concern as it does strcpy behind > your back. Can we record the ifindex in the event record and do the decode in the printk? This is not a critical path so don't really care that much. > I have an year old TODO list item about improving this: > ** TODO Make perf-script plugin for ifindex to name translation > SCHEDULED: <2017-11-20 Mon> > > Today, the existing network tracepoints using dev->name is not that > usable by BPF, as BPF cannot identify the interface. Thus IMHO it would > make sense to convert the existing network tracepoints dev->name into > dev->ifindex, and then let perf-script convert this to the interface > name. Either in userspace via if_indextoname(3), or (as ACME pointed > out at the time) we might want to have a lookup table stored together > with perf.data for later inspection (in-case ifindexes changed). > > > [1] https://github.com/netoptimizer/prototype-kernel/blob/master/kernel/samples/bpf/napi_monitor_kern.c#L34-L130 What about the event enum, can BPF take that? Also want to add net namespace create/destroy events.