Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965725AbbEEWo7 (ORCPT ); Tue, 5 May 2015 18:44:59 -0400 Received: from mail-pa0-f42.google.com ([209.85.220.42]:34411 "EHLO mail-pa0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751450AbbEEWo4 (ORCPT ); Tue, 5 May 2015 18:44:56 -0400 Message-ID: <554947E6.2020107@plumgrid.com> Date: Tue, 05 May 2015 15:44:54 -0700 From: Alexei Starovoitov User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: He Kuang , davem@davemloft.net, acme@kernel.org, mingo@redhat.com, a.p.zijlstra@chello.nl, masami.hiramatsu.pt@hitachi.com, jolsa@kernel.org CC: wangnan0@huawei.com, linux-kernel@vger.kernel.org, pi3orama@163.com Subject: Re: [RFC PATCH 2/6] perf bpf: Add pt_regs convert table for x86 References: <1430820612-84443-1-git-send-email-hekuang@huawei.com> <1430820612-84443-3-git-send-email-hekuang@huawei.com> In-Reply-To: <1430820612-84443-3-git-send-email-hekuang@huawei.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1402 Lines: 51 On 5/5/15 3:10 AM, He Kuang wrote: > Convert register number in debuginfo to its index in pt_regs. > > Signed-off-by: He Kuang > --- > tools/perf/arch/x86/util/dwarf-regs.c | 31 +++++++++++++++++++++++++++++++ > 1 file changed, 31 insertions(+) > > diff --git a/tools/perf/arch/x86/util/dwarf-regs.c b/tools/perf/arch/x86/util/dwarf-regs.c > index be22dd4..e586a47 100644 > --- a/tools/perf/arch/x86/util/dwarf-regs.c > +++ b/tools/perf/arch/x86/util/dwarf-regs.c > @@ -59,10 +59,31 @@ const char *x86_64_regs_table[X86_64_MAX_REGS] = { > "%r15", > }; > > +const char x86_64_pt_regs_table[X86_64_MAX_REGS] = { > + 10, > + 12, > + 11, > + 5, > + 13, > + 14, > + 4, > + 19, > + 9, > + 8, > + 7, > + 6, > + 3, > + 2, > + 1, > + 0, > +}; magic numbers need a comment in .c (not only in commit log) Also I would combine them into struct { const char *regname, int index } and merge with x86_64_regs_table array and would use something like offsetof(struct pt_regs, di) / 8 instead of hard coding. In general patch 2 and 3 are in wrong order. Generic 3 should come first. Otherwise patch 2 introduces things that no one is using. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/