From: "Michael R. Hines" <mrhines@linux.vnet.ibm.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: aliguori@us.ibm.com, mst@redhat.com, qemu-devel@nongnu.org,
owasserm@redhat.com, abali@us.ibm.com, mrhines@us.ibm.com,
gokul@us.ibm.com
Subject: Re: [Qemu-devel] [RFC PATCH RDMA support v4: 07/10] connection-establishment for RDMA
Date: Mon, 18 Mar 2013 16:26:27 -0400 [thread overview]
Message-ID: <51477873.2030005@linux.vnet.ibm.com> (raw)
In-Reply-To: <5146D6C8.5040709@redhat.com>
Acknowledged.
On 03/18/2013 04:56 AM, Paolo Bonzini wrote:
> In a "socket-like" abstraction, all of these steps except the initial
> listen are part of "accept". Please move them to
> qemu_rdma_migrate_accept (possibly renaming the existing
> qemu_rdma_migrate_accept to a different name). Similarly, perhaps you
> can merge qemu_rdma_server_prepare and qemu_rdma_migrate_listen. Try
> to make the public API between modules as small as possible (but not
> smaller :)), so that you can easily document it without too many
> references to RDMA concepts. Thanks, Paolo
>> + rdma->total_bytes = 0;
>> + rdma->enabled = 1;
>> + qemu_rdma_dump_gid("server_connect", rdma->rdma_ctx.cm_id);
>> + return 0;
>> +
>> +err_rdma_server_wait:
>> + qemu_rdma_cleanup(rdma);
>> + return -1;
>> +
>> +}
>> +
>> +int rdma_start_incoming_migration(const char * host_port, Error **errp)
>> +{
>> + RDMAData *rdma = g_malloc0(sizeof(RDMAData));
>> + QEMUFile *f;
>> + int ret;
>> +
>> + if ((ret = qemu_rdma_data_init(rdma, host_port, errp)) < 0)
>> + return ret;
>> +
>> + ret = qemu_rdma_server_init(rdma, NULL);
>> +
>> + DPRINTF("Starting RDMA-based incoming migration\n");
>> +
>> + if (!ret) {
>> + DPRINTF("qemu_rdma_server_init success\n");
>> + ret = qemu_rdma_server_prepare(rdma, NULL);
>> +
>> + if (!ret) {
>> + DPRINTF("qemu_rdma_server_prepare success\n");
>> +
>> + ret = rdma_accept_incoming_migration(rdma, NULL);
>> + if(!ret)
>> + DPRINTF("qemu_rdma_accept_incoming_migration success\n");
>> + f = qemu_fopen_rdma(rdma, "rb");
>> + if (f == NULL) {
>> + fprintf(stderr, "could not qemu_fopen RDMA\n");
>> + ret = -EIO;
>> + }
>> +
>> + process_incoming_migration(f);
>> + }
>> + }
>> +
>> + return ret;
>> +}
>> +
>> +void rdma_start_outgoing_migration(void *opaque, const char *host_port, Error **errp)
>> +{
>> + RDMAData *rdma = g_malloc0(sizeof(RDMAData));
>> + MigrationState *s = opaque;
>> + int ret;
>> +
>> + if (qemu_rdma_data_init(rdma, host_port, errp) < 0)
>> + return;
>> +
>> + ret = qemu_rdma_client_init(rdma, NULL);
>> + if(!ret) {
>> + DPRINTF("qemu_rdma_client_init success\n");
>> + ret = qemu_rdma_client_connect(rdma, NULL);
>> +
>> + if(!ret) {
>> + s->file = qemu_fopen_rdma(rdma, "wb");
>> + DPRINTF("qemu_rdma_client_connect success\n");
>> + migrate_fd_connect(s);
>> + return;
>> + }
>> + }
>> +
>> + migrate_fd_error(s);
>> +}
>> +
>> +size_t save_rdma_page(QEMUFile *f, ram_addr_t block_offset, ram_addr_t offset, int cont, size_t size)
>> +{
>> + int ret;
>> + size_t bytes_sent = 0;
>> + ram_addr_t current_addr;
>> + RDMAData * rdma = migrate_use_rdma(f);
>> +
>> + current_addr = block_offset + offset;
>> +
>> + /*
>> + * Add this page to the current 'chunk'. If the chunk
>> + * is full, an actual RDMA write will occur.
>> + */
>> + if ((ret = qemu_rdma_write(rdma, current_addr, size)) < 0) {
>> + fprintf(stderr, "rdma migration: write error! %d\n", ret);
>> + return ret;
>> + }
>> +
>> + /*
>> + * Drain the Completion Queue if possible.
>> + * If not, the end of the iteration will do this
>> + * again to make sure we don't overflow the
>> + * request queue.
>> + */
>> + while (1) {
>> + int ret = qemu_rdma_poll(rdma);
>> + if (ret == RDMA_WRID_NONE) {
>> + break;
>> + }
>> + if (ret < 0) {
>> + fprintf(stderr, "rdma migration: polling error! %d\n", ret);
>> + return ret;
>> + }
>> + }
>> +
>> + bytes_sent += size;
>> + return bytes_sent;
>> +}
>> +
>> +size_t qemu_rdma_fill(void * opaque, uint8_t *buf, int size)
>> +{
>> + RDMAData * rdma = opaque;
>> + size_t len = 0;
>> +
>> + if(rdma->qemu_file_len) {
>> + DPRINTF("RDMA %" PRId64 " of %d bytes already in buffer\n",
>> + rdma->qemu_file_len, size);
>> +
>> + len = MIN(size, rdma->qemu_file_len);
>> + memcpy(buf, rdma->qemu_file_curr, len);
>> + rdma->qemu_file_curr += len;
>> + rdma->qemu_file_len -= len;
>> + }
>> +
>> + return len;
>> +}
>>
>
next prev parent reply other threads:[~2013-03-18 20:26 UTC|newest]
Thread overview: 73+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-18 3:18 [Qemu-devel] [RFC PATCH RDMA support v4: 00/10] cleaner ramblocks and documentation mrhines
2013-03-18 3:18 ` [Qemu-devel] [RFC PATCH RDMA support v4: 01/10] ./configure --enable-rdma mrhines
2013-03-18 3:18 ` [Qemu-devel] [RFC PATCH RDMA support v4: 02/10] check for CONFIG_RDMA mrhines
2013-03-18 3:18 ` [Qemu-devel] [RFC PATCH RDMA support v4: 03/10] more verbose documentation of the RDMA transport mrhines
2013-03-18 10:40 ` Michael S. Tsirkin
2013-03-18 20:24 ` Michael R. Hines
2013-03-18 21:26 ` Michael S. Tsirkin
2013-03-18 23:23 ` Michael R. Hines
2013-03-19 8:19 ` Michael S. Tsirkin
2013-03-19 13:21 ` Michael R. Hines
2013-03-19 15:08 ` Michael R. Hines
2013-03-19 15:16 ` Michael S. Tsirkin
2013-03-19 15:32 ` Michael R. Hines
2013-03-19 15:36 ` Michael S. Tsirkin
2013-03-19 17:09 ` Michael R. Hines
2013-03-19 17:14 ` Paolo Bonzini
2013-03-19 17:23 ` Michael S. Tsirkin
2013-03-19 17:40 ` Michael R. Hines
2013-03-19 17:52 ` Paolo Bonzini
2013-03-19 18:04 ` Michael R. Hines
2013-03-20 13:07 ` Michael S. Tsirkin
2013-03-20 15:15 ` Michael R. Hines
2013-03-20 15:22 ` Michael R. Hines
2013-03-20 15:55 ` Michael S. Tsirkin
2013-03-20 16:08 ` Michael R. Hines
2013-03-20 19:06 ` Michael S. Tsirkin
2013-03-20 20:20 ` Michael R. Hines
2013-03-20 20:31 ` Michael S. Tsirkin
2013-03-20 20:39 ` Michael R. Hines
2013-03-20 20:46 ` Michael S. Tsirkin
2013-03-20 20:56 ` Michael R. Hines
2013-03-21 5:20 ` Michael S. Tsirkin
2013-03-20 20:24 ` Michael R. Hines
2013-03-20 20:37 ` Michael S. Tsirkin
2013-03-20 20:45 ` Michael R. Hines
2013-03-20 20:52 ` Michael S. Tsirkin
2013-03-19 17:49 ` Michael R. Hines
2013-03-21 6:11 ` Michael S. Tsirkin
2013-03-21 15:22 ` Michael R. Hines
2013-04-05 20:45 ` Michael R. Hines
2013-04-05 20:46 ` Michael R. Hines
2013-03-18 3:18 ` [Qemu-devel] [RFC PATCH RDMA support v4: 04/10] iterators for getting the RAMBlocks mrhines
2013-03-18 8:48 ` Paolo Bonzini
2013-03-18 20:25 ` Michael R. Hines
2013-03-18 3:18 ` [Qemu-devel] [RFC PATCH RDMA support v4: 05/10] reuse function for parsing the QMP 'migrate' string mrhines
2013-03-18 3:18 ` [Qemu-devel] [RFC PATCH RDMA support v4: 06/10] core RDMA migration code (rdma.c) mrhines
2013-03-18 3:19 ` [Qemu-devel] [RFC PATCH RDMA support v4: 07/10] connection-establishment for RDMA mrhines
2013-03-18 8:56 ` Paolo Bonzini
2013-03-18 20:26 ` Michael R. Hines [this message]
2013-03-18 3:19 ` [Qemu-devel] [RFC PATCH RDMA support v4: 08/10] introduce QEMUFileRDMA mrhines
2013-03-18 9:09 ` Paolo Bonzini
2013-03-18 20:33 ` Michael R. Hines
2013-03-19 9:18 ` Paolo Bonzini
2013-03-19 13:12 ` Michael R. Hines
2013-03-19 13:25 ` Paolo Bonzini
2013-03-19 13:40 ` Michael R. Hines
2013-03-19 13:45 ` Paolo Bonzini
2013-03-19 14:10 ` Michael R. Hines
2013-03-19 14:22 ` Paolo Bonzini
2013-03-19 15:02 ` [Qemu-devel] [Bug]? (RDMA-related) ballooned memory not consulted during migration? Michael R. Hines
2013-03-19 15:12 ` Michael R. Hines
2013-03-19 15:17 ` Michael S. Tsirkin
2013-03-19 18:27 ` [Qemu-devel] [RFC PATCH RDMA support v4: 08/10] introduce QEMUFileRDMA Michael R. Hines
2013-03-19 18:40 ` Paolo Bonzini
2013-03-20 15:20 ` Paolo Bonzini
2013-03-20 16:09 ` Michael R. Hines
2013-03-18 3:19 ` [Qemu-devel] [RFC PATCH RDMA support v4: 09/10] check for QMP string and bypass nonblock() calls mrhines
2013-03-18 8:47 ` Paolo Bonzini
2013-03-18 20:37 ` Michael R. Hines
2013-03-19 9:23 ` Paolo Bonzini
2013-03-19 13:08 ` Michael R. Hines
2013-03-19 13:20 ` Paolo Bonzini
2013-03-18 3:19 ` [Qemu-devel] [RFC PATCH RDMA support v4: 10/10] send pc.ram over RDMA mrhines
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=51477873.2030005@linux.vnet.ibm.com \
--to=mrhines@linux.vnet.ibm.com \
--cc=abali@us.ibm.com \
--cc=aliguori@us.ibm.com \
--cc=gokul@us.ibm.com \
--cc=mrhines@us.ibm.com \
--cc=mst@redhat.com \
--cc=owasserm@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.