From patchwork Thu Jun 6 09:48:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 165972 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp8551867ili; Thu, 6 Jun 2019 02:49:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqzvu3bgi7Gi9EA9E7gxf3S6ZMXkr+xLE9Kk+POyMsjc7XlbLUJrXfOv1wFENKDHOnKlbyfI X-Received: by 2002:a17:90a:6544:: with SMTP id f4mr8331498pjs.17.1559814581763; Thu, 06 Jun 2019 02:49:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559814581; cv=none; d=google.com; s=arc-20160816; b=yUmblTKubBwQybCVJcaeWb8dCZeLlcT8/xvHcvC14wwbtJ2xxGfylVe0wiUkQ2pLn3 4ldkY3J4iVq33C1q0icvjN4AHKTX64EyVYQxj2e5wC6dBtVTU0o1LieLGoSK73uzxxw0 4d24D3iDOQrMelnrP6XODWwE3W5NOA1CF/Q2+8QS/40zcZ11a1MAXuvjd+b7tiuDBCRG Z5xJRF+Yf7MvQNK8PEqgZZz9JzHm4TwVpn4/xVtYcfz5an0xIUt4Tx8kJv1qfOmzxu6y WpV5EFy9VkHCluSsmoNN1nuP/Onwx/AU9pURJ94abL++dsRpYKGbiXrh4IwwlOwzSv3L fSsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=dIuWqahxwYfa+gg7zLducBqFVlvQ5xNUBiX7691YYJI=; b=DmLvVURrvkreunzjNwS6hAggCS8N/usouD6XY0Wu9Xn4WekfIrNVjMr3RzrQyeAN3/ hM8ezPhvDydIGAOiIEK+jdfwTnHnmqD6Anr5LI4IGXpg3TiZNPndxe48+EaSPR23OMCF 26aV8/x8AHpRT0Za46lroyGuoawRqynyONJaRzPtfEqusOggdOY8OTbZXmJmMklVhcWi Z9CpzVwK/In0Hy9ljL8ucQk68bd/7lrLn46sBIhrccjsBP7o4wrIWoWHcdOA8ZreB03Z 6OxUUIDZEexhG2dBY/E8ecukV2OfIWiM9n5IRRaPorjbzSsFzBFGsZjfG/9aZioxMe/Q vfKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qq8fspWR; 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 m11si1392583pla.423.2019.06.06.02.49.41; Thu, 06 Jun 2019 02:49:41 -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=qq8fspWR; 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 S1728314AbfFFJti (ORCPT + 30 others); Thu, 6 Jun 2019 05:49:38 -0400 Received: from mail-yb1-f193.google.com ([209.85.219.193]:42279 "EHLO mail-yb1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727540AbfFFJth (ORCPT ); Thu, 6 Jun 2019 05:49:37 -0400 Received: by mail-yb1-f193.google.com with SMTP id c7so694492ybs.9 for ; Thu, 06 Jun 2019 02:49:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=dIuWqahxwYfa+gg7zLducBqFVlvQ5xNUBiX7691YYJI=; b=qq8fspWRrqRd4zZSm3WIi14g0uJacA6l8DkDjMrJY/bMSxeY2EIj0GoZzMXUXP8QoU 6C86B8kbB9ZhEK+PAtWX+isJfxsQkWKmYjFAWqO2JDQ/dYLMAI5BGZGx0S19LVPeJq94 QU+u2HEv9nrLxTpshbbh99HmPOGIlkROXPehcUXk3Anb14Fgh+r5nRzdLVI77v4wPQYT lz9s1ZSBkQqVp9DESR3lTtAkU2NR9z+JrxvZoUFHHBtlUVtpS6jgAIhpojIJ+QwVddHF y3w7m6xGqYbkZNDokLtGCWDLAH1d8xn3AdHjCmzen9xdJbYGz97LCv8PHHauBFIWYsik IXAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=dIuWqahxwYfa+gg7zLducBqFVlvQ5xNUBiX7691YYJI=; b=tjzs+OnZDETodOqJuWNMIpgpo2wPJRnzvMJjJxzuMP/FcmvePtwQ8gEAoRhj8PlJnO A0V9fvIKQBZAG68KYjN/x9Tu1kEBqG8UmyimvNtyFx3EMwqsJ1/xTdbhS8np5LXnXhg6 6kftT58CBJnVe6UsYCzcWAUYdrxex8cmjymAo8555rVlvEJlkCrHSXWguYUC2Cw5Sorp dHEQbAgG5ZE9Esi/4sDyD+xcK9XtmKDSilzwYr92udD8l1d3JL5obr2qI7nEL7IcGB1g JiOAVbEwd6KhIgegElvbOSo2HSSvjYn77lAeTthQszbYnqC/8bLNc09rCWG5OldoGFAI G29g== X-Gm-Message-State: APjAAAUovw8oAPGVMm+CuyZmKbk98bethcmxWehT16iIktlJS49xcAkd VqnqAkYIPS43VIMI3LpyiFUDmw== X-Received: by 2002:a25:84c5:: with SMTP id x5mr13331854ybm.78.1559814576552; Thu, 06 Jun 2019 02:49:36 -0700 (PDT) Received: from localhost.localdomain (li1322-146.members.linode.com. [45.79.223.146]) by smtp.gmail.com with ESMTPSA id 85sm357652ywm.64.2019.06.06.02.49.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Jun 2019 02:49:36 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , Adrian Hunter , Mathieu Poirier , Mike Leach , Suzuki K Poulose , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org Cc: Leo Yan Subject: [PATCH v2 4/4] perf augmented_raw_syscalls: Document clang configuration Date: Thu, 6 Jun 2019 17:48:45 +0800 Message-Id: <20190606094845.4800-5-leo.yan@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190606094845.4800-1-leo.yan@linaro.org> References: <20190606094845.4800-1-leo.yan@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org To build this program successfully with clang, there have three compiler options need to be specified: - Header file path: tools/perf/include/bpf; - Specify architecture; - Define macro __NR_CPUS__. This patch add comments to explain the reasons for building failure and give two examples for llvm.clang-opt variable, one is for x86_64 architecture and another is for aarch64 architecture. Signed-off-by: Leo Yan --- .../examples/bpf/augmented_raw_syscalls.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) -- 2.17.1 diff --git a/tools/perf/examples/bpf/augmented_raw_syscalls.c b/tools/perf/examples/bpf/augmented_raw_syscalls.c index a3701a4daf2e..fb6987edab2c 100644 --- a/tools/perf/examples/bpf/augmented_raw_syscalls.c +++ b/tools/perf/examples/bpf/augmented_raw_syscalls.c @@ -6,6 +6,25 @@ * * perf trace -e tools/perf/examples/bpf/augmented_raw_syscalls.c cat /etc/passwd > /dev/null * + * This program include two header files 'unistd.h' and 'pid_filter.h', which + * are placed in the folder tools/perf/include/bpf, but this folder is not + * included in env $KERNEL_INC_OPTIONS and it leads to compilation failure. + * For building this code, we also need to specify architecture and define macro + * __NR_CPUS__. To resolve these issues, variable llvm.clang-opt can be set in + * the file ~/.perfconfig: + * + * E.g. Test on a platform with 8 CPUs with x86_64 architecture: + * + * [llvm] + * clang-opt = "-D__NR_CPUS__=8 -D__x86_64__ \ + * -I./tools/perf/include/bpf" + * + * E.g. Test on a platform with 5 CPUs with aarch64 architecture: + * + * [llvm] + * clang-opt = "-D__NR_CPUS__=5 -D__aarch64__ \ + * -I./tools/perf/include/bpf" + * This exactly matches what is marshalled into the raw_syscall:sys_enter * payload expected by the 'perf trace' beautifiers. *