Skip to contentSkip to conversation

Drivers: hv: balloon: Use VMBUS_RING_SIZE() wrapper for dm_ring_size

PATCH Applied Boqun Feng 3 participants 3 messages Nov 1, 2021 – Nov 4, 2021

Subsystems (3)
lore
Share & tools
lore

Boqun Feng

author
#0 lore raw

PATCH 1/1 Drivers: hv: balloon: Use VMBUS_RING_SIZE() wrapper for dm_ring_size

Baihua reported an error when boot an ARM64 guest with PAGE_SIZE=64k and BALLOON is enabled:

	hv_vmbus: registering driver hv_balloon
	hv_vmbus: probe failed for device 1eccfd72-4b41-45ef-b73a-4a6e44c12924 (-22)

The cause of this is that the ringbuffer size for hv_balloon is not adjusted with VMBUS_RING_SIZE(), which makes the size not large enough for ringbuffers on guest with PAGE_SIZE=64k. Therefore use VMBUS_RING_SIZE() to calculate the ringbuffer size. Note that the old size (20 * 1024) counts a 4k header in the total size, while VMBUS_RING_SIZE() expects the parameter as the payload size, so use 16 * 1024.

---
 drivers/hv/hv_balloon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hv/hv_balloon.c +1 -1
index 7f11ea07d698..ca873a3b98db 100644
@@ -480,7 +480,7 @@ module_param(pressure_report_delay, uint, (S_IRUGO | S_IWUSR));
 MODULE_PARM_DESC(pressure_report_delay, "Delay in secs in reporting pressure");
 static atomic_t trans_id = ATOMIC_INIT(0);
 
-static int dm_ring_size = 20 * 1024;
+static int dm_ring_size = VMBUS_RING_SIZE(16 * 1024);
 
 /*
  * Driver specific state.
Signature · 1 line
2.33.0
Tested-by on v1 1/1
#1 lore raw
Quoted 26 lines · Boqun Feng

Baihua reported an error when boot an ARM64 guest with PAGE_SIZE=64k and BALLOON is enabled:

	hv_vmbus: registering driver hv_balloon
	hv_vmbus: probe failed for device 1eccfd72-4b41-45ef-b73a-4a6e44c12924 (-22)

The cause of this is that the ringbuffer size for hv_balloon is not adjusted with VMBUS_RING_SIZE(), which makes the size not large enough for ringbuffers on guest with PAGE_SIZE=64k. Therefore use VMBUS_RING_SIZE() to calculate the ringbuffer size. Note that the old size (20 * 1024) counts a 4k header in the total size, while VMBUS_RING_SIZE() expects the parameter as the payload size, so use 16 * 1024.

---
 drivers/hv/hv_balloon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hv/hv_balloon.c +0 -0
index 7f11ea07d698..ca873a3b98db 100644

drivers/hv/hv_balloon.c module_param(pressure_report_delay, uint, (S_IRUGO | S_IWUSR)); · line 486

Quoted 8 lines
drivers/hv/hv_balloon.c +1 -1
@@ -480,7 +480,7 @@ module_param(pressure_report_delay, uint, (S_IRUGO | S_IWUSR));
 MODULE_PARM_DESC(pressure_report_delay, "Delay in secs in reporting pressure");
 static atomic_t trans_id = ATOMIC_INIT(0);
 
-static int dm_ring_size = 20 * 1024;
+static int dm_ring_size = VMBUS_RING_SIZE(16 * 1024);
 
 /*
  * Driver specific state.

Thanks!

Signature · 1 line
Vitaly