[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 49/53] migration/rdma: Silence qemu_rdma_block_for_wrid()
From: |
Markus Armbruster |
Subject: |
[PATCH v2 49/53] migration/rdma: Silence qemu_rdma_block_for_wrid() |
Date: |
Thu, 28 Sep 2023 15:20:15 +0200 |
Functions that use an Error **errp parameter to return errors should
not also report them to the user, because reporting is the caller's
job. When the caller does, the error is reported twice. When it
doesn't (because it recovered from the error), there is no error to
report, i.e. the report is bogus.
qemu_rdma_post_send_control(), qemu_rdma_exchange_get_response(), and
qemu_rdma_write_one() violate this principle: they call
error_report(), fprintf(stderr, ...), and perror() via
qemu_rdma_block_for_wrid(), qemu_rdma_poll(), and
qemu_rdma_wait_comp_channel(). I elected not to investigate how
callers handle the error, i.e. precise impact is not known.
Clean this up by dropping the error reporting from qemu_rdma_poll(),
qemu_rdma_wait_comp_channel(), and qemu_rdma_block_for_wrid(). I
believe the callers' error reports suffice. If they don't, we need to
convert to Error instead.
Bonus: resolves a FIXME about problematic use of errno.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Li Zhijian <lizhijian@fujitsu.com>
---
migration/rdma.c | 16 ----------------
1 file changed, 16 deletions(-)
diff --git a/migration/rdma.c b/migration/rdma.c
index f4bb329671..6c63f9c269 100644
--- a/migration/rdma.c
+++ b/migration/rdma.c
@@ -1483,17 +1483,12 @@ static int qemu_rdma_poll(RDMAContext *rdma, struct
ibv_cq *cq,
}
if (ret < 0) {
- error_report("ibv_poll_cq failed");
return -1;
}
wr_id = wc.wr_id & RDMA_WRID_TYPE_MASK;
if (wc.status != IBV_WC_SUCCESS) {
- fprintf(stderr, "ibv_poll_cq wc.status=%d %s!\n",
- wc.status, ibv_wc_status_str(wc.status));
- fprintf(stderr, "ibv_poll_cq wrid=%" PRIu64 "!\n", wr_id);
-
return -1;
}
@@ -1577,16 +1572,12 @@ static int qemu_rdma_wait_comp_channel(RDMAContext
*rdma,
if (pfds[1].revents) {
ret = rdma_get_cm_event(rdma->channel, &cm_event);
if (ret < 0) {
- error_report("failed to get cm event while wait "
- "completion channel");
return -1;
}
if (cm_event->event == RDMA_CM_EVENT_DISCONNECTED ||
cm_event->event == RDMA_CM_EVENT_DEVICE_REMOVAL) {
rdma_ack_cm_event(cm_event);
- error_report("receive cm event while wait comp
channel,"
- "cm event is %d", cm_event->event);
return -1;
}
rdma_ack_cm_event(cm_event);
@@ -1599,7 +1590,6 @@ static int qemu_rdma_wait_comp_channel(RDMAContext *rdma,
default: /* Error of some type -
* I don't trust errno from qemu_poll_ns
*/
- error_report("%s: poll failed", __func__);
return -1;
}
@@ -1683,12 +1673,6 @@ static int qemu_rdma_block_for_wrid(RDMAContext *rdma,
ret = ibv_get_cq_event(ch, &cq, &cq_ctx);
if (ret < 0) {
- /*
- * FIXME perror() is problematic, because ibv_reg_mr() is
- * not documented to set errno. Will go away later in
- * this series.
- */
- perror("ibv_get_cq_event");
goto err_block_for_wrid;
}
--
2.41.0
- [PATCH v2 16/53] migration/rdma: Fix or document problematic uses of errno, (continued)
- [PATCH v2 16/53] migration/rdma: Fix or document problematic uses of errno, Markus Armbruster, 2023/09/28
- [PATCH v2 14/53] migration/rdma: Make qemu_rdma_buffer_mergeable() return bool, Markus Armbruster, 2023/09/28
- [PATCH v2 44/53] migration/rdma: Convert qemu_rdma_alloc_pd_cq() to Error, Markus Armbruster, 2023/09/28
- [PATCH v2 48/53] migration/rdma: Don't report received completion events as error, Markus Armbruster, 2023/09/28
- [PATCH v2 37/53] migration/rdma: Convert qemu_rdma_exchange_get_response() to Error, Markus Armbruster, 2023/09/28
- [PATCH v2 51/53] migration/rdma: Downgrade qemu_rdma_cleanup() errors to warnings, Markus Armbruster, 2023/09/28
- [PATCH v2 53/53] migration/rdma: Replace flawed device detail dump by tracing, Markus Armbruster, 2023/09/28
- [PATCH v2 49/53] migration/rdma: Silence qemu_rdma_block_for_wrid(),
Markus Armbruster <=
- [PATCH v2 47/53] migration/rdma: Silence qemu_rdma_reg_control(), Markus Armbruster, 2023/09/28