qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH-for-10.1 v7 0/2] hw/core/machine: Display CPU model name in 'info cpus' command
@ 2025-07-15  9:06 Philippe Mathieu-Daudé
  2025-07-15  9:06 ` [PATCH-for-10.1 v7 1/2] qapi/machine: Add @qom-type field to CpuInfoFast structure Philippe Mathieu-Daudé
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-07-15  9:06 UTC (permalink / raw)
  To: qemu-devel
  Cc: Markus Armbruster, Marcel Apfelbaum, Eric Blake, Yanan Wang,
	Xiaoyao Li, Eduardo Habkost, Philippe Mathieu-Daudé,
	Zhao Liu

Since v6 [*]:
- Expose QOM type name on QMP (instead of model name)

(R-b tags kept)

[*] https://lore.kernel.org/qemu-devel/20250703173248.44995-2-philmd@linaro.org/

Philippe Mathieu-Daudé (2):
  qapi/machine: Add @qom-type field to CpuInfoFast structure
  hw/core/machine: Display CPU model name in 'info cpus' command

 qapi/machine.json          | 3 +++
 hw/core/machine-hmp-cmds.c | 4 +++-
 hw/core/machine-qmp-cmds.c | 1 +
 3 files changed, 7 insertions(+), 1 deletion(-)

-- 
2.49.0



^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH-for-10.1 v7 1/2] qapi/machine: Add @qom-type field to CpuInfoFast structure
  2025-07-15  9:06 [PATCH-for-10.1 v7 0/2] hw/core/machine: Display CPU model name in 'info cpus' command Philippe Mathieu-Daudé
@ 2025-07-15  9:06 ` Philippe Mathieu-Daudé
  2025-07-15  9:30   ` Xiaoyao Li
  2025-07-15  9:06 ` [PATCH-for-10.1 v7 2/2] hw/core/machine: Display CPU model name in 'info cpus' command Philippe Mathieu-Daudé
  2025-07-15 19:26 ` [PATCH-for-10.1 v7 0/2] " Philippe Mathieu-Daudé
  2 siblings, 1 reply; 7+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-07-15  9:06 UTC (permalink / raw)
  To: qemu-devel
  Cc: Markus Armbruster, Marcel Apfelbaum, Eric Blake, Yanan Wang,
	Xiaoyao Li, Eduardo Habkost, Philippe Mathieu-Daudé,
	Zhao Liu, Richard Henderson

Knowing the QOM type name of a CPU can be useful,
in particular to infer its model name.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 qapi/machine.json          | 3 +++
 hw/core/machine-qmp-cmds.c | 1 +
 2 files changed, 4 insertions(+)

diff --git a/qapi/machine.json b/qapi/machine.json
index f712e7da6d6..a3f6fcec4d3 100644
--- a/qapi/machine.json
+++ b/qapi/machine.json
@@ -76,6 +76,8 @@
 #
 # @cpu-index: index of the virtual CPU
 #
+# @qom-type: QOM type name of the CPU (since 10.1)
+#
 # @qom-path: path to the CPU object in the QOM tree
 #
 # @thread-id: ID of the underlying host thread
@@ -89,6 +91,7 @@
 ##
 { 'union'         : 'CpuInfoFast',
   'base'          : { 'cpu-index'    : 'int',
+                      'qom-type'     : 'str',
                       'qom-path'     : 'str',
                       'thread-id'    : 'int',
                       '*props'       : 'CpuInstanceProperties',
diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c
index d82043e1c68..5655bfcfee4 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->qom_type = g_strdup(object_get_typename(OBJECT(cpu)));
 
         if (mc->cpu_index_to_instance_props) {
             CpuInstanceProperties *props;
-- 
2.49.0



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH-for-10.1 v7 2/2] hw/core/machine: Display CPU model name in 'info cpus' command
  2025-07-15  9:06 [PATCH-for-10.1 v7 0/2] hw/core/machine: Display CPU model name in 'info cpus' command Philippe Mathieu-Daudé
  2025-07-15  9:06 ` [PATCH-for-10.1 v7 1/2] qapi/machine: Add @qom-type field to CpuInfoFast structure Philippe Mathieu-Daudé
@ 2025-07-15  9:06 ` Philippe Mathieu-Daudé
  2025-07-15  9:30   ` Xiaoyao Li
  2025-07-15 19:26 ` [PATCH-for-10.1 v7 0/2] " Philippe Mathieu-Daudé
  2 siblings, 1 reply; 7+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-07-15  9:06 UTC (permalink / raw)
  To: qemu-devel
  Cc: Markus Armbruster, Marcel Apfelbaum, Eric Blake, Yanan Wang,
	Xiaoyao Li, Eduardo Habkost, Philippe Mathieu-Daudé,
	Zhao Liu, Richard Henderson

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 model=cortex-a72
   CPU #1: thread_id=42916 model=cortex-a72
   CPU #2: thread_id=42916 model=cortex-r5f
   CPU #3: thread_id=42916 model=cortex-r5f
 (qemu)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Tested-by: Zhao Liu <zhao1.liu@intel.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/core/machine-hmp-cmds.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/hw/core/machine-hmp-cmds.c b/hw/core/machine-hmp-cmds.c
index c6325cdcaaa..54b6f5406dc 100644
--- a/hw/core/machine-hmp-cmds.c
+++ b/hw/core/machine-hmp-cmds.c
@@ -32,6 +32,7 @@ void hmp_info_cpus(Monitor *mon, const QDict *qdict)
     cpu_list = qmp_query_cpus_fast(NULL);
 
     for (cpu = cpu_list; cpu; cpu = cpu->next) {
+        g_autofree char *cpu_model = cpu_model_from_type(cpu->value->qom_type);
         int active = ' ';
 
         if (cpu->value->cpu_index == monitor_get_cpu_index(mon)) {
@@ -40,7 +41,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 " model=%s\n",
+                       cpu->value->thread_id, cpu_model);
     }
 
     qapi_free_CpuInfoFastList(cpu_list);
-- 
2.49.0



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH-for-10.1 v7 1/2] qapi/machine: Add @qom-type field to CpuInfoFast structure
  2025-07-15  9:06 ` [PATCH-for-10.1 v7 1/2] qapi/machine: Add @qom-type field to CpuInfoFast structure Philippe Mathieu-Daudé
@ 2025-07-15  9:30   ` Xiaoyao Li
  0 siblings, 0 replies; 7+ messages in thread
From: Xiaoyao Li @ 2025-07-15  9:30 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Markus Armbruster, Marcel Apfelbaum, Eric Blake, Yanan Wang,
	Eduardo Habkost, Zhao Liu, Richard Henderson

On 7/15/2025 5:06 PM, Philippe Mathieu-Daudé wrote:
> Knowing the QOM type name of a CPU can be useful,
> in particular to infer its model name.
> 
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
> Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>

Reviewed-by: Xiaoyao Li <xiaoyao.li@intel.com>

> ---
>   qapi/machine.json          | 3 +++
>   hw/core/machine-qmp-cmds.c | 1 +
>   2 files changed, 4 insertions(+)
> 
> diff --git a/qapi/machine.json b/qapi/machine.json
> index f712e7da6d6..a3f6fcec4d3 100644
> --- a/qapi/machine.json
> +++ b/qapi/machine.json
> @@ -76,6 +76,8 @@
>   #
>   # @cpu-index: index of the virtual CPU
>   #
> +# @qom-type: QOM type name of the CPU (since 10.1)
> +#
>   # @qom-path: path to the CPU object in the QOM tree
>   #
>   # @thread-id: ID of the underlying host thread
> @@ -89,6 +91,7 @@
>   ##
>   { 'union'         : 'CpuInfoFast',
>     'base'          : { 'cpu-index'    : 'int',
> +                      'qom-type'     : 'str',
>                         'qom-path'     : 'str',
>                         'thread-id'    : 'int',
>                         '*props'       : 'CpuInstanceProperties',
> diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c
> index d82043e1c68..5655bfcfee4 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->qom_type = g_strdup(object_get_typename(OBJECT(cpu)));
>   
>           if (mc->cpu_index_to_instance_props) {
>               CpuInstanceProperties *props;



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH-for-10.1 v7 2/2] hw/core/machine: Display CPU model name in 'info cpus' command
  2025-07-15  9:06 ` [PATCH-for-10.1 v7 2/2] hw/core/machine: Display CPU model name in 'info cpus' command Philippe Mathieu-Daudé
@ 2025-07-15  9:30   ` Xiaoyao Li
  2025-07-15  9:34     ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 7+ messages in thread
From: Xiaoyao Li @ 2025-07-15  9:30 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Markus Armbruster, Marcel Apfelbaum, Eric Blake, Yanan Wang,
	Eduardo Habkost, Zhao Liu, Richard Henderson

On 7/15/2025 5:06 PM, Philippe Mathieu-Daudé wrote:
> 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 model=cortex-a72
>     CPU #1: thread_id=42916 model=cortex-a72
>     CPU #2: thread_id=42916 model=cortex-r5f
>     CPU #3: thread_id=42916 model=cortex-r5f
>   (qemu)
> 
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
> Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
> Tested-by: Zhao Liu <zhao1.liu@intel.com>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>

IIRC, I gave r-b tag before. Anyway,

Reviewed-by: Xiaoyao Li <xiaoyao.li@intel.com>

> ---
>   hw/core/machine-hmp-cmds.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/core/machine-hmp-cmds.c b/hw/core/machine-hmp-cmds.c
> index c6325cdcaaa..54b6f5406dc 100644
> --- a/hw/core/machine-hmp-cmds.c
> +++ b/hw/core/machine-hmp-cmds.c
> @@ -32,6 +32,7 @@ void hmp_info_cpus(Monitor *mon, const QDict *qdict)
>       cpu_list = qmp_query_cpus_fast(NULL);
>   
>       for (cpu = cpu_list; cpu; cpu = cpu->next) {
> +        g_autofree char *cpu_model = cpu_model_from_type(cpu->value->qom_type);
>           int active = ' ';
>   
>           if (cpu->value->cpu_index == monitor_get_cpu_index(mon)) {
> @@ -40,7 +41,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 " model=%s\n",
> +                       cpu->value->thread_id, cpu_model);
>       }
>   
>       qapi_free_CpuInfoFastList(cpu_list);



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH-for-10.1 v7 2/2] hw/core/machine: Display CPU model name in 'info cpus' command
  2025-07-15  9:30   ` Xiaoyao Li
@ 2025-07-15  9:34     ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 7+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-07-15  9:34 UTC (permalink / raw)
  To: Xiaoyao Li, qemu-devel
  Cc: Markus Armbruster, Marcel Apfelbaum, Eric Blake, Yanan Wang,
	Eduardo Habkost, Zhao Liu, Richard Henderson

On 15/7/25 11:30, Xiaoyao Li wrote:
> On 7/15/2025 5:06 PM, Philippe Mathieu-Daudé wrote:
>> 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 model=cortex-a72
>>     CPU #1: thread_id=42916 model=cortex-a72
>>     CPU #2: thread_id=42916 model=cortex-r5f
>>     CPU #3: thread_id=42916 model=cortex-r5f
>>   (qemu)
>>
>> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
>> Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
>> Tested-by: Zhao Liu <zhao1.liu@intel.com>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> 
> IIRC, I gave r-b tag before. Anyway,
> 
> Reviewed-by: Xiaoyao Li <xiaoyao.li@intel.com>

Sorry I missed it and thank you :)



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH-for-10.1 v7 0/2] hw/core/machine: Display CPU model name in 'info cpus' command
  2025-07-15  9:06 [PATCH-for-10.1 v7 0/2] hw/core/machine: Display CPU model name in 'info cpus' command Philippe Mathieu-Daudé
  2025-07-15  9:06 ` [PATCH-for-10.1 v7 1/2] qapi/machine: Add @qom-type field to CpuInfoFast structure Philippe Mathieu-Daudé
  2025-07-15  9:06 ` [PATCH-for-10.1 v7 2/2] hw/core/machine: Display CPU model name in 'info cpus' command Philippe Mathieu-Daudé
@ 2025-07-15 19:26 ` Philippe Mathieu-Daudé
  2 siblings, 0 replies; 7+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-07-15 19:26 UTC (permalink / raw)
  To: qemu-devel
  Cc: Markus Armbruster, Marcel Apfelbaum, Eric Blake, Yanan Wang,
	Xiaoyao Li, Eduardo Habkost, Zhao Liu

On 15/7/25 11:06, Philippe Mathieu-Daudé wrote:

> Philippe Mathieu-Daudé (2):
>    qapi/machine: Add @qom-type field to CpuInfoFast structure
>    hw/core/machine: Display CPU model name in 'info cpus' command

Queued, thanks.


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-07-15 19:52 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-15  9:06 [PATCH-for-10.1 v7 0/2] hw/core/machine: Display CPU model name in 'info cpus' command Philippe Mathieu-Daudé
2025-07-15  9:06 ` [PATCH-for-10.1 v7 1/2] qapi/machine: Add @qom-type field to CpuInfoFast structure Philippe Mathieu-Daudé
2025-07-15  9:30   ` Xiaoyao Li
2025-07-15  9:06 ` [PATCH-for-10.1 v7 2/2] hw/core/machine: Display CPU model name in 'info cpus' command Philippe Mathieu-Daudé
2025-07-15  9:30   ` Xiaoyao Li
2025-07-15  9:34     ` Philippe Mathieu-Daudé
2025-07-15 19:26 ` [PATCH-for-10.1 v7 0/2] " Philippe Mathieu-Daudé

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).