linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Support for perf on AMD family17h processors
@ 2016-11-16 17:01 Janakarajan Natarajan
  2016-11-16 17:30 ` Peter Zijlstra
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Janakarajan Natarajan @ 2016-11-16 17:01 UTC (permalink / raw)
  To: linux-kernel
  Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Alexander Shishkin, Suravee Suthikulpanit, Janakarajan Natarajan

This patch enables perf core PMU support for AMD family17h processors.
In family17h, there is no PMC-event constraint. All events, irrespective
of the type, can be measured using any of the performance counters.

Signed-off-by: Janakarajan Natarajan <Janakarajan.Natarajan@amd.com>
---
 arch/x86/events/amd/core.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/arch/x86/events/amd/core.c b/arch/x86/events/amd/core.c
index f5f4b3f..849688d 100644
--- a/arch/x86/events/amd/core.c
+++ b/arch/x86/events/amd/core.c
@@ -652,7 +652,11 @@ static __initconst const struct x86_pmu amd_pmu = {
 	.amd_nb_constraints	= 1,
 };
 
-static int __init amd_core_pmu_init(void)
+/*
+ * This function initializes core PMU to enable support
+ * for AMD Core PMC Extension.
+ */
+static int __init amd_core_pmc_ext_init(void)
 {
 	if (!boot_cpu_has(X86_FEATURE_PERFCTR_CORE))
 		return 0;
@@ -662,7 +666,12 @@ static int __init amd_core_pmu_init(void)
 		pr_cont("Fam15h ");
 		x86_pmu.get_event_constraints = amd_get_event_constraints_f15h;
 		break;
-
+	case 0x17:
+		pr_cont("Fam17h ");
+		/* In family 17h, there are no event constraints in the PMC hardware.
+		 * We fallback to using default amd_get_event_constraints.
+		 */
+		break;
 	default:
 		pr_err("core perfctr but no constraints; unknown hardware!\n");
 		return -ENODEV;
@@ -696,7 +705,7 @@ __init int amd_pmu_init(void)
 
 	x86_pmu = amd_pmu;
 
-	ret = amd_core_pmu_init();
+	ret = amd_core_pmc_ext_init();
 	if (ret)
 		return ret;
 
-- 
2.7.4

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

* Re: [PATCH] Support for perf on AMD family17h processors
  2016-11-16 17:01 [PATCH] Support for perf on AMD family17h processors Janakarajan Natarajan
@ 2016-11-16 17:30 ` Peter Zijlstra
  2016-11-16 20:41   ` Natarajan, Janakarajan
  2016-11-16 18:47 ` Borislav Petkov
  2016-11-17  6:46 ` Ingo Molnar
  2 siblings, 1 reply; 7+ messages in thread
From: Peter Zijlstra @ 2016-11-16 17:30 UTC (permalink / raw)
  To: Janakarajan Natarajan
  Cc: linux-kernel, Ingo Molnar, Arnaldo Carvalho de Melo,
	Alexander Shishkin, Suravee Suthikulpanit

On Wed, Nov 16, 2016 at 11:01:53AM -0600, Janakarajan Natarajan wrote:
> This patch enables perf core PMU support for AMD family17h processors.
> In family17h, there is no PMC-event constraint. All events, irrespective
> of the type, can be measured using any of the performance counters.
> 

Is there a public document describing this thing about already?

> +	case 0x17:
> +		pr_cont("Fam17h ");
> +		/* In family 17h, there are no event constraints in the PMC hardware.
> +		 * We fallback to using default amd_get_event_constraints.
> +		 */
> +		break;

 http://lkml.kernel.org/r/CA+55aFyQYJerovMsSoSKS7PessZBr4vNp-3QUUwhqk4A4_jcbg@mail.gmail.com

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

* Re: [PATCH] Support for perf on AMD family17h processors
  2016-11-16 17:01 [PATCH] Support for perf on AMD family17h processors Janakarajan Natarajan
  2016-11-16 17:30 ` Peter Zijlstra
@ 2016-11-16 18:47 ` Borislav Petkov
  2016-11-16 20:49   ` Natarajan, Janakarajan
  2016-11-17  6:46 ` Ingo Molnar
  2 siblings, 1 reply; 7+ messages in thread
From: Borislav Petkov @ 2016-11-16 18:47 UTC (permalink / raw)
  To: Janakarajan Natarajan
  Cc: linux-kernel, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Alexander Shishkin,
	Suravee Suthikulpanit

On Wed, Nov 16, 2016 at 11:01:53AM -0600, Janakarajan Natarajan wrote:
> This patch enables perf core PMU support for AMD family17h processors.
> In family17h, there is no PMC-event constraint. All events, irrespective
> of the type, can be measured using any of the performance counters.
> 
> Signed-off-by: Janakarajan Natarajan <Janakarajan.Natarajan@amd.com>
> ---
>  arch/x86/events/amd/core.c | 15 ++++++++++++---
>  1 file changed, 12 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/x86/events/amd/core.c b/arch/x86/events/amd/core.c
> index f5f4b3f..849688d 100644
> --- a/arch/x86/events/amd/core.c
> +++ b/arch/x86/events/amd/core.c
> @@ -652,7 +652,11 @@ static __initconst const struct x86_pmu amd_pmu = {
>  	.amd_nb_constraints	= 1,
>  };
>  
> -static int __init amd_core_pmu_init(void)
> +/*
> + * This function initializes core PMU to enable support
> + * for AMD Core PMC Extension.
> + */
> +static int __init amd_core_pmc_ext_init(void)
>  {
>  	if (!boot_cpu_has(X86_FEATURE_PERFCTR_CORE))
>  		return 0;

This renaming looks pretty useless to me. So does the comment.

-- 
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.

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

* Re: [PATCH] Support for perf on AMD family17h processors
  2016-11-16 17:30 ` Peter Zijlstra
@ 2016-11-16 20:41   ` Natarajan, Janakarajan
  0 siblings, 0 replies; 7+ messages in thread
From: Natarajan, Janakarajan @ 2016-11-16 20:41 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: linux-kernel, Ingo Molnar, Arnaldo Carvalho de Melo,
	Alexander Shishkin, Suravee Suthikulpanit


On 11/16/2016 11:30 AM, Peter Zijlstra wrote:
> On Wed, Nov 16, 2016 at 11:01:53AM -0600, Janakarajan Natarajan wrote:
>> This patch enables perf core PMU support for AMD family17h processors.
>> In family17h, there is no PMC-event constraint. All events, irrespective
>> of the type, can be measured using any of the performance counters.
>>
> Is there a public document describing this thing about already?
There is no document published as of now.
>
>> +	case 0x17:
>> +		pr_cont("Fam17h ");
>> +		/* In family 17h, there are no event constraints in the PMC hardware.
>> +		 * We fallback to using default amd_get_event_constraints.
>> +		 */
>> +		break;
>   http://lkml.kernel.org/r/CA+55aFyQYJerovMsSoSKS7PessZBr4vNp-3QUUwhqk4A4_jcbg@mail.gmail.com
I'll send out a v2 patch for the comment following the guidelines.

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

* Re: [PATCH] Support for perf on AMD family17h processors
  2016-11-16 18:47 ` Borislav Petkov
@ 2016-11-16 20:49   ` Natarajan, Janakarajan
  0 siblings, 0 replies; 7+ messages in thread
From: Natarajan, Janakarajan @ 2016-11-16 20:49 UTC (permalink / raw)
  To: Borislav Petkov
  Cc: linux-kernel, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Alexander Shishkin,
	Suravee Suthikulpanit


On 11/16/2016 12:47 PM, Borislav Petkov wrote:
> On Wed, Nov 16, 2016 at 11:01:53AM -0600, Janakarajan Natarajan wrote:
>> This patch enables perf core PMU support for AMD family17h processors.
>> In family17h, there is no PMC-event constraint. All events, irrespective
>> of the type, can be measured using any of the performance counters.
>>
>> Signed-off-by: Janakarajan Natarajan <Janakarajan.Natarajan@amd.com>
>> ---
>>   arch/x86/events/amd/core.c | 15 ++++++++++++---
>>   1 file changed, 12 insertions(+), 3 deletions(-)
>>
>> diff --git a/arch/x86/events/amd/core.c b/arch/x86/events/amd/core.c
>> index f5f4b3f..849688d 100644
>> --- a/arch/x86/events/amd/core.c
>> +++ b/arch/x86/events/amd/core.c
>> @@ -652,7 +652,11 @@ static __initconst const struct x86_pmu amd_pmu = {
>>   	.amd_nb_constraints	= 1,
>>   };
>>   
>> -static int __init amd_core_pmu_init(void)
>> +/*
>> + * This function initializes core PMU to enable support
>> + * for AMD Core PMC Extension.
>> + */
>> +static int __init amd_core_pmc_ext_init(void)
>>   {
>>   	if (!boot_cpu_has(X86_FEATURE_PERFCTR_CORE))
>>   		return 0;
> This renaming looks pretty useless to me. So does the comment.
I'll remove the renaming and comment in a v2 patch.
>

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

* Re: [PATCH] Support for perf on AMD family17h processors
  2016-11-16 17:01 [PATCH] Support for perf on AMD family17h processors Janakarajan Natarajan
  2016-11-16 17:30 ` Peter Zijlstra
  2016-11-16 18:47 ` Borislav Petkov
@ 2016-11-17  6:46 ` Ingo Molnar
  2016-11-17 15:50   ` Natarajan, Janakarajan
  2 siblings, 1 reply; 7+ messages in thread
From: Ingo Molnar @ 2016-11-17  6:46 UTC (permalink / raw)
  To: Janakarajan Natarajan
  Cc: linux-kernel, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Alexander Shishkin,
	Suravee Suthikulpanit


* Janakarajan Natarajan <Janakarajan.Natarajan@amd.com> wrote:

> This patch enables perf core PMU support for AMD family17h processors. In 
> family17h, there is no PMC-event constraint. All events, irrespective of the 
> type, can be measured using any of the performance counters.

BTW., that's a very nice hardware design that simplifies counter constraints and 
scheduling!

Does Fam17h have 6 generic counters per core, like Fam15h?

Thanks,

	Ingo

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

* Re: [PATCH] Support for perf on AMD family17h processors
  2016-11-17  6:46 ` Ingo Molnar
@ 2016-11-17 15:50   ` Natarajan, Janakarajan
  0 siblings, 0 replies; 7+ messages in thread
From: Natarajan, Janakarajan @ 2016-11-17 15:50 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Alexander Shishkin,
	Suravee Suthikulpanit


On 11/17/2016 12:46 AM, Ingo Molnar wrote:
> * Janakarajan Natarajan <Janakarajan.Natarajan@amd.com> wrote:
>
>> This patch enables perf core PMU support for AMD family17h processors. In
>> family17h, there is no PMC-event constraint. All events, irrespective of the
>> type, can be measured using any of the performance counters.
> BTW., that's a very nice hardware design that simplifies counter constraints and
> scheduling!
>
> Does Fam17h have 6 generic counters per core, like Fam15h?
Yes. Fam17h has 6 generic core counters.
>
> Thanks,
>
> 	Ingo

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

end of thread, other threads:[~2016-11-17 17:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-16 17:01 [PATCH] Support for perf on AMD family17h processors Janakarajan Natarajan
2016-11-16 17:30 ` Peter Zijlstra
2016-11-16 20:41   ` Natarajan, Janakarajan
2016-11-16 18:47 ` Borislav Petkov
2016-11-16 20:49   ` Natarajan, Janakarajan
2016-11-17  6:46 ` Ingo Molnar
2016-11-17 15:50   ` Natarajan, Janakarajan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).