target/ppc/cpu_init: make cpu listing determnistic
PATCH 1/1 target/ppc/cpu_init: make cpu listing determnistic
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.
--- target/ppc/cpu_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/ppc/cpu_init.c +1 -1
@@ -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); } } }
Signature · 1 line
2.43.0
Quoted 25 lines · Pierrick Bouvier
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 00083101While 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 00083101Fix 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.
Quoted 4 lines
Signed-off-by Pierrick Bouvier <[email protected]>--- target/ppc/cpu_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 35 lines · Pierrick Bouvier
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 00083101While 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 00083101Fix 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 <[email protected]>--- target/ppc/cpu_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)target/ppc/cpu_init.c +0
-0
target/ppc/cpu_init.c static gint ppc_cpu_list_compare(gconstpointer a, gconstpointer b, gpointer d) · line 7136
Quoted 8 lines
target/ppc/cpu_init.c +1
-1@@ -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); } } }
Any chance one of ppc maintainer could send this for the upcoming release? This would help us to compare command lines across QEMU versions to make sure there is no regression.
Regards,
Pierrick
Quoted 31 lines · Pierrick Bouvier
Quoted 30 lines · Pierrick Bouvier
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 00083101While 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 00083101Fix 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 <[email protected]>--- target/ppc/cpu_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 16 lines
target/ppc/cpu_init.c static gint ppc_cpu_list_compare(gconstpointer a, gconstpointer b, gpointer d) · line 7136
Quoted 13 lines
target/ppc/cpu_init.c +1
-1@@ -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); } } }Any chance one of ppc maintainer could send this for the upcoming release? This would help us to compare command lines across QEMU versions to make ]sure there is no regression.
Hi Pierrick,
Thanks for the patch. Looks good to me.
Since this a minor user visible change and also not a regression fix, IMO this would be a better candidate for 11.2 ?
Regards,
Chinmay
Quoted 3 lines
Regards,
Pierrick
Hi Chinmay,
Quoted 51 lines · Chinmay Rath
Quoted 41 lines · Pierrick Bouvier
Quoted 40 lines · Pierrick Bouvier
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 00083101While 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 00083101Fix 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 <[email protected]>---
target/ppc/cpu_init.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)target/ppc/cpu_init.c +0
-1@@ -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;Quoted 8 lines
Quoted 4 lines
target/ppc/cpu_init.c +1
-0+ return strcmp(name_a, name_b); } }}
Any chance one of ppc maintainer could send this for the upcoming release?
This would help us to compare command lines across QEMU versions to make ]sure there is no regression.
Quoted 6 lines
Hi Pierrick,
Thanks for the patch. Looks good to me.
Since this a minor user visible change and also not a regression fix, IMO this would be a better candidate for 11.2 ?
It's not critical indeed, even though someone could still argue if it's a fix or not. The biggest advantage we would have from it is that we it would allow us to compare command lines between 11.1 and 11.2 easily by having stable cpu listing for ppc targets.
Quoted 7 lines
Regards,
ChinmayQuoted 3 lines
Regards,
Pierrick
Regards,
Pierrick
Quoted 13 lines · Pierrick Bouvier
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
Quoted 8 lines
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 00083101Fix it by comparing cpu names to have a stable result.
Verified the before/after output of qemu-system-ppc64 -cpu help. The patch correctly stabilises ordering in all PVR-collision groups.
No regressions: identical CPU set, ordering only.
Minor nit: subject line has a typo ("determnistic" should be "deterministic").
Thanks,
Amit
Quoted 26 lines
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 <[email protected]>--- target/ppc/cpu_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)target/ppc/cpu_init.c +1
-1@@ -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); } } }Signature · 1 line
2.43.0
Quoted 28 lines · Amit Machhiwal
Quoted 13 lines · Pierrick Bouvier
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 00083101Quoted 8 lines
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 00083101Fix it by comparing cpu names to have a stable result.
Verified the before/after output of
qemu-system-ppc64 -cpu help. The patch correctly stabilises ordering in all PVR-collision groups.No regressions: identical CPU set, ordering only.
Quoted 9 lines
Reviewed-by Amit Machhiwal <[email protected]>Tested-by Amit Machhiwal <[email protected]>Minor nit: subject line has a typo ("determnistic" should be "deterministic").
Thanks,
Amit
Thanks Amit.
Do you need a v2 with a change, or feel like fixing the typo when pulling this patch?
Regards,
Pierrick
Quoted 26 lines
Quoted 26 lines
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 <[email protected]>--- target/ppc/cpu_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)target/ppc/cpu_init.c +1
-1@@ -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); } } }Signature · 1 line
2.43.0
Quoted 35 lines · Pierrick Bouvier
Quoted 34 lines · Amit Machhiwal
Quoted 13 lines · Pierrick Bouvier
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 00083101Quoted 8 lines
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 00083101Fix it by comparing cpu names to have a stable result.
Verified the before/after output of
qemu-system-ppc64 -cpu help. The patch correctly stabilises ordering in all PVR-collision groups.No regressions: identical CPU set, ordering only.
Reviewed-by Amit Machhiwal <[email protected]>Tested-by Amit Machhiwal <[email protected]>Minor nit: subject line has a typo ("determnistic" should be "deterministic").
Quoted 8 lines
Quoted 3 lines
Thanks,
AmitThanks Amit.
Do you need a v2 with a change, or feel like fixing the typo when pulling this patch?
I think its a minor one and a v2 is not required just for this.
@Harsh, could you please fix this while pulling it?
Thanks,
Amit
Quoted 32 lines
Regards,
PierrickQuoted 26 lines
Quoted 26 lines
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 <[email protected]>--- target/ppc/cpu_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)target/ppc/cpu_init.c +1
-1@@ -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); } } }Signature · 1 line
2.43.0
Quoted 5 lines · Amit Machhiwal
Quoted 2 lines
Do you need a v2 with a change, or feel like fixing the typo when pulling this patch?
I think its a minor one and a v2 is not required just for this.
@Harsh, could you please fix this while pulling it?
Fixed typo and queued for 11.2, thanks.
Quoted 3 lines
Thanks,
Amit