qemu/accel
Peter Xu dcafa24827 KVM: Fix dirty ring mmap incorrect size due to renaming accident
Found this when I wanted to try the per-vcpu dirty rate series out, then I
found that it's not really working and it can quickly hang death a guest.  I
found strange errors (e.g. guest crash after migration) happens even without
the per-vcpu dirty rate series.

When merging dirty ring, probably no one notice that the trivial renaming diff
[1] missed two existing references of kvm_dirty_ring_sizes; they do matter
since otherwise we'll mmap() a shorter range of memory after the renaming.

I think it didn't SIGBUS for me easily simply because some other stuff within
qemu mmap()ed right after the dirty rings (e.g. when testing 4096 slots, it
aligned with one small page on x86), so when we access the rings we've been
reading/writting to random memory elsewhere of qemu.

Fix the two sizes when map/unmap the shared dirty gfn memory.

[1] https://lore.kernel.org/qemu-devel/dac5f0c6-1bca-3daf-e5d2-6451dbbaca93@redhat.com/

Cc: Hyman Huang <huangy81@chinatelecom.cn>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
Message-Id: <20210609014355.217110-1-peterx@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-06-25 10:54:12 +02:00
..
hvf hvf: Simplify post reset/init/loadvm hooks 2021-06-03 16:43:27 +01:00
kvm KVM: Fix dirty ring mmap incorrect size due to renaming accident 2021-06-25 10:54:12 +02:00
qtest accel: replace struct CpusAccel with AccelOpsClass 2021-02-05 10:24:15 -10:00
stubs Do not include cpu.h if it's not really necessary 2021-05-02 17:24:51 +02:00
tcg accel/tcg: Probe the proper permissions for atomic ops 2021-06-19 11:09:10 -07:00
xen sysemu: Let VMChangeStateHandler take boolean 'running' argument 2021-03-09 23:13:57 +01:00
accel-common.c accel: add init_accel_cpu for adapting accel behavior to CPU type 2021-05-10 15:41:52 -04:00
accel-softmmu.c accel: replace struct CpusAccel with AccelOpsClass 2021-02-05 10:24:15 -10:00
accel-softmmu.h accel: replace struct CpusAccel with AccelOpsClass 2021-02-05 10:24:15 -10:00
accel-user.c accel: extend AccelState and AccelClass to user-mode 2021-02-05 10:24:15 -10:00
dummy-cpus.c accel: move qtest CpusAccel functions to a common location 2020-10-24 07:23:19 +02:00
Kconfig Add NVMM accelerator: configure and build logic 2021-05-04 14:15:34 +02:00
meson.build hvf: Move assert_hvf_ok() into common directory 2021-06-03 16:43:26 +01:00