Skip to contentSkip to conversation

pc, virtio: fixes

GIT PULL Michael S. Tsirkin 2 participants 10 messages Aug 3, 2018 – Aug 6, 2018

lore
Share & tools
lore
#0 lore raw

Please consider for 3.0 if there is another rc.

The following changes since commit f7502360397d291be04bc040e9f96c92ff2d8030:

Update version for v3.0.0-rc3 release (2018-07-31 19:30:17 +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 1c707d6990eaf3db0c9dc4557bba5458977e9f8d:

tests/acpi: update tables after memory hotplug changes (2018-08-03 11:35:21 +0300)

----------------------------------------------------------------
pc, virtio: fixes

A couple of last minute fixes.

----------------------------------------------------------------
Dou Liyang (2):
hw/acpi-build: Add a check for memory-less NUMA nodes tests/acpi-test: update ACPI tables test blobs

Igor Mammedov (1):
pc: acpi: fix memory hotplug regression by reducing stub SRAT entry size

Michael S. Tsirkin (1):
tests/acpi: update tables after memory hotplug changes

Tiwei Bie (1):
vhost: check region type before casting

 hw/i386/acpi-build.c                  |  28 ++++++++++++++++------------
 hw/virtio/vhost.c                     |   4 +++-
 tests/acpi-test-data/pc/SRAT.dimmpxm  | Bin 472 -> 472 bytes
 tests/acpi-test-data/pc/SRAT.memhp    | Bin 264 -> 264 bytes
 tests/acpi-test-data/pc/SRAT.numamem  | Bin 224 -> 224 bytes
 tests/acpi-test-data/q35/SRAT.dimmpxm | Bin 472 -> 472 bytes
 tests/acpi-test-data/q35/SRAT.memhp   | Bin 264 -> 264 bytes
 tests/acpi-test-data/q35/SRAT.numamem | Bin 224 -> 224 bytes
 8 files changed, 19 insertions(+), 13 deletions(-)
#1 lore raw

[Qemu-devel] [PULL 1/5] vhost: check region type before casting

From: Tiwei Bie <[email protected]>

Check region type first before casting the memory region to IOMMUMemoryRegion. Otherwise QEMU will abort with below error message when casting non-IOMMU memory region:

vhost_iommu_region_add: Object 0x561f28bce4f0 is not an instance of type qemu:iommu-memory-region

Fixes cb1efcf462a2 ("iommu: Add IOMMU index argument to notifier APIs")
Cc Peter Maydell <[email protected]>
---
 hw/virtio/vhost.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
hw/virtio/vhost.c +3 -1
index b129cb9ddd..d4cb5894a8 100644
@@ -663,12 +663,14 @@ static void vhost_iommu_region_add(MemoryListener *listener,
     struct vhost_iommu *iommu;
     Int128 end;
     int iommu_idx;
-    IOMMUMemoryRegion *iommu_mr = IOMMU_MEMORY_REGION(section->mr);
+    IOMMUMemoryRegion *iommu_mr;
 
     if (!memory_region_is_iommu(section->mr)) {
         return;
     }
 
+    iommu_mr = IOMMU_MEMORY_REGION(section->mr);
+
     iommu = g_malloc0(sizeof(*iommu));
     end = int128_add(int128_make64(section->offset_within_region),
                      section->size);
Signature · 1 line
MST
#2 lore raw

[Qemu-devel] [PULL 2/5] hw/acpi-build: Add a check for memory-less NUMA nodes

In reply to Michael S. Tsirkin

From: Dou Liyang <[email protected]>

Currently, Qemu ACPI builder doesn't consider the memory-less NUMA nodes, eg:

  -m 4G,slots=4,maxmem=8G \
  -numa node,nodeid=0 \
  -numa node,nodeid=1,mem=2G \
  -numa node,nodeid=2,mem=2G \
  -numa node,nodeid=3\

Guest Linux will report

  [    0.000000] ACPI: SRAT: Node 0 PXM 0 [mem 0x00000000-0xffffffffffffffff]
  [    0.000000] ACPI: SRAT: Node 1 PXM 1 [mem 0x00000000-0x0009ffff]
  [    0.000000] ACPI: SRAT: Node 1 PXM 1 [mem 0x00100000-0x7fffffff]
  [    0.000000] ACPI: SRAT: Node 2 PXM 2 [mem 0x80000000-0xbfffffff]
  [    0.000000] ACPI: SRAT: Node 2 PXM 2 [mem 0x100000000-0x13fffffff]
  [    0.000000] ACPI: SRAT: Node 3 PXM 3 [mem 0x140000000-0x13fffffff]
  [    0.000000] ACPI: SRAT: Node 3 PXM 3 [mem 0x140000000-0x33fffffff] hotplug

[mem 0x00000000-0xffffffffffffffff] and [mem 0x140000000-0x13fffffff] are bogus.

Add a check to avoid building srat memory for memory-less NUMA nodes, also update the test file. Now the info in guest linux will be

  [    0.000000] ACPI: SRAT: Node 1 PXM 1 [mem 0x00000000-0x0009ffff]
  [    0.000000] ACPI: SRAT: Node 1 PXM 1 [mem 0x00100000-0x7fffffff]
  [    0.000000] ACPI: SRAT: Node 2 PXM 2 [mem 0x80000000-0xbfffffff]
  [    0.000000] ACPI: SRAT: Node 2 PXM 2 [mem 0x100000000-0x13fffffff]
  [    0.000000] ACPI: SRAT: Node 3 PXM 3 [mem 0x140000000-0x33fffffff] hotplug
---
 hw/i386/acpi-build.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
hw/i386/acpi-build.c +6 -3
index 9e8350c55d..c584642e4e 100644
@@ -2392,9 +2392,12 @@ build_srat(GArray *table_data, BIOSLinker *linker, MachineState *machine)
             mem_len = next_base - pcms->below_4g_mem_size;
             next_base = mem_base + mem_len;
         }
-        numamem = acpi_data_push(table_data, sizeof *numamem);
-        build_srat_memory(numamem, mem_base, mem_len, i - 1,
-                          MEM_AFFINITY_ENABLED);
+
+        if (mem_len > 0) {
+            numamem = acpi_data_push(table_data, sizeof *numamem);
+            build_srat_memory(numamem, mem_base, mem_len, i - 1,
+                              MEM_AFFINITY_ENABLED);
+        }
     }
     slots = (table_data->len - numa_start) / sizeof *numamem;
     for (; slots < pcms->numa_nodes + 2; slots++) {
Signature · 1 line
MST
#3 lore raw

[Qemu-devel] [PULL 3/5] tests/acpi-test: update ACPI tables test blobs

In reply to Michael S. Tsirkin

From: Dou Liyang <[email protected]>

Now, QEmu adds a new check for memory-less NUMA nodes in build_srat().

It effects the ACPI test.

So, Update ACPI tables test blobs.

---
 tests/acpi-test-data/pc/SRAT.numamem  | Bin 224 -> 224 bytes
 tests/acpi-test-data/q35/SRAT.numamem | Bin 224 -> 224 bytes
 2 files changed, 0 insertions(+), 0 deletions(-)
tests/acpi-test-data/pc/SRAT.numamem binary +0 -0
index dbc595d9cb85d3fcb5a4243153f42bb431c9de8f..119922f4973f621602047d1dc160519f810922a3 100644
GIT binary patch
tests/acpi-test-data/q35/SRAT.numamem binary +0 -0
index dbc595d9cb85d3fcb5a4243153f42bb431c9de8f..119922f4973f621602047d1dc160519f810922a3 100644
GIT binary patch
Signature · 1 line
MST
#4 lore raw

[Qemu-devel] [PULL 4/5] pc: acpi: fix memory hotplug regression by reducing stub SRAT entry size

In reply to Michael S. Tsirkin

From: Igor Mammedov <[email protected]>

Commit 848a1cc1e (hw/acpi-build: build SRAT memory affinity structures for DIMM devices) broke the first dimm hotplug in following cases:

1: there is no coldplugged dimm in the last numa node
but there is a coldplugged dimm in another node

  -m 4096,slots=4,maxmem=32G               \
  -object memory-backend-ram,id=m0,size=2G \
  -device pc-dimm,memdev=m0,node=0         \
  -numa node,nodeid=0                      \
  -numa node,nodeid=1

2: if order of dimms on CLI is:
1st plugged dimm in node1
2nd plugged dimm in node0

  -m 4096,slots=4,maxmem=32G               \
  -object memory-backend-ram,size=2G,id=m0 \
  -device pc-dimm,memdev=m0,node=1         \
  -object memory-backend-ram,id=m1,size=2G \
  -device pc-dimm,memdev=m1,node=0         \
  -numa node,nodeid=0                      \
  -numa node,nodeid=1

(qemu) object_add memory-backend-ram,id=m2,size=1G (qemu) device_add pc-dimm,memdev=m2,node=0

the first DIMM hotplug to any node except the last one fails (Windows is unable to online it).

Length reduction of stub hotplug memory SRAT entry, fixes issue for some reason.

RHBZ: 1609234

---
 hw/i386/acpi-build.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)
hw/i386/acpi-build.c +10 -9
index c584642e4e..e1ee8ae9e0 100644
@@ -2269,7 +2269,16 @@ static void build_srat_hotpluggable_memory(GArray *table_data, uint64_t base,
         numamem = acpi_data_push(table_data, sizeof *numamem);
 
         if (!info) {
-            build_srat_memory(numamem, cur, end - cur, default_node,
+            /*
+             * Entry is required for Windows to enable memory hotplug in OS
+             * and for Linux to enable SWIOTLB when booted with less than
+             * 4G of RAM. Windows works better if the entry sets proximity
+             * to the highest NUMA node in the machine at the end of the
+             * reserved space.
+             * Memory devices may override proximity set by this entry,
+             * providing _PXM method if necessary.
+             */
+            build_srat_memory(numamem, end - 1, 1, default_node,
                               MEM_AFFINITY_HOTPLUGGABLE | MEM_AFFINITY_ENABLED);
             break;
         }
@@ -2405,14 +2414,6 @@ build_srat(GArray *table_data, BIOSLinker *linker, MachineState *machine)
         build_srat_memory(numamem, 0, 0, 0, MEM_AFFINITY_NOFLAGS);
     }
 
-    /*
-     * Entry is required for Windows to enable memory hotplug in OS
-     * and for Linux to enable SWIOTLB when booted with less than
-     * 4G of RAM. Windows works better if the entry sets proximity
-     * to the highest NUMA node in the machine.
-     * Memory devices may override proximity set by this entry,
-     * providing _PXM method if necessary.
-     */
     if (hotplugabble_address_space_size) {
         build_srat_hotpluggable_memory(table_data, machine->device_memory->base,
                                        hotplugabble_address_space_size,
Signature · 1 line
MST
#5 lore raw

[Qemu-devel] [PULL 5/5] tests/acpi: update tables after memory hotplug changes

In reply to Michael S. Tsirkin

Previous patch changes acpi tables, update expected files accordingly.

---
 tests/acpi-test-data/pc/SRAT.dimmpxm  | Bin 472 -> 472 bytes
 tests/acpi-test-data/pc/SRAT.memhp    | Bin 264 -> 264 bytes
 tests/acpi-test-data/q35/SRAT.dimmpxm | Bin 472 -> 472 bytes
 tests/acpi-test-data/q35/SRAT.memhp   | Bin 264 -> 264 bytes
 4 files changed, 0 insertions(+), 0 deletions(-)
tests/acpi-test-data/pc/SRAT.dimmpxm binary +0 -0
index 3b10a607d5bba6cebb97d9174c2a54a577bba9a8..5aa6f693ef9819b3d30cbd76cafb0ee8b5fc5534 100644
GIT binary patch
tests/acpi-test-data/pc/SRAT.memhp binary +0 -0
index e508b4ae3cd9e3000209a4f9597913faa4206ec1..5de8a100a4adf968b79a7b154a7f98123d583474 100644
GIT binary patch
tests/acpi-test-data/q35/SRAT.dimmpxm binary +0 -0
index 3b10a607d5bba6cebb97d9174c2a54a577bba9a8..5aa6f693ef9819b3d30cbd76cafb0ee8b5fc5534 100644
GIT binary patch
tests/acpi-test-data/q35/SRAT.memhp binary +0 -0
index e508b4ae3cd9e3000209a4f9597913faa4206ec1..5de8a100a4adf968b79a7b154a7f98123d583474 100644
GIT binary patch
Signature · 1 line
MST
#6 lore raw
In reply to Michael S. Tsirkin
Quoted 26 lines · Michael S. Tsirkin

Please consider for 3.0 if there is another rc.

The following changes since commit f7502360397d291be04bc040e9f96c92ff2d8030:

Update version for v3.0.0-rc3 release (2018-07-31 19:30:17 +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 1c707d6990eaf3db0c9dc4557bba5458977e9f8d:

tests/acpi: update tables after memory hotplug changes (2018-08-03 11:35:21 +0300)

----------------------------------------------------------------
pc, virtio: fixes

A couple of last minute fixes.

----------------------------------------------------------------
Dou Liyang (2):
hw/acpi-build: Add a check for memory-less NUMA nodes tests/acpi-test: update ACPI tables test blobs

Quoted 8 lines

Igor Mammedov (1):
pc: acpi: fix memory hotplug regression by reducing stub SRAT entry size

Michael S. Tsirkin (1):
tests/acpi: update tables after memory hotplug changes

Tiwei Bie (1):
vhost: check region type before casting

Can you clarify which of these are regressions from 2.12, please? At this point in the release cycle I only want to apply fixes for regressions. (Test only updates might also be OK, but I need more information than just the commit message subject line.)

thanks
-- PMM

#7 lore raw
Quoted 18 lines · Peter Maydell
Quoted 17 lines · Michael S. Tsirkin

Please consider for 3.0 if there is another rc.

The following changes since commit f7502360397d291be04bc040e9f96c92ff2d8030:

Update version for v3.0.0-rc3 release (2018-07-31 19:30:17 +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 1c707d6990eaf3db0c9dc4557bba5458977e9f8d:

tests/acpi: update tables after memory hotplug changes (2018-08-03 11:35:21 +0300)

----------------------------------------------------------------
pc, virtio: fixes

Quoted 8 lines
Quoted 8 lines

A couple of last minute fixes.

----------------------------------------------------------------
Dou Liyang (2):
hw/acpi-build: Add a check for memory-less NUMA nodes tests/acpi-test: update ACPI tables test blobs

This fixes a regression but from an older release.

Quoted 3 lines
Quoted 3 lines

Igor Mammedov (1):
pc: acpi: fix memory hotplug regression by reducing stub SRAT entry size

This fixes a regression from 2.12.

Quoted 2 lines
Quoted 2 lines

Michael S. Tsirkin (1):
tests/acpi: update tables after memory hotplug changes

This will have to be re-done if we pick this but drop two other fixes.

Quoted 3 lines
Quoted 3 lines

Tiwei Bie (1):
vhost: check region type before casting

Not a regression but an obvious fix.

Quoted 8 lines

Can you clarify which of these are regressions from 2.12, please? At this point in the release cycle I only want to apply fixes for regressions. (Test only updates might also be OK, but I need more information than just the commit message subject line.)

thanks
-- PMM

I'll push a variant with just the two patches fixing regression from 2.12 soon.

Signature · 1 line
MST
#8 lore raw
Quoted 40 lines · Michael S. Tsirkin
Quoted 18 lines · Peter Maydell
Quoted 17 lines · Michael S. Tsirkin

Please consider for 3.0 if there is another rc.

The following changes since commit f7502360397d291be04bc040e9f96c92ff2d8030:

Update version for v3.0.0-rc3 release (2018-07-31 19:30:17 +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 1c707d6990eaf3db0c9dc4557bba5458977e9f8d:

tests/acpi: update tables after memory hotplug changes (2018-08-03 11:35:21 +0300)

----------------------------------------------------------------
pc, virtio: fixes

Quoted 8 lines
Quoted 8 lines

A couple of last minute fixes.

----------------------------------------------------------------
Dou Liyang (2):
hw/acpi-build: Add a check for memory-less NUMA nodes tests/acpi-test: update ACPI tables test blobs

This fixes a regression but from an older release.

Quoted 3 lines
Quoted 3 lines

Igor Mammedov (1):
pc: acpi: fix memory hotplug regression by reducing stub SRAT entry size

This fixes a regression from 2.12.

Quoted 2 lines
Quoted 2 lines

Michael S. Tsirkin (1):
tests/acpi: update tables after memory hotplug changes

Quoted 7 lines

This will have to be re-done if we pick this but drop two other fixes.

Quoted 3 lines
Quoted 3 lines

Tiwei Bie (1):
vhost: check region type before casting

Not a regression but an obvious fix.

This is a regression, because it fixes a code change (by me) that's new in this release.

thanks
-- PMM

#9 lore raw
In reply to Michael S. Tsirkin
Quoted 14 lines · Michael S. Tsirkin

Please consider for 3.0 if there is another rc.

The following changes since commit f7502360397d291be04bc040e9f96c92ff2d8030:

Update version for v3.0.0-rc3 release (2018-07-31 19:30:17 +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 1c707d6990eaf3db0c9dc4557bba5458977e9f8d:

tests/acpi: update tables after memory hotplug changes (2018-08-03 11:35:21 +0300)

Quoted 8 lines

----------------------------------------------------------------
pc, virtio: fixes

A couple of last minute fixes.

----------------------------------------------------------------

Thanks for clarifying the status of the various bugfixes and preparing the alternate pullreq. After thinking it over, I've decided to apply this set.

-- PMM