All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drivers/perf: arm_pmu: Show PMU version on boot
@ 2020-07-30 10:47 Shaokun Zhang
  2020-08-21 16:03 ` Will Deacon
  0 siblings, 1 reply; 7+ messages in thread
From: Shaokun Zhang @ 2020-07-30 10:47 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: Shaokun Zhang, Mark Rutland, Will Deacon

The @pmuver field has been initialized and can tell the PMU version.
Let's show it on boot and the user obtains this information directly.

Cc: Will Deacon <will@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Shaokun Zhang <zhangshaokun@hisilicon.com>
---
 drivers/perf/arm_pmu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c
index df352b334ea7..36f7fad7ba5a 100644
--- a/drivers/perf/arm_pmu.c
+++ b/drivers/perf/arm_pmu.c
@@ -870,8 +870,8 @@ int armpmu_register(struct arm_pmu *pmu)
 	if (!__oprofile_cpu_pmu)
 		__oprofile_cpu_pmu = pmu;
 
-	pr_info("enabled with %s PMU driver, %d counters available\n",
-		pmu->name, pmu->num_events);
+	pr_info("enabled with %s PMU driver, %d counters available, version is %d\n",
+		pmu->name, pmu->num_events, pmu->pmuver);
 
 	return 0;
 
-- 
2.7.4


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

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] drivers/perf: arm_pmu: Show PMU version on boot
  2020-07-30 10:47 [PATCH] drivers/perf: arm_pmu: Show PMU version on boot Shaokun Zhang
@ 2020-08-21 16:03 ` Will Deacon
  2020-08-26  6:42   ` Shaokun Zhang
  0 siblings, 1 reply; 7+ messages in thread
From: Will Deacon @ 2020-08-21 16:03 UTC (permalink / raw)
  To: Shaokun Zhang; +Cc: Mark Rutland, linux-arm-kernel

On Thu, Jul 30, 2020 at 06:47:21PM +0800, Shaokun Zhang wrote:
> The @pmuver field has been initialized and can tell the PMU version.
> Let's show it on boot and the user obtains this information directly.
> 
> Cc: Will Deacon <will@kernel.org>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Signed-off-by: Shaokun Zhang <zhangshaokun@hisilicon.com>
> ---
>  drivers/perf/arm_pmu.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c
> index df352b334ea7..36f7fad7ba5a 100644
> --- a/drivers/perf/arm_pmu.c
> +++ b/drivers/perf/arm_pmu.c
> @@ -870,8 +870,8 @@ int armpmu_register(struct arm_pmu *pmu)
>  	if (!__oprofile_cpu_pmu)
>  		__oprofile_cpu_pmu = pmu;
>  
> -	pr_info("enabled with %s PMU driver, %d counters available\n",
> -		pmu->name, pmu->num_events);
> +	pr_info("enabled with %s PMU driver, %d counters available, version is %d\n",
> +		pmu->name, pmu->num_events, pmu->pmuver);

Hmm. I'm suspicious about this. Who is using this, and what for? We're
better off exposing things in the existing sysfs directory we have if it's
actually needed by tools.

Will

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] drivers/perf: arm_pmu: Show PMU version on boot
  2020-08-21 16:03 ` Will Deacon
@ 2020-08-26  6:42   ` Shaokun Zhang
  2020-09-01 16:16     ` Will Deacon
  0 siblings, 1 reply; 7+ messages in thread
From: Shaokun Zhang @ 2020-08-26  6:42 UTC (permalink / raw)
  To: Will Deacon; +Cc: Mark Rutland, linux-arm-kernel

Hi Will,

在 2020/8/22 0:03, Will Deacon 写道:
> On Thu, Jul 30, 2020 at 06:47:21PM +0800, Shaokun Zhang wrote:
>> The @pmuver field has been initialized and can tell the PMU version.
>> Let's show it on boot and the user obtains this information directly.
>>
>> Cc: Will Deacon <will@kernel.org>
>> Cc: Mark Rutland <mark.rutland@arm.com>
>> Signed-off-by: Shaokun Zhang <zhangshaokun@hisilicon.com>
>> ---
>>  drivers/perf/arm_pmu.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c
>> index df352b334ea7..36f7fad7ba5a 100644
>> --- a/drivers/perf/arm_pmu.c
>> +++ b/drivers/perf/arm_pmu.c
>> @@ -870,8 +870,8 @@ int armpmu_register(struct arm_pmu *pmu)
>>  	if (!__oprofile_cpu_pmu)
>>  		__oprofile_cpu_pmu = pmu;
>>  
>> -	pr_info("enabled with %s PMU driver, %d counters available\n",
>> -		pmu->name, pmu->num_events);
>> +	pr_info("enabled with %s PMU driver, %d counters available, version is %d\n",
>> +		pmu->name, pmu->num_events, pmu->pmuver);
> 
> Hmm. I'm suspicious about this. Who is using this, and what for? We're

Since Arm ARM has extended PMU version for Armv8.1/8.4/8.5 with different PMUver in
ID_AA64DFR0_EL1, someone who does the performance profiling may care the number of
counter and want to know the supported PMU version. Because some events or features
are related to PMU version, Like events corresponding to PMCEID0/1_EL0[32:63] or if
anyone be told PMMIR_EL1 to ZERO, he can check the PMU version directly from the boot
log information.

> better off exposing things in the existing sysfs directory we have if it's
> actually needed by tools.

If you agree it is needed, it is a good choice to do it.

Thanks,
Shaokun

> 
> Will
> 
> .
> 


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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] drivers/perf: arm_pmu: Show PMU version on boot
  2020-08-26  6:42   ` Shaokun Zhang
@ 2020-09-01 16:16     ` Will Deacon
  2020-09-02  1:31       ` Shaokun Zhang
  0 siblings, 1 reply; 7+ messages in thread
From: Will Deacon @ 2020-09-01 16:16 UTC (permalink / raw)
  To: Shaokun Zhang; +Cc: Mark Rutland, linux-arm-kernel

On Wed, Aug 26, 2020 at 02:42:26PM +0800, Shaokun Zhang wrote:
> 在 2020/8/22 0:03, Will Deacon 写道:
> > On Thu, Jul 30, 2020 at 06:47:21PM +0800, Shaokun Zhang wrote:
> >> The @pmuver field has been initialized and can tell the PMU version.
> >> Let's show it on boot and the user obtains this information directly.
> >>
> >> Cc: Will Deacon <will@kernel.org>
> >> Cc: Mark Rutland <mark.rutland@arm.com>
> >> Signed-off-by: Shaokun Zhang <zhangshaokun@hisilicon.com>
> >> ---
> >>  drivers/perf/arm_pmu.c | 4 ++--
> >>  1 file changed, 2 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c
> >> index df352b334ea7..36f7fad7ba5a 100644
> >> --- a/drivers/perf/arm_pmu.c
> >> +++ b/drivers/perf/arm_pmu.c
> >> @@ -870,8 +870,8 @@ int armpmu_register(struct arm_pmu *pmu)
> >>  	if (!__oprofile_cpu_pmu)
> >>  		__oprofile_cpu_pmu = pmu;
> >>  
> >> -	pr_info("enabled with %s PMU driver, %d counters available\n",
> >> -		pmu->name, pmu->num_events);
> >> +	pr_info("enabled with %s PMU driver, %d counters available, version is %d\n",
> >> +		pmu->name, pmu->num_events, pmu->pmuver);
> > 
> > Hmm. I'm suspicious about this. Who is using this, and what for? We're
> 
> Since Arm ARM has extended PMU version for Armv8.1/8.4/8.5 with different PMUver in
> ID_AA64DFR0_EL1, someone who does the performance profiling may care the number of
> counter and want to know the supported PMU version. Because some events or features
> are related to PMU version, Like events corresponding to PMCEID0/1_EL0[32:63] or if
> anyone be told PMMIR_EL1 to ZERO, he can check the PMU version directly from the boot
> log information.

What do you mean by "may care the number of counter"? The number of counters
is independent of the PMU version and shouldn't really be of interest to
userspace anyway, should it? Or are you referring to something else?

As for whether events are supported or not, we already expose that on a
per-event basis, and I think we should continue to do that.

So overall, I still don't see the value in exposing this.

Will

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] drivers/perf: arm_pmu: Show PMU version on boot
  2020-09-01 16:16     ` Will Deacon
@ 2020-09-02  1:31       ` Shaokun Zhang
  2020-09-07 13:24         ` Will Deacon
  0 siblings, 1 reply; 7+ messages in thread
From: Shaokun Zhang @ 2020-09-02  1:31 UTC (permalink / raw)
  To: Will Deacon; +Cc: Mark Rutland, linux-arm-kernel

Hi Will,

在 2020/9/2 0:16, Will Deacon 写道:
> On Wed, Aug 26, 2020 at 02:42:26PM +0800, Shaokun Zhang wrote:
>> 在 2020/8/22 0:03, Will Deacon 写道:
>>> On Thu, Jul 30, 2020 at 06:47:21PM +0800, Shaokun Zhang wrote:
>>>> The @pmuver field has been initialized and can tell the PMU version.
>>>> Let's show it on boot and the user obtains this information directly.
>>>>
>>>> Cc: Will Deacon <will@kernel.org>
>>>> Cc: Mark Rutland <mark.rutland@arm.com>
>>>> Signed-off-by: Shaokun Zhang <zhangshaokun@hisilicon.com>
>>>> ---
>>>>  drivers/perf/arm_pmu.c | 4 ++--
>>>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c
>>>> index df352b334ea7..36f7fad7ba5a 100644
>>>> --- a/drivers/perf/arm_pmu.c
>>>> +++ b/drivers/perf/arm_pmu.c
>>>> @@ -870,8 +870,8 @@ int armpmu_register(struct arm_pmu *pmu)
>>>>  	if (!__oprofile_cpu_pmu)
>>>>  		__oprofile_cpu_pmu = pmu;
>>>>  
>>>> -	pr_info("enabled with %s PMU driver, %d counters available\n",
>>>> -		pmu->name, pmu->num_events);
>>>> +	pr_info("enabled with %s PMU driver, %d counters available, version is %d\n",
>>>> +		pmu->name, pmu->num_events, pmu->pmuver);
>>>
>>> Hmm. I'm suspicious about this. Who is using this, and what for? We're
>>
>> Since Arm ARM has extended PMU version for Armv8.1/8.4/8.5 with different PMUver in
>> ID_AA64DFR0_EL1, someone who does the performance profiling may care the number of
>> counter and want to know the supported PMU version. Because some events or features
>> are related to PMU version, Like events corresponding to PMCEID0/1_EL0[32:63] or if
>> anyone be told PMMIR_EL1 to ZERO, he can check the PMU version directly from the boot
>> log information.
> 
> What do you mean by "may care the number of counter"? The number of counters

If the user doesn't want the kernel to use time multiplexing, it shall use events less
than the counters that it has been told by the boot information, of course, he can access
PMCR_EL0 directly to check it.

> is independent of the PMU version and shouldn't really be of interest to
> userspace anyway, should it? Or are you referring to something else?

Yes, it is independent, I mean that if the user is interested in PMU information, like,
PMU counter number, PMU version, etc, it can be exposed at boot time directly.

> 
> As for whether events are supported or not, we already expose that on a
> per-event basis, and I think we should continue to do that.

Shall we check the PMU version(ARMv8.1) in the driver for PMCEID0/1_EL0[32:63]?

> 
> So overall, I still don't see the value in exposing this.

Thanks Will more explanations.
Shaokun

> 
> Will
> 
> .
> 


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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] drivers/perf: arm_pmu: Show PMU version on boot
  2020-09-02  1:31       ` Shaokun Zhang
@ 2020-09-07 13:24         ` Will Deacon
  2020-09-08 10:59           ` Shaokun Zhang
  0 siblings, 1 reply; 7+ messages in thread
From: Will Deacon @ 2020-09-07 13:24 UTC (permalink / raw)
  To: Shaokun Zhang; +Cc: Mark Rutland, linux-arm-kernel

On Wed, Sep 02, 2020 at 09:31:00AM +0800, Shaokun Zhang wrote:
> 在 2020/9/2 0:16, Will Deacon 写道:
> > On Wed, Aug 26, 2020 at 02:42:26PM +0800, Shaokun Zhang wrote:
> >> 在 2020/8/22 0:03, Will Deacon 写道:
> >>> On Thu, Jul 30, 2020 at 06:47:21PM +0800, Shaokun Zhang wrote:
> >>>> The @pmuver field has been initialized and can tell the PMU version.
> >>>> Let's show it on boot and the user obtains this information directly.
> >>>>
> >>>> Cc: Will Deacon <will@kernel.org>
> >>>> Cc: Mark Rutland <mark.rutland@arm.com>
> >>>> Signed-off-by: Shaokun Zhang <zhangshaokun@hisilicon.com>
> >>>> ---
> >>>>  drivers/perf/arm_pmu.c | 4 ++--
> >>>>  1 file changed, 2 insertions(+), 2 deletions(-)
> >>>>
> >>>> diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c
> >>>> index df352b334ea7..36f7fad7ba5a 100644
> >>>> --- a/drivers/perf/arm_pmu.c
> >>>> +++ b/drivers/perf/arm_pmu.c
> >>>> @@ -870,8 +870,8 @@ int armpmu_register(struct arm_pmu *pmu)
> >>>>  	if (!__oprofile_cpu_pmu)
> >>>>  		__oprofile_cpu_pmu = pmu;
> >>>>  
> >>>> -	pr_info("enabled with %s PMU driver, %d counters available\n",
> >>>> -		pmu->name, pmu->num_events);
> >>>> +	pr_info("enabled with %s PMU driver, %d counters available, version is %d\n",
> >>>> +		pmu->name, pmu->num_events, pmu->pmuver);
> >>>
> >>> Hmm. I'm suspicious about this. Who is using this, and what for? We're
> >>
> >> Since Arm ARM has extended PMU version for Armv8.1/8.4/8.5 with different PMUver in
> >> ID_AA64DFR0_EL1, someone who does the performance profiling may care the number of
> >> counter and want to know the supported PMU version. Because some events or features
> >> are related to PMU version, Like events corresponding to PMCEID0/1_EL0[32:63] or if
> >> anyone be told PMMIR_EL1 to ZERO, he can check the PMU version directly from the boot
> >> log information.
> > 
> > What do you mean by "may care the number of counter"? The number of counters
> 
> If the user doesn't want the kernel to use time multiplexing, it shall use events less
> than the counters that it has been told by the boot information, of course, he can access
> PMCR_EL0 directly to check it.

But this isn't an arm64-specific problem, is it? What happens on other
architectures, such as x86?

> > is independent of the PMU version and shouldn't really be of interest to
> > userspace anyway, should it? Or are you referring to something else?
> 
> Yes, it is independent, I mean that if the user is interested in PMU information, like,
> PMU counter number, PMU version, etc, it can be exposed at boot time directly.

If userspace needs information about the PMU, I'm up for exposing it via
sysfs, but I don't think we should expose things for the sake of it, and I
also think that information which isn't specific to the particular PMU
should be exposed more generally so that userspace doesn't need lots of
different parsers to get the same information on different hardware.

> > As for whether events are supported or not, we already expose that on a
> > per-event basis, and I think we should continue to do that.
> 
> Shall we check the PMU version(ARMv8.1) in the driver for PMCEID0/1_EL0[32:63]?

I'd need to see the patch, since I don't see where you're going with this.

Will

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] drivers/perf: arm_pmu: Show PMU version on boot
  2020-09-07 13:24         ` Will Deacon
@ 2020-09-08 10:59           ` Shaokun Zhang
  0 siblings, 0 replies; 7+ messages in thread
From: Shaokun Zhang @ 2020-09-08 10:59 UTC (permalink / raw)
  To: Will Deacon; +Cc: Mark Rutland, linux-arm-kernel

Hi Will,

在 2020/9/7 21:24, Will Deacon 写道:
> On Wed, Sep 02, 2020 at 09:31:00AM +0800, Shaokun Zhang wrote:
>> 在 2020/9/2 0:16, Will Deacon 写道:
>>> On Wed, Aug 26, 2020 at 02:42:26PM +0800, Shaokun Zhang wrote:
>>>> 在 2020/8/22 0:03, Will Deacon 写道:
>>>>> On Thu, Jul 30, 2020 at 06:47:21PM +0800, Shaokun Zhang wrote:
>>>>>> The @pmuver field has been initialized and can tell the PMU version.
>>>>>> Let's show it on boot and the user obtains this information directly.
>>>>>>
>>>>>> Cc: Will Deacon <will@kernel.org>
>>>>>> Cc: Mark Rutland <mark.rutland@arm.com>
>>>>>> Signed-off-by: Shaokun Zhang <zhangshaokun@hisilicon.com>
>>>>>> ---
>>>>>>  drivers/perf/arm_pmu.c | 4 ++--
>>>>>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>>>>>
>>>>>> diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c
>>>>>> index df352b334ea7..36f7fad7ba5a 100644
>>>>>> --- a/drivers/perf/arm_pmu.c
>>>>>> +++ b/drivers/perf/arm_pmu.c
>>>>>> @@ -870,8 +870,8 @@ int armpmu_register(struct arm_pmu *pmu)
>>>>>>  	if (!__oprofile_cpu_pmu)
>>>>>>  		__oprofile_cpu_pmu = pmu;
>>>>>>  
>>>>>> -	pr_info("enabled with %s PMU driver, %d counters available\n",
>>>>>> -		pmu->name, pmu->num_events);
>>>>>> +	pr_info("enabled with %s PMU driver, %d counters available, version is %d\n",
>>>>>> +		pmu->name, pmu->num_events, pmu->pmuver);
>>>>>
>>>>> Hmm. I'm suspicious about this. Who is using this, and what for? We're
>>>>
>>>> Since Arm ARM has extended PMU version for Armv8.1/8.4/8.5 with different PMUver in
>>>> ID_AA64DFR0_EL1, someone who does the performance profiling may care the number of
>>>> counter and want to know the supported PMU version. Because some events or features
>>>> are related to PMU version, Like events corresponding to PMCEID0/1_EL0[32:63] or if
>>>> anyone be told PMMIR_EL1 to ZERO, he can check the PMU version directly from the boot
>>>> log information.
>>>
>>> What do you mean by "may care the number of counter"? The number of counters
>>
>> If the user doesn't want the kernel to use time multiplexing, it shall use events less
>> than the counters that it has been told by the boot information, of course, he can access
>> PMCR_EL0 directly to check it.
> 
> But this isn't an arm64-specific problem, is it? What happens on other

Correct, but I don't mention it as a problem, I just want to explain why some user may check
the counter number information. Apologies that I gave some misunderstanding words.

> architectures, such as x86?
> 
>>> is independent of the PMU version and shouldn't really be of interest to
>>> userspace anyway, should it? Or are you referring to something else?
>>
>> Yes, it is independent, I mean that if the user is interested in PMU information, like,
>> PMU counter number, PMU version, etc, it can be exposed at boot time directly.
> 
> If userspace needs information about the PMU, I'm up for exposing it via
> sysfs, but I don't think we should expose things for the sake of it, and I
> also think that information which isn't specific to the particular PMU
> should be exposed more generally so that userspace doesn't need lots of
> different parsers to get the same information on different hardware.
> 

Got it, thanks for more explanations.

>>> As for whether events are supported or not, we already expose that on a
>>> per-event basis, and I think we should continue to do that.
>>
>> Shall we check the PMU version(ARMv8.1) in the driver for PMCEID0/1_EL0[32:63]?
> 
> I'd need to see the patch, since I don't see where you're going with this.

Oh,I'm not sure whether we shall check PMU verion for PMCEID0/1_EL0[32:63] since
these are ARMv8.1-PMU events. Indeed I didn't do it anything about it in this patch.

Thanks,
Shaokun

> 

> Will
> 
> .
> 


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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-09-08 11:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-30 10:47 [PATCH] drivers/perf: arm_pmu: Show PMU version on boot Shaokun Zhang
2020-08-21 16:03 ` Will Deacon
2020-08-26  6:42   ` Shaokun Zhang
2020-09-01 16:16     ` Will Deacon
2020-09-02  1:31       ` Shaokun Zhang
2020-09-07 13:24         ` Will Deacon
2020-09-08 10:59           ` Shaokun Zhang

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.