Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752786AbbEFFAk (ORCPT ); Wed, 6 May 2015 01:00:40 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:34717 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752608AbbEFFAj (ORCPT ); Wed, 6 May 2015 01:00:39 -0400 Message-ID: <55499FD3.4070908@huawei.com> Date: Wed, 6 May 2015 13:00:03 +0800 From: Wang Nan User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Thunderbird/24.0.1 MIME-Version: 1.0 To: Alexei Starovoitov CC: , , Li Zefan Subject: Re: [RFC PATCH 00/22] perf tools: introduce 'perf bpf' command to load eBPF programs. References: <1430391165-30267-1-git-send-email-wangnan0@huawei.com> <554302F0.3070101@plumgrid.com> <55447A7D.4000205@huawei.com> <554832AA.5050503@plumgrid.com> <55484A11.7070603@huawei.com> <554859CD.4090206@plumgrid.com> <55485FBF.20306@huawei.com> <55499CB0.1090400@huawei.com> <55499F1B.1020302@plumgrid.com> In-Reply-To: <55499F1B.1020302@plumgrid.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.111.69.129] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2015 Lines: 50 On 2015/5/6 12:56, Alexei Starovoitov wrote: > On 5/5/15 9:46 PM, Wang Nan wrote: >> Hi Alexei Starovoitov, >> >> Have you ever read this mail? > > please don't top post. > >>>> all makes sense and your use case fits quite well into existing >>>> bpf+kprobe model. I'm not sure why you're calling a 'problem'. >>>> A problem of how to display that call stack from perf? >>>> I would say it fits better as a sample than a trace. >>>> If you dump it as a trace, it won't easy to decipher, whereas if you >>>> treat it a sampling event, perf record/report facility will pick it up and display nicely. Meaning that one sample == lock_page/unlock_page >>>> latency > N. Then existing sample_callchain flag should work. >>>> >>> >>> Quite well. Do we have an eBPF function like >>> >>> static int (*bpf_perf_sample)(const char *fmt, int fmt_size, ...) = BPF_FUNC_perf_sample >>> >>> so we can use it in the program probed in the body of __unlock_page() like that: >>> >>> ... >>> if (latency > 0.5s) >>> bpf_perf_sample("page=%p, latency=%d", sizeof(...), page, latency); > > No need for extra helper. There is already return value from > the program for this purpose. > From kernel/trace/bpf_trace.c: > * Return: BPF programs always return an integer which is interpreted by > * kprobe handler as: > * 0 - return from kprobe (event is filtered out) > * 1 - store kprobe event into ring buffer > > in your case the program attached to unlock_page() can return 1 > when it needs to store this event into ring buffer, so that perf can > process it. If I'm not mistaken, the sample_callchain flag cannot be > applied to kprobe events, but that's a general program (not > related to bpf) and can be addressed as such. > That's great! Thanks to your response! -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/