[Android-virt] [RFC PATCH] ARM: KVM: Handle VFP/NEON state switching

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

Cheers,
Rusty.


[Index of Archives]     [Linux KVM]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux