On Mon, Mar 04, 2024 at 03:41:02PM +0100, Anthony Harivel wrote:
> 
> Hi Daniel,
> 
> > > +        if (s->msr_energy.enable == true) {
> >
> > This looks to be where we need to check that both the host CPU
> > vendor is intel, and the guest CPU vendor is intel, and that
> > the host CPU has the RAPL feature we're using.
>
> Checking for the host cpu and RAPL enable is fine and done. 
> 
> But checking for guest CPU is confusing me. 
> The RAPL feature is enable only with KVM enable. 
> This means "-cpu" can only be "host" or its derivative that essentially 
> copy the host CPU definition, no?

KVM can use any named CPU.

> That means if we are already checking the host cpu we don't need to do 
> anything for the guest, do we ?

When I first wrote this I though it would be as simple as checknig a
CPUID feature flag. That appears to not be the case, however, as Linux
is just checking for various CPU models directly. With that in mind
perhaps we should just check of the guest CPU model vendor
== CPUID_VENDOR_INTEL and leave it at that.

eg, create an error if running an AMD CPU such as $QEMU -cpu EPYC

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|


Reply via email to