lkml.org 
[lkml]   [2013]   [Oct]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH, RFC] x86-64: properly handle FPU code/data selectors
>>> On 17.10.13 at 12:23, Gleb Natapov <gleb@redhat.com> wrote:
> On Thu, Oct 17, 2013 at 10:51:52AM +0100, Jan Beulich wrote:
>> >>> On 17.10.13 at 11:41, Gleb Natapov <gleb@redhat.com> wrote:
>> > KVM obviously knows the complete state of virtual CPU. It can figure the
>> > situation above by looking at CS descriptor, not need to check
>> > is_long_mode() at all. Here is how emulator does it:
>>
>> And again - no: The last floating point operation may have
>> happened in 32-bit user mode context, while the state saving
>> may happen when the guest is already back in 64-bit kernel
>> mode.
>>
> Hmm, OK so the scenarios you are talking about is:
> 1. Guest's 32bit process uses FPU
> 2. Guest switch to 64bit kernel.
> 3. Before guest's kernel saves 32bit process's FPU state VMEXIT happens
> 4. KVM need to save FPU but it does not know what mode it is in
> Correct?

Yes.

> KVM gives FPU to a guest lazily, meaning that on a first FPU use #NM
> (intercepted by KVM) happens at which point FPU is granted to a guest.
> KVM can check what mode CPU was in at this point and use this info
> while saving FPU. But there is additional optimization that will prevent
> this from working for all cases: when FPU is granted to a guest KVM
> disabled CR0.TS/#NM intercepts, so guest is free to switch FPU from
> 32bit to 64bit mode without KVM knowing. Disabling this optimization
> will make FP intensive workload slow in a guest.

Not sure what you're trying to tell me with this explanation.

Jan



\
 
 \ /
  Last update: 2013-10-17 13:01    [W:0.038 / U:1.848 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site