From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756606AbbJVDJX (ORCPT ); Wed, 21 Oct 2015 23:09:23 -0400 Received: from mail-pa0-f42.google.com ([209.85.220.42]:34511 "EHLO mail-pa0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753405AbbJVDJW (ORCPT ); Wed, 21 Oct 2015 23:09:22 -0400 Subject: Re: [PATCH V5 1/1] bpf: control events stored in PERF_EVENT_ARRAY maps trace data output when perf sampling To: "Wangnan (F)" , Peter Zijlstra References: <1445325735-121694-1-git-send-email-xiakaixu@huawei.com> <1445325735-121694-2-git-send-email-xiakaixu@huawei.com> <5626C5CE.8080809@plumgrid.com> <20151021091254.GF2881@worktop.programming.kicks-ass.net> <56276968.6070604@huawei.com> <20151021113316.GM17308@twins.programming.kicks-ass.net> <56277BCE.6030400@huawei.com> <20151021121713.GC3604@twins.programming.kicks-ass.net> <56279634.5000606@huawei.com> <5628423B.4010504@huawei.com> Cc: xiakaixu , davem@davemloft.net, acme@kernel.org, mingo@redhat.com, masami.hiramatsu.pt@hitachi.com, jolsa@kernel.org, daniel@iogearbox.net, linux-kernel@vger.kernel.org, pi3orama@163.com, hekuang@huawei.com, netdev@vger.kernel.org From: Alexei Starovoitov Message-ID: <5628535F.5060505@plumgrid.com> Date: Wed, 21 Oct 2015 20:09:19 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <5628423B.4010504@huawei.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/21/15 6:56 PM, Wangnan (F) wrote: >> One alternative solution I can image is to attach a BPF program >> at sampling like kprobe, and return 0 if we don't want sampling >> take action. Thought? > > Do you think attaching BPF programs to sampling is an acceptable idea? If you mean to extend 'filter' concept to sampling events? So instead of soft_disable of non-local events, you'll attach bpf program to sampling events and use map lookup to decide whether to filter out or not such sampling event? What pt_regs would be in such case?