target/arm/machine: Trace all register mismatches
At the moment, cpu_post_load() exits with error on the first catch of unexpected register in the incoming stream. Let the code go further and trace all the issues before exiting. Signed-off-by: Eric Auger <eric.auger@redhat.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 20260304101625.1962633-7-eric.auger@redhat.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Eric Auger committed
Mar 6, 2026 at 09:01 UTC
e25c63c3b368118dc109e49393554f85f1203d1e
1 file changed
+10
-2
target/arm/machine.c
+10
-2
@@ -1061,6 +1061,7 @@ static int cpu_post_load(void *opaque, int version_id)
1061
{
1062
ARMCPU *cpu = opaque;
1063
CPUARMState *env = &cpu->env;
1064
+ bool fail = false;
1065
int i, v;
1066
1067
trace_cpu_post_load(cpu->cpreg_vmstate_array_len,
@@ -1093,13 +1094,14 @@ static int cpu_post_load(void *opaque, int version_id)
1094
*/
1095
1096
for (i = 0, v = 0; i < cpu->cpreg_array_len
1096
- && v < cpu->cpreg_vmstate_array_len; i++) {
1097
+ && v < cpu->cpreg_vmstate_array_len;) {
1098
if (cpu->cpreg_vmstate_indexes[v] > cpu->cpreg_indexes[i]) {
1099
g_autofree gchar *name = print_register_name(cpu->cpreg_indexes[i]);
1100
1101
warn_report("%s: %s "
1102
"expected by the destination but not in the incoming stream: "
1103
"skip it", __func__, name);
1104
+ i++;
1105
continue;
1106
}
1107
if (cpu->cpreg_vmstate_indexes[v] < cpu->cpreg_indexes[i]) {
@@ -1107,12 +1109,18 @@ static int cpu_post_load(void *opaque, int version_id)
1109
1110
error_report("%s: %s in the incoming stream but unknown on the destination: "
1111
"fail migration", __func__, name);
1110
- return -1;
1112
+ v++;
1113
+ fail = true;
1114
+ continue;
1115
}
1116
/* matching register, copy the value over */
1117
cpu->cpreg_values[i] = cpu->cpreg_vmstate_values[v];
1118
+ i++;
1119
v++;
1120
}
1121
+ if (fail) {
1122
+ return -1;
1123
+ }
1124
1125
if (kvm_enabled()) {
1126
if (!kvm_arm_cpu_post_load(cpu)) {