Skip to content

Commit 9bd2788

Browse files
philmdstefanhaRH
authored andcommitted
block/nvme: Only report VFIO error on failed retry
We expect the first qemu_vfio_dma_map() to fail (indicating DMA mappings exhaustion, see commit 15a730e). Do not report the first failure as error, since we are going to flush the mappings and retry. This removes spurious error message displayed on the monitor: (qemu) c (qemu) qemu-kvm: VFIO_MAP_DMA failed: No space left on device (qemu) info status VM status: running Reported-by: Tingting Mao <[email protected]> Reviewed-by: Klaus Jensen <[email protected]> Signed-off-by: Philippe Mathieu-Daudé <[email protected]> Message-id: [email protected] Signed-off-by: Stefan Hajnoczi <[email protected]>
1 parent f38b376 commit 9bd2788

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

block/nvme.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1019,6 +1019,7 @@ static coroutine_fn int nvme_cmd_map_qiov(BlockDriverState *bs, NvmeCmd *cmd,
10191019
uint64_t *pagelist = req->prp_list_page;
10201020
int i, j, r;
10211021
int entries = 0;
1022+
Error *local_err = NULL, **errp = NULL;
10221023

10231024
assert(qiov->size);
10241025
assert(QEMU_IS_ALIGNED(qiov->size, s->page_size));
@@ -1031,7 +1032,7 @@ static coroutine_fn int nvme_cmd_map_qiov(BlockDriverState *bs, NvmeCmd *cmd,
10311032
try_map:
10321033
r = qemu_vfio_dma_map(s->vfio,
10331034
qiov->iov[i].iov_base,
1034-
len, true, &iova, NULL);
1035+
len, true, &iova, errp);
10351036
if (r == -ENOSPC) {
10361037
/*
10371038
* In addition to the -ENOMEM error, the VFIO_IOMMU_MAP_DMA
@@ -1066,6 +1067,8 @@ static coroutine_fn int nvme_cmd_map_qiov(BlockDriverState *bs, NvmeCmd *cmd,
10661067
goto fail;
10671068
}
10681069
}
1070+
errp = &local_err;
1071+
10691072
goto try_map;
10701073
}
10711074
if (r) {
@@ -1109,6 +1112,9 @@ static coroutine_fn int nvme_cmd_map_qiov(BlockDriverState *bs, NvmeCmd *cmd,
11091112
* because they are already mapped before calling this function; for
11101113
* temporary mappings, a later nvme_cmd_(un)map_qiov will reclaim by
11111114
* calling qemu_vfio_dma_reset_temporary when necessary. */
1115+
if (local_err) {
1116+
error_reportf_err(local_err, "Cannot map buffer for DMA: ");
1117+
}
11121118
return r;
11131119
}
11141120

0 commit comments

Comments
 (0)