All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anshuman Khandual <anshuman.khandual@arm.com>
To: James Clark <james.clark@arm.com>,
	linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
	peterz@infradead.org, acme@kernel.org
Cc: suzuki.poulose@arm.com, Ingo Molnar <mingo@redhat.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Will Deacon <will@kernel.org>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH V2 7/8] perf/tools: Extend branch type classification
Date: Fri, 11 Mar 2022 09:22:27 +0530	[thread overview]
Message-ID: <b030f111-59f7-68d0-ca51-e3b81c722a9a@arm.com> (raw)
In-Reply-To: <b88268b2-97c3-4f61-44e9-fa6105d91be9@arm.com>



On 3/10/22 15:46, James Clark wrote:
> 
> 
> 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 <peterz@infradead.org>
>> Cc: Ingo Molnar <mingo@redhat.com>
>> Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
>> Cc: Mark Rutland <mark.rutland@arm.com>
>> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
>> Cc: Jiri Olsa <jolsa@redhat.com>
>> Cc: Namhyung Kim <namhyung@kernel.org>
>> Cc: Thomas Gleixner <tglx@linutronix.de>
>> Cc: Will Deacon <will@kernel.org>
>> 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 <anshuman.khandual@arm.com>
>> ---
>>  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.

Right, there are two ways of looking into this. Because knowing about
this PERF_BR_EXTEND_ABI improves transparency regarding what is really
going on but on the other side, it might just overwhelm the user with
unnecessary information.

> 
> 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.

Exactly, but that is something pending right now.

> 
> So I don't think adding the string "EXTEND_ABI" would be needed because it would
> never be shown.

Got it.

> 
> 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.

I agree that the user space tools implementation is not complete as
mentioned in the cover letter. But both kernel and user space tools
changes should be in the same series for completeness, and to avoid
scenarios where PERF_BR_EXTEND_ABI extender followed by this new
field perf_branch_entry.new_type are supported in kernel but not
in the tools.

Once there is common agreement on the ABI extension, will implement
the perf tools side to completion.

WARNING: multiple messages have this Message-ID (diff)
From: Anshuman Khandual <anshuman.khandual@arm.com>
To: James Clark <james.clark@arm.com>,
	linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
	peterz@infradead.org, acme@kernel.org
Cc: suzuki.poulose@arm.com, Ingo Molnar <mingo@redhat.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Will Deacon <will@kernel.org>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH V2 7/8] perf/tools: Extend branch type classification
Date: Fri, 11 Mar 2022 09:22:27 +0530	[thread overview]
Message-ID: <b030f111-59f7-68d0-ca51-e3b81c722a9a@arm.com> (raw)
In-Reply-To: <b88268b2-97c3-4f61-44e9-fa6105d91be9@arm.com>



On 3/10/22 15:46, James Clark wrote:
> 
> 
> 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 <peterz@infradead.org>
>> Cc: Ingo Molnar <mingo@redhat.com>
>> Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
>> Cc: Mark Rutland <mark.rutland@arm.com>
>> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
>> Cc: Jiri Olsa <jolsa@redhat.com>
>> Cc: Namhyung Kim <namhyung@kernel.org>
>> Cc: Thomas Gleixner <tglx@linutronix.de>
>> Cc: Will Deacon <will@kernel.org>
>> 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 <anshuman.khandual@arm.com>
>> ---
>>  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.

Right, there are two ways of looking into this. Because knowing about
this PERF_BR_EXTEND_ABI improves transparency regarding what is really
going on but on the other side, it might just overwhelm the user with
unnecessary information.

> 
> 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.

Exactly, but that is something pending right now.

> 
> So I don't think adding the string "EXTEND_ABI" would be needed because it would
> never be shown.

Got it.

> 
> 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.

I agree that the user space tools implementation is not complete as
mentioned in the cover letter. But both kernel and user space tools
changes should be in the same series for completeness, and to avoid
scenarios where PERF_BR_EXTEND_ABI extender followed by this new
field perf_branch_entry.new_type are supported in kernel but not
in the tools.

Once there is common agreement on the ABI extension, will implement
the perf tools side to completion.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2022-03-11  3:52 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-09  3:36 [PATCH V2 0/8] perf: Expand perf_branch_entry Anshuman Khandual
2022-03-09  3:36 ` Anshuman Khandual
2022-03-09  3:36 ` [PATCH V2 1/8] perf: Add irq and exception return branch types Anshuman Khandual
2022-03-09  3:36   ` Anshuman Khandual
2022-03-09  3:36 ` [PATCH V2 2/8] perf: Add system error and not in transaction " Anshuman Khandual
2022-03-09  3:36   ` Anshuman Khandual
2022-03-09  3:36 ` [PATCH V2 3/8] perf: Extend branch type classification Anshuman Khandual
2022-03-09  3:36   ` Anshuman Khandual
2022-03-09  3:36 ` [PATCH V2 4/8] perf: Capture branch privilege information Anshuman Khandual
2022-03-09  3:36   ` Anshuman Khandual
2022-03-10 10:21   ` James Clark
2022-03-10 10:21     ` James Clark
2022-03-11  3:25     ` Anshuman Khandual
2022-03-11  3:25       ` Anshuman Khandual
2022-03-09  3:36 ` [PATCH V2 5/8] perf/tools: Add irq and exception return branch types Anshuman Khandual
2022-03-09  3:36   ` Anshuman Khandual
2022-03-09  3:36 ` [PATCH V2 6/8] perf/tools: Add system error and not in transaction " Anshuman Khandual
2022-03-09  3:36   ` Anshuman Khandual
2022-03-09  3:36 ` [PATCH V2 7/8] perf/tools: Extend branch type classification Anshuman Khandual
2022-03-09  3:36   ` Anshuman Khandual
2022-03-10 10:16   ` James Clark
2022-03-10 10:16     ` James Clark
2022-03-11  3:52     ` Anshuman Khandual [this message]
2022-03-11  3:52       ` Anshuman Khandual
2022-03-09  3:36 ` [PATCH V2 8/8] perf/tools: Add branch privilege information request flag Anshuman Khandual
2022-03-09  3:36   ` Anshuman Khandual

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b030f111-59f7-68d0-ca51-e3b81c722a9a@arm.com \
    --to=anshuman.khandual@arm.com \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=james.clark@arm.com \
    --cc=jolsa@redhat.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=suzuki.poulose@arm.com \
    --cc=tglx@linutronix.de \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.