2012-05-01 12:53:44

by Avi Kivity

[permalink] [raw]
Subject: Re: [PATCH] kvm: fix cpuid eax

On 04/30/2012 11:37 PM, Anthony Liguori wrote:
> On 04/30/2012 09:39 AM, Michael S. Tsirkin wrote:
>> cpuid eax should return the max leaf so that
>> guests can find out the valid range.
>> This matches Xen et al.
>
> What KVM does here predates Xen and Hyper-V.
>
> This is an ABI breaker.

First, I don't think we ever documented eax, so nothing can rely on it.
Second, this isn't guest visible, it's just part of
KVM_GET_SUPPORTED_CPUID (used by qemu's -cpu host, but doesn't affect
qemu stable cpus).

--
error compiling committee.c: too many arguments to function


2012-05-01 12:56:31

by Avi Kivity

[permalink] [raw]
Subject: Re: [PATCH] kvm: fix cpuid eax

On 05/01/2012 03:53 PM, Avi Kivity wrote:
> On 04/30/2012 11:37 PM, Anthony Liguori wrote:
> > On 04/30/2012 09:39 AM, Michael S. Tsirkin wrote:
> >> cpuid eax should return the max leaf so that
> >> guests can find out the valid range.
> >> This matches Xen et al.
> >
> > What KVM does here predates Xen and Hyper-V.
> >
> > This is an ABI breaker.
>
> First, I don't think we ever documented eax, so nothing can rely on it.
>

Actually, we did document it.

However, I think it's safe to change. The documentation in this case
should say "reserved, returns zero in this implementation", rather than 0.

--
error compiling committee.c: too many arguments to function

2012-05-07 08:27:06

by Ingo Molnar

[permalink] [raw]
Subject: Re: [PATCH] kvm: fix cpuid eax


* Avi Kivity <[email protected]> wrote:

> On 05/01/2012 03:53 PM, Avi Kivity wrote:
> > On 04/30/2012 11:37 PM, Anthony Liguori wrote:
> > > On 04/30/2012 09:39 AM, Michael S. Tsirkin wrote:
> > >> cpuid eax should return the max leaf so that
> > >> guests can find out the valid range.
> > >> This matches Xen et al.
> > >
> > > What KVM does here predates Xen and Hyper-V.
> > >
> > > This is an ABI breaker.
> >
> > First, I don't think we ever documented eax, so nothing can rely on it.
> >
>
> Actually, we did document it.
>
> However, I think it's safe to change. The documentation in
> this case should say "reserved, returns zero in this
> implementation", rather than 0.

Just a side note: whether and how it got documented is
immaterial, what matters is whether any application binary that
is already out there breaks. (The 'B' in ABI.)

Whether it was fully documented or it was entirly undocumented,
the code obfuscated, encrypted and all this information got
locked away in a safe at a military base protected by nuclear
missiles is immaterial: if someone accidentally stumbled upon it
and an app learned to rely on the ABI detail then tough luck.

Fortunately, this does not appear to have happened, so as a
result it's *not* an Application Binary Interface (it's only a
Binary Interface) and can thus be changed for the better.

Thanks,

Ingo