From patchwork Sat Oct 17 10:48:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Nan X-Patchwork-Id: 55153 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by patches.linaro.org (Postfix) with ESMTPS id 64BD722FFA for ; Sat, 17 Oct 2015 10:49:55 +0000 (UTC) Received: by wiyb4 with SMTP id b4sf10207943wiy.2 for ; Sat, 17 Oct 2015 03:49:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-type:sender:precedence :list-id:x-original-sender:x-original-authentication-results :mailing-list:list-post:list-help:list-archive:list-unsubscribe; bh=kDaU0p+jToS9hVdCBMYZVhRR42KGLfg2x6G+nyFvcN0=; b=DEkLMvJiqsrnBaIEPXzb5nnTiQBA4sTS3AAqp0cUT5iN/iqJ2iY52FZoNAnAbFci9L e4wcfUjuA80J0V02FJX2//yLgg519hpr+aoNDpaORZWxWd0FCO7Q5s/6vew/eu9F1YzN XZoLk6oGCY2Ic+ggzN/TVG/E75eIAORywbrgNCxdn6GD8V83boSqvlfolZl92l8WzZ8N ecz8537aIRWf8S/08rDfUN0ECDhr/0Qa7GGHFs1d+KqkKqYNiwT+dIUU5bwGtvAR+exb x/PdogiTamRyJ2hiVBSblgOq0WDcHhqPlEc45iictHanF8m5PWje9Y4Jqw/9mJg4OODP cs4Q== X-Gm-Message-State: ALoCoQlHSjostQYDIU+q7uUR3bWss4q5fx/kBAvQzoLDC1vUVSTk95qUK6n3Euu6cXNbBA8lN0tv X-Received: by 10.112.181.10 with SMTP id ds10mr4796756lbc.3.1445078994320; Sat, 17 Oct 2015 03:49:54 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.163.194 with SMTP id m185ls364600lfe.66.gmail; Sat, 17 Oct 2015 03:49:54 -0700 (PDT) X-Received: by 10.112.158.38 with SMTP id wr6mr10531580lbb.25.1445078993995; Sat, 17 Oct 2015 03:49:53 -0700 (PDT) Received: from mail-lb0-f177.google.com (mail-lb0-f177.google.com. [209.85.217.177]) by mx.google.com with ESMTPS id l8si15814266lfb.29.2015.10.17.03.49.53 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 17 Oct 2015 03:49:53 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.177 as permitted sender) client-ip=209.85.217.177; Received: by lbbpp2 with SMTP id pp2so86903057lbb.0 for ; Sat, 17 Oct 2015 03:49:53 -0700 (PDT) X-Received: by 10.112.163.131 with SMTP id yi3mr10316378lbb.36.1445078993111; Sat, 17 Oct 2015 03:49:53 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp436283lbq; Sat, 17 Oct 2015 03:49:51 -0700 (PDT) X-Received: by 10.68.88.130 with SMTP id bg2mr22598312pbb.38.1445078991804; Sat, 17 Oct 2015 03:49:51 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ej15si36096786pac.96.2015.10.17.03.49.51; Sat, 17 Oct 2015 03:49:51 -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; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752243AbbJQKtS (ORCPT + 30 others); Sat, 17 Oct 2015 06:49:18 -0400 Received: from szxga01-in.huawei.com ([58.251.152.64]:7826 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751347AbbJQKtQ (ORCPT ); Sat, 17 Oct 2015 06:49:16 -0400 Received: from 172.24.1.50 (EHLO szxeml428-hub.china.huawei.com) ([172.24.1.50]) by szxrg01-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id CWX99310; Sat, 17 Oct 2015 18:48:55 +0800 (CST) Received: from linux-4hy3.site (10.107.193.248) by szxeml428-hub.china.huawei.com (10.82.67.183) with Microsoft SMTP Server id 14.3.235.1; Sat, 17 Oct 2015 18:48:43 +0800 From: Wang Nan To: , , CC: , , , , , , , , , , , , Wang Nan , Arnaldo Carvalho de Melo Subject: [RFC PATCH 3/7] perf record: Apply config to BPF objects before recording Date: Sat, 17 Oct 2015 10:48:26 +0000 Message-ID: <1445078910-73699-4-git-send-email-wangnan0@huawei.com> X-Mailer: git-send-email 1.8.3.4 In-Reply-To: <1445078910-73699-1-git-send-email-wangnan0@huawei.com> References: <1445078910-73699-1-git-send-email-wangnan0@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.107.193.248] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: wangnan0@huawei.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.177 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: He Kuang In perf record, before start recording, call bpf__apply_config() to turn on all BPF config options. Signed-off-by: Wang Nan Signed-off-by: He Kuang Cc: Arnaldo Carvalho de Melo Cc: Alexei Starovoitov Cc: Brendan Gregg Cc: Daniel Borkmann Cc: David Ahern Cc: He Kuang Cc: Jiri Olsa Cc: Kaixu Xia Cc: Masami Hiramatsu Cc: Namhyung Kim Cc: Paul Mackerras Cc: Peter Zijlstra Cc: Zefan Li Cc: pi3orama@163.com Link: http://lkml.kernel.org/n/ebpf-ziazd5s4t9j96d01t5bdbtat@git.kernel.org --- tools/perf/builtin-record.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 200f221..b1c1324 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c @@ -32,6 +32,7 @@ #include "util/parse-branch-options.h" #include "util/parse-regs-options.h" #include "util/llvm-utils.h" +#include "util/bpf-loader.h" #include #include @@ -524,6 +525,16 @@ static int __cmd_record(struct record *rec, int argc, const char **argv) goto out_child; } + err = bpf__apply_config(); + if (err) { + char errbuf[BUFSIZ]; + + bpf__strerror_apply_config(err, errbuf, sizeof(errbuf)); + pr_err("ERROR: Apply config to BPF failed: %s\n", + errbuf); + goto out_child; + } + /* * Normally perf_session__new would do this, but it doesn't have the * evlist.