From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: Problem with KVM when using XSAVES in host Date: Sun, 14 Dec 2014 16:55:47 +0100 Message-ID: <548DB303.9070707@redhat.com> References: <3F0E7E55-133E-42E7-9B5B-AAEDD259B992@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: kvm list To: Nadav Amit Return-path: Received: from mail-wg0-f41.google.com ([74.125.82.41]:47834 "EHLO mail-wg0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750770AbaLNPzw (ORCPT ); Sun, 14 Dec 2014 10:55:52 -0500 Received: by mail-wg0-f41.google.com with SMTP id y19so12720354wgg.14 for ; Sun, 14 Dec 2014 07:55:50 -0800 (PST) In-Reply-To: <3F0E7E55-133E-42E7-9B5B-AAEDD259B992@gmail.com> Sender: kvm-owner@vger.kernel.org List-ID: On 14/12/2014 15:31, Nadav Amit wrote: > This behaviour hurts the =E2=80=9Cequivalence property=E2=80=9D - the= VM does not behave as > bare-metal system. Moreover, it may hurt the VM performance if the VM= uses > XSAVEOPT (and not XSAVES), has MXCSR with value different than the re= set > value of 1F80H and has all SSE registers set to zero. In such case, t= he VM > would save/restore SSE registers unnecessarily. I don=E2=80=99t know = whether such > scenario happens in real workloads. >=20 > tl;dr - hypervisors which use XSAVES (and XSAVEC) mess the VM state a= nd may > hurt VM performance. Perhaps KVM should use XSAVE/XSAVEOPT instead. Unfortunately KVM uses whatever the kernel uses. KVM does not save/restore itself the FPU state. The same problem above can happen if the kernel uses XSAVES/XRSTORS and userspace uses XSAVEOPT. So it's a processor bug. Paolo