From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55594) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W5HbD-0000ID-Qb for qemu-devel@nongnu.org; Mon, 20 Jan 2014 11:21:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W5Hb7-0003sR-Lw for qemu-devel@nongnu.org; Mon, 20 Jan 2014 11:21:19 -0500 Message-ID: <52DD4CEA.4030307@suse.de> Date: Mon, 20 Jan 2014 17:20:58 +0100 From: =?ISO-8859-15?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <1389761859-10150-1-git-send-email-aik@ozlabs.ru> In-Reply-To: <1389761859-10150-1-git-send-email-aik@ozlabs.ru> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable 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: Alexey Kardashevskiy , qemu-devel@nongnu.org Cc: Paolo Bonzini , qemu-ppc@nongnu.org, Alexander Graf Am 15.01.2014 05:57, schrieb Alexey Kardashevskiy: > 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. >=20 > 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=3Dtrue what prevents kvm_cpu_synchronize_s= tate() > from synchronizing registers and we loose the values. >=20 > This resets @kvm_vcpu_dirty flag as we do not have content which we rea= lly want to > keep at this point as the CPU is halted. >=20 > Signed-off-by: Alexey Kardashevskiy > --- >=20 > 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(+) >=20 > 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_, sPAPRE= nvironment *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 =3D false; > kvm_cpu_synchronize_state(cs); While I am not familiar with whether or not the dirty flag should be changed, I've noticed in the past that sPAPR is the only user of kvm_cpu_synchronize_state() outside of KVM code IIUC. Would be nice if you could replace that with cpu_synchronize_state() in its own patch when you find some time. Regards, Andreas > =20 > env->msr =3D (1ULL << MSR_SF) | (1ULL << MSR_ME); >=20 --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrnbe= rg