From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752891AbbIPHbV (ORCPT ); Wed, 16 Sep 2015 03:31:21 -0400 Received: from terminus.zytor.com ([198.137.202.10]:39401 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752605AbbIPHbR (ORCPT ); Wed, 16 Sep 2015 03:31:17 -0400 Date: Wed, 16 Sep 2015 00:30:19 -0700 From: tip-bot for Wang Nan Message-ID: Cc: xiakaixu@huawei.com, masami.hiramatsu.pt@hitachi.com, tglx@linutronix.de, brendan.d.gregg@gmail.com, mingo@kernel.org, dsahern@gmail.com, linux-kernel@vger.kernel.org, jolsa@kernel.org, hpa@zytor.com, hekuang@huawei.com, acme@redhat.com, namhyung@kernel.org, ast@plumgrid.com, lizefan@huawei.com, daniel@iogearbox.net, wangnan0@huawei.com, paulus@samba.org, a.p.zijlstra@chello.nl Reply-To: xiakaixu@huawei.com, masami.hiramatsu.pt@hitachi.com, brendan.d.gregg@gmail.com, tglx@linutronix.de, mingo@kernel.org, dsahern@gmail.com, hpa@zytor.com, linux-kernel@vger.kernel.org, jolsa@kernel.org, hekuang@huawei.com, acme@redhat.com, namhyung@kernel.org, lizefan@huawei.com, ast@plumgrid.com, a.p.zijlstra@chello.nl, paulus@samba.org, daniel@iogearbox.net, wangnan0@huawei.com In-Reply-To: <1441523623-152703-19-git-send-email-wangnan0@huawei.com> References: <1441523623-152703-19-git-send-email-wangnan0@huawei.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf tools: regs_query_register_offset() infrastructure Git-Commit-ID: 63ab024a5b6f295ca17a293ad81b7c728f49a89a X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 63ab024a5b6f295ca17a293ad81b7c728f49a89a Gitweb: http://git.kernel.org/tip/63ab024a5b6f295ca17a293ad81b7c728f49a89a Author: Wang Nan AuthorDate: Mon, 14 Sep 2015 23:02:49 -0300 Committer: Arnaldo Carvalho de Melo CommitDate: Tue, 15 Sep 2015 09:48:33 -0300 perf tools: regs_query_register_offset() infrastructure regs_query_register_offset() is a helper function which converts register name like "%rax" to offset of a register in 'struct pt_regs', which is required by BPF prologue generator. PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET indicates an architecture supports converting name of a register to its offset in 'struct pt_regs'. HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET is introduced as the corresponding CFLAGS of PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET. Signed-off-by: Wang Nan Acked-by: Masami Hiramatsu Cc: Alexei Starovoitov Cc: Brendan Gregg Cc: Daniel Borkmann Cc: David Ahern Cc: Jiri Olsa Cc: Kaixu Xia Cc: Namhyung Kim Cc: Paul Mackerras Cc: Peter Zijlstra Cc: Zefan Li Cc: pi3orama@163.com Link: http://lkml.kernel.org/r/1441523623-152703-19-git-send-email-wangnan0@huawei.com Signed-off-by: He Kuang [ Extracted from eBPF patches ] Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/config/Makefile | 4 ++++ tools/perf/util/include/dwarf-regs.h | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile index 827557f..0435ac4 100644 --- a/tools/perf/config/Makefile +++ b/tools/perf/config/Makefile @@ -109,6 +109,10 @@ endif # include ARCH specific config -include $(src-perf)/arch/$(ARCH)/Makefile +ifdef PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET + CFLAGS += -DHAVE_ARCH_REGS_QUERY_REGISTER_OFFSET +endif + include $(src-perf)/config/utilities.mak ifeq ($(call get-executable,$(FLEX)),) diff --git a/tools/perf/util/include/dwarf-regs.h b/tools/perf/util/include/dwarf-regs.h index 8f14965..07c644e 100644 --- a/tools/perf/util/include/dwarf-regs.h +++ b/tools/perf/util/include/dwarf-regs.h @@ -5,4 +5,12 @@ const char *get_arch_regstr(unsigned int n); #endif +#ifdef HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET +/* + * Arch should support fetching the offset of a register in pt_regs + * by its name. See kernel's regs_query_register_offset in + * arch/xxx/kernel/ptrace.c. + */ +int regs_query_register_offset(const char *name); +#endif #endif