Message ID | 1b3cb65e09304c3327121b89cb7387961a59c408.1670085207.git.huangy81@chinatelecom.cn (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | migration: introduce dirtylimit capabilit | expand |
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index f99b0be..ff26b07 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -683,6 +683,15 @@ static uint32_t kvm_dirty_ring_reap_one(KVMState *s, CPUState *cpu) uint32_t ring_size = s->kvm_dirty_ring_size; uint32_t count = 0, fetch = cpu->kvm_fetch_index; + /* + * It's possible that we race with vcpu creation code where the vcpu is + * put onto the vcpus list but not yet initialized the dirty ring + * structures. If so, skip it. + */ + if (!cpu->created) { + return 0; + } + assert(dirty_gfns && ring_size); trace_kvm_dirty_ring_reap_vcpu(cpu->cpu_index);