From patchwork Thu Jun 6 07:56:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 165956 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp8440838ili; Thu, 6 Jun 2019 00:57:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqwOfBDSSe2AHZcBfhzNoodTX8nE/VPchq93H9cEUXxTNADzO62Eh5x4TBJE3FiWZ0c1XN15 X-Received: by 2002:a17:90a:8902:: with SMTP id u2mr14881241pjn.96.1559807831527; Thu, 06 Jun 2019 00:57:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559807831; cv=none; d=google.com; s=arc-20160816; b=mRUaa7PQ7meTLvbKz/uzwMxE1rPz4xq9XKpg7bcIPFs3ugNfzDNqLQPjryOP3LSkgK le5MV8IN667vscZDclV09im66cpNfFCQqWdc4R2d6W32fDoWGf39beLl9Qs/h9jq7syR +AZEWFCGUukPxVDs8H5VUs3XYqko/89JpBFxL19OyIYaZCFzZ9XoOp0FTZ1/Yi7gsPv4 8uN/7LIZCbapgTtFI2xYrIu23KQcgWXnLGe721pBj9QY/VPcB1WFPCt4KjmPGTj6PcGw hmuCBiYDPEJMaomchTMtnR3lZQjsXgOr8GbSxV1H/4ojKgpqJ7ZzlO+BtMwJ/U0KXmcu omAA== 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=uI1TPeuSd92UbPS5N8KX6krfL9bLASM56BYU9fb4POc=; b=vjb1abb5gu8cKEIlBw9dppnOSXjBh+YZH4UVWOrz2WLQjOzLKNtN6YdxXvJfNGAEpQ 5N+IFx4uOODDwcyqZvs3NJVuqsSwuwrJYp1eHQmHR1HtsgArb7H1tRvnVLRAzva60swP 3+p+p/1cRif1HZaTZfWzcFofarBfvVrGRrj0M+J/QaHBxjn2AQHUwMQrRaSiRkH4Jvaf rgv61GRp0PluxbmWQZwoodvWU37fXZ5SEul5sI1yKz6jJc6NTN1tifrViKqf6vp1XEW5 Noc3uZZU5tW0to/iWCUynoxC8D4YkJ95eMHH6lRYi3ZivGk7ua0s8czB0jPHoH+VPXmk bL9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EK+JXrEb; 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 l67si1255152plb.370.2019.06.06.00.57.11; Thu, 06 Jun 2019 00:57:11 -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=EK+JXrEb; 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 S1726984AbfFFH5K (ORCPT + 30 others); Thu, 6 Jun 2019 03:57:10 -0400 Received: from mail-yw1-f66.google.com ([209.85.161.66]:46772 "EHLO mail-yw1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726664AbfFFH5G (ORCPT ); Thu, 6 Jun 2019 03:57:06 -0400 Received: by mail-yw1-f66.google.com with SMTP id v188so497493ywb.13 for ; Thu, 06 Jun 2019 00:57:06 -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=uI1TPeuSd92UbPS5N8KX6krfL9bLASM56BYU9fb4POc=; b=EK+JXrEb8VZeAve5rLD+Ic/Gr9G7cOKUKRQnt3SOMK+SMmMPKBMI+B0StZwtvAWh1D aBEv5d/DrZVVRllIXm915E2xHNU8V5RG/EiWbcA/AbyqyqyiFJOrT83ecKGDkF7i9tJY GpckMQnpe3QSIqMStsVcUDMErMzwZ4opdg5k7/YHlRovgOSvj9xRCuITR2V/S9RX+FBc U7vAhEqS/GK2I3xjJGUiyIMMXYRGNUY8a4ut5u4Y5q+Hwcvw+ATyrJdCFA1295pinl45 lDcxuOjC2Jy+XnANxtciH4TLAqcmexvePomh1YCeWNPFD8cxJmHmXf09mKK+2o9etBYr mVoQ== 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=uI1TPeuSd92UbPS5N8KX6krfL9bLASM56BYU9fb4POc=; b=VwdLyYXD8mJHIjeOmsxbEOkTIZgIg0krY5Rqmgz2ONMXefFCx8szI6wTHR1bQGtSC0 t5ZuKIjff7H6TxeTWQNkxaghru2THccJ7Rfbdzaw6/AOAnfkvQZGt4CG+gl0Ojg3H8IM lkxf8AOGOF90O5AhB3gFvJr45OxLJywMzhiYtHeNdXug5BuykitiFqSUBWIVrqVpNr1z fcWorRU1WqENDMyULc26mE9/ZIVBdOeZgUuxYCg6XRu5MgCLE1ql/AeZExRpesZo17f/ bbCoNlbeI2CUAB2Xjs1+HDMZU4sGwu9aDjMo/qT9LlBpDeT5EbE8zvUKIoQKMYfo5/HG eL6Q== X-Gm-Message-State: APjAAAWZcdLhATE+i2yAjZvWocP/uH3duVPf/tD5qasmv6HSeKuQdQGW h1wyRd38N9F7yJjRxvNc7SKoTw== X-Received: by 2002:a81:308d:: with SMTP id w135mr5488572yww.110.1559807825644; Thu, 06 Jun 2019 00:57:05 -0700 (PDT) Received: from localhost.localdomain (li1322-146.members.linode.com. [45.79.223.146]) by smtp.gmail.com with ESMTPSA id 14sm316343yws.16.2019.06.06.00.56.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Jun 2019 00:57:05 -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 v1 4/4] perf augmented_raw_syscalls: Document clang configuration Date: Thu, 6 Jun 2019 15:56:17 +0800 Message-Id: <20190606075617.14327-5-leo.yan@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190606075617.14327-1-leo.yan@linaro.org> References: <20190606075617.14327-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 f4ed101b697d..5adc0b3bb351 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. *