From: "Alex Bennée" <alex.bennee@linaro.org>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>
Cc: Richard Henderson <richard.henderson@linaro.org>,
qemu-devel@nongnu.org, fei2.wu@intel.com,
"Vanderson M. do Rosario" <vandersonmr2@gmail.com>
Subject: Re: [PATCH v17 13/16] disas: Allow monitor_disas to read from ram_addr_t
Date: Sun, 15 Oct 2023 20:21:59 +0100 [thread overview]
Message-ID: <874jiry9fe.fsf@linaro.org> (raw)
In-Reply-To: <f0c26ccc-ba96-f0ef-4756-370f5114ec94@linaro.org>
Philippe Mathieu-Daudé <philmd@linaro.org> writes:
> On 3/10/23 20:30, Richard Henderson wrote:
>> From: "Vanderson M. do Rosario" <vandersonmr2@gmail.com>
>> Introduce a MonitorDisasSpace to replace the current is_physical
>> boolean argument to monitor_disas. Generate an error if we attempt
>> to read past the end of a single RAMBlock.
>> Signed-off-by: Vanderson M. do Rosario <vandersonmr2@gmail.com>
>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>> Signed-off-by: Fei Wu <fei2.wu@intel.com>
>> [rth: Split out of a larger patch; validate the RAMBlock size]
>> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
>> ---
>> include/disas/disas.h | 8 +++++++-
>> disas/disas-mon.c | 32 ++++++++++++++++++++++++++++++--
>> monitor/hmp-cmds-target.c | 27 ++++++++++++++++-----------
>> 3 files changed, 53 insertions(+), 14 deletions(-)
>> diff --git a/include/disas/disas.h b/include/disas/disas.h
>> index 176775eff7..cd99b0ccd0 100644
>> --- a/include/disas/disas.h
>> +++ b/include/disas/disas.h
>> @@ -5,8 +5,14 @@
>> void disas(FILE *out, const void *code, size_t size);
>> void target_disas(FILE *out, CPUState *cpu, uint64_t code, size_t size);
>> +typedef enum {
>> + MON_DISAS_GVA, /* virtual */
>> + MON_DISAS_GPA, /* physical */
>> + MON_DISAS_GRA, /* ram_addr_t */
>> +} MonitorDisasSpace;
>
>
> Obviously I'd rather see MonitorDisasSpace = {MON_DISAS_GVA/GPA}
> introduced in a preliminary patch, but just saying.
>
>> static void memory_dump(Monitor *mon, int count, int format, int wsize,
>> - hwaddr addr, int is_physical)
>> + hwaddr addr, MonitorDisasSpace space)
>> {
>> int l, line_size, i, max_digits, len;
>> uint8_t buf[16];
>> uint64_t v;
>> CPUState *cs = mon_get_cpu(mon);
>> - if (!cs && (format == 'i' || !is_physical)) {
>
> Why is the '!cs' check removed? Otherwise LGTM.
Yeah it breaks the monitor I think with should be:
if (!cs && (space == MON_DISAS_GVA || format == 'i'))
>
>> + if (space == MON_DISAS_GVA || format == 'i') {
>> monitor_printf(mon, "Can not dump without CPU\n");
>> return;
>> }
>> if (format == 'i') {
>> - monitor_disas(mon, cs, addr, count, is_physical);
>> - return;
>> + monitor_disas(mon, cs, addr, count, space);
>> }
>> len = wsize * count;
>> @@ -163,15 +162,21 @@ static void memory_dump(Monitor *mon, int count, int format, int wsize,
>> }
>> while (len > 0) {
>> - if (is_physical) {
>> - monitor_printf(mon, HWADDR_FMT_plx ":", addr);
>> - } else {
>> + switch (space) {
>> + case MON_DISAS_GVA:
>> monitor_printf(mon, TARGET_FMT_lx ":", (target_ulong)addr);
>> + break;
>> + case MON_DISAS_GPA:
>> + monitor_printf(mon, HWADDR_FMT_plx ":", addr);
>> + break;
>> + default:
>> + g_assert_not_reached();
>> }
>> l = len;
>> - if (l > line_size)
>> + if (l > line_size) {
>> l = line_size;
>> - if (is_physical) {
>> + }
>> + if (space == MON_DISAS_GPA) {
>> AddressSpace *as = cs ? cs->as : &address_space_memory;
>> MemTxResult r = address_space_read(as, addr,
>> MEMTXATTRS_UNSPECIFIED, buf, l);
>> @@ -235,7 +240,7 @@ void hmp_memory_dump(Monitor *mon, const QDict *qdict)
>> int size = qdict_get_int(qdict, "size");
>> target_long addr = qdict_get_int(qdict, "addr");
>> - memory_dump(mon, count, format, size, addr, 0);
>> + memory_dump(mon, count, format, size, addr, MON_DISAS_GVA);
>> }
--
Alex Bennée
Virtualisation Tech Lead @ Linaro
next prev parent reply other threads:[~2023-10-15 19:27 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-03 18:30 [PATCH v17 00/16] TCG code quality tracking Richard Henderson
2023-10-03 18:30 ` [PATCH v17 01/16] accel/tcg: Move HMP info jit and info opcount code Richard Henderson
2023-10-10 12:09 ` Philippe Mathieu-Daudé
2023-10-15 12:58 ` Alex Bennée
2023-10-03 18:30 ` [PATCH v17 02/16] tcg: Record orig_nb_ops TCGContext Richard Henderson
2023-10-15 12:57 ` Alex Bennée
2023-10-03 18:30 ` [PATCH v17 03/16] tcg: Record nb_deleted_ops in TCGContext Richard Henderson
2023-10-15 12:58 ` Alex Bennée
2023-10-03 18:30 ` [PATCH v17 04/16] tcg: Record nb_spills " Richard Henderson
2023-10-15 12:59 ` Alex Bennée
2023-10-03 18:30 ` [PATCH v17 05/16] accel/tcg: Add TBStatistics structure Richard Henderson
2023-10-16 14:38 ` Alex Bennée
2023-10-03 18:30 ` [PATCH v17 06/16] accel/tcg: Collect TB execution statistics Richard Henderson
2023-10-03 18:30 ` [PATCH v17 07/16] accel/tcg: Collect TB jit statistics Richard Henderson
2023-10-10 12:13 ` Philippe Mathieu-Daudé
2023-10-03 18:30 ` [PATCH v17 08/16] accel/tcg: Add tb_stats hmp command Richard Henderson
2023-10-03 18:30 ` [PATCH v17 09/16] util/log: Add Error argument to qemu_str_to_log_mask Richard Henderson
2023-10-10 12:55 ` Markus Armbruster
2023-10-15 18:55 ` Richard Henderson
2023-10-03 18:30 ` [PATCH v17 10/16] util/log: Add -d tb_stats Richard Henderson
2023-10-10 12:34 ` Philippe Mathieu-Daudé
2023-10-15 19:53 ` Richard Henderson
2023-10-03 18:30 ` [PATCH v17 11/16] accel/tcg: Add tb_stats_collect and tb_stats_dump Richard Henderson
2023-10-16 14:48 ` Alex Bennée
2023-10-03 18:30 ` [PATCH v17 12/16] softmmu: Export qemu_ram_ptr_length Richard Henderson
2023-10-10 12:31 ` Philippe Mathieu-Daudé
2023-10-03 18:30 ` [PATCH v17 13/16] disas: Allow monitor_disas to read from ram_addr_t Richard Henderson
2023-10-10 12:46 ` Philippe Mathieu-Daudé
2023-10-15 19:21 ` Alex Bennée [this message]
2023-10-03 18:30 ` [PATCH v17 14/16] monitor: Change MonitorDec.get_value return type to int64_t Richard Henderson
2023-10-16 14:59 ` Alex Bennée
2023-10-16 15:43 ` Alex Bennée
2023-10-03 18:30 ` [PATCH v17 15/16] accel/tcg: Add info [tb-list|tb] commands to HMP Richard Henderson
2023-10-16 15:02 ` Alex Bennée
2023-10-03 18:30 ` [PATCH v17 16/16] accel/tcg: Dump hot TBs at the end of the execution Richard Henderson
2023-10-10 12:36 ` Philippe Mathieu-Daudé
2023-10-10 13:23 ` Alex Bennée
2024-11-14 9:28 ` [PATCH v17 00/16] TCG code quality tracking Nikita Shubin
2025-01-21 10:22 ` Chinmay Rath
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=874jiry9fe.fsf@linaro.org \
--to=alex.bennee@linaro.org \
--cc=fei2.wu@intel.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.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).