Received: from eggs.gnu.org ([208.118.235.92]:60837) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tr4dp-0001hZ-7U for qemu-devel@nongnu.org; Fri, 04 Jan 2013 05:36:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tr4do-0008Is-9c for qemu-devel@nongnu.org; Fri, 04 Jan 2013 05:36:45 -0500 Received: from cantor2.suse.de ([195.135.220.15]:34983 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tr4do-0008Ij-0z for qemu-devel@nongnu.org; Fri, 04 Jan 2013 05:36:44 -0500 Mime-Version: 1.0 (Apple Message framework v1278) Content-Type: text/plain; charset=us-ascii From: Alexander Graf In-Reply-To: <6A3DF150A5B70D4F9B66A25E3F7C888D06542EF7@039-SN2MPN1-022.039d.mgd.msft.net> Date: Fri, 4 Jan 2013 11:36:40 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: <9B2CB541-8806-4BDF-A523-FD597BDFA08B@suse.de> References: <1356098191-4998-1-git-send-email-jjherne@us.ibm.com> <133FEF92-3C4F-48C8-BF67-E50066EEEF45@suse.de> <50E5D29B.6060804@linux.vnet.ibm.com> <20130104013812.GB23746@amt.cnet> <6A3DF150A5B70D4F9B66A25E3F7C888D06542905@039-SN2MPN1-022.039d.mgd.msft.net> <292DDE3D-7B6F-400E-954B-49CA3E284FDB@suse.de> <6A3DF150A5B70D4F9B66A25E3F7C888D06542EA8@039-SN2MPN1-022.039d.mgd.msft.net> <6A3DF150A5B70D4F9B66A25E3F7C888D06542EF7@039-SN2MPN1-022.039d.mgd.msft.net> Subject: Re: [Qemu-devel] [PATCH 7/7] KVM regsync: Fix do_kvm_cpu_synchronize_state data integrity issue List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Bhushan Bharat-R65777 Cc: Christian Borntraeger , Anthony Liguori , Marcelo Tosatti , "qemu-devel@nongnu.org qemu-devel" , "jjherne@linux.vnet.ibm.com" On 04.01.2013, at 11:32, Bhushan Bharat-R65777 wrote: >=20 >=20 >> -----Original Message----- >>>>>=20 >>>>> Int timer_func(CPUxxState env) >>>>> { >>>>> Struct timer_regs; >>>>> read_regs_type((env, &timer_regs,TIMER_REGS); >>>>> //update env->timer_registers >>>>> Write_regs_type(env, TIMER_REGS) >>>>> } >>>>>=20 >>>>> This will get one type of register_types and can cause multiple >>>>> IOCTL per >>>> entry to QEMU. >>>>=20 >>>> This is still too explicit. How about >>>>=20 >>>> static inline void ppc_set_tsr(CPUState *env, target_ulong val) { >>>> env->kvm_sync_extra |=3D SYNC_TIMER_REGS; >>>> cpu_synchronize_registers(env); >>>> env->spr[SPR_TSR] =3D val; >>>=20 >>> You also want env->kvm_sync_dirty also, right? >>=20 >> Not quite, since SYNC_TIMER_REGS spans more than only TSR. So we need = to make >> sure we fetch the non-TSR register values before we can declare = TIMER_REGS as >> dirty. >=20 > Right , I actually want communicate mark dirty the TIMER_REGS only :) Imagine TIMER_REGS includes TSR and TCR. Then ppc_set_tsr(); should still work without a respective ppc_set_tcr() call. So we can't = just mark it dirty here. The only way we could optimize this bit would = be by either splitting the bitmap per register or by extending the = setter functions to the full scope of the sync: static inline void ppc_set_timer_regs(CPUState *env, target_ulong tsr, = target_ulong tcr) { ... } Alex