From patchwork Thu Jun 6 09:48:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 165969 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp8551481ili; Thu, 6 Jun 2019 02:49:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqzXpZaDiDj9hDhYPXAhdnksJEJi8qbhMSfx6tiILls5tsvLNudtI3f9QWk0X++wYoXqdz0U X-Received: by 2002:a63:3dcf:: with SMTP id k198mr2610407pga.60.1559814554046; Thu, 06 Jun 2019 02:49:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559814554; cv=none; d=google.com; s=arc-20160816; b=jk7Fj0s2iDEwi42eFqXkV7kcsNdDA76kBjTaiFjpy/JsElb4ddJS6QKUsDuZ42+nw1 Q5s1M8s1qTHsc90sqmRTPdH1S2BRs3vryuiLJD1Zlf/O7rLOudSp4Jb4G4+eNvw05c+q w6JEgY2jOr8FcvgqKU8SZGzOAUleYYxQhkpf3PtKFfeAvCKgRTcLqHym+0RAsYorp67a WMG+bQfVk/9BydKlmQM6bamRBKdGvZwxdfc/eXMTyv72VQzKaJQxMmnh2MLp/mowjS4w Zvz0tozrVvB3wDfMP/JW6Sc0/5MEeLdxSUsIqsKloC79N7OE6c/tDg7HdZ+jYgW5yOdA cYUQ== 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=Z69gicwAXZGpi8VRS0iC9YC/b3qgAqndAAc2IT4RqWJJvwfRBu2dwZvtWZeST/Ya/b HD2PM3K85z3hgC2c6+HIAN0LhWFdVcBHSLpq3sRSoWuSxBxj2IF34q/eYwzH1x3tQx14 xtR7Cbeb4pk4HqfCXWfQJNM6XRQMjK83n7aW/VRVoFap2yatBQceQjZGjXEGwNp/Dstx zlssuLntVQ8LcqMPQtVlQoHRcNuORLtfw8UikIwCMgY/OL7nlVJrJ80PMoaHxEWEqPcV KzImP8RI6bVhXdWyikVIOItPqGOgC5Drw/HNHogzKDY/ItyvKmURO2mnInXI3babxggd npoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zsmhUT89; 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 f9si1665811pgs.115.2019.06.06.02.49.13; Thu, 06 Jun 2019 02:49:14 -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=zsmhUT89; 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 S1728259AbfFFJtN (ORCPT + 30 others); Thu, 6 Jun 2019 05:49:13 -0400 Received: from mail-yw1-f67.google.com ([209.85.161.67]:36728 "EHLO mail-yw1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728042AbfFFJtM (ORCPT ); Thu, 6 Jun 2019 05:49:12 -0400 Received: by mail-yw1-f67.google.com with SMTP id t126so622255ywf.3 for ; Thu, 06 Jun 2019 02:49:12 -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=zsmhUT89ZCU+vNeRBa0UgwcQ66/LK2vtVlacT4gsa9cFjC90MQ8ROW63aFSV62iPsp Zhty+47a4l8hIKT608jS4i4FRWolQ5jbQhFfv9k/mb0f64f2CIV7eBsPlgiXdJOsv5zv 08PNfooIZ/y0/wggtCO+S4g13FA1Jgim2U9DHC7DsgnH93W4iW2kP2HPvZQNTHOIyAR3 BXFeaXkSBqi4zatoIlydBllcFCzPF33fE8ZEXzMyR35cxvv+83MpCdF7+H5rytfsWp8U A4nsx2Q3AucQw18xPGRYXHNuwx+vGPkJR8k7sacgA5qWAg4h8APJ4SuIjzGint0Bluho jGfA== 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=P93SRZt+mTDcyArZ0FeBiWoMCEV/NpxrJgKdOFZ5eBToYQvD5wI6nfh0AWalW8JUUS m40aCZSY83MXeNYjWXtpJcRxC2IHnncT++ycQtv4vlnCem8jT7iu5XuAZ5mMr8eG5sOH hXIZf1YqyZtOyzfXnKd6cid4nvsG3DK/sYvgG7ixaWJvsmlJnaC/X4GPwe6U5aEBdDB1 94LqW2hUiHTYn/m8shrbsk/D7ifLwF7bLNuaFyXn3yx7PrNIqLNYKxGGmrAD8FQVW6bH crqE8ROsWOsfS4hznhWDPCQFzy/h/uYM/A9ec8epFMzpN6+AagPiBiGUelpq30SEnro0 3YIg== X-Gm-Message-State: APjAAAWAGBLPk0zEkDB4v9tvU+qpEky9VH+unbcZdk1WunyDVMuAZEil le6ns86G1g8AGwn1KRErK+VhaQ== X-Received: by 2002:a81:3c90:: with SMTP id j138mr24229019ywa.1.1559814551800; Thu, 06 Jun 2019 02:49:11 -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.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Jun 2019 02:49:11 -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 1/4] perf trace: Exit when build eBPF program failure Date: Thu, 6 Jun 2019 17:48:42 +0800 Message-Id: <20190606094845.4800-2-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 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 09:48:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 165970 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp8551581ili; Thu, 6 Jun 2019 02:49:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqzLLED8l/jOAzFVZlXIg9tqfsxUDpTZ31t+1cb20Ilux87iBfQ47pHAiTLXfOKvJ5fXeLFj X-Received: by 2002:a17:90a:29c5:: with SMTP id h63mr16114873pjd.83.1559814561944; Thu, 06 Jun 2019 02:49:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559814561; cv=none; d=google.com; s=arc-20160816; b=l0d1C/aWkmLJJAplg05JB8s/UoSApT278Qt3qgYHrMfV6ZVsU8Nxz7Z2ezVcb9d2oq qtE4CVeSFwont1BLS7WxpSBMcWVegIP9XAZokYDMh3I6w0y/zF/t4d47Z3Smcm3AcwXV fITBpYYjkCnCfpTfJdIDtK3WAjmoH0Rs7Vln2CK8Z3cTnWyGTVkZbAelGhvPEpSvN1iG S7LbRIhaNDSAyl1/w8efiI71ojUftn3AIXKs6J8XqK82kSDbS/xGHlv9pJd+GAy8kKpi xy4m0eUqbg5cNNFXzuGC2eEZy9N2E+FwPM9MpWJ0mKAm39h2aql9TPtVa18J0980kCGJ E63w== 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=tq8G8/q6+R5mWIicg7pFYdm/Aw4zmzZuIOXPphz2mhkme/8ag8KBBUMrPnHZ8YIonT d/26iDeab6oeL7MnfwLEH3+Trx+uUpBMUoIhO+KNgvLduYRWcvYYQ8cnQ7dBA1Akybaw p0VZY1IswNqlqVpkoiBCtoc6dbY/8EbZjel+gAgLiR9hN3hQkE7mbODGHEkqUJsKpZSR 868jDUYV9nUmEijZRzdJB3cKm9jLwoOfSj69AP2DM8ZbwulMvudTrGGs9min1h32gDlX jLHWPJyIN5t8enCadX3jXsY4baIZ5IfMvJIp8nJ3t9FVZcrFoXFnBRyzx/JM65n5oUYO ZEbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xvEQkpFW; 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 204si1633634pga.373.2019.06.06.02.49.21; Thu, 06 Jun 2019 02:49:21 -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=xvEQkpFW; 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 S1728274AbfFFJtU (ORCPT + 30 others); Thu, 6 Jun 2019 05:49:20 -0400 Received: from mail-yw1-f66.google.com ([209.85.161.66]:43955 "EHLO mail-yw1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727840AbfFFJtU (ORCPT ); Thu, 6 Jun 2019 05:49:20 -0400 Received: by mail-yw1-f66.google.com with SMTP id t2so604671ywe.10 for ; Thu, 06 Jun 2019 02:49:19 -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=xvEQkpFW7U+cyfXABrk8OGQT+iMDWfuf5C9izUay98hemQXRn3UvCf2XQZAhqeKbaY /HPKE5mNFJPLJ+MTNCbLBTR1uDHjxMtYu5EF2B1FpffQXMyok0Hz8OTS3775SFYIZfw/ DMIo5SI91aay1zX2lMniEIhb19rXUi/eVBzpm4U5HXUjhmDLRajWqMrBDLz2GC6wsKlS /NV1SeA9mN2R/AWMr4/PmWPPS2nBek24yhnuY6ENbh7zJ6OYdhVtBop5R2RFxXkkyBmL QOiwh1PEjWETnYXNQVS4hVhUNRlaieNO0/kMGBzfCTEV7dwtrF8OnipFjO7s260W0xg4 b9xA== 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=UJI6tfWHdRePZP/uJsbxPSRBRPh0JtEK/pCH3tAVv3izssprvcSxMouAr3XtiEIHlZ F7TNh/EN+3grV7AL7WXMjM0N1O2YChZLimBT3XTOpOc/1mRlKJjYGDYI0A9sn/7Cw09T njVCbbUsTSqHPXJ45RxTLb/RwbYn3vUwUTMd9IpmNz1UxM+V6tUgs3/h9HHyfZkCVZPR sQUksXqLS5uaK7n59LdpU7Q/NT4L+He0TimYtZ86cEswEpkFoLCIzqlknQ00IJe4+aUE dIoznyI6LTo1yigGAzK6tcBEY5k/UOBWZBBczwohtifpm61HChJFjUFgQBT4pDE9Upx3 NSJw== X-Gm-Message-State: APjAAAWs4CzkItMwalIknVu8xi6JoF9IWbZUKQQCKnaSjyyWg5bWLHs3 IPaj1KvKI/q49q+mLUOEPOwwKA== X-Received: by 2002:a0d:ea91:: with SMTP id t139mr16181530ywe.119.1559814559608; Thu, 06 Jun 2019 02:49:19 -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.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Jun 2019 02:49:18 -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 2/4] perf augmented_raw_syscalls: Remove duplicate macros Date: Thu, 6 Jun 2019 17:48:43 +0800 Message-Id: <20190606094845.4800-3-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 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 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. *