qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [RFC PATCH v4 00/30] ACPI memory hotplug
@ 2012-12-18 12:41 Vasilis Liaskovitis
  2012-12-18 12:41 ` [Qemu-devel] [RFC PATCH v4 01/30] [SeaBIOS] Add ACPI_EXTRACT_DEVICE* macros Vasilis Liaskovitis
                   ` (34 more replies)
  0 siblings, 35 replies; 72+ messages in thread
From: Vasilis Liaskovitis @ 2012-12-18 12:41 UTC (permalink / raw)
  To: qemu-devel, seabios
  Cc: Vasilis Liaskovitis, pingfank, gleb, stefanha, jbaron, blauwirbel,
	kevin, kraxel, anthony

This is v4 of the ACPI memory hotplug functionality. Only x86_64 target is
supported (both i440fx and q35). There are still several issues, but it's
been a while since v3 and I wanted to get some more feedback on the current
state of the patchseries.

Overview:

Dimm device layout is modeled with a normal qemu device:

"-device dimm,id=name,size=sz,node=pxm,populated=on|off,bus=membus.0"

The starting physical address for all dimms is calculated from top of memory,
during memory controller init, skipping the pci hole at [PCI_HOLE_START, 4G).
e.g.
"-device dimm,id=dimm0,size=512M,node=0,populated=off,bus=membus.0"
will define a 512M memory dimm belonging to numa node 0, on bus membus.0.

Because dimm layout needs to be configured on machine-boot, all dimm devices
need to be specified on startup command line (either with populated=on or with
populated=off). The dimm information is stored in dimm configuration structures.

After machine startup, dimms are hot-added or removed with normal device_add
and device_del operations e.g.:
Hot-add syntax: "device_add dimm,id=mydimm0,bus=membus.0"
Hot-remove syntax: "device_del dimm,id=mydimm0"

Changes v3->v4

- Dimms added with normal -device argument (extra -dimm arg dropped).
- multiple memory buses can be registered. Memory buses of the real hw/chipset
  or a paravirtual memory bus can be added.
- acpi implementation uses memory API instead of old ioports.
- Support for q35/ich9 added (still buggy, see patch 12/31).
- piix4/i440fx initialization code has been refactored to resemble q35. This
will allow memory map initialization at chipset qdev init time for both
machines, as well as more similar code.
- Hot-remove functionality has been moved to separate patches. Hot-remove no
longer frees memory but unmaps the dimm/qdev device from the guest's view.
Freeing the memory should happen when the last user unrefs/unmaps the memory,
see also (work in progress):
https://lists.gnu.org/archive/html/qemu-devel/2012-11/msg00728.html
https://lists.gnu.org/archive/html/qemu-devel/2012-11/msg02697.html
- new qmp/hmp command for the state of each dimm (on/off)

Changes v2->v3

- qdev integration. Dimms are attached to a dimmbus. The dimmbus is a child
  of i440fx device in the pc machine. Hot-add and remove are done with normal
  device_add / device_del operations on the dimmbus. New commands "dimm_add" and
  "dimm_del" are obsolete.
- Add _PS3 method to allow OSPM-induced hot operations.
- pci-window calculation in Seabios takes dimms into account(for both 32-bit and
  64-bit windows)
- rename new qmp commands: query-memory-total and query-memory-hotplug
- balloon driver can see the hotplugged memory

Changes v1->v2

- memory map is automatically calculated for hotplug dimms. Dimms are added from
top-of-memory skipping the pci hole at [PCI_HOLE_START, 4G).
- Renamed from "-memslot" to "-dimm". Commands changed to "dimm_add", "dimm_del"
- Seabios ejection array reduced to a byte. Use extraction macros for dimm ssdt.
- additional SRAT paravirt info does not break previous SRAT fw_cfg layout.
- Documentation of new acpi_piix4 registers and paravirt data.
- add ACPI _OST support for _OST enabled guests. This allows qemu to receive
notification for success / failure of memory hot-add and hot-remove operations.
Guest needs to support _OST (https://lkml.org/lkml/2012/6/25/321)
- add monitor info command to report total guest memory (initial + hot-added)

Issues:

- hot-remove needs to only unmap the dimm device from guest's view. Freeing the
memory should happen when the last user of the device (e.g. virtio-blk) unrefs
the device. A testcase is needed for this.

- Live Migration: Ramblocks are migrated before qdev VMStates are migrated. So
the DimmDevice is handled diferrently than other devices. Should this be
reworked ?( DimmDevice structure currently does not define a VMStateDescription)
Live migration works as long as the dimm layout (command line args) are
identical at the source and destination qemu command line, and destination takes
into account hot-operations that have occured on source. (v3 patch 10/19
created the DimmDevice that corresponds to an unknown incoming ramblock, e.g.
for a dimm that was hot-added on source. but has been dropped for the moment). 

- A main blocker issue is windows guest functionality. The patchset does not
work for windows currently.  Testing on win2012 server RC or windows2008
consumer prerelease, when adding a DIMM, there is a BSOD with ACPI_BIOS_ERROR
message. After this, the VM keeps rebooting with ACPI_BIOS_ERROR. The windows
pnpmem driver obviosuly has a problem with the seabios dimm implementation
(or the seabios dimm implementation is not fully ACPI-compliant). If someone
can review the seabios patches or has any ideas to debug this, let me know.

- hot-operation notification lists need to be added to migration state.

series is based on:
- qemu master (commit a8a826a3) + patch:
https://lists.gnu.org/archive/html/qemu-devel/2012-11/msg02699.html 
- seabios master (commit a810e4e7) 

Can also be found at:

http://github.com/vliaskov/qemu-kvm/commits/memhp-v4
http://github.com/vliaskov/seabios/commits/memhp-v4

Vasilis Liaskovitis (21):
  qapi: make visit_type_size fallback to type_int
  Add SIZE type to qdev properties
  qemu-option: export parse_option_number
  Implement dimm device abstraction
  vl: handle "-device dimm"
  acpi_piix4 : Implement memory device hotplug registers
  acpi_ich9 : Implement memory device hotplug registers
  piix_pci and pc_piix: refactor
  piix_pci: Add i440fx dram controller initialization
  q35: Add i440fx dram controller initialization
  pc: Add dimm paravirt SRAT info
  Introduce paravirt interface QEMU_CFG_PCI_WINDOW
  Implement "info memory-total" and "query-memory-total"
  balloon: update with hotplugged memory
  Implement dimm-info
  dimm: add hot-remove capability
  acpi_piix4: add hot-remove capability
  acpi_ich9: add hot-remove capability
  Implement qmp and hmp commands for notification lists
  Add _OST dimm support
  Implement _PS3 for dimm

 docs/specs/acpi_hotplug.txt |   54 ++++++
 docs/specs/fwcfg.txt        |   28 +++
 hmp-commands.hx             |    6 +
 hmp.c                       |   41 ++++
 hmp.h                       |    3 +
 hw/Makefile.objs            |    2 +-
 hw/acpi.h                   |    5 +
 hw/acpi_ich9.c              |  115 +++++++++++-
 hw/acpi_ich9.h              |   12 +-
 hw/acpi_piix4.c             |  126 ++++++++++++-
 hw/dimm.c                   |  444 +++++++++++++++++++++++++++++++++++++++++++
 hw/dimm.h                   |  102 ++++++++++
 hw/fw_cfg.h                 |    1 +
 hw/lpc_ich9.c               |    2 +-
 hw/pc.c                     |   28 +++-
 hw/pc.h                     |    1 +
 hw/pc_piix.c                |   74 ++++++--
 hw/pc_q35.c                 |   18 ++-
 hw/piix_pci.c               |  249 ++++++++-----------------
 hw/q35.c                    |   27 +++
 hw/q35.h                    |    5 +
 hw/qdev-properties.c        |   60 ++++++
 hw/qdev-properties.h        |    3 +
 hw/virtio-balloon.c         |   13 +-
 monitor.c                   |   21 ++
 qapi-schema.json            |   63 ++++++
 qapi/qapi-visit-core.c      |   11 +-
 qemu-option.c               |    4 +-
 qemu-option.h               |    4 +
 qmp-commands.hx             |   57 ++++++
 sysemu.h                    |    1 +
 vl.c                        |   60 ++++++
 32 files changed, 1432 insertions(+), 208 deletions(-)
 create mode 100644 docs/specs/acpi_hotplug.txt
 create mode 100644 docs/specs/fwcfg.txt
 create mode 100644 hw/dimm.c
 create mode 100644 hw/dimm.h


Vasilis Liaskovitis (9):
  Add ACPI_EXTRACT_DEVICE* macros
  Add SSDT memory device support
  acpi-dsdt: Implement functions for memory hotplug
  acpi: generate hotplug memory devices
  q35: Add memory hotplug handler
  pci: Use paravirt interface for pcimem_start and pcimem64_start
  acpi: add _EJ0 operation and eject port for memory devices
  Add _OST dimm method
  Implement _PS3 method for memory device

 Makefile                      |    2 +-
 src/acpi-dsdt-mem-hotplug.dsl |  136 +++++++++++++++++++++++++++++++++++
 src/acpi-dsdt.dsl             |    5 +-
 src/acpi.c                    |  158 +++++++++++++++++++++++++++++++++++++++--
 src/paravirt.c                |    6 ++
 src/paravirt.h                |    2 +
 src/pciinit.c                 |    9 +++
 src/q35-acpi-dsdt.dsl         |    6 +-
 src/ssdt-mem.dsl              |   73 +++++++++++++++++++
 tools/acpi_extract.py         |   28 +++++++
 10 files changed, 415 insertions(+), 10 deletions(-)
 create mode 100644 src/acpi-dsdt-mem-hotplug.dsl
 create mode 100644 src/ssdt-mem.dsl

-- 
1.7.9

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

end of thread, other threads:[~2013-04-02  9:16 UTC | newest]

Thread overview: 72+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-18 12:41 [Qemu-devel] [RFC PATCH v4 00/30] ACPI memory hotplug Vasilis Liaskovitis
2012-12-18 12:41 ` [Qemu-devel] [RFC PATCH v4 01/30] [SeaBIOS] Add ACPI_EXTRACT_DEVICE* macros Vasilis Liaskovitis
2013-03-20  3:28   ` li guang
2012-12-18 12:41 ` [Qemu-devel] [RFC PATCH v4 02/30] [SeaBIOS] Add SSDT memory device support Vasilis Liaskovitis
2012-12-18 12:41 ` [Qemu-devel] [RFC PATCH v4 03/30] [SeaBIOS] acpi-dsdt: Implement functions for memory hotplug Vasilis Liaskovitis
2012-12-18 12:41 ` [Qemu-devel] [RFC PATCH v4 04/30] [SeaBIOS] acpi: generate hotplug memory devices Vasilis Liaskovitis
2012-12-18 12:41 ` [Qemu-devel] [RFC PATCH v4 05/30] [SeaBIOS] q35: Add memory hotplug handler Vasilis Liaskovitis
2012-12-18 12:41 ` [Qemu-devel] [RFC PATCH v4 06/30] qapi: make visit_type_size fallback to type_int Vasilis Liaskovitis
2013-01-09  0:18   ` Andreas Färber
2013-01-09 16:00     ` mdroth
2012-12-18 12:41 ` [Qemu-devel] [RFC PATCH v4 07/30] Add SIZE type to qdev properties Vasilis Liaskovitis
2013-03-20  6:06   ` li guang
2013-03-20 14:24     ` Eric Blake
2013-03-21  0:39       ` li guang
2012-12-18 12:41 ` [Qemu-devel] [RFC PATCH v4 08/30] qemu-option: export parse_option_number Vasilis Liaskovitis
2012-12-18 12:41 ` [Qemu-devel] [RFC PATCH v4 09/30] Implement dimm device abstraction Vasilis Liaskovitis
2013-03-26  3:51   ` li guang
2012-12-18 12:41 ` [Qemu-devel] [RFC PATCH v4 10/30] vl: handle "-device dimm" Vasilis Liaskovitis
2012-12-18 12:41 ` [Qemu-devel] [RFC PATCH v4 11/30] acpi_piix4 : Implement memory device hotplug registers Vasilis Liaskovitis
2012-12-18 12:41 ` [Qemu-devel] [RFC PATCH v4 12/30] acpi_ich9 " Vasilis Liaskovitis
2012-12-18 12:41 ` [Qemu-devel] [RFC PATCH v4 13/30] piix_pci and pc_piix: refactor Vasilis Liaskovitis
2013-01-16  7:20   ` Hu Tao
2013-01-16  9:36     ` Vasilis Liaskovitis
2013-01-16 11:17       ` Andreas Färber
2013-01-16 17:10         ` Vasilis Liaskovitis
2012-12-18 12:41 ` [Qemu-devel] [RFC PATCH v4 14/30] piix_pci: Add i440fx dram controller initialization Vasilis Liaskovitis
2012-12-18 12:41 ` [Qemu-devel] [RFC PATCH v4 15/30] q35: " Vasilis Liaskovitis
2012-12-18 12:41 ` [Qemu-devel] [RFC PATCH v4 16/30] pc: Add dimm paravirt SRAT info Vasilis Liaskovitis
2012-12-18 12:41 ` [Qemu-devel] [RFC PATCH v4 17/30] [SeaBIOS] pci: Use paravirt interface for pcimem_start and pcimem64_start Vasilis Liaskovitis
2012-12-18 12:41 ` [Qemu-devel] [RFC PATCH v4 18/30] Introduce paravirt interface QEMU_CFG_PCI_WINDOW Vasilis Liaskovitis
2012-12-18 12:41 ` [Qemu-devel] [RFC PATCH v4 19/30] Implement "info memory-total" and "query-memory-total" Vasilis Liaskovitis
2012-12-19 19:47   ` Blue Swirl
2013-01-04 16:21   ` Eric Blake
2013-01-10 17:42     ` Vasilis Liaskovitis
2012-12-18 12:41 ` [Qemu-devel] [RFC PATCH v4 20/30] balloon: update with hotplugged memory Vasilis Liaskovitis
2012-12-18 12:41 ` [Qemu-devel] [RFC PATCH v4 21/30] Implement dimm-info Vasilis Liaskovitis
2013-01-08 23:20   ` Eric Blake
2013-01-10 17:45     ` Vasilis Liaskovitis
2012-12-18 12:41 ` [Qemu-devel] [RFC PATCH v4 22/30] [SeaBIOS] acpi: add _EJ0 operation and eject port for memory devices Vasilis Liaskovitis
2012-12-18 12:41 ` [Qemu-devel] [RFC PATCH v4 23/30] dimm: add hot-remove capability Vasilis Liaskovitis
2012-12-18 12:41 ` [Qemu-devel] [RFC PATCH v4 24/30] acpi_piix4: " Vasilis Liaskovitis
2012-12-18 12:41 ` [Qemu-devel] [RFC PATCH v4 25/30] acpi_ich9: " Vasilis Liaskovitis
2012-12-19 19:48   ` Blue Swirl
2012-12-18 12:41 ` [Qemu-devel] [RFC PATCH v4 26/30] Implement qmp and hmp commands for notification lists Vasilis Liaskovitis
2013-01-09  0:23   ` Eric Blake
2012-12-18 12:41 ` [Qemu-devel] [RFC PATCH v4 27/30] [SeaBIOS] Add _OST dimm method Vasilis Liaskovitis
2012-12-18 12:41 ` [Qemu-devel] [RFC PATCH v4 28/30] Add _OST dimm support Vasilis Liaskovitis
2012-12-18 12:41 ` [Qemu-devel] [RFC PATCH v4 29/30] [SeaBIOS] Implement _PS3 method for memory device Vasilis Liaskovitis
2012-12-18 12:41 ` [Qemu-devel] [RFC PATCH v4 30/30] Implement _PS3 for dimm Vasilis Liaskovitis
2012-12-18 16:45 ` [Qemu-devel] [RFC PATCH v4 00/30] ACPI memory hotplug Zhi Yong Wu
2012-12-19 11:40   ` Vasilis Liaskovitis
2012-12-19  7:27 ` Gerd Hoffmann
2012-12-19 11:35   ` Vasilis Liaskovitis
2012-12-19 13:56     ` Gerd Hoffmann
2013-01-10 18:57     ` Vasilis Liaskovitis
2013-03-19  6:30       ` li guang
2013-03-26 16:58         ` Vasilis Liaskovitis
2013-03-27  2:42           ` li guang
2013-04-02  9:15       ` liu ping fan
2013-01-09  0:08 ` Andreas Färber
2013-01-10 17:36   ` Vasilis Liaskovitis
2013-01-10 17:55     ` Andreas Färber
2013-03-20  6:18   ` li guang
2013-03-26 14:20     ` Eduardo Habkost
2013-03-27  7:39       ` li guang
     [not found] ` <CAF+CadtnTcOnUt7jp1bARJgioxR5KzLG0QSQuDbiqhiKxiCqFA@mail.gmail.com>
     [not found]   ` <20130228101819.GA4370@dhcp-192-168-178-175.profitbricks.localdomain>
2013-03-19  7:28     ` li guang
2013-03-26 16:43       ` Vasilis Liaskovitis
2013-03-27  2:54         ` li guang
2013-03-28  9:29           ` Vasilis Liaskovitis
2013-03-28  9:49             ` liu ping fan
2013-03-26 14:47 ` Luiz Capitulino
2013-03-26 16:59   ` Vasilis Liaskovitis

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).