On Wed, May 9, 2012 at 3:29 AM, Rusty Russell <rusty.russell at linaro.org> wrote: > On Sat, 17 Mar 2012 09:59:23 +0100, Antonios Motakis <a.motakis at virtualopensystems.com> wrote: >> Applies to commit 827ee5bffde826336c4a7f33109347c77a2cbbcf of the >> latest kvm-a15-v7 branch. >> >> This patch allows to safely run guests that use the VFP and NEON >> floating point extensions. When we switch to a guest, we save >> the host's state (registers with floating point data, configuration >> registers) and load those used by the guest. We can also handle >> versions of the extensions with ?16 or 32 double registers, and >> also the registers introduced by the Common VFP Subarchitecture, as >> defined in the ARM Architecture Reference Manual, Issue C. >> >> Possible future improvements include letting QEMU fetch a copy of the >> registers, and lazy switching of the registers only when they are >> actually used. >> >> Signed-off-by: Antonios Motakis <a.motakis at virtualopensystems.com> > > Hi Antonios, > > ? ? ? ?Nice work! > > AFAICT, this is going to be fairly inefficient. ?Not just because we're > saving and restoring even when the FP registers are not being used, but > also because the (host) kernel does very naive lazy FPU restore, so > we'll be doing an undefined trap in the host every time we run this code > after a context switch. > > I'm thinking we should use HCPTR to do lazy FPU enable. ?It might be > best to have an arg to __kvm_vcpu_run() which activates your code; that > way we can always set it to 'true' now, and false later as we get smarter. > We need to implement lazy switching of FPU state for the guest for the initial version of this patch to be merged. Antonios, can you prepare this within a reasonable time frame? Thanks, Christoffer