qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 00/11] Make memory_region_init_ram() and friends handle migration
@ 2017-07-07 14:42 Peter Maydell
  2017-07-07 14:42 ` [Qemu-devel] [PATCH 01/11] include/hw/boards.h: Document memory_region_allocate_system_memory() Peter Maydell
                   ` (12 more replies)
  0 siblings, 13 replies; 23+ messages in thread
From: Peter Maydell @ 2017-07-07 14:42 UTC (permalink / raw)
  To: qemu-devel
  Cc: patches, Paolo Bonzini, Eduardo Habkost, Marcel Apfelbaum,
	Igor Mammedov

This patchset changes the memory region functions
 - memory_region_init_ram()
 - memory_region_init_rom()
 - memory_region_init_rom_device()
to all automatically register the backing memory they allocate
for migration using vmstate_register_ram(). Renamed functions
 - memory_region_init_ram_nomigrate()
 - memory_region_init_rom_nomigrate()
 - memory_region_init_rom_device_nomigrate()
are provided which only do the MR init, for the oddball
cases which want to manage migration of the backing memory
themselves (and to avoid behavioural changes for callers
which weren't managing correctly migration themselves...)

The idea is based on discussion from a previous patchset:
 https://lists.gnu.org/archive/html/qemu-devel/2017-07/msg00764.html

The series includes a largish coccinelle-scripted patch and a
few by-hand conversions which change callsites which previously
manually created the region and registered its backing ram in
two separate steps to use the new functions.

This series does not include any patches to fix bugs like:
 * caller forgot to call vmstate_register_ram() so region
   is not actually migrated (eg hw/arm/highbank.c)
 * caller used vmstate_register_ram_global() even though it is
   a device, so you can't create 2 copies of the device (eg sm501)
because I wanted to stick to strictly no-behaviour-change
for this patch -- we can fix the bugs separately (fixes will
tend to imply migration compat breaks so can only be done
for some boards.) Most of the remaining callers of the
_nomigrate functions are buggy, I think (and a demonstration
that our current API does not score well on the "hard to
get wrong by accident" scale).


thanks
-- PMM

Peter Maydell (11):
  include/hw/boards.h: Document memory_region_allocate_system_memory()
  memory: Document that the RAM MR initializers do not handle migration
  memory: Rename memory_region_init_ram() to
    memory_region_init_ram_nomigrate()
  memory: Rename memory_region_init_rom() and _rom_device() to
    _nomigrate()
  memory.h: Add memory_region_init_{ram,rom,rom_device}() handling
    migration
  scripts/coccinelle/memory-region-init-ram.cocci: New script
  hw: Use new memory_region_init_{ram,rom,rom_device}() functions
  hw/block/pflash_cfi01, pflash_cfi02: Use
    memory_region_init_rom_device()
  hw/pci/pci.c: Use memory_region_init_rom()
  hw/display/qxl.c Use memory_region_init_ram()
  docs/devel/memory.txt: Add section about RAM migration

 docs/devel/memory.txt                           |  31 +++++
 include/exec/memory.h                           | 161 ++++++++++++++++++++----
 include/hw/boards.h                             |  29 +++++
 backends/hostmem-ram.c                          |   2 +-
 hw/arm/aspeed.c                                 |   2 +-
 hw/arm/aspeed_soc.c                             |   2 +-
 hw/arm/exynos4210.c                             |   2 -
 hw/arm/exynos4_boards.c                         |   2 -
 hw/arm/fsl-imx25.c                              |   5 +-
 hw/arm/fsl-imx31.c                              |   5 +-
 hw/arm/fsl-imx6.c                               |   5 +-
 hw/arm/highbank.c                               |   2 +-
 hw/arm/integratorcp.c                           |   2 +-
 hw/arm/mainstone.c                              |   1 -
 hw/arm/musicpal.c                               |   1 -
 hw/arm/omap1.c                                  |   1 -
 hw/arm/omap2.c                                  |   1 -
 hw/arm/omap_sx1.c                               |   6 +-
 hw/arm/palm.c                                   |   1 -
 hw/arm/pxa2xx.c                                 |   4 -
 hw/arm/realview.c                               |   3 -
 hw/arm/spitz.c                                  |   1 -
 hw/arm/stellaris.c                              |   2 -
 hw/arm/stm32f205_soc.c                          |   3 -
 hw/arm/tosa.c                                   |   1 -
 hw/arm/vexpress.c                               |   3 -
 hw/arm/virt.c                                   |   4 +-
 hw/arm/xilinx_zynq.c                            |   1 -
 hw/arm/xlnx-zynqmp.c                            |   1 -
 hw/block/onenand.c                              |   2 +-
 hw/block/pflash_cfi01.c                         |   1 -
 hw/block/pflash_cfi02.c                         |   1 -
 hw/cris/axis_dev88.c                            |   5 +-
 hw/display/cg3.c                                |   3 +-
 hw/display/qxl.c                                |   3 -
 hw/display/sm501.c                              |   2 +-
 hw/display/tc6393xb.c                           |   1 -
 hw/display/tcx.c                                |   4 +-
 hw/display/vga.c                                |   2 +-
 hw/display/vmware_vga.c                         |   1 -
 hw/i386/pc.c                                    |   1 -
 hw/i386/pc_sysfw.c                              |   2 -
 hw/i386/pci-assign-load-rom.c                   |   2 +-
 hw/i386/xen/xen-hvm.c                           |   1 -
 hw/input/milkymist-softusb.c                    |   4 +-
 hw/m68k/an5206.c                                |   1 -
 hw/m68k/mcf5208.c                               |   1 -
 hw/microblaze/petalogix_ml605_mmu.c             |   2 -
 hw/microblaze/petalogix_s3adsp1800_mmu.c        |   2 -
 hw/mips/boston.c                                |   2 +-
 hw/mips/mips_fulong2e.c                         |   1 -
 hw/mips/mips_jazz.c                             |   2 -
 hw/mips/mips_malta.c                            |   2 +-
 hw/mips/mips_mipssim.c                          |   1 -
 hw/mips/mips_r4k.c                              |   1 -
 hw/moxie/moxiesim.c                             |   4 +-
 hw/net/dp8393x.c                                |   2 +-
 hw/net/milkymist-minimac2.c                     |   2 +-
 hw/nios2/10m50_devboard.c                       |   8 +-
 hw/openrisc/openrisc_sim.c                      |   1 -
 hw/pci-host/prep.c                              |   2 +-
 hw/pci-host/xilinx-pcie.c                       |   2 +-
 hw/pci/pci.c                                    |   1 -
 hw/ppc/mac_newworld.c                           |   1 -
 hw/ppc/mac_oldworld.c                           |   1 -
 hw/ppc/ppc405_boards.c                          |   3 -
 hw/ppc/ppc405_uc.c                              |   1 -
 hw/s390x/sclp.c                                 |   1 -
 hw/sh4/r2d.c                                    |   1 -
 hw/sh4/shix.c                                   |   3 -
 hw/sparc/leon3.c                                |   1 -
 hw/sparc/sun4m.c                                |   6 +-
 hw/sparc64/sun4u.c                              |   4 +-
 hw/tricore/tricore_testboard.c                  |  26 ++--
 hw/unicore32/puv3.c                             |   1 -
 hw/xtensa/sim.c                                 |   4 +-
 hw/xtensa/xtfpga.c                              |   4 +-
 memory.c                                        | 110 +++++++++++++---
 numa.c                                          |   4 +-
 scripts/coccinelle/memory-region-init-ram.cocci |  38 ++++++
 80 files changed, 385 insertions(+), 180 deletions(-)
 create mode 100644 scripts/coccinelle/memory-region-init-ram.cocci

-- 
2.7.4

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2017-07-25  5:28 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-07 14:42 [Qemu-devel] [PATCH 00/11] Make memory_region_init_ram() and friends handle migration Peter Maydell
2017-07-07 14:42 ` [Qemu-devel] [PATCH 01/11] include/hw/boards.h: Document memory_region_allocate_system_memory() Peter Maydell
2017-07-10  9:42   ` Paolo Bonzini
2017-07-07 14:42 ` [Qemu-devel] [PATCH 02/11] memory: Document that the RAM MR initializers do not handle migration Peter Maydell
2017-07-10 10:01   ` Paolo Bonzini
2017-07-10 10:04     ` Peter Maydell
2017-07-10 10:05       ` Paolo Bonzini
2017-07-10 10:08         ` Peter Maydell
2017-07-07 14:42 ` [Qemu-devel] [PATCH 03/11] memory: Rename memory_region_init_ram() to memory_region_init_ram_nomigrate() Peter Maydell
2017-07-07 14:42 ` [Qemu-devel] [PATCH 04/11] memory: Rename memory_region_init_rom() and _rom_device() to _nomigrate() Peter Maydell
2017-07-07 14:42 ` [Qemu-devel] [PATCH 05/11] memory.h: Add memory_region_init_{ram, rom, rom_device}() handling migration Peter Maydell
2017-07-07 14:42 ` [Qemu-devel] [PATCH 06/11] scripts/coccinelle/memory-region-init-ram.cocci: New script Peter Maydell
2017-07-07 14:42 ` [Qemu-devel] [PATCH 07/11] hw: Use new memory_region_init_{ram, rom, rom_device}() functions Peter Maydell
2017-07-07 14:42 ` [Qemu-devel] [PATCH 08/11] hw/block/pflash_cfi01, pflash_cfi02: Use memory_region_init_rom_device() Peter Maydell
2017-07-07 14:42 ` [Qemu-devel] [PATCH 09/11] hw/pci/pci.c: Use memory_region_init_rom() Peter Maydell
2017-07-07 14:42 ` [Qemu-devel] [PATCH 10/11] hw/display/qxl.c Use memory_region_init_ram() Peter Maydell
2017-07-07 14:42 ` [Qemu-devel] [PATCH 11/11] docs/devel/memory.txt: Add section about RAM migration Peter Maydell
2017-07-10 10:05 ` [Qemu-devel] [PATCH 00/11] Make memory_region_init_ram() and friends handle migration Paolo Bonzini
2017-07-14 17:01   ` Peter Maydell
2017-07-17  9:01     ` Peter Maydell
2017-07-22  4:47 ` Philippe Mathieu-Daudé
2017-07-23 19:58   ` Peter Maydell
2017-07-25  5:28     ` Philippe Mathieu-Daudé

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).