hv_sock: fix ARM64 support
Subsystems (9)
PATCH 1/2 hv_sock: fix ARM64 support
VMBUS ring buffers must be page aligned. Therefore, the current value of 24K presents a challenge on ARM64 kernels (with 64K pages). So, use VMBUS_RING_SIZE() to ensure they are always aligned and large enough to hold all of the relevant data.
--- net/vmw_vsock/hyperv_transport.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/vmw_vsock/hyperv_transport.c +2 -2
@@ -375,10 +375,10 @@ static void hvs_open_connection(struct vmbus_channel *chan) }else { sndbuf =max_t (int, sk->sk_sndbuf,RINGBUFFER_HVS_SND_SIZE ); sndbuf =min_t (int, sndbuf,RINGBUFFER_HVS_MAX_SIZE ); - sndbuf =ALIGN (sndbuf,HV_HYP_PAGE_SIZE ); + sndbuf =VMBUS_RING_SIZE (sndbuf); rcvbuf =max_t (int, sk->sk_rcvbuf,RINGBUFFER_HVS_RCV_SIZE ); rcvbuf =min_t (int, rcvbuf,RINGBUFFER_HVS_MAX_SIZE ); - rcvbuf =ALIGN (rcvbuf,HV_HYP_PAGE_SIZE ); + rcvbuf =VMBUS_RING_SIZE (rcvbuf); } chan->max_pkt_size =HVS_MAX_PKT_SIZE ;
Signature · 1 line
2.54.0
PATCH 2/2 drm/hyperv: use VMBUS_RING_SIZE()
VMBUS ring buffers must be page aligned. So, use VMBUS_RING_SIZE() to ensure they are always aligned and large enough to hold all of the relevant data.
--- drivers/gpu/drm/hyperv/hyperv_drm_proto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/hyperv/hyperv_drm_proto.c +1 -1
@@ -10,7 +10,7 @@#include "hyperv_drm.h" -#define VMBUS_RING_BUFSIZE (256 * 1024) +#define VMBUS_RING_BUFSIZE VMBUS_RING_SIZE(256 * 1024)#define VMBUS_VSP_TIMEOUT (10 * HZ)#define SYNTHVID_VERSION (major, minor) ((minor) << 16 | (major))
Signature · 1 line
2.54.0
RE: [PATCH 2/2] drm/hyperv: use VMBUS_RING_SIZE()
Quoted 29 lines
Subject: [PATCH 2/2] drm/hyperv: use
VMBUS_RING_SIZE()VMBUS ring buffers must be page aligned. So, use
VMBUS_RING_SIZE()to ensure they are always aligned and large enough to hold all of the relevant data.Fixes 76c56a5affeb ("drm/hyperv: Add DRM driver for hyperv synthetic videodevice")
Signed-off-by Hamza Mahfooz <[email protected]>--- drivers/gpu/drm/hyperv/hyperv_drm_proto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/hyperv/hyperv_drm_proto.c +1
-2@@ -10,7 +10,7 @@#include "hyperv_drm.h" -#define VMBUS_RING_BUFSIZE (256 * 1024) +#define VMBUS_RING_BUFSIZE VMBUS_RING_SIZE(256 * 1024)#define VMBUS_VSP_TIMEOUT (10 * HZ)#define SYNTHVID_VERSION (major, minor) ((minor) << 16 | (major)) --
Quoted 1 line
2.54.0
Although this lgtm, but this may change the behaviour on ARM64 systems with page size > 4K ? Have we tested it ?
Hamza Mahfooz
AppliedRe: [PATCH 2/2] drm/hyperv: use VMBUS_RING_SIZE()
Quoted 27 lines · Saurabh Singh Sengar
Quoted 27 lines
Subject: [PATCH 2/2] drm/hyperv: use
VMBUS_RING_SIZE()VMBUS ring buffers must be page aligned. So, use
VMBUS_RING_SIZE()to ensure they are always aligned and large enough to hold all of the relevant data.Fixes 76c56a5affeb ("drm/hyperv: Add DRM driver for hyperv synthetic videodevice")
Signed-off-by Hamza Mahfooz <[email protected]>--- drivers/gpu/drm/hyperv/hyperv_drm_proto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/hyperv/hyperv_drm_proto.c +1
-1@@ -10,7 +10,7 @@#include "hyperv_drm.h" -#define VMBUS_RING_BUFSIZE (256 * 1024) +#define VMBUS_RING_BUFSIZE VMBUS_RING_SIZE(256 * 1024)#define VMBUS_VSP_TIMEOUT (10 * HZ)
Quoted 6 lines
Quoted 3 lines
drivers/gpu/drm/hyperv/hyperv_drm_proto.c +0
-1#define SYNTHVID_VERSION (major, minor) ((minor) << 16 | (major)) --2.54.0
Although this lgtm, but this may change the behaviour on ARM64 systems with page size > 4K ? Have we tested it ?
Yup, I tested it on an ARM64 windows machine with a 64K page size guest kernel.
Quoted 2 lines
Reviewed-by Saurabh Sengar <[email protected]>
Pushed to drm-misc.
Quoted 1 line
Dexuan Cui
maintainerRE: [PATCH 2/2] drm/hyperv: use VMBUS_RING_SIZE()
Quoted 14 lines
From: Hamza Mahfooz <[email protected]>
Sent: Monday, April 27, 2026 4:52 AM
To: Saurabh Singh Sengar <[email protected]>
...Quoted 9 lines · Saurabh Singh Sengar
Quoted 9 lines
Subject: [PATCH 2/2] drm/hyperv: use
VMBUS_RING_SIZE()VMBUS ring buffers must be page aligned. So, use
VMBUS_RING_SIZE()to ensure they are always aligned and large enough to hold all of the relevant data.Fixes 76c56a5affeb ("drm/hyperv: Add DRM driver for hyperv syntheticvideo device")
IMO the Fixes tag is unnecessary because the existing VMBUS_RING_BUFSIZE is 256KB, which is already aligned to 4KB, 16KB and 64KB.
VMBUS_RING_SIZE(256 * 1024) is still 256KB.
Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
Signed-off-by Hamza Mahfooz <[email protected]>--- drivers/gpu/drm/hyperv/hyperv_drm_proto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/hyperv/hyperv_drm_proto.c +1
-1@@ -10,7 +10,7 @@#include "hyperv_drm.h" -#define VMBUS_RING_BUFSIZE (256 * 1024) +#define VMBUS_RING_BUFSIZE VMBUS_RING_SIZE(256 * 1024)#define VMBUS_VSP_TIMEOUT (10 * HZ)
Quoted 6 lines
Quoted 5 lines
Quoted 3 lines
drivers/gpu/drm/hyperv/hyperv_drm_proto.c +0
-1#define SYNTHVID_VERSION (major, minor) ((minor) << 16 | (major)) --2.54.0
Although this lgtm, but this may change the behaviour on ARM64 systems
with page size > 4K ?
Actually the behavior won't change, becauseVMBUS_RING_SIZE(256 * 1024) is still 256KB.
Quoted 9 lines
Quoted 1 line
Have we tested it ?
Yup, I tested it on an ARM64 windows machine with a 64K page size guest kernel.
Quoted 2 lines
Reviewed-by Saurabh Sengar <[email protected]>Pushed to drm-misc.
Quoted 6 lines
From: Hamza Mahfooz <[email protected]>
Sent: Saturday, April 25, 2026 11:17 AM
...Fixes 77ffe33363c0 ("hv_sock: use HV_HYP_PAGE_SIZE for Hyper-Vcommunication")
It looks like 77ffe33363c0 was not tested withCONFIG_ARM64_64K_PAGES=y...
Thanks for the fix!
Quoted 1 line
Signed-off-by Hamza Mahfooz <[email protected]>
RE: [PATCH 2/2] drm/hyperv: use VMBUS_RING_SIZE()
In reply to Dexuan CuiFrom: Dexuan Cui <[email protected]> Sent: Monday, April 27, 2026 11:42 AM
Quoted 12 lines
Quoted 12 lines
From: Hamza Mahfooz <[email protected]>
Sent: Monday, April 27, 2026 4:52 AM
To: Saurabh Singh Sengar <[email protected]>
...Quoted 6 lines · Saurabh Singh Sengar
Quoted 6 lines
Subject: [PATCH 2/2] drm/hyperv: use
VMBUS_RING_SIZE()VMBUS ring buffers must be page aligned. So, use
VMBUS_RING_SIZE()to ensure they are always aligned and large enough to hold all of the relevant data.
Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Fixes 76c56a5affeb ("drm/hyperv: Add DRM driver for hyperv syntheticvideo device")
IMO the Fixes tag is unnecessary because the existing
VMBUS_RING_BUFSIZEis 256KB, which is already aligned to 4KB, 16KB and 64KB.
VMBUS_RING_SIZE(256 * 1024)is still 256KB.
Not always. If PAGE_SIZE is 64KiB, VMBUS_RING_SIZE(256 * 1024) is 320KiB. If PAGE_SIZE is 16KiB or 4KiB, then VMBUS_RING_SIZE(256 * 1024) is indeed 256 KiB. See the explanation in the comment for VMBUS_RING_SIZE.
Michael
Quoted 38 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Signed-off-by Hamza Mahfooz <[email protected]>--- drivers/gpu/drm/hyperv/hyperv_drm_proto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/hyperv/hyperv_drm_proto.c +1
-1@@ -10,7 +10,7 @@#include "hyperv_drm.h" -#define VMBUS_RING_BUFSIZE (256 * 1024) +#define VMBUS_RING_BUFSIZE VMBUS_RING_SIZE(256 * 1024)#define VMBUS_VSP_TIMEOUT (10 * HZ)Quoted 6 lines
Quoted 5 lines
Quoted 3 lines
drivers/gpu/drm/hyperv/hyperv_drm_proto.c +0
-1#define SYNTHVID_VERSION (major, minor) ((minor) << 16 | (major)) --2.54.0
Although this lgtm, but this may change the behaviour on ARM64 systems
with page size > 4K ?
Actually the behavior won't change, because
VMBUS_RING_SIZE(256 * 1024)is still 256KB.Quoted 9 lines
Quoted 1 line
Have we tested it ?
Yup, I tested it on an ARM64 windows machine with a 64K page size guest kernel.
Quoted 2 lines
Reviewed-by Saurabh Sengar <[email protected]>Pushed to drm-misc.
Jakub Kicinski
maintainerQuoted 4 lines · On Sat, 25 Apr 2026 11:17:18 -0700 Hamza Mahfooz wrote:
VMBUS ring buffers must be page aligned. Therefore, the current value of 24K presents a challenge on ARM64 kernels (with 64K pages). So, use
VMBUS_RING_SIZE()to ensure they are always aligned and large enough to hold all of the relevant data.
Please split the fixes into two independent postings. They have to go via different trees AFAICT
Dexuan Cui
maintainerRE: [PATCH 2/2] drm/hyperv: use VMBUS_RING_SIZE()
In reply to Michael KelleyQuoted 6 lines
From: Michael Kelley <[email protected]>
Sent: Monday, April 27, 2026 12:06 PMQuoted 4 lines
IMO the Fixes tag is unnecessary because the existing
VMBUS_RING_BUFSIZE
is 256KB, which is already aligned to 4KB, 16KB and 64KB.
Quoted 8 lines
Quoted 1 line
VMBUS_RING_SIZE(256 * 1024)is still 256KB.Not always. If
PAGE_SIZEis 64KiB,VMBUS_RING_SIZE(256 * 1024)is 320KiB. IfPAGE_SIZEis 16KiB or 4KiB, thenVMBUS_RING_SIZE(256 * 1024)is indeed 256 KiB. See the explanation in the comment forVMBUS_RING_SIZE.Michael
Thanks for correcting me!
I didn't realize that sizeof(struct hv_ring_buffer) is based on PAGE_SIZE, not on HV_HYP_PAGE_SIZE.
However, it looks like the Fixes tag is still not needed:
without the patch, we always pass two arguments of 256KB to vmbus_open().
with the patch, we still pass 256KB to vmbus_open() in the case of PAGE_SIZE=4KB or 16KB, and we pass 320KB in the case of PAGE_SIZE=64KB.
Both 320K and 256KB are multiples of PAGE_SIZE, so vmbus_open() -> vmbus_alloc_ring() doesn't return -EINVAL.
In the case of PAGE_SIZE=64KB, it's OK to pass 256KB to vmbus_open() here since the hyperv-drm driver doesn't really have to use a slightly bigger VMBus ringbuffer size.
Thanks,
Dexuan
Dexuan Cui
maintainerRE: [PATCH 2/2] drm/hyperv: use VMBUS_RING_SIZE()
In reply to Hamza MahfoozQuoted 4 lines
From: Hamza Mahfooz <[email protected]>
Sent: Saturday, April 25, 2026 11:17 AM
I think this should be
Cc: [email protected]