Re: [PATCH] Lazy FPU save/restore

Avi Kivity
2007-02-18T16:17:50Z

Anthony Liguori wrote:
>>
>> ... and reverted.
>>
>> Running an fpu load on both guest and host shows corruption (both on
>> the guest and host). The load is
>>
>>
>>> #include <stdio.h>
>>>
>>> void test_fpu()
>>> {
>>> int i;
>>> double f = 0;
>>>
>>> for (i = 0; i < 10000000; ++i)
>>> f += 1 / (1.0 + i);
>>> printf("%20.16f\n", f);
>>> }
>>>
>>> int main(int ac, char **av)
>>> {
>>> while (1)
>>> test_fpu();
>>> }
>>
>> Compiled statically with -O2 on 64-bit. I don't know what's wrong --
>> the code looks correct (well, on Intel it wants KVM_GUEST_CR0_MASK to
>> include CR0_MP_MASK and CR0_TS_MASK, but it fails with that too, and
>> it fails on AMD as well).
>
> I'll have to try and setup a 64 bit system. I cannot reproduce on my
> 32bit system with your test program.

It may be related to 64-bit (as that uses sse for floating point), or to
the fact that I use ssh on a remote host, which causes more context
switches. I'll try to reproduce on 32 bits with my setup.

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