]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.14-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 27 Oct 2023 15:14:03 +0000 (17:14 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 27 Oct 2023 15:14:03 +0000 (17:14 +0200)
added patches:
virtio_balloon-fix-endless-deflation-and-inflation-on-arm64.patch

queue-4.14/series
queue-4.14/virtio_balloon-fix-endless-deflation-and-inflation-on-arm64.patch [new file with mode: 0644]

index 3406e550475e605ec49bae395e7c1f31bebd1250..004b6f583d2263611cdee664b49c11f791a52562 100644 (file)
@@ -1,2 +1,3 @@
 mcb-return-actual-parsed-size-when-reading-chameleon.patch
 mcb-lpc-reallocate-memory-region-to-avoid-memory-ove.patch
+virtio_balloon-fix-endless-deflation-and-inflation-on-arm64.patch
diff --git a/queue-4.14/virtio_balloon-fix-endless-deflation-and-inflation-on-arm64.patch b/queue-4.14/virtio_balloon-fix-endless-deflation-and-inflation-on-arm64.patch
new file mode 100644 (file)
index 0000000..8198536
--- /dev/null
@@ -0,0 +1,97 @@
+From 07622bd415639e9709579f400afd19e7e9866e5e Mon Sep 17 00:00:00 2001
+From: Gavin Shan <gshan@redhat.com>
+Date: Thu, 31 Aug 2023 11:10:07 +1000
+Subject: virtio_balloon: Fix endless deflation and inflation on arm64
+
+From: Gavin Shan <gshan@redhat.com>
+
+commit 07622bd415639e9709579f400afd19e7e9866e5e upstream.
+
+The deflation request to the target, which isn't unaligned to the
+guest page size causes endless deflation and inflation actions. For
+example, we receive the flooding QMP events for the changes on memory
+balloon's size after a deflation request to the unaligned target is
+sent for the ARM64 guest, where we have 64KB base page size.
+
+  /home/gavin/sandbox/qemu.main/build/qemu-system-aarch64      \
+  -accel kvm -machine virt,gic-version=host -cpu host          \
+  -smp maxcpus=8,cpus=8,sockets=2,clusters=2,cores=2,threads=1 \
+  -m 1024M,slots=16,maxmem=64G                                 \
+  -object memory-backend-ram,id=mem0,size=512M                 \
+  -object memory-backend-ram,id=mem1,size=512M                 \
+  -numa node,nodeid=0,memdev=mem0,cpus=0-3                     \
+  -numa node,nodeid=1,memdev=mem1,cpus=4-7                     \
+    :                                                          \
+  -device virtio-balloon-pci,id=balloon0,bus=pcie.10
+
+  { "execute" : "balloon", "arguments": { "value" : 1073672192 } }
+  {"return": {}}
+  {"timestamp": {"seconds": 1693272173, "microseconds": 88667},   \
+   "event": "BALLOON_CHANGE", "data": {"actual": 1073610752}}
+  {"timestamp": {"seconds": 1693272174, "microseconds": 89704},   \
+   "event": "BALLOON_CHANGE", "data": {"actual": 1073610752}}
+  {"timestamp": {"seconds": 1693272175, "microseconds": 90819},   \
+   "event": "BALLOON_CHANGE", "data": {"actual": 1073610752}}
+  {"timestamp": {"seconds": 1693272176, "microseconds": 91961},   \
+   "event": "BALLOON_CHANGE", "data": {"actual": 1073610752}}
+  {"timestamp": {"seconds": 1693272177, "microseconds": 93040},   \
+   "event": "BALLOON_CHANGE", "data": {"actual": 1073676288}}
+  {"timestamp": {"seconds": 1693272178, "microseconds": 94117},   \
+   "event": "BALLOON_CHANGE", "data": {"actual": 1073676288}}
+  {"timestamp": {"seconds": 1693272179, "microseconds": 95337},   \
+   "event": "BALLOON_CHANGE", "data": {"actual": 1073610752}}
+  {"timestamp": {"seconds": 1693272180, "microseconds": 96615},   \
+   "event": "BALLOON_CHANGE", "data": {"actual": 1073676288}}
+  {"timestamp": {"seconds": 1693272181, "microseconds": 97626},   \
+   "event": "BALLOON_CHANGE", "data": {"actual": 1073610752}}
+  {"timestamp": {"seconds": 1693272182, "microseconds": 98693},   \
+   "event": "BALLOON_CHANGE", "data": {"actual": 1073676288}}
+  {"timestamp": {"seconds": 1693272183, "microseconds": 99698},   \
+   "event": "BALLOON_CHANGE", "data": {"actual": 1073610752}}
+  {"timestamp": {"seconds": 1693272184, "microseconds": 100727},  \
+   "event": "BALLOON_CHANGE", "data": {"actual": 1073610752}}
+  {"timestamp": {"seconds": 1693272185, "microseconds": 90430},   \
+   "event": "BALLOON_CHANGE", "data": {"actual": 1073610752}}
+  {"timestamp": {"seconds": 1693272186, "microseconds": 102999},  \
+   "event": "BALLOON_CHANGE", "data": {"actual": 1073676288}}
+     :
+  <The similar QMP events repeat>
+
+Fix it by aligning the target up to the guest page size, 64KB in this
+specific case. With this applied, no flooding QMP events are observed
+and the memory balloon's size can be stablizied to 0x3ffe0000 soon
+after the deflation request is sent.
+
+  { "execute" : "balloon", "arguments": { "value" : 1073672192 } }
+  {"return": {}}
+  {"timestamp": {"seconds": 1693273328, "microseconds": 793075},  \
+   "event": "BALLOON_CHANGE", "data": {"actual": 1073610752}}
+  { "execute" : "query-balloon" }
+  {"return": {"actual": 1073610752}}
+
+Cc: stable@vger.kernel.org
+Signed-off-by: Gavin Shan <gshan@redhat.com>
+Tested-by: Zhenyu Zhang <zhenyzha@redhat.com>
+Message-Id: <20230831011007.1032822-1-gshan@redhat.com>
+Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
+Reviewed-by: David Hildenbrand <david@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/virtio/virtio_balloon.c |    6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+--- a/drivers/virtio/virtio_balloon.c
++++ b/drivers/virtio/virtio_balloon.c
+@@ -341,7 +341,11 @@ static inline s64 towards_target(struct
+       if (!virtio_has_feature(vb->vdev, VIRTIO_F_VERSION_1))
+               num_pages = le32_to_cpu((__force __le32)num_pages);
+-      target = num_pages;
++      /*
++       * Aligned up to guest page size to avoid inflating and deflating
++       * balloon endlessly.
++       */
++      target = ALIGN(num_pages, VIRTIO_BALLOON_PAGES_PER_PAGE);
+       return target - vb->num_pages;
+ }