From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:38604) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TvZVX-0007A8-Kj for qemu-devel@nongnu.org; Wed, 16 Jan 2013 15:22:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TvZVV-0007WB-Bj for qemu-devel@nongnu.org; Wed, 16 Jan 2013 15:22:47 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48230) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TvZVV-0007Vo-2T for qemu-devel@nongnu.org; Wed, 16 Jan 2013 15:22:45 -0500 Date: Wed, 16 Jan 2013 18:09:15 -0200 From: Marcelo Tosatti Message-ID: <20130116200914.GA1413@amt.cnet> References: <1357831744-3950-1-git-send-email-jjherne@us.ibm.com> <20130116160533.GA8541@amt.cnet> <6A3DF150A5B70D4F9B66A25E3F7C888D06564C9A@039-SN2MPN1-023.039d.mgd.msft.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6A3DF150A5B70D4F9B66A25E3F7C888D06564C9A@039-SN2MPN1-023.039d.mgd.msft.net> Subject: Re: [Qemu-devel] [PATCH 4/7 v2] KVM regsync: Add register bitmap parameter to do_kvm_cpu_synchronize_state List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Bhushan Bharat-R65777 Cc: "agraf@suse.de" , "aliguori@us.ibm.com" , "jan.kiszka@siemens.com" , "qemu-devel@nongnu.org" , "Jason J. Herne" , "borntraeger@de.ibm.com" 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.