qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Markus Armbruster <armbru@redhat.com>
Cc: qemu-devel@nongnu.org, "Zhao Liu" <zhao1.liu@intel.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Pierrick Bouvier" <pierrick.bouvier@linaro.org>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Eduardo Habkost" <eduardo@habkost.net>,
	"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
	"Yanan Wang" <wangyanan55@huawei.com>,
	"Eric Blake" <eblake@redhat.com>
Subject: Re: [PATCH v6 01/39] hw/core/machine: Display CPU model name in 'info cpus' command
Date: Tue, 15 Jul 2025 10:48:29 +0200	[thread overview]
Message-ID: <5f1fbfe7-d990-484f-825a-64af2781ac3c@linaro.org> (raw)
In-Reply-To: <87zfdksg8j.fsf@pond.sub.org>

On 4/7/25 06:59, Markus Armbruster wrote:
> Philippe Mathieu-Daudé <philmd@linaro.org> writes:
> 
>> Display the CPU model in 'info cpus'. Example before:
>>
>>   $ qemu-system-aarch64 -M xlnx-versal-virt -S -monitor stdio
>>   QEMU 10.0.0 monitor - type 'help' for more information
>>   (qemu) info cpus
>>   * CPU #0: thread_id=42924
>>     CPU #1: thread_id=42924
>>     CPU #2: thread_id=42924
>>     CPU #3: thread_id=42924
>>   (qemu) q
>>
>> and after:
>>
>>   $ qemu-system-aarch64 -M xlnx-versal-virt -S -monitor stdio
>>   QEMU 10.0.50 monitor - type 'help' for more information
>>   (qemu) info cpus
>>   * CPU #0: thread_id=42916 (cortex-a72)
>>     CPU #1: thread_id=42916 (cortex-a72)
>>     CPU #2: thread_id=42916 (cortex-r5f)
>>     CPU #3: thread_id=42916 (cortex-r5f)
>>   (qemu)
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
>> Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
>> Tested-by: Zhao Liu <zhao1.liu@intel.com>
>> ---
>>   qapi/machine.json          | 3 +++
>>   hw/core/machine-hmp-cmds.c | 3 ++-
>>   hw/core/machine-qmp-cmds.c | 1 +
>>   3 files changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/qapi/machine.json b/qapi/machine.json
>> index 0650b8de71a..d5bbb5e367e 100644
>> --- a/qapi/machine.json
>> +++ b/qapi/machine.json
>> @@ -80,6 +80,8 @@
>>   #
>>   # @thread-id: ID of the underlying host thread
>>   #
>> +# @model: CPU model name (since 10.1)
>> +#
>>   # @props: properties associated with a virtual CPU, e.g. the socket id
>>   #
>>   # @target: the QEMU system emulation target, which determines which
>> @@ -91,6 +93,7 @@
>>     'base'          : { 'cpu-index'    : 'int',
>>                         'qom-path'     : 'str',
>>                         'thread-id'    : 'int',
>> +                      'model'        : 'str',
>>                         '*props'       : 'CpuInstanceProperties',
>>                         'target'       : 'SysEmuTarget' },
>>     'discriminator' : 'target',
>> diff --git a/hw/core/machine-hmp-cmds.c b/hw/core/machine-hmp-cmds.c
>> index c6325cdcaaa..65eeb5e9cc2 100644
>> --- a/hw/core/machine-hmp-cmds.c
>> +++ b/hw/core/machine-hmp-cmds.c
>> @@ -40,7 +40,8 @@ void hmp_info_cpus(Monitor *mon, const QDict *qdict)
>>   
>>           monitor_printf(mon, "%c CPU #%" PRId64 ":", active,
>>                          cpu->value->cpu_index);
>> -        monitor_printf(mon, " thread_id=%" PRId64 "\n", cpu->value->thread_id);
>> +        monitor_printf(mon, " thread_id=%" PRId64 " (%s)\n",
>> +                       cpu->value->thread_id, cpu->value->model);
>>       }
>>   
>>       qapi_free_CpuInfoFastList(cpu_list);
>> diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c
>> index d82043e1c68..ab4fd1ec08a 100644
>> --- a/hw/core/machine-qmp-cmds.c
>> +++ b/hw/core/machine-qmp-cmds.c
>> @@ -47,6 +47,7 @@ CpuInfoFastList *qmp_query_cpus_fast(Error **errp)
>>           value->cpu_index = cpu->cpu_index;
>>           value->qom_path = object_get_canonical_path(OBJECT(cpu));
>>           value->thread_id = cpu->thread_id;
>> +        value->model = cpu_model_from_type(object_get_typename(OBJECT(cpu)));
>>   
>>           if (mc->cpu_index_to_instance_props) {
>>               CpuInstanceProperties *props;
> 
> Does the conversion from CPU type name to model name lose information?

Likely.

> If yes, should we provide the type name at least in QMP?

OK.

> Let me also try a different angle...  what's the preferred thing for
> users of HMP and for users of QMP, CPU model name or CPU type name?
> 
> Are there any commands that accept one, but not the other?

Likely. In particular the CLI expect model names for '-cpu',
except when created as '-device' were the type name is expected...

> Are there other commands that return one, but not the other?

QMP commands usually return the QOM type name, not the model.


IMHO the external interface should be the CPU model name. Keeping it
simple, an example could be "max".

The internal interface (QOM type name) is used to compose the QOM model.
Some types end verbose, such "riscv64-max-tcg". I expect such
information to be more relevant to an experimented QEMU developer or in
a bug report rather than exposed to the users.

Anyway, I'll respin using type name for QMP and model name for HMP.

Thanks,

Phil.



  reply	other threads:[~2025-07-15  8:48 UTC|newest]

Thread overview: 112+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-03 17:32 [PATCH v6 00/39] accel: Preparatory cleanups for split-accel Philippe Mathieu-Daudé
2025-07-03 17:32 ` [PATCH v6 01/39] hw/core/machine: Display CPU model name in 'info cpus' command Philippe Mathieu-Daudé
2025-07-04  3:10   ` Xiaoyao Li
2025-07-04  4:59   ` Markus Armbruster
2025-07-15  8:48     ` Philippe Mathieu-Daudé [this message]
2025-07-03 17:32 ` [PATCH v6 02/39] system/memory: Restrict eventfd dispatch_write() to emulators Philippe Mathieu-Daudé
2025-07-04  3:32   ` Xiaoyao Li
2025-07-04 11:34     ` Alex Bennée
2025-07-03 17:32 ` [PATCH v6 03/39] system/runstate: Document qemu_add_vm_change_state_handler() Philippe Mathieu-Daudé
2025-07-04  3:40   ` Xiaoyao Li
2025-07-15  9:02     ` Alex Bennée
2025-07-15  9:34       ` Xiaoyao Li
2025-07-04  9:31   ` Zhao Liu
2025-07-03 17:32 ` [PATCH v6 04/39] system/cpus: Assert interrupt handling is done with BQL locked Philippe Mathieu-Daudé
2025-07-04  4:07   ` Xiaoyao Li
2025-07-04  9:32   ` Zhao Liu
2025-07-03 17:32 ` [PATCH v6 05/39] accel/kvm: Remove kvm_init_cpu_signals() stub Philippe Mathieu-Daudé
2025-07-04  4:13   ` Xiaoyao Li
2025-07-04  8:24     ` Philippe Mathieu-Daudé
2025-07-04 11:49   ` Zhao Liu
2025-07-03 17:32 ` [PATCH v6 06/39] accel/kvm: Reduce kvm_create_vcpu() declaration scope Philippe Mathieu-Daudé
2025-07-04  4:15   ` Xiaoyao Li
2025-07-04  9:33   ` Zhao Liu
2025-07-03 17:32 ` [PATCH v6 07/39] accel/tcg: Remove 'info opcount' and @x-query-opcount Philippe Mathieu-Daudé
2025-07-04  4:23   ` Xiaoyao Li
2025-07-04  4:50   ` Markus Armbruster
2025-07-04  9:36   ` Zhao Liu
2025-07-03 17:32 ` [PATCH v6 08/39] accel/tcg: Remove profiler leftover Philippe Mathieu-Daudé
2025-07-04  4:24   ` Xiaoyao Li
2025-07-04  9:37   ` Zhao Liu
2025-07-03 17:32 ` [PATCH v6 09/39] accel/tcg: Factor tcg_dump_flush_info() out Philippe Mathieu-Daudé
2025-07-04  4:27   ` Xiaoyao Li
2025-07-04  4:33     ` Xiaoyao Li
2025-07-04  9:38   ` Zhao Liu
2025-07-03 17:32 ` [PATCH v6 10/39] accel/tcg: Factor tcg_dump_stats() out for re-use Philippe Mathieu-Daudé
2025-07-04  9:39   ` Zhao Liu
2025-07-03 17:32 ` [PATCH v6 11/39] accel/tcg: Extract statistic related code to tcg-stats.c Philippe Mathieu-Daudé
2025-07-04  8:44   ` Zhao Liu
2025-07-03 17:32 ` [PATCH v6 12/39] accel: Move supports_guest_debug() declaration to AccelClass Philippe Mathieu-Daudé
2025-07-04  5:25   ` Xiaoyao Li
2025-07-04  9:42   ` Zhao Liu
2025-07-03 17:32 ` [PATCH v6 13/39] accel: Move cpus_are_resettable() " Philippe Mathieu-Daudé
2025-07-04  5:36   ` Xiaoyao Li
2025-07-04  9:44   ` Zhao Liu
2025-07-03 17:32 ` [PATCH v6 14/39] accel/hvf: Restrict internal declarations Philippe Mathieu-Daudé
2025-07-04  5:39   ` Xiaoyao Li
2025-07-04  9:45   ` Zhao Liu
2025-07-03 17:32 ` [PATCH v6 15/39] accel/hvf: Move per-cpu method declarations to hvf-accel-ops.c Philippe Mathieu-Daudé
2025-07-04  9:46   ` Zhao Liu
2025-07-03 17:32 ` [PATCH v6 16/39] accel/hvf: Move generic method declarations to hvf-all.c Philippe Mathieu-Daudé
2025-07-04  9:50   ` Zhao Liu
2025-07-03 17:32 ` [PATCH v6 17/39] cpus: Document CPUState::vcpu_dirty field Philippe Mathieu-Daudé
2025-07-04  5:52   ` Xiaoyao Li
2025-07-03 17:32 ` [PATCH v6 18/39] accel/hvf: Replace @dirty field by generic " Philippe Mathieu-Daudé
2025-07-04  5:54   ` Xiaoyao Li
2025-07-04 10:07   ` Zhao Liu
2025-07-03 17:32 ` [PATCH v6 19/39] accel/nvmm: " Philippe Mathieu-Daudé
2025-07-04  5:55   ` Xiaoyao Li
2025-07-04 10:08   ` Zhao Liu
2025-07-03 17:32 ` [PATCH v6 20/39] accel/whpx: " Philippe Mathieu-Daudé
2025-07-04  5:55   ` Xiaoyao Li
2025-07-04 10:11   ` Zhao Liu
2025-07-03 17:32 ` [PATCH v6 21/39] accel/kvm: Remove kvm_cpu_synchronize_state() stub Philippe Mathieu-Daudé
2025-07-04  6:02   ` Xiaoyao Li
2025-07-04  8:21     ` Philippe Mathieu-Daudé
2025-07-04 10:15   ` Zhao Liu
2025-07-03 17:32 ` [PATCH v6 22/39] accel/system: Document cpu_synchronize_state() Philippe Mathieu-Daudé
2025-07-04 10:17   ` Zhao Liu
2025-07-03 17:32 ` [PATCH v6 23/39] accel/system: Document cpu_synchronize_state_post_init/reset() Philippe Mathieu-Daudé
2025-07-04 10:19   ` Zhao Liu
2025-07-03 17:32 ` [PATCH v6 24/39] accel/nvmm: Expose nvmm_enabled() to common code Philippe Mathieu-Daudé
2025-07-04  8:32   ` Philippe Mathieu-Daudé
2025-07-04 10:26   ` Zhao Liu
2025-07-03 17:32 ` [PATCH v6 25/39] accel/whpx: Expose whpx_enabled() " Philippe Mathieu-Daudé
2025-07-04 10:36   ` Zhao Liu
2025-07-03 17:32 ` [PATCH v6 26/39] accel/dummy: Extract 'dummy-cpus.h' header from 'system/cpus.h' Philippe Mathieu-Daudé
2025-07-04  6:16   ` Xiaoyao Li
2025-07-04 10:44   ` Zhao Liu
2025-07-03 17:32 ` [PATCH v6 27/39] accel: Pass old/new interrupt mask to handle_interrupt() handler Philippe Mathieu-Daudé
2025-07-04  6:32   ` Xiaoyao Li
2025-07-04 10:59   ` Zhao Liu
2025-07-03 17:32 ` [PATCH v6 28/39] accel: Expose and register generic_handle_interrupt() Philippe Mathieu-Daudé
2025-07-04  6:38   ` Xiaoyao Li
2025-07-04  8:27     ` Philippe Mathieu-Daudé
2025-07-03 17:32 ` [PATCH v6 29/39] accel: Keep reference to AccelOpsClass in AccelClass Philippe Mathieu-Daudé
2025-07-04 11:01   ` Zhao Liu
2025-07-03 17:32 ` [PATCH v6 30/39] accel: Propagate AccelState to AccelClass::init_machine() Philippe Mathieu-Daudé
2025-07-04 11:33   ` Zhao Liu
2025-07-03 17:32 ` [PATCH v6 31/39] accel/kvm: Prefer local AccelState over global MachineState::accel Philippe Mathieu-Daudé
2025-07-04 11:33   ` Zhao Liu
2025-07-03 17:32 ` [PATCH v6 32/39] accel/tcg: Prefer local AccelState over global current_accel() Philippe Mathieu-Daudé
2025-07-04 11:34   ` Zhao Liu
2025-07-03 17:32 ` [PATCH v6 33/39] accel: Directly pass AccelState argument to AccelClass::has_memory() Philippe Mathieu-Daudé
2025-07-04 11:35   ` Zhao Liu
2025-07-04 11:46   ` Zhao Liu
2025-07-03 17:32 ` [PATCH v6 34/39] accel/kvm: Directly pass KVMState argument to do_kvm_create_vm() Philippe Mathieu-Daudé
2025-07-04 11:37   ` Zhao Liu
2025-07-04 11:46   ` Zhao Liu
2025-07-03 17:32 ` [PATCH v6 35/39] accel: Remove unused MachineState argument of AccelClass::setup_post() Philippe Mathieu-Daudé
2025-07-04 11:38   ` Zhao Liu
2025-07-03 17:32 ` [PATCH v6 36/39] accel: Pass AccelState argument to gdbstub_supported_sstep_flags() Philippe Mathieu-Daudé
2025-07-04 11:42   ` Zhao Liu
2025-07-03 17:32 ` [PATCH v6 37/39] accel: Rename 'system/accel-ops.h' -> 'accel/accel-cpu-ops.h' Philippe Mathieu-Daudé
2025-07-04  8:52   ` Zhao Liu
2025-07-04 14:01   ` Richard Henderson
2025-07-03 17:32 ` [PATCH v6 38/39] accel: Extract AccelClass definition to 'accel/accel-ops.h' Philippe Mathieu-Daudé
2025-07-04  9:02   ` Zhao Liu
2025-07-04 14:03   ` Richard Henderson
2025-07-03 17:32 ` [PATCH v6 39/39] MAINTAINERS: Add me as reviewer of overall accelerators section Philippe Mathieu-Daudé
2025-07-03 22:42   ` Philippe Mathieu-Daudé
2025-07-04  3:23   ` Richard Henderson
2025-07-04  8:50 ` [PATCH v6 00/39] accel: Preparatory cleanups for split-accel Philippe Mathieu-Daudé

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=5f1fbfe7-d990-484f-825a-64af2781ac3c@linaro.org \
    --to=philmd@linaro.org \
    --cc=alex.bennee@linaro.org \
    --cc=armbru@redhat.com \
    --cc=eblake@redhat.com \
    --cc=eduardo@habkost.net \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=pierrick.bouvier@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=wangyanan55@huawei.com \
    --cc=zhao1.liu@intel.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).