From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=59267 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PvvyI-0005rC-6Y for qemu-devel@nongnu.org; Sat, 05 Mar 2011 13:12:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PvvyG-00081x-VV for qemu-devel@nongnu.org; Sat, 05 Mar 2011 13:12:54 -0500 Received: from fmmailgate01.web.de ([217.72.192.221]:46206) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PvvyG-00081l-8h for qemu-devel@nongnu.org; Sat, 05 Mar 2011 13:12:52 -0500 Message-ID: <4D727D22.2030700@web.de> Date: Sat, 05 Mar 2011 19:12:50 +0100 From: Jan Kiszka MIME-Version: 1.0 References: <481368ec2de108b87df4cd11c2bd870b215e49b5.1299233998.git.jan.kiszka@siemens.com> <20110305160519.GA4387@amt.cnet> In-Reply-To: <20110305160519.GA4387@amt.cnet> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigD0B739470B52438F1378772D" Sender: jan.kiszka@web.de Subject: [Qemu-devel] Re: [PATCH 11/15] kvm: Rework inner loop of kvm_cpu_exec List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Marcelo Tosatti Cc: Avi Kivity , kvm@vger.kernel.org, qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigD0B739470B52438F1378772D Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 2011-03-05 17:05, Marcelo Tosatti wrote: > On Fri, Mar 04, 2011 at 11:20:08AM +0100, Jan Kiszka wrote: >> Let kvm_cpu_exec return EXCP_* values consistently and generate those >> codes already inside its inner loop. This means we will now re-enter t= he >> kernel while ret =3D=3D 0. >> >> Update kvm_handle_internal_error accordingly, but keep >> kvm_arch_handle_exit untouched, it will be converted in a separate ste= p. >> >> Signed-off-by: Jan Kiszka >> --- >> kvm-all.c | 26 ++++++++++++++------------ >> 1 files changed, 14 insertions(+), 12 deletions(-) >> >> diff --git a/kvm-all.c b/kvm-all.c >> index 2952499..cc652cf 100644 >> --- a/kvm-all.c >> +++ b/kvm-all.c >> @@ -848,7 +848,7 @@ static int kvm_handle_internal_error(CPUState *env= , struct kvm_run *run) >> fprintf(stderr, "emulation failure\n"); >> if (!kvm_arch_stop_on_emulation_error(env)) { >> cpu_dump_state(env, stderr, fprintf, CPU_DUMP_CODE); >> - return 0; >> + return EXCP_INTERRUPT; >> } >> } >> /* FIXME: Should trigger a qmp message to let management know >> @@ -947,7 +947,7 @@ int kvm_cpu_exec(CPUState *env) >> =20 >> if (ret =3D=3D -EINTR || ret =3D=3D -EAGAIN) { >> DPRINTF("io window exit\n"); >> - ret =3D 0; >> + ret =3D EXCP_INTERRUPT; >> break; >> } >> =20 >> @@ -956,7 +956,6 @@ int kvm_cpu_exec(CPUState *env) >> abort(); >> } >> =20 >> - ret =3D 0; /* exit loop */ >> switch (run->exit_reason) { >=20 > Better keep ret assignment here so default behaviour is to=20 > exit loop? EXCP_INTERRUPT. There is no real default behavior: in two cases we stay in the loop, in two others we leave, and the rest obtains ret from a return value. Moreover, if a new case misses to set ret, the compiler will complain. Jan --------------enigD0B739470B52438F1378772D 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.15 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org/ iEYEARECAAYFAk1yfSIACgkQitSsb3rl5xTrmwCfdXrFtU/EHEv02qGTGbgTwHHh TC0An25zIw8cnFPcN9/PJ06+HYkS2Jnb =85OW -----END PGP SIGNATURE----- --------------enigD0B739470B52438F1378772D--