[libvirt] [PATCH 34/36] vircpuhost: Add support for reading MSRs

Jiri Denemark jdenemar at redhat.com
Fri Apr 12 09:47:15 UTC 2019


On Thu, Apr 11, 2019 at 17:13:51 +0100, Daniel P. Berrangé wrote:
> On Mon, Apr 08, 2019 at 10:42:38AM +0200, Jiri Denemark wrote:
> > The new virHostCPUGetMSR internal API will try to read the MSR from
> > /dev/cpu/0/msr and if it is not possible (the device does not exist or
> > libvirt is running unprivileged), it will fallback to asking KVM for the
> > MSR using KVM_GET_MSRS ioctl.
> 
> Is there benefit to using /dev/cpu/0/msr, instead of always using
> /dev/kvm ?

KVM may report some bits in the IA32_ARCH_CAPABILITIES MSR even when the
host does not set them or even support MSR at all. So for reporting host
capabilities /dev/cpu/0/msr is IMHO better. We will still get the made
up bits in the MSR via QEMU for host-model.

For example, on my laptop which does not support IA32_ARCH_CAPABILITIES
MSR at all I get 0x8 when asking KVM, while reading /dev/cpu/0/msr
returns I/O error since the MSR does not exist.

Jirka




More information about the libvir-list mailing list