patch 'vhost/crypto: skip fetch before vring init' has been queued to stable release 24.11.2
Kevin Traynor
ktraynor at redhat.com
Fri Mar 7 13:46:50 CET 2025
Hi,
FYI, your patch has been queued to stable release 24.11.2
Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 03/12/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/kevintraynor/dpdk-stable
This queued commit can be viewed at:
https://github.com/kevintraynor/dpdk-stable/commit/35d722b7a10303e04e5ca186763e239027f6d75e
Thanks.
Kevin
---
>From 35d722b7a10303e04e5ca186763e239027f6d75e Mon Sep 17 00:00:00 2001
From: Gowrishankar Muthukrishnan <gmuthukrishn at marvell.com>
Date: Fri, 28 Feb 2025 19:17:09 +0530
Subject: [PATCH] vhost/crypto: skip fetch before vring init
[ upstream commit b03cb9c87a61054ce34b1c19c89170c80d75d27d ]
Until virtio avail ring is initialized (by VHOST_USER_SET_VRING_ADDR),
worker thread should not try to fetch crypto op, which would lead to
memory fault.
Fixes: 939066d96563 ("vhost/crypto: add public function implementation")
Signed-off-by: Gowrishankar Muthukrishnan <gmuthukrishn at marvell.com>
Acked-by: Akhil Goyal <gakhil at marvell.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin at redhat.com>
---
lib/vhost/vhost_crypto.c | 25 ++++++++++++++++++++++---
1 file changed, 22 insertions(+), 3 deletions(-)
diff --git a/lib/vhost/vhost_crypto.c b/lib/vhost/vhost_crypto.c
index 7caf6d9afa..912dae012b 100644
--- a/lib/vhost/vhost_crypto.c
+++ b/lib/vhost/vhost_crypto.c
@@ -9,4 +9,5 @@
#include <rte_cryptodev.h>
+#include "iotlb.h"
#include "rte_vhost_crypto.h"
#include "vhost.h"
@@ -1581,4 +1582,18 @@ rte_vhost_crypto_fetch_requests(int vid, uint32_t qid,
vq = dev->virtqueue[qid];
+ if (unlikely(vq == NULL)) {
+ VC_LOG_ERR("Invalid virtqueue %u", qid);
+ return 0;
+ }
+
+ if (unlikely(rte_rwlock_read_trylock(&vq->access_lock) != 0))
+ return 0;
+
+ vhost_user_iotlb_rd_lock(vq);
+ if (unlikely(!vq->access_ok)) {
+ VC_LOG_DBG("Virtqueue %u vrings not yet initialized", qid);
+ goto out_unlock;
+ }
+
avail_idx = *((volatile uint16_t *)&vq->avail->idx);
start_idx = vq->last_used_idx;
@@ -1588,5 +1603,5 @@ rte_vhost_crypto_fetch_requests(int vid, uint32_t qid,
if (unlikely(count == 0))
- return 0;
+ goto out_unlock;
/* for zero copy, we need 2 empty mbufs for src and dst, otherwise
@@ -1598,5 +1613,5 @@ rte_vhost_crypto_fetch_requests(int vid, uint32_t qid,
(void **)mbufs, count * 2) < 0)) {
VC_LOG_ERR("Insufficient memory");
- return 0;
+ goto out_unlock;
}
@@ -1628,5 +1643,5 @@ rte_vhost_crypto_fetch_requests(int vid, uint32_t qid,
(void **)mbufs, count) < 0)) {
VC_LOG_ERR("Insufficient memory");
- return 0;
+ goto out_unlock;
}
@@ -1657,4 +1672,8 @@ rte_vhost_crypto_fetch_requests(int vid, uint32_t qid,
vq->last_used_idx += i;
+out_unlock:
+ vhost_user_iotlb_rd_unlock(vq);
+ rte_rwlock_read_unlock(&vq->access_lock);
+
return i;
}
--
2.48.1
---
Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- - 2025-03-07 11:02:57.529052751 +0000
+++ 0017-vhost-crypto-skip-fetch-before-vring-init.patch 2025-03-07 11:02:56.857335643 +0000
@@ -1 +1 @@
-From b03cb9c87a61054ce34b1c19c89170c80d75d27d Mon Sep 17 00:00:00 2001
+From 35d722b7a10303e04e5ca186763e239027f6d75e Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit b03cb9c87a61054ce34b1c19c89170c80d75d27d ]
+
@@ -11 +12,0 @@
-Cc: stable at dpdk.org
@@ -21 +22 @@
-index 4c36df9cb2..38c5a7f06f 100644
+index 7caf6d9afa..912dae012b 100644
@@ -30 +31 @@
-@@ -1587,4 +1588,18 @@ rte_vhost_crypto_fetch_requests(int vid, uint32_t qid,
+@@ -1581,4 +1582,18 @@ rte_vhost_crypto_fetch_requests(int vid, uint32_t qid,
@@ -49 +50 @@
-@@ -1594,5 +1609,5 @@ rte_vhost_crypto_fetch_requests(int vid, uint32_t qid,
+@@ -1588,5 +1603,5 @@ rte_vhost_crypto_fetch_requests(int vid, uint32_t qid,
@@ -56 +57 @@
-@@ -1604,5 +1619,5 @@ rte_vhost_crypto_fetch_requests(int vid, uint32_t qid,
+@@ -1598,5 +1613,5 @@ rte_vhost_crypto_fetch_requests(int vid, uint32_t qid,
@@ -63 +64 @@
-@@ -1634,5 +1649,5 @@ rte_vhost_crypto_fetch_requests(int vid, uint32_t qid,
+@@ -1628,5 +1643,5 @@ rte_vhost_crypto_fetch_requests(int vid, uint32_t qid,
@@ -70 +71 @@
-@@ -1663,4 +1678,8 @@ rte_vhost_crypto_fetch_requests(int vid, uint32_t qid,
+@@ -1657,4 +1672,8 @@ rte_vhost_crypto_fetch_requests(int vid, uint32_t qid,
More information about the stable
mailing list