stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: stable@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	patches@lists.linux.dev, Gavin Shan <gshan@redhat.com>,
	Zhenyu Zhang <zhenyzha@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	David Hildenbrand <david@redhat.com>
Subject: [PATCH 5.10 04/95] virtio_balloon: Fix endless deflation and inflation on arm64
Date: Mon,  6 Nov 2023 14:03:32 +0100	[thread overview]
Message-ID: <20231106130304.837434044@linuxfoundation.org> (raw)
In-Reply-To: <20231106130304.678610325@linuxfoundation.org>

5.10-stable review patch.  If anyone has any objections, please let me know.

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

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
@@ -402,7 +402,11 @@ static inline s64 towards_target(struct
 	virtio_cread_le(vb->vdev, struct virtio_balloon_config, num_pages,
 			&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;
 }
 



  parent reply	other threads:[~2023-11-06 13:30 UTC|newest]

Thread overview: 109+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-06 13:03 [PATCH 5.10 00/95] 5.10.200-rc1 review Greg Kroah-Hartman
2023-11-06 13:03 ` [PATCH 5.10 01/95] selftests/ftrace: Add new test case which checks non unique symbol Greg Kroah-Hartman
2023-11-06 13:03 ` [PATCH 5.10 02/95] mcb: Return actual parsed size when reading chameleon table Greg Kroah-Hartman
2023-11-06 13:03 ` [PATCH 5.10 03/95] mcb-lpc: Reallocate memory region to avoid memory overlapping Greg Kroah-Hartman
2023-11-06 13:03 ` Greg Kroah-Hartman [this message]
2023-11-06 13:03 ` [PATCH 5.10 05/95] virtio-mmio: fix memory leak of vm_dev Greg Kroah-Hartman
2023-11-06 13:03 ` [PATCH 5.10 06/95] mm/page_alloc: correct start page when guard page debug is enabled Greg Kroah-Hartman
2023-11-06 13:03 ` [PATCH 5.10 07/95] mmc: renesas_sdhi: use custom mask for TMIO_MASK_ALL Greg Kroah-Hartman
2023-11-06 13:03 ` [PATCH 5.10 08/95] drm/dp_mst: Fix NULL deref in get_mst_branch_device_by_guid_helper() Greg Kroah-Hartman
2023-11-06 13:03 ` [PATCH 5.10 09/95] r8169: fix the KCSAN reported data-race in rtl_tx while reading TxDescArray[entry].opts1 Greg Kroah-Hartman
2023-11-06 13:03 ` [PATCH 5.10 10/95] r8169: fix the KCSAN reported data race in rtl_rx while reading desc->opts1 Greg Kroah-Hartman
2023-11-06 13:03 ` [PATCH 5.10 11/95] treewide: Spelling fix in comment Greg Kroah-Hartman
2023-11-06 13:03 ` [PATCH 5.10 12/95] igb: Fix potential memory leak in igb_add_ethtool_nfc_entry Greg Kroah-Hartman
2023-11-06 13:03 ` [PATCH 5.10 13/95] neighbour: fix various data-races Greg Kroah-Hartman
2023-11-06 13:03 ` [PATCH 5.10 14/95] igc: Fix ambiguity in the ethtool advertising Greg Kroah-Hartman
2023-11-06 13:03 ` [PATCH 5.10 15/95] net: ieee802154: adf7242: Fix some potential buffer overflow in adf7242_stats_show() Greg Kroah-Hartman
2023-11-06 13:03 ` [PATCH 5.10 16/95] net: usb: smsc95xx: Fix uninit-value access in smsc95xx_read_reg Greg Kroah-Hartman
2023-11-06 13:03 ` [PATCH 5.10 17/95] r8152: Increase USB control msg timeout to 5000ms as per spec Greg Kroah-Hartman
2023-11-06 13:03 ` [PATCH 5.10 18/95] r8152: Run the unload routine if we have errors during probe Greg Kroah-Hartman
2023-11-06 13:03 ` [PATCH 5.10 19/95] r8152: Cancel hw_phy_work if we have an error in probe Greg Kroah-Hartman
2023-11-06 13:03 ` [PATCH 5.10 20/95] r8152: Release firmware " Greg Kroah-Hartman
2023-11-06 13:03 ` [PATCH 5.10 21/95] tcp: fix wrong RTO timeout when received SACK reneging Greg Kroah-Hartman
2023-11-06 13:03 ` [PATCH 5.10 22/95] gtp: uapi: fix GTPA_MAX Greg Kroah-Hartman
2023-11-06 13:03 ` [PATCH 5.10 23/95] gtp: fix fragmentation needed check with gso Greg Kroah-Hartman
2023-11-06 13:03 ` [PATCH 5.10 24/95] i40e: Fix wrong check for I40E_TXR_FLAGS_WB_ON_ITR Greg Kroah-Hartman
2023-11-06 13:03 ` [PATCH 5.10 25/95] kasan: print the original fault addr when access invalid shadow Greg Kroah-Hartman
2023-11-06 13:03 ` [PATCH 5.10 26/95] iio: exynos-adc: request second interupt only when touchscreen mode is used Greg Kroah-Hartman
2023-11-06 13:03 ` [PATCH 5.10 27/95] i2c: muxes: i2c-mux-pinctrl: Use of_get_i2c_adapter_by_node() Greg Kroah-Hartman
2023-11-06 13:03 ` [PATCH 5.10 28/95] i2c: muxes: i2c-mux-gpmux: " Greg Kroah-Hartman
2023-11-06 13:03 ` [PATCH 5.10 29/95] i2c: muxes: i2c-demux-pinctrl: " Greg Kroah-Hartman
2023-11-06 13:03 ` [PATCH 5.10 30/95] i2c: stm32f7: Fix PEC handling in case of SMBUS transfers Greg Kroah-Hartman
2023-11-06 13:03 ` [PATCH 5.10 31/95] i2c: aspeed: Fix i2c bus hang in slave read Greg Kroah-Hartman
2023-11-06 13:04 ` [PATCH 5.10 32/95] tracing/kprobes: Fix the description of variable length arguments Greg Kroah-Hartman
2023-11-06 13:04 ` [PATCH 5.10 33/95] misc: fastrpc: Clean buffers on remote invocation failures Greg Kroah-Hartman
2023-11-06 13:04 ` [PATCH 5.10 34/95] nvmem: imx: correct nregs for i.MX6ULL Greg Kroah-Hartman
2023-11-06 13:04 ` [PATCH 5.10 35/95] nvmem: imx: correct nregs for i.MX6SLL Greg Kroah-Hartman
2023-11-06 13:04 ` [PATCH 5.10 36/95] nvmem: imx: correct nregs for i.MX6UL Greg Kroah-Hartman
2023-11-06 13:04 ` [PATCH 5.10 37/95] perf/core: Fix potential NULL deref Greg Kroah-Hartman
2023-11-06 13:04 ` [PATCH 5.10 38/95] sparc32: fix a braino in fault handling in csum_and_copy_..._user() Greg Kroah-Hartman
2023-11-06 13:04 ` [PATCH 5.10 39/95] clk: Sanitize possible_parent_show to Handle Return Value of of_clk_get_parent_name Greg Kroah-Hartman
2023-11-06 13:04 ` [PATCH 5.10 40/95] iio: adc: xilinx: use helper variable for &pdev->dev Greg Kroah-Hartman
2023-11-06 13:04 ` [PATCH 5.10 41/95] iio: adc: xilinx: use devm_krealloc() instead of kfree() + kcalloc() Greg Kroah-Hartman
2023-11-06 13:04 ` [PATCH 5.10 42/95] iio: adc: xilinx: use more devres helpers and remove remove() Greg Kroah-Hartman
2023-11-06 13:04 ` [PATCH 5.10 43/95] iio: adc: xilinx-xadc: Dont clobber preset voltage/temperature thresholds Greg Kroah-Hartman
2023-11-06 13:04 ` [PATCH 5.10 44/95] x86/i8259: Skip probing when ACPI/MADT advertises PCAT compatibility Greg Kroah-Hartman
2023-11-06 13:04 ` [PATCH 5.10 45/95] kobject: Fix slab-out-of-bounds in fill_kobj_path() Greg Kroah-Hartman
2023-11-06 13:04 ` [PATCH 5.10 46/95] smbdirect: missing rc checks while waiting for rdma events Greg Kroah-Hartman
2023-11-06 13:04 ` [PATCH 5.10 47/95] f2fs: fix to do sanity check on inode type during garbage collection Greg Kroah-Hartman
2023-11-06 13:04 ` [PATCH 5.10 48/95] x86/mm: Simplify RESERVE_BRK() Greg Kroah-Hartman
2023-11-06 13:04 ` [PATCH 5.10 49/95] x86/mm: Fix RESERVE_BRK() for older binutils Greg Kroah-Hartman
2023-11-06 13:04 ` [PATCH 5.10 50/95] ext4: add two helper functions extent_logical_end() and pa_logical_end() Greg Kroah-Hartman
2023-11-06 13:04 ` [PATCH 5.10 51/95] ext4: fix BUG in ext4_mb_new_inode_pa() due to overflow Greg Kroah-Hartman
2023-11-06 13:04 ` [PATCH 5.10 52/95] ext4: avoid overlapping preallocations " Greg Kroah-Hartman
2023-11-06 13:04 ` [PATCH 5.10 53/95] objtool/x86: add missing embedded_insn check Greg Kroah-Hartman
2023-11-06 13:04 ` [PATCH 5.10 54/95] driver: platform: Add helper for safer setting of driver_override Greg Kroah-Hartman
2023-11-06 13:04 ` [PATCH 5.10 55/95] rpmsg: Constify local variable in field store macro Greg Kroah-Hartman
2023-11-06 13:04 ` [PATCH 5.10 56/95] rpmsg: Fix kfree() of static memory on setting driver_override Greg Kroah-Hartman
2023-11-06 13:04 ` [PATCH 5.10 57/95] rpmsg: Fix calling device_lock() on non-initialized device Greg Kroah-Hartman
2023-11-06 13:04 ` [PATCH 5.10 58/95] rpmsg: glink: Release driver_override Greg Kroah-Hartman
2023-11-06 13:04 ` [PATCH 5.10 59/95] rpmsg: Fix possible refcount leak in rpmsg_register_device_override() Greg Kroah-Hartman
2023-11-06 13:04 ` [PATCH 5.10 60/95] x86: Fix .brk attribute in linker script Greg Kroah-Hartman
2023-11-06 13:04 ` [PATCH 5.10 61/95] net: sched: cls_u32: Fix allocation size in u32_init() Greg Kroah-Hartman
2023-11-06 13:04 ` [PATCH 5.10 62/95] irqchip/riscv-intc: Mark all INTC nodes as initialized Greg Kroah-Hartman
2023-11-06 13:04 ` [PATCH 5.10 63/95] irqchip/stm32-exti: add missing DT IRQ flag translation Greg Kroah-Hartman
2023-11-06 13:04 ` [PATCH 5.10 64/95] dmaengine: ste_dma40: Fix PM disable depth imbalance in d40_probe Greg Kroah-Hartman
2023-11-06 13:04 ` [PATCH 5.10 65/95] Input: synaptics-rmi4 - handle reset delay when using SMBus trsnsport Greg Kroah-Hartman
2023-11-06 13:04 ` [PATCH 5.10 66/95] fbdev: atyfb: only use ioremap_uc() on i386 and ia64 Greg Kroah-Hartman
2023-11-06 13:04 ` [PATCH 5.10 67/95] spi: npcm-fiu: Fix UMA reads when dummy.nbytes == 0 Greg Kroah-Hartman
2023-11-06 13:04 ` [PATCH 5.10 68/95] netfilter: nfnetlink_log: silence bogus compiler warning Greg Kroah-Hartman
2023-11-06 13:04 ` [PATCH 5.10 69/95] ASoC: rt5650: fix the wrong result of key button Greg Kroah-Hartman
2023-11-06 13:04 ` [PATCH 5.10 70/95] fbdev: uvesafb: Call cn_del_callback() at the end of uvesafb_exit() Greg Kroah-Hartman
2023-11-06 13:04 ` [PATCH 5.10 71/95] scsi: mpt3sas: Fix in error path Greg Kroah-Hartman
2023-11-06 13:04 ` [PATCH 5.10 72/95] platform/mellanox: mlxbf-tmfifo: Fix a warning message Greg Kroah-Hartman
2023-11-06 13:04 ` [PATCH 5.10 73/95] net: chelsio: cxgb4: add an error code check in t4_load_phy_fw Greg Kroah-Hartman
2023-11-06 13:04 ` [PATCH 5.10 74/95] powerpc/mm: Fix boot crash with FLATMEM Greg Kroah-Hartman
2023-11-06 13:04 ` [PATCH 5.10 75/95] perf evlist: Add evlist__add_dummy_on_all_cpus() Greg Kroah-Hartman
2023-11-06 13:04 ` [PATCH 5.10 76/95] perf tools: Get rid of evlist__add_on_all_cpus() Greg Kroah-Hartman
2023-11-06 13:04 ` [PATCH 5.10 77/95] perf evlist: Avoid frequency mode for the dummy event Greg Kroah-Hartman
2023-11-06 13:04 ` [PATCH 5.10 78/95] can: isotp: change error format from decimal to symbolic error names Greg Kroah-Hartman
2023-11-06 13:04 ` [PATCH 5.10 79/95] can: isotp: add symbolic error message to isotp_module_init() Greg Kroah-Hartman
2023-11-06 13:04 ` [PATCH 5.10 80/95] can: isotp: Add error message if txqueuelen is too small Greg Kroah-Hartman
2023-11-06 13:04 ` [PATCH 5.10 81/95] can: isotp: set max PDU size to 64 kByte Greg Kroah-Hartman
2023-11-06 13:04 ` [PATCH 5.10 82/95] can: isotp: isotp_bind(): return -EINVAL on incorrect CAN ID formatting Greg Kroah-Hartman
2023-11-06 13:04 ` [PATCH 5.10 83/95] can: isotp: check CAN address family in isotp_bind() Greg Kroah-Hartman
2023-11-06 13:04 ` [PATCH 5.10 84/95] can: isotp: handle wait_event_interruptible() return values Greg Kroah-Hartman
2023-11-06 13:04 ` [PATCH 5.10 85/95] can: isotp: add local echo tx processing and tx without FC Greg Kroah-Hartman
2023-11-06 13:04 ` [PATCH 5.10 86/95] can: isotp: isotp_bind(): do not validate unused address information Greg Kroah-Hartman
2023-11-06 13:04 ` [PATCH 5.10 87/95] can: isotp: isotp_sendmsg(): fix TX state detection and wait behavior Greg Kroah-Hartman
2023-11-06 13:04 ` [PATCH 5.10 88/95] PCI: Prevent xHCI driver from claiming AMD VanGogh USB3 DRD device Greg Kroah-Hartman
2023-11-06 13:04 ` [PATCH 5.10 89/95] usb: storage: set 1.50 as the lower bcdDevice for older "Super Top" compatibility Greg Kroah-Hartman
2023-11-06 13:04 ` [PATCH 5.10 90/95] usb: raw-gadget: properly handle interrupted requests Greg Kroah-Hartman
2023-11-06 13:04 ` [PATCH 5.10 91/95] tty: 8250: Remove UC-257 and UC-431 Greg Kroah-Hartman
2023-11-06 13:05 ` [PATCH 5.10 92/95] tty: 8250: Add support for additional Brainboxes UC cards Greg Kroah-Hartman
2023-11-06 13:05 ` [PATCH 5.10 93/95] tty: 8250: Add support for Brainboxes UP cards Greg Kroah-Hartman
2023-11-06 13:05 ` [PATCH 5.10 94/95] tty: 8250: Add support for Intashield IS-100 Greg Kroah-Hartman
2023-11-06 13:05 ` [PATCH 5.10 95/95] ALSA: hda: intel-dsp-config: Fix JSL Chromebook quirk detection Greg Kroah-Hartman
2023-11-06 17:37 ` [PATCH 5.10 00/95] 5.10.200-rc1 review Florian Fainelli
2023-11-07 20:22   ` Greg Kroah-Hartman
2023-11-06 17:53 ` Daniel Díaz
2023-11-06 18:14   ` Daniel Díaz
2023-11-07 20:24     ` Greg Kroah-Hartman
2023-11-06 21:30   ` Pavel Machek
2023-11-06 21:50 ` Pavel Machek
2023-11-07 11:34   ` Pavel Machek
2023-11-07  9:08 ` Dominique Martinet
2023-11-07 11:43 ` Jon Hunter
2023-11-07 15:40 ` Shuah Khan
2023-11-07 18:02 ` Naresh Kamboju
2023-11-07 18:57 ` Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231106130304.837434044@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=david@redhat.com \
    --cc=gshan@redhat.com \
    --cc=mst@redhat.com \
    --cc=patches@lists.linux.dev \
    --cc=stable@vger.kernel.org \
    --cc=zhenyzha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).