From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0C3F1C433F5 for ; Thu, 10 Mar 2022 10:16:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230205AbiCJKRh (ORCPT ); Thu, 10 Mar 2022 05:17:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241108AbiCJKRd (ORCPT ); Thu, 10 Mar 2022 05:17:33 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0C03413DE07; Thu, 10 Mar 2022 02:16:31 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5C3BE1650; Thu, 10 Mar 2022 02:16:31 -0800 (PST) Received: from [10.57.41.41] (unknown [10.57.41.41]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 583BA3FA27; Thu, 10 Mar 2022 02:16:28 -0800 (PST) Message-ID: Date: Thu, 10 Mar 2022 10:16:25 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH V2 7/8] perf/tools: Extend branch type classification Content-Language: en-US To: Anshuman Khandual , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, peterz@infradead.org, acme@kernel.org Cc: suzuki.poulose@arm.com, Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Thomas Gleixner , Will Deacon , linux-arm-kernel@lists.infradead.org References: <20220309033642.144769-1-anshuman.khandual@arm.com> <20220309033642.144769-8-anshuman.khandual@arm.com> From: James Clark In-Reply-To: <20220309033642.144769-8-anshuman.khandual@arm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-perf-users@vger.kernel.org On 09/03/2022 03:36, Anshuman Khandual wrote: > This updates the perf tool with generic branch type classification with new > ABI extender place holder i.e PERF_BR_EXTEND_ABI, the new 4 bit branch type > field i.e perf_branch_entry.new_type, new generic page fault related branch > types and some arch specific branch types as added earlier in the kernel. > > Cc: Peter Zijlstra > Cc: Ingo Molnar > Cc: Arnaldo Carvalho de Melo > Cc: Mark Rutland > Cc: Alexander Shishkin > Cc: Jiri Olsa > Cc: Namhyung Kim > Cc: Thomas Gleixner > Cc: Will Deacon > Cc: linux-arm-kernel@lists.infradead.org > Cc: linux-perf-users@vger.kernel.org > Cc: linux-kernel@vger.kernel.org > Signed-off-by: Anshuman Khandual > --- > tools/include/uapi/linux/perf_event.h | 16 +++++++++++++++- > tools/perf/util/branch.c | 3 ++- > 2 files changed, 17 insertions(+), 2 deletions(-) > > diff --git a/tools/include/uapi/linux/perf_event.h b/tools/include/uapi/linux/perf_event.h > index 26d8f0b5ac0d..d29280adc3c4 100644 > --- a/tools/include/uapi/linux/perf_event.h > +++ b/tools/include/uapi/linux/perf_event.h > @@ -255,9 +255,22 @@ enum { > PERF_BR_IRQ = 12, /* irq */ > PERF_BR_SERROR = 13, /* system error */ > PERF_BR_NO_TX = 14, /* not in transaction */ > + PERF_BR_EXTEND_ABI = 15, /* extend ABI */ > PERF_BR_MAX, > }; > > +enum { > + PERF_BR_NEW_FAULT_ALGN = 0, /* Alignment fault */ > + PERF_BR_NEW_FAULT_DATA = 1, /* Data fault */ > + PERF_BR_NEW_FAULT_INST = 2, /* Inst fault */ > + PERF_BR_NEW_ARCH_1 = 3, /* Architecture specific */ > + PERF_BR_NEW_ARCH_2 = 4, /* Architecture specific */ > + PERF_BR_NEW_ARCH_3 = 5, /* Architecture specific */ > + PERF_BR_NEW_ARCH_4 = 6, /* Architecture specific */ > + PERF_BR_NEW_ARCH_5 = 7, /* Architecture specific */ > + PERF_BR_NEW_MAX, > +}; > + > #define PERF_SAMPLE_BRANCH_PLM_ALL \ > (PERF_SAMPLE_BRANCH_USER|\ > PERF_SAMPLE_BRANCH_KERNEL|\ > @@ -1372,7 +1385,8 @@ struct perf_branch_entry { > abort:1, /* transaction abort */ > cycles:16, /* cycle count to last branch */ > type:4, /* branch type */ > - reserved:40; > + new_type:4, /* additional branch type */ > + reserved:36; > }; > > union perf_sample_weight { > diff --git a/tools/perf/util/branch.c b/tools/perf/util/branch.c > index abc673347bee..4bd52de0527c 100644 > --- a/tools/perf/util/branch.c > +++ b/tools/perf/util/branch.c > @@ -53,7 +53,8 @@ const char *branch_type_name(int type) > "ERET", > "IRQ", > "SERROR", > - "NO_TX" > + "NO_TX", > + "EXTEND_ABI" Shouldn't we hide this implementation detail from users? They just want to know the branch type, they don't want to see the extend_abi stuff. It should be possible to fix all the perf internals so that it's transparent and any code using or printing the branch type has some accessor that works out what the final type is rather than having to re-implement that logic everywhere. So I don't think adding the string "EXTEND_ABI" would be needed because it would never be shown. If we just want to discuss the new extend ABI kernel side changes then I think this patch can be dropped and we can do the full perf tool side implementation in a more complete way later. James > }; > > if (type >= 0 && type < PERF_BR_MAX)