linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Drivers: hv: balloon: Use VMBUS_RING_SIZE() wrapper for dm_ring_size
@ 2021-11-01 15:00 Boqun Feng
  2021-11-02 13:03 ` Vitaly Kuznetsov
  0 siblings, 1 reply; 3+ messages in thread
From: Boqun Feng @ 2021-11-01 15:00 UTC (permalink / raw)
  To: linux-hyperv, linux-kernel
  Cc: K. Y. Srinivasan, Haiyang Zhang, Stephen Hemminger, Wei Liu,
	Dexuan Cui, Boqun Feng, stable, Baihua Lu

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.

Cc: <stable@vger.kernel.org> # 5.15.x
Reported-by: Baihua Lu <baihua.lu@microsoft.com>
Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
---
 drivers/hv/hv_balloon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hv/hv_balloon.c b/drivers/hv/hv_balloon.c
index 7f11ea07d698..ca873a3b98db 100644
--- a/drivers/hv/hv_balloon.c
+++ b/drivers/hv/hv_balloon.c
@@ -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.
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Drivers: hv: balloon: Use VMBUS_RING_SIZE() wrapper for dm_ring_size
  2021-11-01 15:00 [PATCH] Drivers: hv: balloon: Use VMBUS_RING_SIZE() wrapper for dm_ring_size Boqun Feng
@ 2021-11-02 13:03 ` Vitaly Kuznetsov
  2021-11-04 12:18   ` Wei Liu
  0 siblings, 1 reply; 3+ messages in thread
From: Vitaly Kuznetsov @ 2021-11-02 13:03 UTC (permalink / raw)
  To: Boqun Feng, linux-hyperv, linux-kernel
  Cc: K. Y. Srinivasan, Haiyang Zhang, Stephen Hemminger, Wei Liu,
	Dexuan Cui, Boqun Feng, stable, Baihua Lu

Boqun Feng <boqun.feng@gmail.com> writes:

> 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.
>
> Cc: <stable@vger.kernel.org> # 5.15.x
> Reported-by: Baihua Lu <baihua.lu@microsoft.com>
> Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
> ---
>  drivers/hv/hv_balloon.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/hv/hv_balloon.c b/drivers/hv/hv_balloon.c
> index 7f11ea07d698..ca873a3b98db 100644
> --- a/drivers/hv/hv_balloon.c
> +++ b/drivers/hv/hv_balloon.c
> @@ -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.

Tested-by: Vitaly Kuznetsov <vkuznets@redhat.com>

Thanks!

-- 
Vitaly


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Drivers: hv: balloon: Use VMBUS_RING_SIZE() wrapper for dm_ring_size
  2021-11-02 13:03 ` Vitaly Kuznetsov
@ 2021-11-04 12:18   ` Wei Liu
  0 siblings, 0 replies; 3+ messages in thread
From: Wei Liu @ 2021-11-04 12:18 UTC (permalink / raw)
  To: Vitaly Kuznetsov
  Cc: Boqun Feng, linux-hyperv, linux-kernel, K. Y. Srinivasan,
	Haiyang Zhang, Stephen Hemminger, Wei Liu, Dexuan Cui, stable,
	Baihua Lu

On Tue, Nov 02, 2021 at 02:03:57PM +0100, Vitaly Kuznetsov wrote:
> Boqun Feng <boqun.feng@gmail.com> writes:
[...]
> 
> Tested-by: Vitaly Kuznetsov <vkuznets@redhat.com>
> 

Applied to hyperv-fixes. Thanks.


> Thanks!
> 
> -- 
> Vitaly
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-11-04 12:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-01 15:00 [PATCH] Drivers: hv: balloon: Use VMBUS_RING_SIZE() wrapper for dm_ring_size Boqun Feng
2021-11-02 13:03 ` Vitaly Kuznetsov
2021-11-04 12:18   ` Wei Liu

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).