On Wed, Jan 16, 2013 at 05:00:52PM +0000, Bhushan Bharat-R65777 wrote: > Second-) > Currently kvm_arch_get_registers() is not optimized in two sense; one, it > always get all registers from KVM; two, in kvm_arch_get_registers() it copies > all registers to env->. This patch-set handles the second issue of > optimization, copy only the requested registers to env-> in > kvm_arch_get_registers(), plus when kvm_arch_put_registers() is called then > it copies only the modified registers for KVM_SET_SREGS. > > This optimization is looking good to me and allows sync of registers via one > common kvm_arch_get/set_registers() and no separate function definition for > setting is needed for timer related changes.
To be clearer. For example, executing: - kvm_get_regs(FULL_STATE) - kvm_put_regs(FULL_STATE) Is reading and writing the full register set while in runtime state. /* full state set, modified during initialization or on vmload */ #define KVM_PUT_FULL_STATE 3 Again, its necessary to read the full state on "cpu_synchronize_state" because its not specified which registers can be modified during ioctl(KVM_RUN) (therefore separating get registers operation in full/reset/runtime sets is awkward). But direct read/write of registers is also bad: if a given register is read and modified (but not written back), then reading through ioctl() returns a wrong value. Apparently accessors are the best option.