From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:57662) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RwDzF-0004MJ-6E for qemu-devel@nongnu.org; Sat, 11 Feb 2012 09:31:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RwDzD-0000p5-Oi for qemu-devel@nongnu.org; Sat, 11 Feb 2012 09:31:37 -0500 Received: from fmmailgate03.web.de ([217.72.192.234]:34975) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RwDzD-0000ox-Cg for qemu-devel@nongnu.org; Sat, 11 Feb 2012 09:31:35 -0500 Received: from moweb001.kundenserver.de (moweb001.kundenserver.de [172.19.20.114]) by fmmailgate03.web.de (Postfix) with ESMTP id 701DA1B0C773F for ; Sat, 11 Feb 2012 15:31:34 +0100 (CET) Message-ID: <4F367BC2.1010407@web.de> Date: Sat, 11 Feb 2012 15:31:30 +0100 From: Jan Kiszka MIME-Version: 1.0 References: In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig2258D6A33C1FF069760CD7ED" Subject: Re: [Qemu-devel] [PATCH v2 2/8] Allow to use pause_all_vcpus from VCPU context List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Blue Swirl Cc: Anthony Liguori , Gleb Natapov , kvm@vger.kernel.org, Marcelo Tosatti , qemu-devel , Avi Kivity , Paolo Bonzini This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig2258D6A33C1FF069760CD7ED Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 2012-02-11 15:16, Blue Swirl wrote: > On Fri, Feb 10, 2012 at 18:31, Jan Kiszka wrot= e: >> In order to perform critical manipulations on the VM state in the >> context of a VCPU, specifically code patching, stopping and resuming o= f >> all VCPUs may be necessary. resume_all_vcpus is already compatible, no= w >> enable pause_all_vcpus for this use case by stopping the calling conte= xt >> before starting to wait for the whole gang. >> >> CC: Paolo Bonzini >> Signed-off-by: Jan Kiszka >> --- >> cpus.c | 12 ++++++++++++ >> 1 files changed, 12 insertions(+), 0 deletions(-) >> >> diff --git a/cpus.c b/cpus.c >> index d0c8340..5adfc6b 100644 >> --- a/cpus.c >> +++ b/cpus.c >> @@ -870,6 +870,18 @@ void pause_all_vcpus(void) >> penv =3D (CPUState *)penv->next_cpu; >> } >> >> + if (!qemu_thread_is_self(&io_thread)) { >> + cpu_stop_current(); >> + if (!kvm_enabled()) { >> + while (penv) { >> + penv->stop =3D 0; >> + penv->stopped =3D 1; >> + penv =3D (CPUState *)penv->next_cpu; >=20 > The cast is useless, next_cpu is already CPUState *. I wonder why it > is used in other cases too. Indeed, weird. We can clean the others up separately. Jan --------------enig2258D6A33C1FF069760CD7ED Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk82e8IACgkQitSsb3rl5xRbRACfU2lXg5EA7hx8qnxcZ+Qb2hs6 kbwAoJ1+U3ioi51INPKnoz9qNhgFdlD8 =Xsbr -----END PGP SIGNATURE----- --------------enig2258D6A33C1FF069760CD7ED--