From patchwork Sat Aug 29 04:21:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Nan X-Patchwork-Id: 52832 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f200.google.com (mail-lb0-f200.google.com [209.85.217.200]) by patches.linaro.org (Postfix) with ESMTPS id 77A1D20503 for ; Sat, 29 Aug 2015 04:26:11 +0000 (UTC) Received: by lbcli1 with SMTP id li1sf22496461lbc.2 for ; Fri, 28 Aug 2015 21:26:10 -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=WU/PfAODidJQJ8EQKwPuJpxfoZMW3HYE5u6eWsee1sw=; b=UJXZXM/NZEAUI5PZcPdx3oJvuoWapuJmZQyVa5snyCeugntZy1KUkNfOMk6p0FHIn4 K5yFVnnng011cGJSb4SCftqeZV12PqEjwYfKuGBMYuqcfw8emXidKeaKuj0hcaJW2y8N P4g6Yfvx8b1lv+zLL/cATaA5pgPeuUDSs3vdRDEvNq6h+qzE0+g0fsSuuhnUSAi5aHXv 2gqPjl1XQLDgiU6irZOV57EnpfzPDPb9xmJGdS+Q7q1n2G+C95oqaoIzy8zNDPBJuyCX DX55yWkmfKCACrv7A1QS3xLOWPMv1ABOUl6P+K2KhZNgTSLyrfzp7Jaq5iMHZXdVxiMy SDbA== X-Gm-Message-State: ALoCoQn9DDoAP9LszjLMBVKOtRl+6HM19/zZk6x6UFk11bHCe5fsTrneWGIxaXYT+0ozz79C8c2b X-Received: by 10.112.17.106 with SMTP id n10mr3560657lbd.18.1440822370446; Fri, 28 Aug 2015 21:26:10 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.120.40 with SMTP id kz8ls284637lab.24.gmail; Fri, 28 Aug 2015 21:26:10 -0700 (PDT) X-Received: by 10.152.29.6 with SMTP id f6mr6034038lah.85.1440822370280; Fri, 28 Aug 2015 21:26:10 -0700 (PDT) Received: from mail-la0-f41.google.com (mail-la0-f41.google.com. [209.85.215.41]) by mx.google.com with ESMTPS id pf2si7682585lbc.2.2015.08.28.21.26.10 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 28 Aug 2015 21:26:10 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.41 as permitted sender) client-ip=209.85.215.41; Received: by laboe4 with SMTP id oe4so17424353lab.0 for ; Fri, 28 Aug 2015 21:26:10 -0700 (PDT) X-Received: by 10.112.141.136 with SMTP id ro8mr6235933lbb.88.1440822369905; Fri, 28 Aug 2015 21:26:09 -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.151.194 with SMTP id us2csp268107lbb; Fri, 28 Aug 2015 21:26:08 -0700 (PDT) X-Received: by 10.66.217.138 with SMTP id oy10mr20698840pac.83.1440822368834; Fri, 28 Aug 2015 21:26:08 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f6si13392132pas.3.2015.08.28.21.26.06; Fri, 28 Aug 2015 21:26:08 -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 S1753096AbbH2E0F (ORCPT + 28 others); Sat, 29 Aug 2015 00:26:05 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:3758 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752723AbbH2EYL (ORCPT ); Sat, 29 Aug 2015 00:24:11 -0400 Received: from 172.24.1.47 (EHLO szxeml431-hub.china.huawei.com) ([172.24.1.47]) by szxrg03-dlp.huawei.com (MOS 4.4.3-GA FastPath queued) with ESMTP id BLW04309; Sat, 29 Aug 2015 12:23:22 +0800 (CST) Received: from linux-4hy3.site (10.107.193.248) by szxeml431-hub.china.huawei.com (10.82.67.208) with Microsoft SMTP Server id 14.3.235.1; Sat, 29 Aug 2015 12:23:14 +0800 From: Wang Nan To: , , CC: , , , Wang Nan , Brendan Gregg , Daniel Borkmann , David Ahern , "He Kuang" , Jiri Olsa , Kaixu Xia , Masami Hiramatsu , Namhyung Kim , Paul Mackerras , Peter Zijlstra Subject: [PATCH 22/31] perf tools: Add BPF_PROLOGUE config options for further patches Date: Sat, 29 Aug 2015 04:21:56 +0000 Message-ID: <1440822125-52691-23-git-send-email-wangnan0@huawei.com> X-Mailer: git-send-email 1.8.3.4 In-Reply-To: <1440822125-52691-1-git-send-email-wangnan0@huawei.com> References: <1440822125-52691-1-git-send-email-wangnan0@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.107.193.248] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020205.55E133BA.017B, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: d126fdf8128e831bfaaf7cc32799225f 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.215.41 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: , If both LIBBPF and DWARF are detected, it is possible to create prologue for eBPF programs to help them accessing kernel data. HAVE_BPF_PROLOGUE and CONFIG_BPF_PROLOGUE is added as flags for this feature. PERF_HAVE_ARCH_GET_REG_OFFSET indicates an architecture supports converting name of a register to its offset in 'struct pt_regs'. Without this support, BPF_PROLOGUE should be turned off. Signed-off-by: Wang Nan 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 Cc: Arnaldo Carvalho de Melo Link: http://lkml.kernel.org/n/1436445342-1402-33-git-send-email-wangnan0@huawei.com --- tools/perf/config/Makefile | 12 ++++++++++++ tools/perf/util/include/dwarf-regs.h | 7 +++++++ 2 files changed, 19 insertions(+) diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile index 38a4144..d46765b7 100644 --- a/tools/perf/config/Makefile +++ b/tools/perf/config/Makefile @@ -314,6 +314,18 @@ ifndef NO_LIBELF CFLAGS += -DHAVE_LIBBPF_SUPPORT $(call detected,CONFIG_LIBBPF) endif + + ifndef NO_DWARF + ifneq ($(origin PERF_HAVE_ARCH_GET_REG_INFO), undefined) + CFLAGS += -DHAVE_BPF_PROLOGUE + $(call detected,CONFIG_BPF_PROLOGUE) + else + msg := $(warning BPF prologue is not supported by architecture $(ARCH)); + endif + else + msg := $(warning DWARF support is off, BPF prologue is disabled); + endif + endif # NO_LIBBPF endif # NO_LIBELF diff --git a/tools/perf/util/include/dwarf-regs.h b/tools/perf/util/include/dwarf-regs.h index 8f14965..3dda083 100644 --- a/tools/perf/util/include/dwarf-regs.h +++ b/tools/perf/util/include/dwarf-regs.h @@ -5,4 +5,11 @@ const char *get_arch_regstr(unsigned int n); #endif +#ifdef HAVE_BPF_PROLOGUE +/* + * Arch should support fetching the offset of a register in pt_regs + * by its name. + */ +int arch_get_reg_info(const char *name, int *offset); +#endif #endif