patch 'bus/vmbus: align ring buffer data to page boundary' has been queued to stable release 22.11.9

luca.boccassi at gmail.com luca.boccassi at gmail.com
Thu Jun 12 23:06:54 CEST 2025


Hi,

FYI, your patch has been queued to stable release 22.11.9

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 06/14/25. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://github.com/bluca/dpdk-stable

This queued commit can be viewed at:
https://github.com/bluca/dpdk-stable/commit/bd19d0b8ddf448274260edc43761924e8831c738

Thanks.

Luca Boccassi

---
>From bd19d0b8ddf448274260edc43761924e8831c738 Mon Sep 17 00:00:00 2001
From: Long Li <longli at microsoft.com>
Date: Fri, 18 Apr 2025 12:32:47 -0700
Subject: [PATCH] bus/vmbus: align ring buffer data to page boundary

[ upstream commit c54fa45817932057dd8f275fa1b8e4dcaede7813 ]

The ring buffer data region always starts at the system page boundary
after ring buffer head. The current code assumes the system page size is
4k. This is not always correct.

Fix this by using system page size for addressing ring buffer data.

Fixes: 831dba47bd36 ("bus/vmbus: add Hyper-V virtual bus support")

Signed-off-by: Long Li <longli at microsoft.com>
---
 drivers/bus/vmbus/rte_vmbus_reg.h | 9 +++------
 drivers/bus/vmbus/vmbus_bufring.c | 9 ++++++---
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/bus/vmbus/rte_vmbus_reg.h b/drivers/bus/vmbus/rte_vmbus_reg.h
index a17ce40763..6257774f29 100644
--- a/drivers/bus/vmbus/rte_vmbus_reg.h
+++ b/drivers/bus/vmbus/rte_vmbus_reg.h
@@ -100,14 +100,11 @@ struct vmbus_bufring {
 		uint32_t value;
 	} feature_bits;
 
-	/* Pad it to rte_mem_page_size() so that data starts on page boundary */
-	uint8_t	reserved2[4028];
-
 	/*
-	 * Ring data starts here + RingDataStartOffset
-	 * !!! DO NOT place any fields below this !!!
+	 * This is the end of ring buffer head. The ring buffer data is system
+	 * page aligned and starts at rte_mem_page_size() from the beginning
+	 * of this structure
 	 */
-	uint8_t data[];
 } __rte_packed;
 
 /*
diff --git a/drivers/bus/vmbus/vmbus_bufring.c b/drivers/bus/vmbus/vmbus_bufring.c
index c78619dc44..fcb97287dc 100644
--- a/drivers/bus/vmbus/vmbus_bufring.c
+++ b/drivers/bus/vmbus/vmbus_bufring.c
@@ -36,7 +36,10 @@ void vmbus_br_setup(struct vmbus_br *br, void *buf, unsigned int blen)
 {
 	br->vbr = buf;
 	br->windex = br->vbr->windex;
-	br->dsize = blen - sizeof(struct vmbus_bufring);
+
+	/* The ring buffer data starts at the 2nd page of the ring buffer */
+	RTE_VERIFY(blen > rte_mem_page_size());
+	br->dsize = blen - rte_mem_page_size();
 }
 
 /*
@@ -72,7 +75,7 @@ static inline uint32_t
 vmbus_txbr_copyto(const struct vmbus_br *tbr, uint32_t windex,
 		  const void *src0, uint32_t cplen)
 {
-	uint8_t *br_data = tbr->vbr->data;
+	uint8_t *br_data = (uint8_t *)tbr->vbr + rte_mem_page_size();
 	uint32_t br_dsize = tbr->dsize;
 	const uint8_t *src = src0;
 
@@ -170,7 +173,7 @@ static inline uint32_t
 vmbus_rxbr_copyfrom(const struct vmbus_br *rbr, uint32_t rindex,
 		    void *dst0, size_t cplen)
 {
-	const uint8_t *br_data = rbr->vbr->data;
+	const uint8_t *br_data = (uint8_t *)rbr->vbr + rte_mem_page_size();
 	uint32_t br_dsize = rbr->dsize;
 	uint8_t *dst = dst0;
 
-- 
2.47.2

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2025-06-12 22:06:25.258591068 +0100
+++ 0037-bus-vmbus-align-ring-buffer-data-to-page-boundary.patch	2025-06-12 22:06:23.858044384 +0100
@@ -1 +1 @@
-From c54fa45817932057dd8f275fa1b8e4dcaede7813 Mon Sep 17 00:00:00 2001
+From bd19d0b8ddf448274260edc43761924e8831c738 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit c54fa45817932057dd8f275fa1b8e4dcaede7813 ]
+
@@ -13 +14,0 @@
-Cc: stable at dpdk.org
@@ -22 +23 @@
-index 54a26d12bd..fb7e3043ec 100644
+index a17ce40763..6257774f29 100644
@@ -25 +26 @@
-@@ -100,14 +100,11 @@ struct __rte_packed_begin vmbus_bufring {
+@@ -100,14 +100,11 @@ struct vmbus_bufring {
@@ -40 +41 @@
- } __rte_packed_end;
+ } __rte_packed;


More information about the stable mailing list