mirror of
https://github.com/torvalds/linux.git
synced 2026-07-26 17:20:32 +02:00
At the moment, if a virtio balloon device has a page reporting vq but its
size is < PAGE_REPORTING_CAPACITY (32), the balloon driver fails probe.
But, there's no way for host to know this value, so it can easily create a
smaller vq and suddenly adding the reporting capability to the device
makes all of the driver fail. Not pretty.
Add a capacity field to page_reporting_dev_info so drivers can control the
maximum number of pages per report batch.
In virtio-balloon, set the capacity to the reporting virtqueue size,
letting page_reporting adapt to whatever the device provides.
Capacity need not be a power of two. Code previously called out division
by PAGE_REPORTING_CAPACITY as cheap since it was a power of 2, but no
performance difference was observed with non-power-of-2 values.
If capacity is 0 or exceeds PAGE_REPORTING_CAPACITY, it defaults to
PAGE_REPORTING_CAPACITY. The 0 check and the clamping is done in
page_reporting_register(), before the reporting work is scheduled, so we
never get division by 0.
Link: https://lore.kernel.org/444c24cf39f3f3620fc90ef4695bd6b0979f4c4b.1783232420.git.mst@redhat.com
Fixes:
|
||
|---|---|---|
| .. | ||
| Kconfig | ||
| Makefile | ||
| virtio_anchor.c | ||
| virtio_balloon.c | ||
| virtio_debug.c | ||
| virtio_dma_buf.c | ||
| virtio_input.c | ||
| virtio_mem.c | ||
| virtio_mmio.c | ||
| virtio_pci_admin_legacy_io.c | ||
| virtio_pci_common.c | ||
| virtio_pci_common.h | ||
| virtio_pci_legacy_dev.c | ||
| virtio_pci_legacy.c | ||
| virtio_pci_modern_dev.c | ||
| virtio_pci_modern.c | ||
| virtio_ring.c | ||
| virtio_rtc_arm.c | ||
| virtio_rtc_class.c | ||
| virtio_rtc_driver.c | ||
| virtio_rtc_internal.h | ||
| virtio_rtc_ptp.c | ||
| virtio_vdpa.c | ||
| virtio.c | ||