tools/power x86_energy_perf_policy: Input/output error in a VM
authorOndřej Lysoněk <olysonek@redhat.com>
Fri, 27 Mar 2020 07:27:12 +0000 (08:27 +0100)
committerLen Brown <len.brown@intel.com>
Thu, 3 Sep 2020 17:58:38 +0000 (13:58 -0400)
commit0936cdfbb527a4fa2559292069ebff2e8cf2c843
treea3ce68d3336eb6bbc17e07e824403bdb698f849f
parentc315a09b1b0f491c27d46e9d05f397023a44fb81
tools/power x86_energy_perf_policy: Input/output error in a VM

I've encountered an issue with x86_energy_perf_policy. If I run it on a
machine that I'm told is a qemu-kvm virtual machine running inside a
privileged container, I get the following error:

x86_energy_perf_policy: /dev/cpu/0/msr offset 0x1ad read failed: Input/output error

I get the same error in a Digital Ocean droplet, so that might be a
similar environment.

I created the following patch which is intended to give a more
user-friendly message. It's based on a patch for turbostat from Prarit
Bhargava that was posted some time ago. The patch is "[v2] turbostat:
Running on virtual machine is not supported" [1].

Given my limited knowledge of the topic, I can't say with confidence
that this is the right solution, though (that's why this is not an
official patch submission). Also, I'm not sure what the convention with
exit codes is in this tool. Also, instead of the error message, perhaps
the tool should just not print anything in this case, which is how it
behaves in a "regular" VM?

[1] https://patchwork.kernel.org/patch/9868587/

Signed-off-by: Ondřej Lysoněk <olysonek@redhat.com>
Signed-off-by: Len Brown <len.brown@intel.com>
tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.c