Skip to contentSkip to conversation

sparc64: T5 PMU

PATCH Superseded Bob Picco 2 participants 3 messages Sep 7, 2014 – Sep 10, 2014

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Bob Picco

author
#0 lore raw

PATCH 1/1 sparc64: T5 PMU

From: bob picco <[email protected]>

The T5 (niagara5) has different PCR related HV fast trap values and a new HV API Group. This patch utilizes these and shares when possible with niagara4.

We use the same sparc_pmu niagara4_pmu. Should there be new effort to obtain the MCU perf statistics then this would have to be changed.

---
 arch/sparc/include/asm/hypervisor.h |   11 ++++++++
 arch/sparc/kernel/hvapi.c           |    1 +
 arch/sparc/kernel/hvcalls.S         |   16 ++++++++++++
 arch/sparc/kernel/pcr.c             |   44 ++++++++++++++++++++++++++++++++--
 arch/sparc/kernel/perf_event.c      |    3 +-
 5 files changed, 71 insertions(+), 4 deletions(-)
arch/sparc/include/asm/hypervisor.h +11 -0
index 94b39ca..4f6725f 100644
@@ -2947,6 +2947,16 @@ unsigned long sun4v_vt_set_perfreg(unsigned long reg_num,
 				   unsigned long reg_val);
 #endif
 
+#define	HV_FAST_T5_GET_PERFREG		0x1a8
+#define	HV_FAST_T5_SET_PERFREG		0x1a9
+
+#ifndef	__ASSEMBLY__
+unsigned long sun4v_t5_get_perfreg(unsigned long reg_num,
+				   unsigned long *reg_val);
+unsigned long sun4v_t5_set_perfreg(unsigned long reg_num,
+				   unsigned long reg_val);
+#endif
+
 /* Function numbers for HV_CORE_TRAP.  */
 #define HV_CORE_SET_VER			0x00
 #define HV_CORE_PUTCHAR			0x01
@@ -2978,6 +2988,7 @@ unsigned long sun4v_vt_set_perfreg(unsigned long reg_num,
 #define HV_GRP_VF_CPU			0x0205
 #define HV_GRP_KT_CPU			0x0209
 #define HV_GRP_VT_CPU			0x020c
+#define HV_GRP_T5_CPU			0x0211
 #define HV_GRP_DIAG			0x0300
 
 #ifndef __ASSEMBLY__
arch/sparc/kernel/hvapi.c +1 -0
index c0a2de0..5c55145 100644
@@ -46,6 +46,7 @@ static struct api_info api_table[] = {
 	{ .group = HV_GRP_VF_CPU,				},
 	{ .group = HV_GRP_KT_CPU,				},
 	{ .group = HV_GRP_VT_CPU,				},
+	{ .group = HV_GRP_T5_CPU,				},
 	{ .group = HV_GRP_DIAG,		.flags = FLAG_PRE_API	},
 };
 
arch/sparc/kernel/hvcalls.S +16 -0
index f3ab509..caedf83 100644
@@ -821,3 +821,19 @@ ENTRY(sun4v_vt_set_perfreg)
 	retl
 	 nop
 ENDPROC(sun4v_vt_set_perfreg)
+
+ENTRY(sun4v_t5_get_perfreg)
+	mov	%o1, %o4
+	mov	HV_FAST_T5_GET_PERFREG, %o5
+	ta	HV_FAST_TRAP
+	stx	%o1, [%o4]
+	retl
+	 nop
+ENDPROC(sun4v_t5_get_perfreg)
+
+ENTRY(sun4v_t5_set_perfreg)
+	mov	HV_FAST_T5_SET_PERFREG, %o5
+	ta	HV_FAST_TRAP
+	retl
+	 nop
+ENDPROC(sun4v_t5_set_perfreg)
arch/sparc/kernel/pcr.c +41 -3

75 lines not on this page · raw message

arch/sparc/kernel/perf_event.c +2 -1
index d35c490..c9759ad 100644
@@ -1662,7 +1662,8 @@ static bool __init supported_pmu(void)
 		sparc_pmu = &niagara2_pmu;
 		return true;
 	}
-	if (!strcmp(sparc_pmu_type, "niagara4")) {
+	if (!strcmp(sparc_pmu_type, "niagara4") ||
+	    !strcmp(sparc_pmu_type, "niagara5")) {
 		sparc_pmu = &niagara4_pmu;
 		return true;
 	}
Signature · 1 line
1.7.1
maintainer
#1 lore raw

From: Bob Picco <[email protected]>
Date: Sun, 7 Sep 2014 11:49:49 -0400

Quoted 10 lines

From: bob picco <[email protected]>

The T5 (niagara5) has different PCR related HV fast trap values and a new HV API Group. This patch utilizes these and shares when possible with niagara4.

We use the same sparc_pmu niagara4_pmu. Should there be new effort to obtain the MCU perf statistics then this would have to be changed.

This patch looks fine but needs some minor coding style fixups.

arch/sparc/include/asm/hypervisor.h unsigned long sun4v_vt_set_perfreg(unsigned long reg_num, · line 2955

Quoted 2 lines
arch/sparc/include/asm/hypervisor.h +2 -0
+unsigned long sun4v_t5_get_perfreg(unsigned long reg_num,
+				   unsigned long *reg_val);

Arguments on the second and subsequent line of a function declaration or call need to start exactly at the first column after the openning parenthesis of the first line. You must use the appropriate number of TAB and SPACE characters necessary to achieve this.

arch/sparc/kernel/pcr.c static int __init register_perf_hsvc(void) · line 258

Quoted 3 lines
arch/sparc/kernel/pcr.c +1 -1
-		if (sun4v_hvapi_register(perf_hsvc_group,
+		hverror = sun4v_hvapi_register(perf_hsvc_group,
 					 perf_hsvc_major,

Since you are changing where the openning parenthesis of this function call is located, you have to reindent the following lines as needed.

arch/sparc/kernel/pcr.c static int __init register_perf_hsvc(void) · line 262

Quoted 2 lines
arch/sparc/kernel/pcr.c +2 -0
+			pr_err("perfmon: Could not register hvapi(0x%lx).\n",
+				hverror);

Not a blocker for this patch, but we probably want an "hverr_to_string()" helper function so that we can print these out mnenomically.

author
#2 lore raw
In reply to Bob Picco

David Miller wrote: [Tue Sep 09 2014, 06:13:48PM EDT]

Quoted 8 lines

From: Bob Picco <[email protected]>
Date: Sun, 7 Sep 2014 11:49:49 -0400

Quoted 5 lines

From: bob picco <[email protected]>

The T5 (niagara5) has different PCR related HV fast trap values and a new HV API Group. This patch utilizes these and shares when possible with niagara4.

Quoted 7 lines
Quoted 5 lines

We use the same sparc_pmu niagara4_pmu. Should there be new effort to obtain the MCU perf statistics then this would have to be changed.

This patch looks fine but needs some minor coding style fixups.

Okay.

Quoted 7 lines

arch/sparc/include/asm/hypervisor.h unsigned long sun4v_vt_set_perfreg(unsigned long reg_num, · line 2955

Quoted 2 lines
arch/sparc/include/asm/hypervisor.h +2 -0
+unsigned long sun4v_t5_get_perfreg(unsigned long reg_num,
+				   unsigned long *reg_val);

Arguments on the second and subsequent line of a function declaration or call need to start exactly at the first column after the openning parenthesis of the first line. You must use the appropriate number of TAB and SPACE characters necessary to achieve this.

My Berkeley and Bell Labs style always creeps back in. Sorry.

Quoted 7 lines

arch/sparc/kernel/pcr.c static int __init register_perf_hsvc(void) · line 258

Quoted 4 lines
arch/sparc/kernel/pcr.c +1 -1
-		if (sun4v_hvapi_register(perf_hsvc_group,
+		hverror = sun4v_hvapi_register(perf_hsvc_group,
 					 perf_hsvc_major,

Since you are changing where the openning parenthesis of this function call is located, you have to reindent the following lines as needed.

Okay. I'll ask another person locally should my confusion remain :)

Quoted 6 lines

arch/sparc/kernel/pcr.c static int __init register_perf_hsvc(void) · line 262

Quoted 3 lines
arch/sparc/kernel/pcr.c +2 -0
+			pr_err("perfmon: Could not register hvapi(0x%lx).\n",
+				hverror);

Not a blocker for this patch, but we probably want an "hverr_to_string()" helper function so that we can print these out mnenomically.

I agree.

thanx for the review,

bob

Quoted 4 lines

--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html