From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexei Starovoitov Subject: Re: [PATCH v11 tip 6/9] samples: bpf: simple non-portable kprobe filter example Date: Sun, 29 Mar 2015 17:59:54 -0700 Message-ID: <5518A00A.5090004@plumgrid.com> References: <1427312966-8434-1-git-send-email-ast@plumgrid.com> <1427312966-8434-7-git-send-email-ast@plumgrid.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Sender: linux-api-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Jovi Zhangwei Cc: Ingo Molnar , Steven Rostedt , Namhyung Kim , Arnaldo Carvalho de Melo , Jiri Olsa , Masami Hiramatsu , "David S. Miller" , Daniel Borkmann , Peter Zijlstra , linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, LKML List-Id: linux-api@vger.kernel.org On 3/29/15 5:34 PM, Jovi Zhangwei wrote: >> + snprintf(buf, sizeof(buf), >> + "echo '%c:%s %s' >> /sys/kernel/debug/tracing/kprobe_events", >> + is_kprobe ? 'p' : 'r', event, event); >> + err = system(buf); > > Maybe we need to remember cleanup the kprobe_events in debugfs? the real tracing tool should be cleaning it up. This is sample code. I didn't want to overcomplicate it with a chain of ctrl-c handlers. Notice patch 7 is simply doing signal(SIGINT, int_exit) and prints histogram when process is terminated. The kprobe cleaning logic would have interfere with this and overall would have made these samples unnecessary complex.