From patchwork Mon Jan 28 22:01:43 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: mrhines@linux.vnet.ibm.com X-Patchwork-Id: 216380 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 369022C0095 for ; Tue, 29 Jan 2013 09:03:34 +1100 (EST) Received: from localhost ([::1]:56997 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tzwnc-0000xD-CT for incoming@patchwork.ozlabs.org; Mon, 28 Jan 2013 17:03:32 -0500 Received: from eggs.gnu.org ([208.118.235.92]:34820) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tzwmt-0007pz-0B for qemu-devel@nongnu.org; Mon, 28 Jan 2013 17:02:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tzwmn-0007x6-5h for qemu-devel@nongnu.org; Mon, 28 Jan 2013 17:02:46 -0500 Received: from e7.ny.us.ibm.com ([32.97.182.137]:35278) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tzwmn-0007x0-04 for qemu-devel@nongnu.org; Mon, 28 Jan 2013 17:02:41 -0500 Received: from /spool/local by e7.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 28 Jan 2013 17:02:40 -0500 Received: from d01dlp02.pok.ibm.com (9.56.250.167) by e7.ny.us.ibm.com (192.168.1.107) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 28 Jan 2013 17:02:11 -0500 Received: from d01relay01.pok.ibm.com (d01relay01.pok.ibm.com [9.56.227.233]) by d01dlp02.pok.ibm.com (Postfix) with ESMTP id ECA676E803A for ; Mon, 28 Jan 2013 17:02:09 -0500 (EST) Received: from d01av02.pok.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) by d01relay01.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r0SM2BXx312848 for ; Mon, 28 Jan 2013 17:02:11 -0500 Received: from d01av02.pok.ibm.com (loopback [127.0.0.1]) by d01av02.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r0SM2AAt001233 for ; Mon, 28 Jan 2013 20:02:10 -0200 Received: from mrhinesdev.klabtestbed.com (klinux.watson.ibm.com [9.2.208.21]) by d01av02.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id r0SM1qhI030965; Mon, 28 Jan 2013 20:02:10 -0200 From: mrhines@linux.vnet.ibm.com To: qemu-devel@nongnu.org Date: Mon, 28 Jan 2013 17:01:43 -0500 Message-Id: <1359410505-4715-3-git-send-email-mrhines@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1359410505-4715-1-git-send-email-mrhines@linux.vnet.ibm.com> References: <1359410505-4715-1-git-send-email-mrhines@linux.vnet.ibm.com> X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13012822-5806-0000-0000-00001EDD0D7E X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 32.97.182.137 Cc: aliguori@us.ibm.com, abali@us.ibm.com, "Michael R. Hines" , gokul@us.ibm.com Subject: [Qemu-devel] [RFC PATCH RDMA support v1: 3/5] initialize RDMA options when QEMU first runs on command-line X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: "Michael R. Hines" Signed-off-by: Michael R. Hines --- exec.c | 27 +++++++++++++++++++++++++++ vl.c | 10 ++++++++++ 2 files changed, 37 insertions(+) diff --git a/exec.c b/exec.c index b85508b..4fc56d1 100644 --- a/exec.c +++ b/exec.c @@ -25,6 +25,8 @@ #endif #include "qemu-common.h" +#include "qemu/rdma.h" +#include "monitor/monitor.h" #include "cpu.h" #include "tcg.h" #include "hw/hw.h" @@ -104,6 +106,31 @@ static MemoryRegion io_mem_watch; #if !defined(CONFIG_USER_ONLY) +/* + * Memory regions need to be registered with the device and queue pairs setup + * in advanced before the migration starts. This tells us where the RAM blocks + * are so that we can register them individually. + */ +int qemu_rdma_init_ram_blocks(struct qemu_rdma_ram_blocks *rdma_ram_blocks) +{ + RAMBlock *block; + int num_blocks = 0; + + memset(rdma_ram_blocks, 0, sizeof *rdma_ram_blocks); + QTAILQ_FOREACH(block, &ram_list.blocks, next) { + if (num_blocks >= QEMU_MAX_RAM_BLOCKS) { + return -1; + } + rdma_ram_blocks->block[num_blocks].local_host_addr = block->host; + rdma_ram_blocks->block[num_blocks].offset = (uint64_t)block->offset; + rdma_ram_blocks->block[num_blocks].length = (uint64_t)block->length; + num_blocks++; + } + rdma_ram_blocks->num_blocks = num_blocks; + + return 0; +} + static void phys_map_node_reserve(unsigned nodes) { if (phys_map_nodes_nb + nodes > phys_map_nodes_nb_alloc) { diff --git a/vl.c b/vl.c index 7aab73b..195a56e 100644 --- a/vl.c +++ b/vl.c @@ -29,6 +29,7 @@ #include #include #include "qemu/bitmap.h" +#include "qemu/rdma.h" /* Needed early for CONFIG_BSD etc. */ #include "config-host.h" @@ -3622,6 +3623,13 @@ int main(int argc, char **argv, char **envp) default_sdcard = 0; default_vga = 0; break; + case QEMU_OPTION_rdmaport: + rdmaport = atoi(optarg); + break; + case QEMU_OPTION_rdmahost: + strncpy(rdmahost, optarg, 64); + rdmahost[63] = '\0'; + break; case QEMU_OPTION_xen_domid: if (!(xen_available())) { printf("Option %s not supported for this target\n", popt->name); @@ -4007,6 +4015,8 @@ int main(int argc, char **argv, char **envp) register_savevm_live(NULL, "ram", 0, 4, &savevm_ram_handlers, NULL); + qemu_rdma_migration_data_init(&rdma_mdata); + if (nb_numa_nodes > 0) { int i;