From patchwork Thu Jun 6 07:56:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 165953 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp8440491ili; Thu, 6 Jun 2019 00:56:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqxnPCjM8p0RjE2YLrkFw+YblFNKCr6c8sbVXN0tffvQ1NLK7aipdRdiPaPGm9r1mkIy5384 X-Received: by 2002:a17:90a:29c5:: with SMTP id h63mr15677297pjd.83.1559807809028; Thu, 06 Jun 2019 00:56:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559807809; cv=none; d=google.com; s=arc-20160816; b=za+p/spmFAwauChWA2dVG7Mw9vI4CApZHhJn9iJqYauAaAJ/G+KV0p86VRlpAW5g5Z b73nCnjH4e+Fnbkvs9ivKJCc/L+Il0j4PZIqXl5nOf2cIDyfeJQpJJ6RI4KQC4R0FLEh HS+EYig3t/DKAXE2q5TQnzRIKu8WfRxWlbqGAN0y87Di2bTtnWpBf3GpejtHbB8VjGkn r5x7+AFEIuYXxmkvZ73KcYhUVyuloyY2NV2HLxLJO3ekKYbVINuZb0K0VGju/bhZiQ5M eFmKVQZr3F1beyU8yKT8NX1whlT0AyItuYqP362VUXwiajAfyo5ySeexdvFLdg1jMn1e i4mQ== 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=TbM9vdATYDfk/+/NGyr5Ij8vLHhNayhJciB4ayq0pHE=; b=l3Ph0fMe7C92j0ey3VVpboPOMn7aMSm5wny1RIT0Wud/znLFd7tSUdP2LMVI5u+kvq pkQGRkuDmA51z2cewGPkfFG0g3me77e7sbOyZaY0wSWvjXh+vSXkIpqLD1X+5kDXLbf6 YLfhZx+XwZOfwiVHYJ60wtMqv/LidRb4pHjjDUgDqlDB0CYpPY2bZAIrh/0vIjpIiAro b4yrRdyteIyCHXkGQBdchoIQRGqst7Wc5hsROnqfAerLRPf98EmUANLLZIZRpQsNNA9G tYKc10TFTR/utD5wX7P7sBK/RJYKSHzf3o/7djCjno/9cvlQXEAMU5TmqAV2HMVcqsf6 FEMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MM6OcPwA; 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 195si1387556pgb.327.2019.06.06.00.56.48; Thu, 06 Jun 2019 00:56:49 -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=MM6OcPwA; 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 S1726883AbfFFH4s (ORCPT + 30 others); Thu, 6 Jun 2019 03:56:48 -0400 Received: from mail-yb1-f195.google.com ([209.85.219.195]:39670 "EHLO mail-yb1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726837AbfFFH4q (ORCPT ); Thu, 6 Jun 2019 03:56:46 -0400 Received: by mail-yb1-f195.google.com with SMTP id c5so600318ybk.6 for ; Thu, 06 Jun 2019 00:56:46 -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=TbM9vdATYDfk/+/NGyr5Ij8vLHhNayhJciB4ayq0pHE=; b=MM6OcPwAJE1POnI9pGXHiBCNozL4ZBtxEn7ju0XByHG94g+QwzU/iiSy44DRpp3Unm FYPVos2EGcDv26xHAbZRORvla6calNQz4bJPO419a6f/RVB0FqB0wnH1K0bpliXR0snw 7ot9cbH/X6rWk2AYvw88dVCramLl96KtBpZ1KfzV2MpsNBY4AyKGEvjdqNYoBwh/sjkW gUEd8CXA/N5zkn4EkSVFtCQDgodRSQ8TkO+0BilrhFBNsCQ9aIwwObLfuDN5/Oj/vvQl TW6ZP85+pOrzanq+88wrhLAf+HYTSw9GTGEEHwRyRLCTKy19juEFCNEovH81pwPXf6dP ohkg== 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=TbM9vdATYDfk/+/NGyr5Ij8vLHhNayhJciB4ayq0pHE=; b=U+BJ6df1akpHpsyYlKZMMEe+/LggLHU2HLulqrCNIwsxnd5ZY2twADtTGyFReRlohl U1Ln+t6C5ClmPOQTh1UFOHno/fxVKDNlnYa52FEru2XdtVyA/PVS3b4zJZE86aCeRTY0 c2DDu4q7s3ujOXVLBFL3DvHiuQ4+FeAcoQ0mP/4gFjdBmFdTLuvvnHdEqvrt4YmSomVF NUI1B2PMn314VUO38ObRlSxkBX/6BoufUe1N00JhBxhieWyHicRlUwRE6Bj2PETSONlU MOiEp8CLHW5I4gm9cEFyLp/GtuMA7+lsPilgNMIFQDcXCJrFZABvdVK6a30JAL2b1aAT 3I4g== X-Gm-Message-State: APjAAAU/Pv/t2y5mCxqFkWlFwkVTDPoq8me+FDjRW3S6jFMuQknper6s mc0He6qxTTrPSE4DemukQGCYOQ== X-Received: by 2002:a25:410f:: with SMTP id o15mr20004920yba.328.1559807806138; Thu, 06 Jun 2019 00:56:46 -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.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Jun 2019 00:56:45 -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 1/4] perf trace: Exit when build eBPF program failure Date: Thu, 6 Jun 2019 15:56:14 +0800 Message-Id: <20190606075617.14327-2-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 On my Juno board with ARM64 CPUs, perf trace command reports the eBPF program building failure but the command will not exit and continue to run. If we define an eBPF event in config file, the event will be parsed with below flow: perf_config() `> trace__config() `> parse_events_option() `> parse_events__scanner() `-> parse_events_parse() `> parse_events_load_bpf() `> llvm__compile_bpf() Though the low level functions return back error values when detect eBPF building failure, but parse_events_option() returns 1 for this case and trace__config() passes 1 to perf_config(); perf_config() doesn't treat the returned value 1 as failure and it continues to parse other configurations. Thus the perf command continues to run even without enabling eBPF event successfully. This patch changes error handling in trace__config(), when it detects failure it will return -1 rather than directly pass error value (1); finally, perf_config() will directly bail out and perf will exit for this case. Signed-off-by: Leo Yan --- tools/perf/builtin-trace.c | 8 ++++++++ 1 file changed, 8 insertions(+) -- 2.17.1 diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index 54b2d0fd0d02..4b5d004aab74 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c @@ -3664,6 +3664,14 @@ static int trace__config(const char *var, const char *value, void *arg) "event selector. use 'perf list' to list available events", parse_events_option); err = parse_events_option(&o, value, 0); + + /* + * When parse option successfully parse_events_option() will + * return 0, otherwise means the paring failure. And it + * returns 1 for eBPF program building failure; so adjust the + * err value to -1 for the failure. + */ + err = err ? -1 : 0; } else if (!strcmp(var, "trace.show_timestamp")) { trace->show_tstamp = perf_config_bool(var, value); } else if (!strcmp(var, "trace.show_duration")) { From patchwork Thu Jun 6 07:56:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 165954 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp8440585ili; Thu, 6 Jun 2019 00:56:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqykabrX8f5cgKBmT3MzpwLhjOiBUAGDE83OaoO/fKpca67hyTjk9auaDtAbDXbSsjXO5ntA X-Received: by 2002:a62:8c97:: with SMTP id m145mr51275167pfd.62.1559807816359; Thu, 06 Jun 2019 00:56:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559807816; cv=none; d=google.com; s=arc-20160816; b=0VuCpoGuIOgjpYtoDleLe3PJB5eLW4qpdND8detlPANPubIz+E38YWZM0DmRuRrZlP UbvIMzuNQc6fC6DHkFJBF+1VOYQ1bRq2RlQPK29N1Za2IaqchollNqHIL1QAucOaZZAg VSL7iVp8JKVd4Ao/Gljzp54yZTZJtO8eIvsUKtqKAfu4/exxJi3FBfiTAVWu7em1gInl 0wSPc3EDpv7Hfm4eqY/UTg74jFcvSjUWyr8WkckUU8BGeFdSPG5a3EMmKO6I4Joz72c5 xa/HxEWEF+mZJ09KJA8irlLQ9jBpu/MQbVHdH6QxETyJr/1mNhYjh2DQL8WtylTEa2jp izJA== 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=9i+39qzlLlaj4ZIJyuysO0V74pT4jxs4rHh5xzjVecc=; b=pF9Sc0WkR2291sWPtXYmEbVQzusmzkHtJ5ZrTbF67lHhpuRrJRnrFjhBaUZ8E8zNbf dgqWByP6rwHAMoFebQOs2AnWWdi6C1q1eeN8hWvZuFyoAueDdxJxMvlEmgSzaDaT0WMq tjXhtLWQn9KKBTIrrjU6anpSrn681xOhlPKO4huGJ2zgFToyURfXFyAu8XSjlNKMZDFp LsKw9OlRCDofR7jBCmnUTwl/RgzgubwRVru1KJ6+pevK4PjzHAGnuqKWYEfm3MOubMyP d0Vum8+fyaeDZU6f+c8egg+dZvfMopQ+CNSqfkKl1CY1xPqCHQTyR5LXHQdED/CrKIij r37Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="pJ/XAoNi"; 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 r13si1441375pga.263.2019.06.06.00.56.56; Thu, 06 Jun 2019 00:56:56 -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="pJ/XAoNi"; 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 S1726040AbfFFH4y (ORCPT + 30 others); Thu, 6 Jun 2019 03:56:54 -0400 Received: from mail-yw1-f66.google.com ([209.85.161.66]:44450 "EHLO mail-yw1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726885AbfFFH4x (ORCPT ); Thu, 6 Jun 2019 03:56:53 -0400 Received: by mail-yw1-f66.google.com with SMTP id m80so501309ywd.11 for ; Thu, 06 Jun 2019 00:56:53 -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=9i+39qzlLlaj4ZIJyuysO0V74pT4jxs4rHh5xzjVecc=; b=pJ/XAoNin++ppwq0Yryx58yYTvqaZaQj8So8vITNx5j6Ty5ySAWqIr36sESXSFmaR8 9HomApkEVr1IiR6M4JnOxf4jg7D3RXcLWx0RgOKLxj0C/TA1UXqAq7i1S7bWi6bVY+Uq 9/nZJtNx9DaywajZ/iowMTY7S0YAJ7AfcOAFxET8HWmzQxO2UT7I8H2scnQojIHiELvA Xk3CwGnga560N3HRVcVF/JkEIA5SY/HjaWWvmIvVSQRZprabi//HTGKoOvsdFIiwtFCa P8qiEP0zgewtJW0XMD891BgK1PL82mlWRyb8cy0BcXqubHqc1dSM2oAR31pY3r2y6THY AL5A== 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=9i+39qzlLlaj4ZIJyuysO0V74pT4jxs4rHh5xzjVecc=; b=mJ33AUUxY/YD1klN4QJmtCX+3HpbYbnSV6NDgcAsuIerzfYN76LQP7pwMABTWJf6V6 HThjLOELE/3SHjFx2slGnZLtsC1XappngFXhYAiFJvDXT44Szu5ZBaopyJ1+e9bmkBu7 I6aa5nTHw66M8EXcs4eFfCLtIqzeeWdU3Eq0o5+iJ4x3pKenfM1q3TLCW64+4M68CJyf jY4b9SJ7Sk1tgxZdHQH+cTtph00vzI43vZZYtQK1PGLsxFLM/PFCb3/oAmbRffXMR3Eq OHa5RpApZcCUNXsMRdKIrPKrpSl4HgpBLwXolQ+fuLlkXPq5QjthH+1IBVChuT/D/grG xlIQ== X-Gm-Message-State: APjAAAUob46a5Bc8hT7kGSn4fXkHoVhTxikmLZOnPIFGPUIe72zYqczU guxdKyrYsXnHDV3MtCgFFOv/jA== X-Received: by 2002:a81:2981:: with SMTP id p123mr10051401ywp.430.1559807812812; Thu, 06 Jun 2019 00:56:52 -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.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Jun 2019 00:56:52 -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 2/4] perf augmented_raw_syscalls: Remove duplicate macros Date: Thu, 6 Jun 2019 15:56:15 +0800 Message-Id: <20190606075617.14327-3-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 The macro SYS_EXECVE has been defined twice, remove the duplicate one. Signed-off-by: Leo Yan --- tools/perf/examples/bpf/augmented_raw_syscalls.c | 1 - 1 file changed, 1 deletion(-) -- 2.17.1 diff --git a/tools/perf/examples/bpf/augmented_raw_syscalls.c b/tools/perf/examples/bpf/augmented_raw_syscalls.c index 68a3d61752ce..5c4a4e715ae6 100644 --- a/tools/perf/examples/bpf/augmented_raw_syscalls.c +++ b/tools/perf/examples/bpf/augmented_raw_syscalls.c @@ -90,7 +90,6 @@ struct augmented_filename { /* syscalls where the second arg is a string */ #define SYS_PWRITE64 18 -#define SYS_EXECVE 59 #define SYS_RENAME 82 #define SYS_QUOTACTL 179 #define SYS_FSETXATTR 190 From patchwork Thu Jun 6 07:56:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 165955 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp8440682ili; Thu, 6 Jun 2019 00:57:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqx8UWCfd59xOA4RXh0q0mV1LH5M/jFZYv2whyipywm+RQ/o2N2bOgvlJg9Xx442ZKVrpd4Y X-Received: by 2002:a17:90a:aa0a:: with SMTP id k10mr37068194pjq.43.1559807822047; Thu, 06 Jun 2019 00:57:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559807822; cv=none; d=google.com; s=arc-20160816; b=mw1BcfMvV5tIFNkgL3/LKYt1OkG/x1KJ2rcp+5CSiiOFgF1lsR8YHpOcUWpjCmgWhJ eO1gNVAIq8r6lpXo6OxzhOF0KTSFQUFg9ODz3OMv4j9F9AYQ0xquiQkCwehaeXmh1SlK 3BTcEBFQWrzweFPo19T79jDlSuBcnNvd8XwK/CT5RjRX7QC0sfiDh6wES8+phyaoOjNN pMLNDFjimAaa4otpTLFKAHTOEbxg1SWf8H0RhvZhr3rUiK3EYpmlx/R8AfZLJWD8zO6S OiP2okraaHBmeuw09OtTMo174t0DPGRxlOPtHN88DSgfFKRX4/dHNSlV9AkQe1MsuWhC IgEA== 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=e2oYBhfvK7ZPiWOEwi/H0aRHGINCuJ9bdzg0oB3t3I8=; b=x3TzGniosi1lzc10crdHjLj7Yk704LO8O5dHHVK//8m2k4Sgd68YgfPo05TdmKOV8k UZzipSagSBkYQz+R2+Nk5He00FQtSaVSTt5Y35CJpriiqA4bLRW/kyo3nsbWRaqaIBxl EBryle8+2GhK1ORBweVgEZkBfRBJeyGsfaQ+8Tkx+7wTNM5OJp6zSWSungtm7i6Ct9GS niY41UBHWaQlTot6NEGMzoCHBiL2HqnYSNsgG2NvZUt+zj+yptYTc7c5jADUFv2XLCEt IirCLjUHlZudTgVDQzVSqyO4aKIwiV6tiEBSIcovGaZbbJRsjk9i4AjdmM4eQ3Xdwn/N 76Dg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Zh8eNxLV; 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 b17si1115797pls.52.2019.06.06.00.57.01; Thu, 06 Jun 2019 00:57:02 -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=Zh8eNxLV; 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 S1726961AbfFFH5B (ORCPT + 30 others); Thu, 6 Jun 2019 03:57:01 -0400 Received: from mail-yb1-f196.google.com ([209.85.219.196]:37108 "EHLO mail-yb1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726885AbfFFH5A (ORCPT ); Thu, 6 Jun 2019 03:57:00 -0400 Received: by mail-yb1-f196.google.com with SMTP id l66so608018ybf.4 for ; Thu, 06 Jun 2019 00:56:59 -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=e2oYBhfvK7ZPiWOEwi/H0aRHGINCuJ9bdzg0oB3t3I8=; b=Zh8eNxLVnPty5J/NWX1zW05wsPNNZWyvKzHuwuWPy86z2xqivWNWZM/j/ppvwdeVuj LHr3pH8+MHJhMqFcaGS+NbuJHQfZhcdzRIJCurDHb7q8kRkGuflNOqzxt/vecFg++PSn lku9coxsyZK+/Fad+hdtdoqKRjenEj9owObNe43aldBYv5qDQacIrU6AIUWtlSgcxm1V ToLzsFz2muoT5Z8TnjBEvend61T5l9DlsUVI8H9NrDbweLlHWqtnAyJxCmrfOjsiWSuB gSsZIDeK80kz4W7cPKSQ3KXiza/hZnKz8+xW0p6i4AWH65z/VmBKL08y5YaV/tPZXqkQ nQ0Q== 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=e2oYBhfvK7ZPiWOEwi/H0aRHGINCuJ9bdzg0oB3t3I8=; b=VsbpNsrWpKamMENHl/5C2XOV5XEdO+t1asnJTC0F5VGqiNIa+yawz6UaWxK3HG6mtv 5Lz9qFxF1b66G6OTi4hFnaY7Mn3AuTsw7jOUQCPtTN4gNe5BqQcvl3ldEPZ7a4lPFujO U2oI15VlmZuTpgA96kpKaqX8qGqBooE0+w7uHlvE7joyOOBbvBNltB/+lVBZqzI5C82+ lOkRBodwl5N8mO2JIOfD5uq3yNtFQt0FPF3R5IR+X+iTEqW3ihI0/VDLv6K0UCLfcP8z PXu+68XxQzs0SuMMcokhJP0cwveIFKEsUGBZ0CO+3kmad7XAcx/ULIvn9N08MU1HgA4R 3bnw== X-Gm-Message-State: APjAAAXbu8JMhZojyIq54KTs4QTHueN0CNyOkakBjAvZTiiv2opUNJjU 0q3Ytv94UbOqaoiceklhJpyqaQ== X-Received: by 2002:a25:6b46:: with SMTP id o6mr14097845ybm.392.1559807819058; Thu, 06 Jun 2019 00:56:59 -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.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Jun 2019 00:56:58 -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 3/4] perf augmented_raw_syscalls: Support arm64 raw syscalls Date: Thu, 6 Jun 2019 15:56:16 +0800 Message-Id: <20190606075617.14327-4-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 This patch adds support for arm64 raw syscall numbers so that we can use it on arm64 platform. After applied this patch, we need to specify macro -D__aarch64__ or -D__x86_64__ in compilation option so Clang can use the corresponding syscall numbers for arm64 or x86_64 respectively, other architectures will report failure when compilation. Signed-off-by: Leo Yan --- .../examples/bpf/augmented_raw_syscalls.c | 82 +++++++++++++++++++ 1 file changed, 82 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 5c4a4e715ae6..f4ed101b697d 100644 --- a/tools/perf/examples/bpf/augmented_raw_syscalls.c +++ b/tools/perf/examples/bpf/augmented_raw_syscalls.c @@ -45,6 +45,84 @@ struct augmented_filename { char value[PATH_MAX]; }; +#if defined(__aarch64__) + +/* syscalls where the first arg is a string */ +#define SYS_OPEN 1024 +#define SYS_STAT 1038 +#define SYS_LSTAT 1039 +#define SYS_ACCESS 1033 +#define SYS_EXECVE 221 +#define SYS_TRUNCATE 45 +#define SYS_CHDIR 49 +#define SYS_RENAME 1034 +#define SYS_MKDIR 1030 +#define SYS_RMDIR 1031 +#define SYS_CREAT 1064 +#define SYS_LINK 1025 +#define SYS_UNLINK 1026 +#define SYS_SYMLINK 1036 +#define SYS_READLINK 1035 +#define SYS_CHMOD 1028 +#define SYS_CHOWN 1029 +#define SYS_LCHOWN 1032 +#define SYS_MKNOD 1027 +#define SYS_STATFS 1056 +#define SYS_PIVOT_ROOT 41 +#define SYS_CHROOT 51 +#define SYS_ACCT 89 +#define SYS_SWAPON 224 +#define SYS_SWAPOFF 225 +#define SYS_DELETE_MODULE 106 +#define SYS_SETXATTR 5 +#define SYS_LSETXATTR 6 +#define SYS_GETXATTR 8 +#define SYS_LGETXATTR 9 +#define SYS_LISTXATTR 11 +#define SYS_LLISTXATTR 12 +#define SYS_REMOVEXATTR 14 +#define SYS_LREMOVEXATTR 15 +#define SYS_MQ_OPEN 180 +#define SYS_MQ_UNLINK 181 +#define SYS_ADD_KEY 217 +#define SYS_REQUEST_KEY 218 +#define SYS_SYMLINKAT 36 +#define SYS_MEMFD_CREATE 279 + +/* syscalls where the second arg is a string */ +#define SYS_PWRITE64 68 +#define SYS_EXECVE 221 +#define SYS_RENAME 1034 +#define SYS_QUOTACTL 60 +#define SYS_FSETXATTR 7 +#define SYS_FGETXATTR 10 +#define SYS_FREMOVEXATTR 16 +#define SYS_MQ_TIMEDSEND 182 +#define SYS_REQUEST_KEY 218 +#define SYS_INOTIFY_ADD_WATCH 27 +#define SYS_OPENAT 56 +#define SYS_MKDIRAT 34 +#define SYS_MKNODAT 33 +#define SYS_FCHOWNAT 54 +#define SYS_FUTIMESAT 1066 +#define SYS_NEWFSTATAT 1054 +#define SYS_UNLINKAT 35 +#define SYS_RENAMEAT 38 +#define SYS_LINKAT 37 +#define SYS_READLINKAT 78 +#define SYS_FCHMODAT 53 +#define SYS_FACCESSAT 48 +#define SYS_UTIMENSAT 88 +#define SYS_NAME_TO_HANDLE_AT 264 +#define SYS_FINIT_MODULE 273 +#define SYS_RENAMEAT2 276 +#define SYS_EXECVEAT 281 +#define SYS_STATX 291 +#define SYS_MOVE_MOUNT 429 +#define SYS_FSPICK 433 + +#elif defined(__x86_64__) + /* syscalls where the first arg is a string */ #define SYS_OPEN 2 #define SYS_STAT 4 @@ -119,6 +197,10 @@ struct augmented_filename { #define SYS_MOVE_MOUNT 429 #define SYS_FSPICK 433 +#else +#error "unsupported architecture" +#endif + pid_filter(pids_filtered); struct augmented_args_filename { 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. *