From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O47kA-0001S9-1D for qemu-devel@nongnu.org; Tue, 20 Apr 2010 03:19:38 -0400 Received: from [140.186.70.92] (port=33492 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O47jp-0001LH-QD for qemu-devel@nongnu.org; Tue, 20 Apr 2010 03:19:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O47je-0000SJ-8E for qemu-devel@nongnu.org; Tue, 20 Apr 2010 03:19:17 -0400 Received: from fmmailgate03.web.de ([217.72.192.234]:34996) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O47jZ-0000RL-Np for qemu-devel@nongnu.org; Tue, 20 Apr 2010 03:19:02 -0400 Message-ID: <4BCD5560.6070004@web.de> Date: Tue, 20 Apr 2010 09:18:56 +0200 From: Jan Kiszka MIME-Version: 1.0 References: <4BC8D2E8.3030309@mail.berlios.de> In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigC8F2F05C0AA3643478D24B74" Sender: jan.kiszka@web.de Subject: [Qemu-devel] Re: [PATCH] flush TB on singlestep command List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jun Koi Cc: qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigC8F2F05C0AA3643478D24B74 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Jun Koi wrote: > Thank you for the explanation of this code. >=20 > Qemu has a command named singlestep, which reduces the translated code > block to be only one instruction. > This new patch flushes TBs both when singlestep is on and off. >=20 > Signed-off-by: Jun Koi >=20 >=20 > diff --git a/monitor.c b/monitor.c > index 5659991..2b2005b 100644 > --- a/monitor.c > +++ b/monitor.c > @@ -1187,13 +1187,26 @@ static void do_log(Monitor *mon, const QDict *q= dict) > cpu_set_log(mask); > } >=20 > +/* flush all the TBs to force new code generation */ > +static void flush_all_tb(void) > +{ > + CPUState *env; > + > + for (env =3D first_cpu; env !=3D NULL; env =3D env->next_cpu) { > + tb_flush(env); > + } > +} > + The smaller your patch are, the more people pick on it. :) I was about to suggest moving this close to tb_flush, but then I realized that the env argument of that service is misleading. In fact, it already flushes the one and only translation buffer pool. > static void do_singlestep(Monitor *mon, const QDict *qdict) > { > const char *option =3D qdict_get_try_str(qdict, "option"); > + > if (!option || !strcmp(option, "on")) { > singlestep =3D 1; > + flush_all_tb(); > } else if (!strcmp(option, "off")) { > singlestep =3D 0; > + flush_all_tb(); > } else { > monitor_printf(mon, "unexpected option %s\n", option); > } >=20 Let's just pass mon->mon_cpu to tb_flush and skip the redundant loop. Jan --------------enigC8F2F05C0AA3643478D24B74 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.9 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org iEYEARECAAYFAkvNVWMACgkQitSsb3rl5xSuhwCgzSF7BTX7+BDE+/1cj1xEartg TgEAoNSWA793IdE+OTInCK0B0TykN3Ep =VqGy -----END PGP SIGNATURE----- --------------enigC8F2F05C0AA3643478D24B74--