|
|
9ae3a8 |
From 90c28e632cce2d60c8242f5fb3e93f630e6211bc Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
Message-Id: <90c28e632cce2d60c8242f5fb3e93f630e6211bc.1387382496.git.minovotn@redhat.com>
|
|
|
9ae3a8 |
In-Reply-To: <c5386144fbf09f628148101bc674e2421cdd16e3.1387382496.git.minovotn@redhat.com>
|
|
|
9ae3a8 |
References: <c5386144fbf09f628148101bc674e2421cdd16e3.1387382496.git.minovotn@redhat.com>
|
|
|
9ae3a8 |
From: Nigel Croxon <ncroxon@redhat.com>
|
|
|
9ae3a8 |
Date: Thu, 14 Nov 2013 22:53:05 +0100
|
|
|
9ae3a8 |
Subject: [PATCH 29/46] rdma: check if RDMAControlHeader::len match
|
|
|
9ae3a8 |
transferred byte
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RH-Author: Nigel Croxon <ncroxon@redhat.com>
|
|
|
9ae3a8 |
Message-id: <1384469598-13137-30-git-send-email-ncroxon@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 55718
|
|
|
9ae3a8 |
O-Subject: [RHEL7.0 PATCH 29/42] rdma: check if RDMAControlHeader::len match transferred byte
|
|
|
9ae3a8 |
Bugzilla: 1011720
|
|
|
9ae3a8 |
RH-Acked-by: Orit Wasserman <owasserm@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Amit Shah <amit.shah@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Bugzilla: 1011720
|
|
|
9ae3a8 |
https://bugzilla.redhat.com/show_bug.cgi?id=1011720
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
>From commit ID:
|
|
|
9ae3a8 |
commit 88571882516a7cb4291a329c537eb79fd126e1f2
|
|
|
9ae3a8 |
Author: Isaku Yamahata <yamahata@private.email.ne.jp>
|
|
|
9ae3a8 |
Date: Fri Aug 9 16:05:42 2013 -0400
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
rdma: check if RDMAControlHeader::len match transferred byte
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RDMAControlHeader::len is provided from remote, so check if the value
|
|
|
9ae3a8 |
match the actual transferred byte_len.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
|
|
|
9ae3a8 |
Reviewed-by: Michael R. Hines <mrhines@us.ibm.com>
|
|
|
9ae3a8 |
Signed-off-by: Isaku Yamahata <yamahata@private.email.ne.jp>
|
|
|
9ae3a8 |
Signed-off-by: Michael R. Hines <mrhines@us.ibm.com>
|
|
|
9ae3a8 |
Message-id: 1376078746-24948-4-git-send-email-mrhines@linux.vnet.ibm.com
|
|
|
9ae3a8 |
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
migration-rdma.c | 32 ++++++++++++++++++++++----------
|
|
|
9ae3a8 |
1 files changed, 22 insertions(+), 10 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Michal Novotny <minovotn@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
migration-rdma.c | 32 ++++++++++++++++++++++----------
|
|
|
9ae3a8 |
1 file changed, 22 insertions(+), 10 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/migration-rdma.c b/migration-rdma.c
|
|
|
9ae3a8 |
index 140d930..9c02ad3 100644
|
|
|
9ae3a8 |
--- a/migration-rdma.c
|
|
|
9ae3a8 |
+++ b/migration-rdma.c
|
|
|
9ae3a8 |
@@ -1214,7 +1214,8 @@ static void qemu_rdma_signal_unregister(RDMAContext *rdma, uint64_t index,
|
|
|
9ae3a8 |
* (of any kind) has completed.
|
|
|
9ae3a8 |
* Return the work request ID that completed.
|
|
|
9ae3a8 |
*/
|
|
|
9ae3a8 |
-static uint64_t qemu_rdma_poll(RDMAContext *rdma, uint64_t *wr_id_out)
|
|
|
9ae3a8 |
+static uint64_t qemu_rdma_poll(RDMAContext *rdma, uint64_t *wr_id_out,
|
|
|
9ae3a8 |
+ uint32_t *byte_len)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
int ret;
|
|
|
9ae3a8 |
struct ibv_wc wc;
|
|
|
9ae3a8 |
@@ -1285,6 +1286,9 @@ static uint64_t qemu_rdma_poll(RDMAContext *rdma, uint64_t *wr_id_out)
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
*wr_id_out = wc.wr_id;
|
|
|
9ae3a8 |
+ if (byte_len) {
|
|
|
9ae3a8 |
+ *byte_len = wc.byte_len;
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
return 0;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
@@ -1302,7 +1306,8 @@ static uint64_t qemu_rdma_poll(RDMAContext *rdma, uint64_t *wr_id_out)
|
|
|
9ae3a8 |
* completions only need to be recorded, but do not actually
|
|
|
9ae3a8 |
* need further processing.
|
|
|
9ae3a8 |
*/
|
|
|
9ae3a8 |
-static int qemu_rdma_block_for_wrid(RDMAContext *rdma, int wrid_requested)
|
|
|
9ae3a8 |
+static int qemu_rdma_block_for_wrid(RDMAContext *rdma, int wrid_requested,
|
|
|
9ae3a8 |
+ uint32_t *byte_len)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
int num_cq_events = 0, ret = 0;
|
|
|
9ae3a8 |
struct ibv_cq *cq;
|
|
|
9ae3a8 |
@@ -1314,7 +1319,7 @@ static int qemu_rdma_block_for_wrid(RDMAContext *rdma, int wrid_requested)
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
/* poll cq first */
|
|
|
9ae3a8 |
while (wr_id != wrid_requested) {
|
|
|
9ae3a8 |
- ret = qemu_rdma_poll(rdma, &wr_id_in);
|
|
|
9ae3a8 |
+ ret = qemu_rdma_poll(rdma, &wr_id_in, byte_len);
|
|
|
9ae3a8 |
if (ret < 0) {
|
|
|
9ae3a8 |
return ret;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
@@ -1356,7 +1361,7 @@ static int qemu_rdma_block_for_wrid(RDMAContext *rdma, int wrid_requested)
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
while (wr_id != wrid_requested) {
|
|
|
9ae3a8 |
- ret = qemu_rdma_poll(rdma, &wr_id_in);
|
|
|
9ae3a8 |
+ ret = qemu_rdma_poll(rdma, &wr_id_in, byte_len);
|
|
|
9ae3a8 |
if (ret < 0) {
|
|
|
9ae3a8 |
goto err_block_for_wrid;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
@@ -1442,7 +1447,7 @@ static int qemu_rdma_post_send_control(RDMAContext *rdma, uint8_t *buf,
|
|
|
9ae3a8 |
return ret;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
- ret = qemu_rdma_block_for_wrid(rdma, RDMA_WRID_SEND_CONTROL);
|
|
|
9ae3a8 |
+ ret = qemu_rdma_block_for_wrid(rdma, RDMA_WRID_SEND_CONTROL, NULL);
|
|
|
9ae3a8 |
if (ret < 0) {
|
|
|
9ae3a8 |
fprintf(stderr, "rdma migration: send polling control error!\n");
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
@@ -1483,7 +1488,9 @@ static int qemu_rdma_post_recv_control(RDMAContext *rdma, int idx)
|
|
|
9ae3a8 |
static int qemu_rdma_exchange_get_response(RDMAContext *rdma,
|
|
|
9ae3a8 |
RDMAControlHeader *head, int expecting, int idx)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
- int ret = qemu_rdma_block_for_wrid(rdma, RDMA_WRID_RECV_CONTROL + idx);
|
|
|
9ae3a8 |
+ uint32_t byte_len;
|
|
|
9ae3a8 |
+ int ret = qemu_rdma_block_for_wrid(rdma, RDMA_WRID_RECV_CONTROL + idx,
|
|
|
9ae3a8 |
+ &byte_len);
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
if (ret < 0) {
|
|
|
9ae3a8 |
fprintf(stderr, "rdma migration: recv polling control error!\n");
|
|
|
9ae3a8 |
@@ -1509,6 +1516,11 @@ static int qemu_rdma_exchange_get_response(RDMAContext *rdma,
|
|
|
9ae3a8 |
fprintf(stderr, "too long length: %d\n", head->len);
|
|
|
9ae3a8 |
return -EINVAL;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
+ if (sizeof(*head) + head->len != byte_len) {
|
|
|
9ae3a8 |
+ fprintf(stderr, "Malformed length: %d byte_len %d\n",
|
|
|
9ae3a8 |
+ head->len, byte_len);
|
|
|
9ae3a8 |
+ return -EINVAL;
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
return 0;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
@@ -1738,7 +1750,7 @@ retry:
|
|
|
9ae3a8 |
count++, current_index, chunk,
|
|
|
9ae3a8 |
sge.addr, length, rdma->nb_sent, block->nb_chunks);
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
- ret = qemu_rdma_block_for_wrid(rdma, RDMA_WRID_RDMA_WRITE);
|
|
|
9ae3a8 |
+ ret = qemu_rdma_block_for_wrid(rdma, RDMA_WRID_RDMA_WRITE, NULL);
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
if (ret < 0) {
|
|
|
9ae3a8 |
fprintf(stderr, "Failed to Wait for previous write to complete "
|
|
|
9ae3a8 |
@@ -1882,7 +1894,7 @@ retry:
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
if (ret == ENOMEM) {
|
|
|
9ae3a8 |
DDPRINTF("send queue is full. wait a little....\n");
|
|
|
9ae3a8 |
- ret = qemu_rdma_block_for_wrid(rdma, RDMA_WRID_RDMA_WRITE);
|
|
|
9ae3a8 |
+ ret = qemu_rdma_block_for_wrid(rdma, RDMA_WRID_RDMA_WRITE, NULL);
|
|
|
9ae3a8 |
if (ret < 0) {
|
|
|
9ae3a8 |
fprintf(stderr, "rdma migration: failed to make "
|
|
|
9ae3a8 |
"room in full send queue! %d\n", ret);
|
|
|
9ae3a8 |
@@ -2471,7 +2483,7 @@ static int qemu_rdma_drain_cq(QEMUFile *f, RDMAContext *rdma)
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
while (rdma->nb_sent) {
|
|
|
9ae3a8 |
- ret = qemu_rdma_block_for_wrid(rdma, RDMA_WRID_RDMA_WRITE);
|
|
|
9ae3a8 |
+ ret = qemu_rdma_block_for_wrid(rdma, RDMA_WRID_RDMA_WRITE, NULL);
|
|
|
9ae3a8 |
if (ret < 0) {
|
|
|
9ae3a8 |
fprintf(stderr, "rdma migration: complete polling error!\n");
|
|
|
9ae3a8 |
return -EIO;
|
|
|
9ae3a8 |
@@ -2607,7 +2619,7 @@ static size_t qemu_rdma_save_page(QEMUFile *f, void *opaque,
|
|
|
9ae3a8 |
*/
|
|
|
9ae3a8 |
while (1) {
|
|
|
9ae3a8 |
uint64_t wr_id, wr_id_in;
|
|
|
9ae3a8 |
- int ret = qemu_rdma_poll(rdma, &wr_id_in);
|
|
|
9ae3a8 |
+ int ret = qemu_rdma_poll(rdma, &wr_id_in, NULL);
|
|
|
9ae3a8 |
if (ret < 0) {
|
|
|
9ae3a8 |
fprintf(stderr, "rdma migration: polling error! %d\n", ret);
|
|
|
9ae3a8 |
goto err;
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.7.11.7
|
|
|
9ae3a8 |
|