Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp336270ybi; Fri, 31 May 2019 02:12:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqzecvVkwZYtTh21HEW+TdACEcok/2500Dpq/DDqjYVw2lRphzdd53wlP6+cuAGCekNLPe+3 X-Received: by 2002:a17:902:522:: with SMTP id 31mr7557199plf.296.1559293957600; Fri, 31 May 2019 02:12:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559293957; cv=none; d=google.com; s=arc-20160816; b=VtVacAKX3pS/BMP/8grbWMqZDUiBwm4Aw991B16h7SjeUbgXvJgMJ1zmJI5wtFVLp6 msVUB6k8RqmuZU+cb4cHWWs3o4i/phvRwIbA7AJ1kJpIf5Ssofz2I9oNLZ4++qBh95lp pLeJgLFZtquFvli3izHNj5sK3Jw+Ci/Xa2O8M6qKyeR4eNNLxmht+rwz6D7fEzfXQDCa 7aQ5Q+I7xd+I4JSCMnkHqOj/TXnI3BCFCI7cTvWES0VZlUEPAzJ/v/vLTXIAiNwRkh3h UKL+uJoketKcjNi2/qygICAQwv1buim0giqiwJwUCaC7cFKpM4r4RFJ6gRf1S8jgvG1c a+Gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=eOoyuE6GZ0/N5LfXMgRy4lFPmyiN4GqePwZ9hhxKx7c=; b=hkDXki1kzCkaOtJkltU+/6+oIat9Yy3naYGOIkrf4/dAEqrUOkmS3FvefElEf6yAEC 5qx9CSTj08/ztDoYzf+AjwwyI7+wfAyY6asKb3avXDAgtnMbQkdr/QU6Kp/QT89WH0w7 n/Jca09xc1PhHXtdZBQRvO6FZdj+yGSZrlNXBJBoa8O92S5YAvmdU2xuZDjIaarAVlsc k4cEtTaLCMrc3VR5DwZiFGAKH0q5Ncnp1rzE0khO88/8gs+LXcsPWo219Sj8rL3R6JJF mfg0LmTysVCxCgZL5iQPudSmhIv/LHxkvWho4FlFoUKNtDuD4/mIWGYM63uhpnq4+YAB jN+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YC7v+rg1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s21si5221031pgm.154.2019.05.31.02.12.19; Fri, 31 May 2019 02:12:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YC7v+rg1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726867AbfEaJJ6 (ORCPT + 99 others); Fri, 31 May 2019 05:09:58 -0400 Received: from mail-ot1-f44.google.com ([209.85.210.44]:38915 "EHLO mail-ot1-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726002AbfEaJJ5 (ORCPT ); Fri, 31 May 2019 05:09:57 -0400 Received: by mail-ot1-f44.google.com with SMTP id k24so3358538otn.6 for ; Fri, 31 May 2019 02:09:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=eOoyuE6GZ0/N5LfXMgRy4lFPmyiN4GqePwZ9hhxKx7c=; b=YC7v+rg1saI7e5IllQqsAPxsWgrNv2T/HquEKBQtpLdsRkixDv/kZVpskTBdkyXlOC RYo1G9JYsxa8EGUbp9eBd3+m+OOzVLIAzUETNgcMoiQuVjl9VeCtpLRxmGjLaw+LMd5m G/tfpCYiriKJIRJ+KFp01GDriRMlIqH5WjvJuMSmyX17sI5pNSh3ApIh3L/LfJXduayZ 88WEK6B8NB3gWs7j8TpLoEEu3WCjURrwTyPHLLLhCbm4+etZXcRLYarNoEo503Oz5S9t rpkT6yHrLoiNkv2+7fz/oYpFeL6iZvKFYkPOvLNtcAN+8V3ot7h5qhjbud6a2yWvcN6w qQKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=eOoyuE6GZ0/N5LfXMgRy4lFPmyiN4GqePwZ9hhxKx7c=; b=Dv04TXHWL1FEv8Y1iggKF4kA47QBHibaglrlPdMgXrF9iFq5R+jnnj2Ae3/YEvrJ8O 3rpSWYYOMHxGxZyM7w6mRqqO55B63xsK11nxMkXzbR3GPsmoqhu6XilmwjpSB+YZNHU+ qZwVu+Xfp4S25fpCqcMWdZqOvMDRioqWR4is4zuhE2UPGvWSOxUMaz+VqUs/JwQWUoSd i9rqn/EZKpigz7lolx+u2iVcqi8nKlrumiEXXRS4rUkCAbmSqchJ73pC0tD7vQXEi+TC amd090fvKQ9ozI0lDWGP+7PVi4c6xo5/dcv6nUhOeRuzMw6pucYA8zB5fOxJr4N5DrrI G1+g== X-Gm-Message-State: APjAAAW9HXTyL9j1pWhuRkfA6ZNAbIjK1V0c3ccPIGhuAfimFO3zSfsJ lH98G0J6XFm6mrCf8zTc6bEWow== X-Received: by 2002:a9d:481a:: with SMTP id c26mr989834otf.267.1559293796647; Fri, 31 May 2019 02:09:56 -0700 (PDT) Received: from leoy-ThinkPad-X240s (li808-42.members.linode.com. [104.237.132.42]) by smtp.gmail.com with ESMTPSA id o203sm1966255oia.15.2019.05.31.02.09.44 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 31 May 2019 02:09:50 -0700 (PDT) Date: Fri, 31 May 2019 17:09:41 +0800 From: Leo Yan To: Arnaldo Carvalho de Melo Cc: Jiri Olsa , Jiri Olsa , Jesper Dangaard Brouer , Alexei Starovoitov , Daniel Borkmann , lkml , Ingo Molnar , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Stanislav Fomichev , Song Liu , Adrian Hunter , Andi Kleen Subject: Re: [PATCHv3 00/12] perf tools: Display eBPF code in intel_pt trace Message-ID: <20190531090940.GA9580@leoy-ThinkPad-X240s> References: <20190508132010.14512-1-jolsa@kernel.org> <20190530105439.GA5927@leoy-ThinkPad-X240s> <20190530120709.GA3669@krava> <20190530125709.GB5927@leoy-ThinkPad-X240s> <20190530133645.GC21962@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190530133645.GC21962@kernel.org> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Arnaldo, On Thu, May 30, 2019 at 10:36:45AM -0300, Arnaldo Carvalho de Melo wrote: [...] > One other way of testing this: > > I used perf trace's use of BPF, using: > > [root@quaco ~]# cat ~/.perfconfig > [llvm] > dump-obj = true > clang-opt = -g > [trace] > add_events = /home/acme/git/perf/tools/perf/examples/bpf/augmented_raw_syscalls.c > show_zeros = yes > show_duration = no > no_inherit = yes > show_timestamp = no > show_arg_names = no > args_alignment = 40 > show_prefix = yes > > For arm64 this needs fixing, tools/perf/examples/bpf/augmented_raw_syscalls.c > (its in the kernel sources) is still hard coded for x86_64 syscall numbers :-\ I changed the system call numbers for arm64 respectively in augmented_raw_syscalls.s; so this if fine. > Use some other BPF workload, one that has its programs being hit so that > we get samples in it, in my case running: > > # perf trace After I run 'perf trace' command it reports the building failure when generate eBPF object file, as shown in below log. I saw the eBPF code includes the header files unistd.h and pid_filter.h which cannot be found when clang compiled it. These two header files are stored in the folder $linux/tools/perf/include/bpf so I tried to use below command to specify header path, but still failed: # clang-7 -target bpf -O2 -I./include/bpf -I./include \ -I../../usr/include -I../../include \ -I../../tools/testing/selftests/bpf/ \ -I../../tools/lib/ \ -c examples/bpf/augmented_raw_syscalls.c So now I am stuck for eBPF program building. Do I miss some configurations for headers pathes for llvm/clang? BTW, I notice another potential issue is even the eBPF bytecode building failed, 'perf trace' command still can continue its work; after read the code [1], the flow is: trace__config(); `-> parse_events_option(); When building eBPF object failure, parse_events_option() returns 1; for this case trace__config() needs to detect the erro and return -1 rather than directly return 1 to caller function. ---8<--- # perf trace /mnt/linux-kernel/linux-cs-dev/tools/perf/examples/bpf/augmented_raw_syscalls.c:17:10: fatal error: 'unistd.h' file not found #include ^~~~~~~~~~ 1 error generated. ERROR: unable to compile /mnt/linux-kernel/linux-cs-dev/tools/perf/examples/bpf/augmented_raw_syscalls.c Hint: Check error message shown above. Hint: You can also pre-compile it into .o using: clang -target bpf -O2 -c /mnt/linux-kernel/linux-cs-dev/tools/perf/examples/bpf/augmented_raw_syscalls.c with proper -I and -D options. event syntax error: '/mnt/linux-kernel/linux-cs-dev/tools/perf/examples/bpf/augmented_raw_syscalls.c' \___ Failed to load /mnt/linux-kernel/linux-cs-dev/tools/perf/examples/bpf/augmented_raw_syscalls.c from source: Error when compiling BPF scriptlet (add -v to see detail) Run 'perf list' for a list of valid events Thanks a lot for help! Leo. [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/perf/builtin-trace.c?h=v5.2-rc2#n3631