Skip to contentSkip to conversation

Remove useless architecture prefix from the CPU list

PATCH In review Thomas Huth 7 participants 11 messages Apr 20, 2024 – Apr 29, 2024

lore
Share & tools
lore
#0 lore raw

cover Remove useless architecture prefix from the CPU list

Printing an architecture prefix in front of each CPU name is not helpful at all: It is confusing for the users since they don't know whether they have to specify these letters for the "-cpu" parameter, too, and it also takes some precious space in the dense output of the CPU entries. Let's simply remove those now.

Thomas Huth (3):
target/i386/cpu: Remove "x86" prefix from the CPU list target/s390x/cpu_models: Rework the output of "-cpu help" target/ppc/cpu_init: Remove "PowerPC" prefix from the CPU list

 target/i386/cpu.c         | 2 +-
 target/ppc/cpu_init.c     | 9 +++++----
 target/s390x/cpu_models.c | 9 +++++----
 3 files changed, 11 insertions(+), 9 deletions(-)
Signature · 1 line
2.44.0
#2 lore raw

PATCH 2/3 target/s390x/cpu_models: Rework the output of "-cpu help"

Printing an "s390x" in front of each CPU name is not helpful at all:
It is confusing for the users since they don't know whether they have to specify these letters for the "-cpu" parameter, too, and it also takes some precious space in the dense output of the CPU entries. Let's simply remove this now!

While we're at it, use two spaces at the beginning of the lines for the indentation of the entries, and add a "Available CPUs" in the very first line, like most other target architectures are doing it for their "-cpu help" output already.

---
 target/s390x/cpu_models.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
target/s390x/cpu_models.c +5 -4
index 8ed3bb6a27..58c58f05a0 100644
@@ -355,9 +355,9 @@ static void s390_print_cpu_model_list_entry(gpointer data, gpointer user_data)
     /* strip off the -s390x-cpu */
     g_strrstr(name, "-" TYPE_S390_CPU)[0] = 0;
     if (details->len) {
-        qemu_printf("s390 %-15s %-35s (%s)\n", name, scc->desc, details->str);
+        qemu_printf("  %-15s %-35s (%s)\n", name, scc->desc, details->str);
     } else {
-        qemu_printf("s390 %-15s %-35s\n", name, scc->desc);
+        qemu_printf("  %-15s %-35s\n", name, scc->desc);
     }
     g_free(name);
 }
@@ -402,6 +402,7 @@ void s390_cpu_list(void)
     S390Feat feat;
     GSList *list;
 
+    qemu_printf("Available CPUs:\n");
     list = object_class_get_list(TYPE_S390_CPU, false);
     list = g_slist_sort(list, s390_cpu_list_compare);
     g_slist_foreach(list, s390_print_cpu_model_list_entry, NULL);
@@ -411,14 +412,14 @@ void s390_cpu_list(void)
     for (feat = 0; feat < S390_FEAT_MAX; feat++) {
         const S390FeatDef *def = s390_feat_def(feat);
 
-        qemu_printf("%-20s %s\n", def->name, def->desc);
+        qemu_printf("  %-20s %s\n", def->name, def->desc);
     }
 
     qemu_printf("\nRecognized feature groups:\n");
     for (group = 0; group < S390_FEAT_GROUP_MAX; group++) {
         const S390FeatGroupDef *def = s390_feat_group_def(group);
 
-        qemu_printf("%-20s %s\n", def->name, def->desc);
+        qemu_printf("  %-20s %s\n", def->name, def->desc);
     }
 }
 
Signature · 1 line
2.44.0
#1 lore raw

PATCH 1/3 target/i386/cpu: Remove "x86" prefix from the CPU list

In reply to Thomas Huth

Printing an "x86" in front of each CPU name is not helpful at all:
It is confusing for the users since they don't know whether they have to specify these letters for the "-cpu" parameter, too, and it also takes some precious space in the dense output of the CPU entries. Let's simply remove this now and use two spaces at the beginning of the lines for the indentation of the entries instead, like most other target architectures are doing it for their CPU help output already.

---
 target/i386/cpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
target/i386/cpu.c +1 -1
index 33760a2ee1..fd46e264a2 100644
@@ -5572,7 +5572,7 @@ static void x86_cpu_list_entry(gpointer data, gpointer user_data)
         desc = g_strdup_printf("%s (deprecated)", olddesc);
     }
 
-    qemu_printf("x86 %-20s  %s\n", name, desc);
+    qemu_printf("  %-20s  %s\n", name, desc);
 }
 
 /* list available CPU models and flags */
Signature · 1 line
2.44.0
#3 lore raw

PATCH 3/3 target/ppc/cpu_init: Remove "PowerPC" prefix from the CPU list

In reply to Thomas Huth

Printing a "PowerPC" in front of each CPU name is not helpful at all:
It is confusing for the users since they don't know whether they have to specify these letters for the "-cpu" parameter, too, and it also takes some precious space in the dense output of the CPU entries. Let's simply remove this now and use two spaces at the beginning of the lines for the indentation of the entries instead, and add a "Available CPUs" in the very first line, like most other target architectures are doing it for their CPU help output already.

---
 target/ppc/cpu_init.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
target/ppc/cpu_init.c +5 -4
index 6241de62ce..8b932dccfb 100644
@@ -7063,7 +7063,7 @@ static void ppc_cpu_list_entry(gpointer data, gpointer user_data)
     }
 
     name = cpu_model_from_type(typename);
-    qemu_printf("PowerPC %-16s PVR %08x\n", name, pcc->pvr);
+    qemu_printf("  %-16s PVR %08x\n", name, pcc->pvr);
     for (i = 0; ppc_cpu_aliases[i].alias != NULL; i++) {
         PowerPCCPUAlias *alias = &ppc_cpu_aliases[i];
         ObjectClass *alias_oc = ppc_cpu_class_by_name(alias->model);
@@ -7076,10 +7076,10 @@ static void ppc_cpu_list_entry(gpointer data, gpointer user_data)
          * avoid printing the wrong alias here and use "preferred" instead
          */
         if (strcmp(alias->alias, family->desc) == 0) {
-            qemu_printf("PowerPC %-16s (alias for preferred %s CPU)\n",
+            qemu_printf("  %-16s (alias for preferred %s CPU)\n",
                         alias->alias, family->desc);
         } else {
-            qemu_printf("PowerPC %-16s (alias for %s)\n",
+            qemu_printf("  %-16s (alias for %s)\n",
                         alias->alias, name);
         }
     }
@@ -7090,6 +7090,7 @@ void ppc_cpu_list(void)
 {
     GSList *list;
 
+    qemu_printf("Available CPUs:\n");
     list = object_class_get_list(TYPE_POWERPC_CPU, false);
     list = g_slist_sort(list, ppc_cpu_list_compare);
     g_slist_foreach(list, ppc_cpu_list_entry, NULL);
@@ -7097,7 +7098,7 @@ void ppc_cpu_list(void)
 
 #ifdef CONFIG_KVM
     qemu_printf("\n");
-    qemu_printf("PowerPC %s\n", "host");
+    qemu_printf("  %s\n", "host");
 #endif
 }
 
Signature · 1 line
2.44.0
#4 lore raw
In reply to Thomas Huth
Quoted 5 lines · Thomas Huth

Printing an architecture prefix in front of each CPU name is not helpful at all: It is confusing for the users since they don't know whether they have to specify these letters for the "-cpu" parameter, too, and it also takes some precious space in the dense output of the CPU entries. Let's simply remove those now.

Yes, I also never really understood the purpose.

Signature · 3 lines
Cheers,

David / dhildenb
Reviewed-by on the v1 series
#6 lore raw
In reply to Thomas Huth

20.04.2024 08:46, Thomas Huth:

Quoted 10 lines

Printing an architecture prefix in front of each CPU name is not helpful at all: It is confusing for the users since they don't know whether they have to specify these letters for the "-cpu" parameter, too, and it also takes some precious space in the dense output of the CPU entries. Let's simply remove those now.

Thomas Huth (3):
target/i386/cpu: Remove "x86" prefix from the CPU list target/s390x/cpu_models: Rework the output of "-cpu help" target/ppc/cpu_init: Remove "PowerPC" prefix from the CPU list

I'll pick it up for trivial-patches after 9.0 is out.

This also reminded me about https://gitlab.com/qemu-project/qemu/-/issues/2141

/mjt

#7 lore raw
In reply to Thomas Huth
Quoted 5 lines · Thomas Huth

Printing an architecture prefix in front of each CPU name is not helpful at all: It is confusing for the users since they don't know whether they have to specify these letters for the "-cpu" parameter, too, and it also takes some precious space in the dense output of the CPU entries. Let's simply remove those now.

Could it be said that this arch prefix is about to finally become useful with Philippe's patches to add a 'qemu-system-any' command covering multiple arches ?

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#8 lore raw
Quoted 10 lines · Daniel P. Berrangé
Quoted 5 lines · Thomas Huth

Printing an architecture prefix in front of each CPU name is not helpful at all: It is confusing for the users since they don't know whether they have to specify these letters for the "-cpu" parameter, too, and it also takes some precious space in the dense output of the CPU entries. Let's simply remove those now.

Could it be said that this arch prefix is about to finally become useful with Philippe's patches to add a 'qemu-system-any' command covering multiple arches ?

I don't think so: In that case we'd rather print it once at the beginning of a list ("Available x86 CPUs:") instead of printing it in each and every line.

Thomas

Tested-by on the v1 series
#10 lore raw
In reply to Thomas Huth

This series has been successfully tested in x86. Execute the cpu help command and check in the list the x86 prefix is no longer present.

Quoted 21 lines · Thomas Huth

Printing an architecture prefix in front of each CPU name is not helpful at all: It is confusing for the users since they don't know whether they have to specify these letters for the "-cpu" parameter, too, and it also takes some precious space in the dense output of the CPU entries. Let's simply remove those now.

Thomas Huth (3):
target/i386/cpu: Remove "x86" prefix from the CPU list target/s390x/cpu_models: Rework the output of "-cpu help" target/ppc/cpu_init: Remove "PowerPC" prefix from the CPU list

 target/i386/cpu.c         | 2 +-
 target/ppc/cpu_init.c     | 9 +++++----
 target/s390x/cpu_models.c | 9 +++++----
 3 files changed, 11 insertions(+), 9 deletions(-)

--
2.44.0

#9 lore raw
In reply to Thomas Huth
Quoted 8 lines · Thomas Huth
Quoted 7 lines · Daniel P. Berrangé
Quoted 5 lines · Thomas Huth

Printing an architecture prefix in front of each CPU name is not helpful at all: It is confusing for the users since they don't know whether they have to specify these letters for the "-cpu" parameter, too, and it also takes some precious space in the dense output of the CPU entries. Let's simply remove those now.

Quoted 5 lines
Quoted 3 lines

Could it be said that this arch prefix is about to finally become useful with Philippe's patches to add a 'qemu-system-any' command covering multiple arches ?

I don't think so: In that case we'd rather print it once at the beginning of a list ("Available x86 CPUs:") instead of printing it in each and every line.

Yes that is correct. Hopefully we won't have the same CPU name used by different architectures...