From: Richard Henderson <richard.henderson@linaro.org>
To: "Wu, Fei" <fei2.wu@intel.com>,
alex.bennee@linaro.org, qemu-devel@nongnu.org
Cc: "Vanderson M. do Rosario" <vandersonmr2@gmail.com>,
"Dr . David Alan Gilbert" <dgilbert@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
"Dr. David Alan Gilbert" <dave@treblig.org>,
Peter Maydell <peter.maydell@linaro.org>
Subject: Re: [PATCH v15 07/10] tb-stats: Adding info [tb-list|tb] commands to HMP (WIP)
Date: Mon, 12 Jun 2023 09:17:02 +0200 [thread overview]
Message-ID: <63354939-ae21-dbbd-c788-1acacc64abae@linaro.org> (raw)
In-Reply-To: <81e761e4-7776-b569-229f-f0bd8257145d@intel.com>
On 6/12/23 03:44, Wu, Fei wrote:
> On 6/7/2023 8:24 PM, Fei Wu wrote:
>> +void hmp_info_tb(Monitor *mon, const QDict *qdict)
>> +{
>> + const int id = qdict_get_int(qdict, "id");
>> + g_autoptr(GString) buf = g_string_new("");
>> +
>> + if (!tcg_enabled()) {
>> + monitor_printf(mon, "Only available with accel=tcg\n");
>> + return;
>> + }
>> +
>> + TBStatistics *tbs = get_tbstats_by_id(id);
>> + if (tbs == NULL) {
>> + monitor_printf(mon, "TB %d information is not recorded\n", id);
>> + return;
>> + }
>> +
>> + monitor_printf(mon, "\n------------------------------\n\n");
>> +
>> + int valid_tb_num = dump_tb_info(buf, tbs, id);
>> + monitor_printf(mon, "%s", buf->str);
>> +
>> + if (valid_tb_num > 0) {
>> + unsigned num_inst = tbs->code.num_guest_inst / tbs->translations.total;
>> +
>> + monitor_printf(mon, "\n----------------n\n");
>> + // FIXME: cannot disas
>> + monitor_disas(mon, mon_get_cpu(mon), tbs->phys_pc, num_inst, true);
>> + monitor_printf(mon, "\n------------------------------\n\n");
>> + }
>> +}
>> +
> So far the following methods are candidates for monitor_disas:
>
> 1. still use ram_addr_t for tbs->phys_pc, and extend monitor_disas to
> support disassemble ram_addr_t by using qemu_map_ram_ptr(NULL, ram_addr)
> to convert it to hva first
>
> 2. use gpa for tbs->phys_pc, there is no need to change monitor_disas,
> but add another parameter for get_page_addr_code_hostp() to return extra
> gpa, probe_access_internal() has already returned CPUTLBEntryFull, so
> it's plain to get gpa here.
No, we need the ram_addr_t for dirty-page handling in order to detect self-modifying code.
Leave tb->phys_pc alone.
r~
>
> 3. record gpa in another field of tbs, and keep tbs->phys_pc as it is,
> this is just a variation of #2.
>
> I'm inclined to use method #2. I think gpa carries more information for
> debugging than ram_addr_t, guest can map gpa to the executable file
> etc., but it has little knowledge of ram_addr_t.
>
> What do you suggest?
>
> Thanks,
> Fei.
>
next prev parent reply other threads:[~2023-06-12 7:17 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-07 12:24 [PATCH v15 00/10] TCG code quality tracking Fei Wu
2023-06-07 12:24 ` [PATCH v15 01/10] accel/tcg: remove CONFIG_PROFILER Fei Wu
2023-06-07 12:24 ` [PATCH v15 02/10] accel/tcg: introduce TBStatistics structure Fei Wu
2023-06-07 12:24 ` [PATCH v15 03/10] accel: collecting TB execution count Fei Wu
2023-06-07 12:24 ` [PATCH v15 04/10] accel/tcg: add jit stats to TBStatistics Fei Wu
2023-06-07 12:24 ` [PATCH v15 05/10] monitor: adding tb_stats hmp command Fei Wu
2023-06-07 12:24 ` [PATCH v15 06/10] tb-stats: reset the tracked TBs on a tb_flush Fei Wu
2023-06-07 12:24 ` [PATCH v15 07/10] tb-stats: Adding info [tb-list|tb] commands to HMP (WIP) Fei Wu
2023-06-12 1:44 ` Wu, Fei
2023-06-12 7:17 ` Richard Henderson [this message]
2023-06-12 9:11 ` Wu, Fei
2023-06-07 12:24 ` [PATCH v15 08/10] debug: add -d tb_stats to control TBStatistics Fei Wu
2023-06-07 12:24 ` [PATCH v15 09/10] tb-stats: dump hot TBs at the end of the execution Fei Wu
2023-06-07 12:24 ` [PATCH v15 10/10] docs: add tb-stats how to Fei Wu
2023-06-12 11:04 ` [PATCH v15 00/10] TCG code quality tracking Wu, Fei
2023-06-13 3:29 ` Wu, Fei
2023-06-16 1:32 ` Wu, Fei
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=63354939-ae21-dbbd-c788-1acacc64abae@linaro.org \
--to=richard.henderson@linaro.org \
--cc=alex.bennee@linaro.org \
--cc=dave@treblig.org \
--cc=dgilbert@redhat.com \
--cc=fei2.wu@intel.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=vandersonmr2@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).