Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp7986646ybi; Thu, 6 Jun 2019 05:00:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqyptwMtKjRr6445KSIkEA9yqKpTOkRaLIFhDHR+1qfhl3onr9LtnGWEobjwasy1nj9l9xQe X-Received: by 2002:a63:1a5e:: with SMTP id a30mr2946472pgm.433.1559822417768; Thu, 06 Jun 2019 05:00:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559822417; cv=none; d=google.com; s=arc-20160816; b=CrSn1mZT1qX0Vd7sYIygZw54F/89yZAxde4e73Nvtt4I81MdA5EHL0XVKNCRiI5n+9 hLVK7HG89srag2AcI0QgRWzKpIGUJpV/Yq6YaQAgV7KWriUv2+RObRbNSXCqGlU+utAD BhDzybFWgBKD3s95UTATafh1KFV2JGqHtzrpXMo+KBwEjIujAzmLifr4eklFmg6D2kzH O5dvQMxB4Qd7Hj+A/0Z6XDiA3r8q2MgcVYV56AvcL9yCSOiXzOlgEuv2zpAYOtgBwQ4m ruyM9chaXtaTIfVobbIw//kbt0bwWa9W78lSeOAbAmEHuOBZ+zzQlnosuFNHe3cGHQTm sOzg== 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 cj13si1700936plb.162.2019.06.06.05.00.01; Thu, 06 Jun 2019 05:00:17 -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 S1728310AbfFFJti (ORCPT + 99 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(+) 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. * -- 2.17.1