From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34050) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W5GNW-0001rT-9q for qemu-devel@nongnu.org; Mon, 20 Jan 2014 10:03:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W5GNJ-0003hw-MK for qemu-devel@nongnu.org; Mon, 20 Jan 2014 10:03:06 -0500 Received: from mail-pd0-f181.google.com ([209.85.192.181]:51898) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W5GNJ-0003hi-GG for qemu-devel@nongnu.org; Mon, 20 Jan 2014 10:02:53 -0500 Received: by mail-pd0-f181.google.com with SMTP id y10so3389050pdj.12 for ; Mon, 20 Jan 2014 07:02:52 -0800 (PST) Message-ID: <52DD3A8D.4050508@ozlabs.ru> Date: Tue, 21 Jan 2014 02:02:37 +1100 From: Alexey Kardashevskiy MIME-Version: 1.0 References: <1389761859-10150-1-git-send-email-aik@ozlabs.ru> <2A4B3B3D-EA5D-41F0-A986-ABCB2020BFA3@suse.de> In-Reply-To: <2A4B3B3D-EA5D-41F0-A986-ABCB2020BFA3@suse.de> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] spapr: reset @kvm_vcpu_dirty before starting CPU List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Graf Cc: Paolo Bonzini , qemu-ppc , QEMU Developers , =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= On 01/21/2014 01:45 AM, Alexander Graf wrote: > > On 15.01.2014, at 05:57, Alexey Kardashevskiy wrote: > >> Normally QEMU kvm_arch_get_registers() reads registers and sets a dirty >> flag which prevents further registers reading from KVM till >> kvm_arch_put_registers() executes and resets the flag. >> >> However if we run QEMU with "-S" ("suspended"), then execute "info cpus" >> from the QEMU monitor, we end up with not reading registers in >> rtas_start_cpu() as qmp_query_cpus() calls kvm_cpu_synchronize_state() >> which leaves @kvm_vcpu_dirty=true what prevents kvm_cpu_synchronize_state() >> from synchronizing registers and we loose the values. > > But that's fine because the values are already synchronized and couldn't > have changed because the guest cpu wasn't running, no? Discovered today that "[PATCH] spapr: fix H_SET_MODE to sync LPCR with KVM" seems to be v2 of this as that patch solves the issue this patch was intended to solve so I'll drop this one. > > > Alex > >> >> This resets @kvm_vcpu_dirty flag as we do not have content which we really want to >> keep at this point as the CPU is halted. >> >> Signed-off-by: Alexey Kardashevskiy >> --- >> >> We could also reset @kvm_vcpu_dirty in qmp_query_cpus() but that would be >> racy. >> --- >> hw/ppc/spapr_rtas.c | 2 ++ >> 1 file changed, 2 insertions(+) >> >> diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c >> index 1cb276d..3dade5e 100644 >> --- a/hw/ppc/spapr_rtas.c >> +++ b/hw/ppc/spapr_rtas.c >> @@ -185,6 +185,8 @@ static void rtas_start_cpu(PowerPCCPU *cpu_, sPAPREnvironment *spapr, >> /* This will make sure qemu state is up to date with kvm, and >> * mark it dirty so our changes get flushed back before the >> * new cpu enters */ >> + >> + cs->kvm_vcpu_dirty = false; >> kvm_cpu_synchronize_state(cs); >> >> env->msr = (1ULL << MSR_SF) | (1ULL << MSR_ME); >> -- >> 1.8.4.rc4 >> > -- Alexey