summary refs log tree commit diff stats
path: root/hw/i386/intel_iommu.c
diff options
context:
space:
mode:
authorPeter Xu <peterx@redhat.com>2023-02-17 00:18:32 +0800
committerPaolo Bonzini <pbonzini@redhat.com>2023-04-04 18:46:46 +0200
commit56adee407fc564da19e49cfe18e20e3da92320be (patch)
treebc9b62476258378ed2f6713315af295b7d42804a /hw/i386/intel_iommu.c
parentf00506aeca2f6d92318967693f8da8c713c163f3 (diff)
downloadfocaccia-qemu-56adee407fc564da19e49cfe18e20e3da92320be.tar.gz
focaccia-qemu-56adee407fc564da19e49cfe18e20e3da92320be.zip
kvm: dirty-ring: Fix race with vcpu creation
It's possible that we want to reap a dirty ring on a vcpu that is during
creation, because the vcpu is put onto list (CPU_FOREACH visible) before
initialization of the structures.  In this case:

qemu_init_vcpu
    x86_cpu_realizefn
        cpu_exec_realizefn
            cpu_list_add      <---- can be probed by CPU_FOREACH
        qemu_init_vcpu
            cpus_accel->create_vcpu_thread(cpu);
                kvm_init_vcpu
                    map kvm_dirty_gfns  <--- kvm_dirty_gfns valid

Don't try to reap dirty ring on vcpus during creation or it'll crash.

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2124756
Reported-by: Xiaohui Li <xiaohli@redhat.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
Message-Id: <1d14deb6684bcb7de1c9633c5bd21113988cc698.1676563222.git.huangy81@chinatelecom.cn>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw/i386/intel_iommu.c')
0 files changed, 0 insertions, 0 deletions