Skip to content

pc: memhp: enforce gaps between DIMMs

Igor Mammedov qemu-devel 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest2 patches 4 repliesIn review
  2. v22 patches 1 replySuperseded
  3. v12 patches 9 repliesSuperseded

Changes in v3 from the cover letter

- use pc_machine_class_init() for default. (Eduardo)
- make 'gap' boolean and just add 1 byte gap
when calculating new_addr for DIMM.

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2memhp: extend address auto assignment to support gapshw/i386/pc.c hw/mem/pc-dimm.c hw/ppc/spapr.c +1 more+16 -114 replies
2/2pc: memhp: force gaps between DIMM's GPAhw/i386/pc.c hw/i386/pc_piix.c hw/i386/pc_q35.c +1 more+7 -20 replies

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchEduardo Habkost
1/2A-b
2/2A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [Qemu-devel] [PATCH v3 0/2] pc: memhp: enforce gaps between DIMMs

v3:
- use pc_machine_class_init() for default. (Eduardo)
- make 'gap' boolean and just add 1 byte gap
when calculating new_addr for DIMM.
v2:
make inter_dimm_gap a boolean and inster gap in 1 byte instead of 2Mb, due to alignment that gap would be extended up to natural backend alignment value.

it's a simplier way suggested by Michael S. Tsirkin to workaround virtio bug reported earlier:
http://lists.nongnu.org/archive/html/qemu-devel/2015-08/msg00522.html
where virtio can't handle buffer that crosses border between 2 DIMM's (i.e. 2 MemoryRegions).

idea is to leave gaps between DIMMs, making their GPAs non contiguous, which effectively forces kmalloc to not use DIMM if buffer doesn't fit inside of it.

Simpler reproducer:
qemu-system-x86_64 -enable-kvm -m 256,slots=250,maxmem=32G -drive if=virtio,file=/dev/slow/rhel72 \
for i in $(seq 0 58); do echo -n "-object memory-backend-ram,id=m$i,size=10M -device pc-dimm,id=dimm$i,memdev=m$i "; done \
-nodefaults -snapshot -serial stdio -nographic -M pc-i440fx-2.4

if guest manages to boot just login and do:
dd if=/dev/vda of=/dev/null bs=128M

it will crash QEMU in 99% cases with following message:
qemu-system-x86_64: virtio: error trying to map MMIO memory

Tested vs master and mst/PCI trees.

Igor Mammedov (2):
memhp: extend address auto assignment to support gaps
pc: memhp: force gaps between DIMM's GPA

 hw/i386/pc.c             |  5 ++++-
 hw/i386/pc_piix.c        |  1 +
 hw/i386/pc_q35.c         |  1 +
 hw/mem/pc-dimm.c         | 15 +++++++++------
 hw/ppc/spapr.c           |  2 +-
 include/hw/i386/pc.h     |  1 +
 include/hw/mem/pc-dimm.h |  7 ++++---
 7 files changed, 21 insertions(+), 11 deletions(-)
Signature · 1 line
1.8.3.1