From: Jan Kiszka <jan.kiszka@web.de>
To: Jun Koi <junkoi2004@gmail.com>
Cc: qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: [PATCH] flush TB on singlestep command
Date: Tue, 20 Apr 2010 09:18:56 +0200 [thread overview]
Message-ID: <4BCD5560.6070004@web.de> (raw)
In-Reply-To: <o2mfdaac4d51004191817h7158e19dy448b40502839a431@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1562 bytes --]
Jun Koi wrote:
> Thank you for the explanation of this code.
>
> 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.
>
> Signed-off-by: Jun Koi <junkoi2004@gmail.com>
>
>
> 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 *qdict)
> cpu_set_log(mask);
> }
>
> +/* flush all the TBs to force new code generation */
> +static void flush_all_tb(void)
> +{
> + CPUState *env;
> +
> + for (env = first_cpu; env != NULL; env = 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 = qdict_get_try_str(qdict, "option");
> +
> if (!option || !strcmp(option, "on")) {
> singlestep = 1;
> + flush_all_tb();
> } else if (!strcmp(option, "off")) {
> singlestep = 0;
> + flush_all_tb();
> } else {
> monitor_printf(mon, "unexpected option %s\n", option);
> }
>
Let's just pass mon->mon_cpu to tb_flush and skip the redundant loop.
Jan
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 257 bytes --]
next prev parent reply other threads:[~2010-04-20 7:19 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-16 1:03 [Qemu-devel] [PATCH] flush TB on singlestep command Jun Koi
2010-04-16 21:13 ` Stefan Weil
2010-04-20 1:17 ` Jun Koi
2010-04-20 7:18 ` Jan Kiszka [this message]
2010-04-20 10:51 ` [Qemu-devel] " Alexander Graf
2010-04-20 11:38 ` Jan Kiszka
2010-04-20 11:44 ` Alexander Graf
2010-04-21 10:04 ` Jun Koi
2010-04-21 10:11 ` Alexander Graf
2010-04-21 10:43 ` Jan Kiszka
2010-04-21 19:20 ` Stefan Weil
2010-04-22 7:02 ` Jan Kiszka
2010-04-27 19:55 ` Stefan Weil
2010-04-27 23:50 ` Jun Koi
2010-04-28 18:06 ` Stefan Weil
2010-04-22 7:14 ` Jun Koi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4BCD5560.6070004@web.de \
--to=jan.kiszka@web.de \
--cc=junkoi2004@gmail.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.