Avi Kivity wrote: > Avi Kivity wrote: >> Anthony Liguori wrote: >>> The following patch saves the host FPU state and loads the guests >>> FPU state if !(CR0.MP == 1 && CR0.TS == 1). >>> >>> When CR0.MP == 1 && CR0.TS == 1, all FPU activity will generate >>> exceptions. OS's use these exceptions to implement lazy FPU loading >>> to improve context switch time. Since any FPU activity will >>> generate traps, we don't have to worry about the guest modifying the >>> host FPU state. >>> >>> My microbenchmark of choice uses FPU operations so I think the >>> results are currently tainted. I've only tested on a 32bit SVM system. >>> >>> Signed-off-by: Anthony Liguori <[EMAIL PROTECTED]> >>> >> >> Applied, thanks. >> > > ... 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. Thanks for figuring this out! Regards, Anthony Liguori ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel