Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933470AbbHLB7u (ORCPT ); Tue, 11 Aug 2015 21:59:50 -0400 Received: from mail-io0-f171.google.com ([209.85.223.171]:35969 "EHLO mail-io0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753064AbbHLB7s (ORCPT ); Tue, 11 Aug 2015 21:59:48 -0400 Subject: Re: [PATCH v7 5/5] samples/bpf: example of get selected PMU counter value To: Kaixu Xia , daniel@iogearbox.net References: <1438844556-27064-1-git-send-email-xiakaixu@huawei.com> <1438844556-27064-6-git-send-email-xiakaixu@huawei.com> Cc: wangnan0@huawei.com, linux-kernel@vger.kernel.org, pi3orama@163.com, hekuang@huawei.com, netdev@vger.kernel.org From: Alexei Starovoitov Message-ID: <55CAA892.80403@plumgrid.com> Date: Tue, 11 Aug 2015 18:59:46 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: <1438844556-27064-6-git-send-email-xiakaixu@huawei.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2640 Lines: 62 On 8/6/15 12:02 AM, Kaixu Xia wrote: > This is a simple example and shows how to use the new ability > to get the selected Hardware PMU counter value. > > Signed-off-by: Kaixu Xia > --- > samples/bpf/Makefile | 4 +++ > samples/bpf/bpf_helpers.h | 2 ++ > samples/bpf/tracex6_kern.c | 26 ++++++++++++++++++ > samples/bpf/tracex6_user.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++ 1. I see a bunch of warnings building it: HOSTCC samples/bpf/tracex6_user.o ../samples/bpf/tracex6_user.c: In function ?test_bpf_perf_event?: ../samples/bpf/tracex6_user.c:49:2: warning: passing argument 1 of ?close? makes integer from pointer without a cast [enabled by default] In file included from ../samples/bpf/tracex6_user.c:2:0: /usr/include/unistd.h:354:12: note: expected ?int? but argument is of type ?int *? ../samples/bpf/tracex6_user.c:20:16: warning: unused variable ?value? [-Wunused-variable] ../samples/bpf/tracex6_user.c:42:8: warning: ignoring return value of ?system?, declared with attribute warn_unused_result [-Wunused-result] ../samples/bpf/tracex6_user.c:43:8: warning: ignoring return value of ?system?, declared with attribute warn_unused_result [-Wunused-result] ../samples/bpf/tracex6_user.c:44:8: warning: ignoring return value of ?system?, declared with attribute warn_unused_result [-Wunused-result] HOSTLD samples/bpf/tracex6 HOSTCC samples/bpf/lathist_user.o HOSTLD samples/bpf/lathist clang -nostdinc -isystem /usr/lib/gcc/x86_64-linux-gnu/4.7/include -I../arch/x86/include -Iarch/x86/include/generated/uapi -Iarch/x86/include/generated -I../include -Iinclude -I../arch/x86/include/uapi -Iarch/x86/include/generated/uapi -I../include/uapi -Iinclude/generated/uapi -include ../include/linux/kconfig.h \ -D__KERNEL__ -Wno-unused-value -Wno-pointer-sign \ -O2 -emit-llvm -c ../samples/bpf/tracex6_kern.c -o -| ../tools/bpf/llvm/bld/Debug+Asserts/bin/llc -march=bpf -filetype=obj -o samples/bpf/tracex6_kern.o ../samples/bpf/tracex6_kern.c:13:22: warning: declaration of 'struct pt_regs' will not be visible outside of this function [-Wvisibility] int bpf_prog1(struct pt_regs *ctx) Please fix. 2. the example is incomplete. Please add read_trace_pipe() otherwise it exits without printing anything useful. 3. please replace ls and pwd with ls > /dev/null the spam on the screen is unnecessary. -- 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/