Skip to contentSkip to conversation

pc: bugfixes, maintainers

GIT PULL Applied Michael S. Tsirkin 2 participants 6 messages Apr 13, 2020

lore
Share & tools
lore
#0 lore raw

The following changes since commit f3bac27cc1e303e1860cc55b9b6889ba39dee587:

Update version for v5.0.0-rc2 release (2020-04-07 23:13:37 +0100)

are available in the Git repository at:

git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream

for you to fetch changes up to ce4adc0b6e6167091373389ef8befd379c61fddb:

exec: Fix for qemu_ram_resize() callback (2020-04-13 06:55:54 -0400)

----------------------------------------------------------------
pc: bugfixes, maintainers

A couple of bugfixes.
Add a new vhost-user-blk maintainer.

----------------------------------------------------------------
David Hildenbrand (1):
exec: Fix for qemu_ram_resize() callback

Raphael Norwitz (1):
MAINTAINERS: Add myself as vhost-user-blk maintainer

Shameer Kolothum (2):
acpi: Use macro for table-loader file name
fw_cfg: Migrate ACPI table mr sizes separately

 include/hw/acpi/aml-build.h |  1 +
 include/hw/nvram/fw_cfg.h   |  6 +++
 exec.c                      | 16 +++++++-
 hw/arm/virt-acpi-build.c    |  2 +-
 hw/core/machine.c           |  1 +
 hw/i386/acpi-build.c        |  2 +-
 hw/nvram/fw_cfg.c           | 91 ++++++++++++++++++++++++++++++++++++++++++++-
 MAINTAINERS                 | 12 ++++++
 8 files changed, 126 insertions(+), 5 deletions(-)
#1 lore raw

[PULL 1/4] MAINTAINERS: Add myself as vhost-user-blk maintainer

From: Raphael Norwitz <[email protected]>

As suggested by Michael, let's add me as a maintainer of vhost-user-blk and vhost-user-scsi.

CC: Michael S. Tsirkin <[email protected]> CC Peter Maydell <[email protected]>

Message-Id: <[email protected]>

---
 MAINTAINERS | 12 ++++++++++++
 1 file changed, 12 insertions(+)
MAINTAINERS +12 -0
index 642c8e0b6b..5f93e8c01d 100644
@@ -1853,6 +1853,18 @@ F: hw/display/virtio-gpu*
 F: hw/display/virtio-vga.*
 F: include/hw/virtio/virtio-gpu.h
 
+vhost-user-blk
+M: Raphael Norwitz <[email protected]>
+S: Maintained
+F: contrib/vhost-user-blk/
+F: contrib/vhost-user-scsi/
+F: hw/block/vhost-user-blk.c
+F: hw/scsi/vhost-user-scsi.c
+F: hw/virtio/vhost-user-blk-pci.c
+F: hw/virtio/vhost-user-scsi-pci.c
+F: include/hw/virtio/vhost-user-blk.h
+F: include/hw/virtio/vhost-user-scsi.h
+
 vhost-user-gpu
 M: Marc-André Lureau <[email protected]>
 M: Gerd Hoffmann <[email protected]>
Signature · 1 line
MST
#2 lore raw

[PULL 2/4] acpi: Use macro for table-loader file name

In reply to Michael S. Tsirkin

From: Shameer Kolothum <[email protected]>

Use macro for "etc/table-loader" and move it to the header file similar to ACPI_BUILD_TABLE_FILE/ACPI_BUILD_RSDP_FILE etc.

Message-Id: <[email protected]>

---
 include/hw/acpi/aml-build.h | 1 +
 hw/arm/virt-acpi-build.c    | 2 +-
 hw/i386/acpi-build.c        | 2 +-
 3 files changed, 3 insertions(+), 2 deletions(-)
include/hw/acpi/aml-build.h +1 -0
index de4a406568..0f4ed53d7f 100644
@@ -13,6 +13,7 @@
 #define ACPI_BUILD_TABLE_FILE "etc/acpi/tables"
 #define ACPI_BUILD_RSDP_FILE "etc/acpi/rsdp"
 #define ACPI_BUILD_TPMLOG_FILE "etc/tpm/log"
+#define ACPI_BUILD_LOADER_FILE "etc/table-loader"
 
 #define AML_NOTIFY_METHOD "NTFY"
 
hw/arm/virt-acpi-build.c +1 -1
index 7ef0733d71..81d41a3990 100644
@@ -929,7 +929,7 @@ void virt_acpi_setup(VirtMachineState *vms)
 
     build_state->linker_mr =
         acpi_add_rom_blob(virt_acpi_build_update, build_state,
-                          tables.linker->cmd_blob, "etc/table-loader", 0);
+                          tables.linker->cmd_blob, ACPI_BUILD_LOADER_FILE, 0);
 
     fw_cfg_add_file(vms->fw_cfg, ACPI_BUILD_TPMLOG_FILE, tables.tcpalog->data,
                     acpi_data_len(tables.tcpalog));
hw/i386/acpi-build.c +1 -1
index 2a7e55bae7..23c77eeb95 100644
@@ -3043,7 +3043,7 @@ void acpi_setup(void)
 
     build_state->linker_mr =
         acpi_add_rom_blob(acpi_build_update, build_state,
-                          tables.linker->cmd_blob, "etc/table-loader", 0);
+                          tables.linker->cmd_blob, ACPI_BUILD_LOADER_FILE, 0);
 
     fw_cfg_add_file(x86ms->fw_cfg, ACPI_BUILD_TPMLOG_FILE,
                     tables.tcpalog->data, acpi_data_len(tables.tcpalog));
Signature · 1 line
MST
#3 lore raw

[PULL 3/4] fw_cfg: Migrate ACPI table mr sizes separately

In reply to Michael S. Tsirkin

From: Shameer Kolothum <[email protected]>

Any sub-page size update to ACPI MRs will be lost during migration, as we use aligned size in ram_load_precopy() -> qemu_ram_resize() path. This will result in inconsistency in FWCfgEntry sizes between source and destination. In order to avoid this, save and restore them separately during migration.

Up until now, this problem may not be that relevant for x86 as both ACPI table and Linker MRs gets padded and aligned. Also at present, qemu_ram_resize() doesn't invoke callback to update FWCfgEntry for unaligned size changes. But since we are going to fix the qemu_ram_resize() in the subsequent patch, the issue may become more serious especially for RSDP MR case.

Moreover, the issue will soon become prominent in arm/virt as well where the MRs are not padded or aligned at all and eventually have acpi table changes as part of future additions like NVDIMM hot-add feature.

Message-Id: <[email protected]>

---
 include/hw/nvram/fw_cfg.h |  6 +++
 hw/core/machine.c         |  1 +
 hw/nvram/fw_cfg.c         | 91 ++++++++++++++++++++++++++++++++++++++-
 3 files changed, 97 insertions(+), 1 deletion(-)
include/hw/nvram/fw_cfg.h +6 -0
index b5291eefad..25d9307018 100644
@@ -53,6 +53,12 @@ struct FWCfgState {
     dma_addr_t dma_addr;
     AddressSpace *dma_as;
     MemoryRegion dma_iomem;
+
+    /* restore during migration */
+    bool acpi_mr_restore;
+    uint64_t table_mr_size;
+    uint64_t linker_mr_size;
+    uint64_t rsdp_mr_size;
 };
 
 struct FWCfgIoState {
hw/core/machine.c +1 -0
index de0c425605..c1a444cb75 100644
@@ -39,6 +39,7 @@ GlobalProperty hw_compat_4_2[] = {
     { "usb-redir", "suppress-remote-wake", "off" },
     { "qxl", "revision", "4" },
     { "qxl-vga", "revision", "4" },
+    { "fw_cfg", "acpi-mr-restore", "false" },
 };
 const size_t hw_compat_4_2_len = G_N_ELEMENTS(hw_compat_4_2);
 
hw/nvram/fw_cfg.c +90 -1

145 lines not on this page · raw message

Signature · 1 line
MST
#4 lore raw

[PULL 4/4] exec: Fix for qemu_ram_resize() callback

In reply to Michael S. Tsirkin

From: David Hildenbrand <[email protected]>

Summarizing the issue:
1. Memory regions contain ram blocks with a different size, if the size is not properly aligned. While memory regions can have an unaligned size, ram blocks can't. This is true when creating resizable memory region with an unaligned size.
2. When resizing a ram block/memory region, the size of the memory region is set to the aligned size. The callback is called with the aligned size. The unaligned piece is lost.

Because of the above, if ACPI blob length modifications happens after the initial virt_acpi_build() call, and the changed blob length is within the PAGE size boundary, then the revised size is not seen by the firmware on Guest reboot.

Hence make sure callback is called if memory region size is changed, irrespective of aligned or not.

Message-Id: <[email protected]>

---
 exec.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
exec.c +14 -2
index de9d949902..2874bb5088 100644
@@ -2074,11 +2074,23 @@ static int memory_try_enable_merging(void *addr, size_t len)
  */
 int qemu_ram_resize(RAMBlock *block, ram_addr_t newsize, Error **errp)
 {
+    const ram_addr_t unaligned_size = newsize;
+
     assert(block);
 
     newsize = HOST_PAGE_ALIGN(newsize);
 
     if (block->used_length == newsize) {
+        /*
+         * We don't have to resize the ram block (which only knows aligned
+         * sizes), however, we have to notify if the unaligned size changed.
+         */
+        if (unaligned_size != memory_region_size(block->mr)) {
+            memory_region_set_size(block->mr, unaligned_size);
+            if (block->resized) {
+                block->resized(block->idstr, unaligned_size, block->host);
+            }
+        }
         return 0;
     }
 
@@ -2102,9 +2114,9 @@ int qemu_ram_resize(RAMBlock *block, ram_addr_t newsize, Error **errp)
     block->used_length = newsize;
     cpu_physical_memory_set_dirty_range(block->offset, block->used_length,
                                         DIRTY_CLIENTS_ALL);
-    memory_region_set_size(block->mr, newsize);
+    memory_region_set_size(block->mr, unaligned_size);
     if (block->resized) {
-        block->resized(block->idstr, newsize, block->host);
+        block->resized(block->idstr, unaligned_size, block->host);
     }
     return 0;
 }
Signature · 1 line
MST
#5 lore raw
In reply to Michael S. Tsirkin
Quoted 13 lines · Michael S. Tsirkin

The following changes since commit f3bac27cc1e303e1860cc55b9b6889ba39dee587:

Update version for v5.0.0-rc2 release (2020-04-07 23:13:37 +0100)

are available in the Git repository at:

git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream

for you to fetch changes up to ce4adc0b6e6167091373389ef8befd379c61fddb:

exec: Fix for qemu_ram_resize() callback (2020-04-13 06:55:54 -0400)

Quoted 7 lines

----------------------------------------------------------------
pc: bugfixes, maintainers

A couple of bugfixes.
Add a new vhost-user-blk maintainer.

Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/5.0
for any user-visible changes.

-- PMM