Skip to contentSkip to conversation

perf/x86/intel: make error messages less confusing

PATCH In review Eduardo Valentin 3 participants 8 messages Aug 23, 2018 – Sep 14, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 perf/x86/intel: make error messages less confusing

On a system with X86_FEATURE_ARCH_PERFMON disabled and with a model not known by family PMU drivers, user gets a kernel message log like the following:

[ 0.100114] Performance Events: unsupported p6 CPU model 85 no PMU driver, software events only.

The "unsupported .. CPU" part may be confusing for some users leading to wrong understanding that the kernel does not support the CPU model.

This patch rewords the messages on the failure path to:

[ 0.667154] Performance Events: CPU does not support PMU: no PMU driver, software events only.
Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc "H. Peter Anvin" <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Andi Kleen <[email protected]>
Cc Kan Liang <[email protected]>
Cc Dan Carpenter <[email protected]>
Cc Eduardo Valentin <[email protected]>
Cc Jia Zhang <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>

---

Changes from V1->V2:
- As per initial review, the propose messaging was even more confusing. Simplified it by only saying that the CPU does not support PMU.

 arch/x86/events/intel/core.c | 15 +++++++++++----
 arch/x86/events/intel/p4.c   |  5 +----
 arch/x86/events/intel/p6.c   |  1 -
 3 files changed, 12 insertions(+), 9 deletions(-)
arch/x86/events/intel/core.c +11 -4
index 035c37481f57..2ddb97f03f4a 100644
@@ -3889,15 +3889,22 @@ __init int intel_pmu_init(void)
 	char *name;
 
 	if (!cpu_has(&boot_cpu_data, X86_FEATURE_ARCH_PERFMON)) {
+		int ret = -ENODEV;
+
 		switch (boot_cpu_data.x86) {
 		case 0x6:
-			return p6_pmu_init();
+			ret = p6_pmu_init();
+			break;
 		case 0xb:
-			return knc_pmu_init();
+			ret = knc_pmu_init();
+			break;
 		case 0xf:
-			return p4_pmu_init();
+			ret = p4_pmu_init();
+			break;
 		}
-		return -ENODEV;
+		if (ret)
+			pr_cont("CPU does not support PMU: ");
+		return ret;
 	}
 
 	/*
arch/x86/events/intel/p4.c +1 -4
index d32c0eed38ca..fb5e8576d9ac 100644
@@ -1345,11 +1345,8 @@ __init int p4_pmu_init(void)
 	BUILD_BUG_ON(ARCH_P4_MAX_CCCR > INTEL_PMC_MAX_GENERIC);
 
 	rdmsr(MSR_IA32_MISC_ENABLE, low, high);
-	if (!(low & (1 << 7))) {
-		pr_cont("unsupported Netburst CPU model %d ",
-			boot_cpu_data.x86_model);
+	if (!(low & (1 << 7)))
 		return -ENODEV;
-	}
 
 	memcpy(hw_cache_event_ids, p4_hw_cache_event_ids,
 		sizeof(hw_cache_event_ids));
arch/x86/events/intel/p6.c +0 -1
index 408879b0c0d4..e8e03e68b22f 100644
@@ -269,7 +269,6 @@ __init int p6_pmu_init(void)
 		break;
 
 	default:
-		pr_cont("unsupported p6 CPU model %d ", boot_cpu_data.x86_model);
 		return -ENODEV;
 	}
 
Signature · 1 line
2.18.0
#1 lore raw

Hello,

Quoted 12 lines · Eduardo Valentin

On a system with X86_FEATURE_ARCH_PERFMON disabled and with a model not known by family PMU drivers, user gets a kernel message log like the following:

[ 0.100114] Performance Events: unsupported p6 CPU model 85 no PMU driver, software events only.

The "unsupported .. CPU" part may be confusing for some users leading to wrong understanding that the kernel does not support the CPU model.

This patch rewords the messages on the failure path to:

[ 0.667154] Performance Events: CPU does not support PMU: no PMU driver, software events only.

Gentle ping on this patch, any further comments?

Quoted 89 lines
Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc "H. Peter Anvin" <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Andi Kleen <[email protected]>
Cc Kan Liang <[email protected]>
Cc Dan Carpenter <[email protected]>
Cc Eduardo Valentin <[email protected]>
Cc Jia Zhang <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>

---

Changes from V1->V2:
- As per initial review, the propose messaging was even more confusing. Simplified it by only saying that the CPU does not support PMU.

 arch/x86/events/intel/core.c | 15 +++++++++++----
 arch/x86/events/intel/p4.c   |  5 +----
 arch/x86/events/intel/p6.c   |  1 -
 3 files changed, 12 insertions(+), 9 deletions(-)
arch/x86/events/intel/core.c +11 -4
index 035c37481f57..2ddb97f03f4a 100644
@@ -3889,15 +3889,22 @@ __init int intel_pmu_init(void)
 	char *name;
 
 	if (!cpu_has(&boot_cpu_data, X86_FEATURE_ARCH_PERFMON)) {
+		int ret = -ENODEV;
+
 		switch (boot_cpu_data.x86) {
 		case 0x6:
-			return p6_pmu_init();
+			ret = p6_pmu_init();
+			break;
 		case 0xb:
-			return knc_pmu_init();
+			ret = knc_pmu_init();
+			break;
 		case 0xf:
-			return p4_pmu_init();
+			ret = p4_pmu_init();
+			break;
 		}
-		return -ENODEV;
+		if (ret)
+			pr_cont("CPU does not support PMU: ");
+		return ret;
 	}
 
 	/*
arch/x86/events/intel/p4.c +1 -4
index d32c0eed38ca..fb5e8576d9ac 100644
@@ -1345,11 +1345,8 @@ __init int p4_pmu_init(void)
 	BUILD_BUG_ON(ARCH_P4_MAX_CCCR > INTEL_PMC_MAX_GENERIC);
 
 	rdmsr(MSR_IA32_MISC_ENABLE, low, high);
-	if (!(low & (1 << 7))) {
-		pr_cont("unsupported Netburst CPU model %d ",
-			boot_cpu_data.x86_model);
+	if (!(low & (1 << 7)))
 		return -ENODEV;
-	}
 
 	memcpy(hw_cache_event_ids, p4_hw_cache_event_ids,
 		sizeof(hw_cache_event_ids));
arch/x86/events/intel/p6.c +0 -1
index 408879b0c0d4..e8e03e68b22f 100644
@@ -269,7 +269,6 @@ __init int p6_pmu_init(void)
 		break;
 
 	default:
-		pr_cont("unsupported p6 CPU model %d ", boot_cpu_data.x86_model);
 		return -ENODEV;
 	}
 
Signature · 1 line
2.18.0
Signature · 2 lines
All the best,
Eduardo Valentin
Reviewed-by
#2 lore raw
Quoted 12 lines · Eduardo Valentin

Hello,

Quoted 9 lines · Eduardo Valentin

On a system with X86_FEATURE_ARCH_PERFMON disabled and with a model not known by family PMU drivers, user gets a kernel message log like the following:

[ 0.100114] Performance Events: unsupported p6 CPU model 85 no PMU driver, software events only.

The "unsupported .. CPU" part may be confusing for some users leading to wrong understanding that the kernel does not support the CPU model.

Quoted 6 lines
Quoted 3 lines

This patch rewords the messages on the failure path to:

[ 0.667154] Performance Events: CPU does not support PMU: no PMU driver, software events only.

Gentle ping on this patch, any further comments?

-Andi

maintainer
#3 lore raw
In reply to Eduardo Valentin
Quoted 8 lines · Eduardo Valentin

On a system with X86_FEATURE_ARCH_PERFMON disabled and with a model not known by family PMU drivers, user gets a kernel message log like the following:

[ 0.100114] Performance Events: unsupported p6 CPU model 85 no PMU driver, software events only.

The "unsupported .. CPU" part may be confusing for some users leading to wrong understanding that the kernel does not support the CPU model.

Send them back to first grade, such that they might learn to read?

#4 lore raw
Quoted 6 lines · Peter Zijlstra
Quoted 5 lines · Eduardo Valentin

On a system with X86_FEATURE_ARCH_PERFMON disabled and with a model not known by family PMU drivers, user gets a kernel message log like the following:

[ 0.100114] Performance Events: unsupported p6 CPU model 85 no PMU driver, software events only.
Quoted 6 lines
Quoted 3 lines

The "unsupported .. CPU" part may be confusing for some users leading to wrong understanding that the kernel does not support the CPU model.

Send them back to first grade, such that they might learn to read?

:-)

Signature · 2 lines
All the best,
Eduardo Valentin
#5 lore raw
Quoted 7 lines · Eduardo Valentin
Quoted 6 lines · Peter Zijlstra
Quoted 5 lines · Eduardo Valentin

On a system with X86_FEATURE_ARCH_PERFMON disabled and with a model not known by family PMU drivers, user gets a kernel message log like the following:

[ 0.100114] Performance Events: unsupported p6 CPU model 85 no PMU driver, software events only.
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

The "unsupported .. CPU" part may be confusing for some users leading to wrong understanding that the kernel does not support the CPU model.

Send them back to first grade, such that they might learn to read?

:-)

I think it's a valid concern, I guess Eduardo actually has real people who got confused.

-Andi

maintainer
#6 lore raw
Quoted 12 lines · Andi Kleen
Quoted 11 lines · Eduardo Valentin
Quoted 10 lines · Peter Zijlstra
Quoted 8 lines · Eduardo Valentin

On a system with X86_FEATURE_ARCH_PERFMON disabled and with a model not known by family PMU drivers, user gets a kernel message log like the following:

[ 0.100114] Performance Events: unsupported p6 CPU model 85 no PMU driver, software events only.

The "unsupported .. CPU" part may be confusing for some users leading to wrong understanding that the kernel does not support the CPU model.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Send them back to first grade, such that they might learn to read?

:-)

I think it's a valid concern, I guess Eduardo actually has real people who got confused.

But it is really easy to confuse real people; as real people are mostly clueless. There is only so much you can do for the semi illiterate masses. Should we dumb down everything to baby talk just to cater to them?

The string is clearly prefixed by the subsystem, if you get confused by that your reading comprehension really is rock bottom.

  [ 0.100114] Performance Events: unsupported p6 CPU model 85 no PMU driver, software events only.

Heck, it even mentions "no PMU driver", how much clues do you need? Also, the proposed alternative:

  [ 0.667154] Performance Events: CPU does not support PMU: no PMU driver, software events only.

Looses out information on which CPU family we failed on. Nor does it mention the most likely reason for this error: virt crap.

I'd not mind a warning like:

[] Performance Events: Your crappy virt solution is lying about it's CPU model, it doesn't have a (matching) PMU.

#7 lore raw

Hey Peter,

Quoted 26 lines · Peter Zijlstra
Quoted 12 lines · Andi Kleen
Quoted 11 lines · Eduardo Valentin
Quoted 10 lines · Peter Zijlstra
Quoted 8 lines · Eduardo Valentin

On a system with X86_FEATURE_ARCH_PERFMON disabled and with a model not known by family PMU drivers, user gets a kernel message log like the following:

[ 0.100114] Performance Events: unsupported p6 CPU model 85 no PMU driver, software events only.

The "unsupported .. CPU" part may be confusing for some users leading to wrong understanding that the kernel does not support the CPU model.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Send them back to first grade, such that they might learn to read?

:-)

I think it's a valid concern, I guess Eduardo actually has real people who got confused.

But it is really easy to confuse real people; as real people are mostly clueless. There is only so much you can do for the semi illiterate masses. Should we dumb down everything to baby talk just to cater to them?

Quoted 5 lines

The string is clearly prefixed by the subsystem, if you get confused by that your reading comprehension really is rock bottom.

  [ 0.100114] Performance Events: unsupported p6 CPU model 85 no PMU driver, software events only.

Once again, the confusing part is the "unsupported CPU".

Quoted 6 lines

Heck, it even mentions "no PMU driver", how much clues do you need? Also, the proposed alternative:

  [ 0.667154] Performance Events: CPU does not support PMU: no PMU driver, software events only.

Looses out information on which CPU family we failed on. Nor does it

Maybe keeping the CPU family and rephrasing the unsupported part?

Quoted 6 lines

mention the most likely reason for this error: virt crap.

I'd not mind a warning like:

[] Performance Events: Your crappy virt solution is lying about it's CPU model, it doesn't have a (matching) PMU.

Well, I would be OK if the kernel spits out a message saying that vPMU is disabled or something. That would be more accurate than unsupported CPU.

Quoted 2 lines
Signature · 2 lines
All the best,
Eduardo Valentin