All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] vhost-vdpa: propagate set_map error to caller
@ 2026-07-16  3:02 Weimin Xiong
  2026-07-16 10:01 ` Eugenio Perez Martin
  2026-07-17  3:03 ` sashiko-bot
  0 siblings, 2 replies; 7+ messages in thread
From: Weimin Xiong @ 2026-07-16  3:02 UTC (permalink / raw)
  To: virtualization; +Cc: mst, jasowangio, eperezma, netdev, kvm, xiongweimin

From: xiongweimin <xiongweimin@kylinos.cn>

The return value of ops->set_map() is currently ignored when handling
VHOST_IOTLB_BATCH_END. If the backend fails to program the IOTLB,
the VMM incorrectly believes the operation succeeded and may continue
with stale or incorrect mappings.

Save and propagate the error from ops->set_map() in BATCH_END.

Signed-off-by: xiongweimin <xiongweimin@kylinos.cn>
---
 drivers/vhost/vdpa.c | 6 +++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c
index bb96b1aa5..ffbb10a92 100644
--- a/drivers/vhost/vdpa.c
+++ b/drivers/vhost/vdpa.c
@@ -1297,8 +1297,10 @@ static int vhost_vdpa_process_iotlb_msg(struct vhost_dev *dev, u32 asid,
 		v->in_batch = true;
 		break;
 	case VHOST_IOTLB_BATCH_END:
-		if (v->in_batch && ops->set_map)
-			ops->set_map(vdpa, asid, iotlb);
+		if (v->in_batch && ops->set_map) {
+			r = ops->set_map(vdpa, asid, iotlb);
+			break;
+		}
 		v->in_batch = false;
 		break;
 	default:
--
2.39.3


^ permalink raw reply related	[flat|nested] 7+ messages in thread
* [PATCH] vhost-vdpa: propagate set_map error to caller
@ 2026-07-17  2:09 Weimin Xiong
  0 siblings, 0 replies; 7+ messages in thread
From: Weimin Xiong @ 2026-07-17  2:09 UTC (permalink / raw)
  To: virtualization; +Cc: xiongweimin

From: xiongweimin <xiongweimin@kylinos.cn>

The return value of ops->set_map() is currently ignored when handling
VHOST_IOTLB_BATCH_END. If the backend fails to program the IOTLB,
the VMM incorrectly believes the operation succeeded and may continue
with stale or incorrect mappings.

Propagate the error from ops->set_map() to the caller.

Signed-off-by: xiongweimin <xiongweimin@kylinos.cn>
---
 drivers/vhost/vdpa.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c
index bb96b1aa5..b52d8d94e 100644
--- a/drivers/vhost/vdpa.c
+++ b/drivers/vhost/vdpa.c
@@ -1298,7 +1298,7 @@ static int vhost_vdpa_process_iotlb_msg(struct vhost_dev *dev, u32 asid,
 		break;
 	case VHOST_IOTLB_BATCH_END:
 		if (v->in_batch && ops->set_map)
-			ops->set_map(vdpa, asid, iotlb);
+			r = ops->set_map(vdpa, asid, iotlb);
 		v->in_batch = false;
 		break;
 	default:

--
2.39.3


^ permalink raw reply related	[flat|nested] 7+ messages in thread
* [PATCH] vhost-vdpa: propagate set_map error to caller
@ 2026-07-16  3:00 Weimin Xiong
  0 siblings, 0 replies; 7+ messages in thread
From: Weimin Xiong @ 2026-07-16  3:00 UTC (permalink / raw)
  To: virtualization; +Cc: mst, jasowangio, eperezma, netdev, xiongweimin

From: xiongweimin <xiongweimin@kylinos.cn>

The return value of ops->set_map() is currently ignored when handling
VHOST_IOTLB_BATCH_END. If the backend fails to program the IOTLB,
the VMM incorrectly believes the operation succeeded and may continue
with stale or incorrect mappings.

Save and propagate the error from ops->set_map() in BATCH_END.

Signed-off-by: xiongweimin <xiongweimin@kylinos.cn>
---
 drivers/vhost/vdpa.c | 6 +++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c
index bb96b1aa5..ffbb10a92 100644
--- a/drivers/vhost/vdpa.c
+++ b/drivers/vhost/vdpa.c
@@ -1297,8 +1297,10 @@ static int vhost_vdpa_process_iotlb_msg(struct vhost_dev *dev, u32 asid,
 		v->in_batch = true;
 		break;
 	case VHOST_IOTLB_BATCH_END:
-		if (v->in_batch && ops->set_map)
-			ops->set_map(vdpa, asid, iotlb);
+		if (v->in_batch && ops->set_map) {
+			r = ops->set_map(vdpa, asid, iotlb);
+			break;
+		}
 		v->in_batch = false;
 		break;
 	default:
--
2.39.3


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

end of thread, other threads:[~2026-07-17  3:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-16  3:02 [PATCH] vhost-vdpa: propagate set_map error to caller Weimin Xiong
2026-07-16 10:01 ` Eugenio Perez Martin
2026-07-17  2:13   ` Weimin Xiong
2026-07-17  2:17   ` Re: [PATCH] vhost-vdpa: propagate set_map error to caller Weimin Xiong
2026-07-17  3:03 ` sashiko-bot
  -- strict thread matches above, loose matches on Subject: below --
2026-07-17  2:09 Weimin Xiong
2026-07-16  3:00 Weimin Xiong

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.