Skip to contentSkip to conversation

xen: Make VPMU init message look less scary

PATCH Superseded Juergen Gross 2 participants 3 messages Aug 2, 2016 1 message not in the archive

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Juergen Gross

author maintainer
#0 lore raw

PATCH v2 1/1 xen: Make VPMU init message look less scary

The default for the Xen hypervisor is to not enable VPMU in order to avoid security issues. In this case the Linux kernel will issue the message "Could not initialize VPMU for cpu 0, error -95" which looks more like an error than a normal state.

Change the message to something less scary in case the hypervisor returns EOPNOTSUPP when trying to activate VPMU.

---
V2: modify error message as suggested by Konrad Wilk

---
 arch/x86/xen/pmu.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
arch/x86/xen/pmu.c +5 -2
index 32bdc2c..bfe8880 100644
@@ -547,8 +547,11 @@ void xen_pmu_init(int cpu)
 	return;
 
 fail:
-	pr_info_once("Could not initialize VPMU for cpu %d, error %d\n",
-		cpu, err);
+	if (err == -EOPNOTSUPP)
+		pr_info_once("VPMU disabled by hypervisor.\n");
+	else
+		pr_info_once("Could not initialize VPMU for cpu %d, error %d\n",
+			cpu, err);
 	free_pages((unsigned long)xenpmu_data, 0);
 }
 
Signature · 7 lines
2.6.6


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#1 lore raw
Quoted 4 lines
Quoted 1 line
Quoted 1 line · On 02.08.16 at 08:43, <[email protected]> wrote:

arch/x86/xen/pmu.c void xen_pmu_init(int cpu) · line 554

Quoted 10 lines
arch/x86/xen/pmu.c +5 -2
@@ -547,8 +547,11 @@ void xen_pmu_init(int cpu)
 	return;
 
 fail:
-	pr_info_once("Could not initialize VPMU for cpu %d, error %d\n",
-		cpu, err);
+	if (err == -EOPNOTSUPP)
+		pr_info_once("VPMU disabled by hypervisor.\n");
+	else
+		pr_info_once("Could not initialize VPMU for cpu %d, error %d\n",
+			cpu, err);

I'm sorry for not already having thought about this for v1, but what about older hypervisors, where the hypercall would return -ENOSYS?

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

author maintainer
#3 lore raw
In reply to a message not in the archive
Quoted 6 lines · Jan Beulich
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 02.08.16 at 08:43, <[email protected]> wrote:
arch/x86/xen/pmu.c +0 -0
@@ -547,8 +547,11 @@ void xen_pmu_init(int cpu)
 	return;
 
Quoted 12 lines

arch/x86/xen/pmu.c void xen_pmu_init(int cpu) · line 554

Quoted 8 lines
arch/x86/xen/pmu.c +5 -2
 fail:
-	pr_info_once("Could not initialize VPMU for cpu %d, error %d\n",
-		cpu, err);
+	if (err == -EOPNOTSUPP)
+		pr_info_once("VPMU disabled by hypervisor.\n");
+	else
+		pr_info_once("Could not initialize VPMU for cpu %d, error %d\n",
+			cpu, err);

I'm sorry for not already having thought about this for v1, but what about older hypervisors, where the hypercall would return -ENOSYS?

I wasn't aware of that possibility. It should be covered, of course!

V3 will be sent soon...

Thanks for noticing now,

Juergen

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel