Patchwork [kvmtool,5/6] arm: pmu: Improve PMU error reporting

login
register
mail settings
Submitter Andre Przywara
Date Jan. 25, 2019, 6:08 p.m.
Message ID <20190125180801.209910-6-andre.przywara@arm.com>
Download mbox | patch
Permalink /patch/710057/
State New
Headers show

Comments

Andre Przywara - Jan. 25, 2019, 6:08 p.m.
The KVM ioctls mostly just return -1 in the error case, leaving the
actual error code in errno.

Change the output of the PMU error message to actually print this error
code instead of the generic -1.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
---
 arm/pmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch

diff --git a/arm/pmu.c b/arm/pmu.c
index 69c37fae..ffd152e2 100644
--- a/arm/pmu.c
+++ b/arm/pmu.c
@@ -18,7 +18,7 @@  static int set_pmu_attr(struct kvm *kvm, int vcpu_idx,
 	if (!ret) {
 		ret = ioctl(fd, KVM_SET_DEVICE_ATTR, attr);
 		if (ret)
-			pr_err("PMU KVM_SET_DEVICE_ATTR failed (%d)\n", ret);
+			perror("PMU KVM_SET_DEVICE_ATTR failed");
 	} else {
 		pr_err("Unsupported PMU on vcpu%d\n", vcpu_idx);
 	}