Skip to contentSkip to conversation

target/i386: kvm: just return after migrate_add_blocker failed

PATCH In review Li Qiang 2 participants 2 messages Oct 6, 2018 – Oct 8, 2018

lore
Share & tools
lore

Li Qiang

author
#0 lore raw

PATCH 1/1 target/i386: kvm: just return after migrate_add_blocker failed

When migrate_add_blocker failed, the invtsc_mig_blocker is not appended so no need to remove. This can save several instructions.

---
 target/i386/kvm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
target/i386/kvm.c +1 -1
index 0b2a07d3a4..6ba84a39f3 100644
@@ -1153,7 +1153,7 @@ int kvm_arch_init_vcpu(CPUState *cs)
             if (local_err) {
                 error_report_err(local_err);
                 error_free(invtsc_mig_blocker);
-                goto fail;
+                return r;
             }
             /* for savevm */
             vmstate_x86_cpu.unmigratable = 1;
Signature · 1 line
2.17.1
#1 lore raw
Quoted 13 lines · * Li Qiang ([email protected]) wrote:

When migrate_add_blocker failed, the invtsc_mig_blocker is not appended so no need to remove. This can save several instructions.

---
 target/i386/kvm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
target/i386/kvm.c +0 -0
index 0b2a07d3a4..6ba84a39f3 100644

target/i386/kvm.c int kvm_arch_init_vcpu(CPUState *cs) · line 1156

Quoted 5 lines
target/i386/kvm.c +1 -1
@@ -1153,7 +1153,7 @@ int kvm_arch_init_vcpu(CPUState *cs)
             if (local_err) {
                 error_report_err(local_err);
                 error_free(invtsc_mig_blocker);
-                goto fail;
+                return r;

So I think that's OK, however, I wonder if fail: should be doing some more cleanup?
For example, I notice we've added cpu_update_state to the change state handler's before that point, should that be removed?

Dave

Quoted 7 lines
target/i386/kvm.c +0 -0
             }
             /* for savevm */
             vmstate_x86_cpu.unmigratable = 1;
Signature · 1 line
2.17.1

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK