From: Harsh Prateek Bora <harshpb@linux.ibm.com>
To: qemu-devel@nongnu.org
Cc: "Pierrick Bouvier" <pierrick.bouvier@oss.qualcomm.com>,
"Philippe Mathieu-Daudé" <philmd@oss.qualcomm.com>,
"Amit Machhiwal" <amachhiw@linux.ibm.com>
Subject: [PULL 1/7] target/ppc/cpu_init: make cpu listing deterministic
Date: Sun, 23 Aug 2026 13:05:27 +0530 [thread overview]
Message-ID: <20260823073536.40282-2-harshpb@linux.ibm.com> (raw)
In-Reply-To: <20260823073536.40282-1-harshpb@linux.ibm.com>
From: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
The existing compare function only make sure that we list cpus with PVR
order. However, we never compare cpu names.
As a result, while cpus are grouped per PVR, the order within a group is
non deterministic. Depending on QOM type initialization order, we get
different results for -cpu help.
For instance, previous output could be:
Available CPUs:
755_v1.0 PVR 00083100
745_v1.0 PVR 00083100
755_v1.1 PVR 00083101
745_v1.1 PVR 00083101
While a sorted output should be:
Available CPUs:
745_v1.0 PVR 00083100
755_v1.0 PVR 00083100
745_v1.1 PVR 00083101
755_v1.1 PVR 00083101
Fix it by comparing cpu names to have a stable result.
This allows us to record and compare various command line results across
versions to make sure we didn't break anything while working on
single-binary.
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Tested-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Amit Machhiwal <amachhiw@linux.ibm.com>
Tested-by: Amit Machhiwal <amachhiw@linux.ibm.com>
Link: https://lore.kernel.org/qemu-devel/20260720192403.66694-1-pierrick.bouvier@oss.qualcomm.com
Signed-off-by: Harsh Prateek Bora <harshpb@linux.ibm.com>
---
target/ppc/cpu_init.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c
index e3a1075aad..e2533481d8 100644
--- a/target/ppc/cpu_init.c
+++ b/target/ppc/cpu_init.c
@@ -7130,7 +7130,7 @@ static gint ppc_cpu_list_compare(gconstpointer a, gconstpointer b, gpointer d)
} else if (pcc_a->pvr > pcc_b->pvr) {
return 1;
} else {
- return 0;
+ return strcmp(name_a, name_b);
}
}
}
--
2.52.0
next prev parent reply other threads:[~2026-08-23 7:36 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-23 7:35 [PULL 0/7] ppc-for-11.2 queue Harsh Prateek Bora
2026-08-23 7:35 ` Harsh Prateek Bora [this message]
2026-08-23 7:35 ` [PULL 2/7] target/ppc: Validate HTABMASK and reserved bits in SDR1 for 32-bit mode Harsh Prateek Bora
2026-08-23 7:35 ` [PULL 3/7] MAINTAINERS: Add myself as a reviewer for PPC KVM and sPAPR Harsh Prateek Bora
2026-08-23 7:35 ` [PULL 4/7] hw/watchdog: Add lower bound check for watchdogNumber Harsh Prateek Bora
2026-08-23 7:35 ` [PULL 5/7] powernv: boot OpenBSD on POWER9 Harsh Prateek Bora
2026-08-23 7:35 ` [PULL 6/7] MAINTAINERS: add dedicated PowerPC RAS section Harsh Prateek Bora
2026-08-23 7:35 ` [PULL 7/7] MAINTAINERS: add self as reviewer for PowerPC RAS Harsh Prateek Bora
2026-08-24 6:03 ` [PULL 0/7] ppc-for-11.2 queue Richard Henderson
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=20260823073536.40282-2-harshpb@linux.ibm.com \
--to=harshpb@linux.ibm.com \
--cc=amachhiw@linux.ibm.com \
--cc=philmd@oss.qualcomm.com \
--cc=pierrick.bouvier@oss.qualcomm.com \
--cc=qemu-devel@nongnu.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.