Skip to contentSkip to conversation

RDMA patches

GIT PULL Marcel Apfelbaum 4 participants 16 messages Feb 5, 2018 – Feb 8, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

The following changes since commit f24ee107a07f093bd7ed475dd48d7ba57ea3d8fe:

Merge remote-tracking branch 'remotes/kraxel/tags/ui-20180202-pull-request' into staging (2018-02-02 18:54:11 +0000)

are available in the git repository at:

https://github.com/marcel-apf/qemu tags/rdma-pull-request

for you to fetch changes up to f172ba1b02724fb66dabd69cd553cfa625b413e5:

MAINTAINERS: add entry for hw/rdma (2018-02-05 11:53:00 +0200)

----------------------------------------------------------------
PVRDMA implementation

----------------------------------------------------------------
Marcel Apfelbaum (3):
mem: add share parameter to memory-backend-ram
docs: add pvrdma device documentation.
MAINTAINERS: add entry for hw/rdma

Yuval Shaia (1):
pvrdma: initial implementation

 MAINTAINERS                   |   8 +
 Makefile.objs                 |   2 +
 backends/hostmem-file.c       |  25 +-
 backends/hostmem-ram.c        |   4 +-
 backends/hostmem.c            |  21 ++
 configure                     |   9 +-
 docs/pvrdma.txt               | 255 +++++++++++++
 exec.c                        |  26 +-
 hw/Makefile.objs              |   1 +
 hw/rdma/Makefile.objs         |   5 +
 hw/rdma/rdma_backend.c        | 818 ++++++++++++++++++++++++++++++++++++++++++
 hw/rdma/rdma_backend.h        |  99 +++++
 hw/rdma/rdma_backend_defs.h   |  62 ++++
 hw/rdma/rdma_rm.c             | 544 ++++++++++++++++++++++++++++
 hw/rdma/rdma_rm.h             |  69 ++++
 hw/rdma/rdma_rm_defs.h        | 104 ++++++
 hw/rdma/rdma_utils.c          |  52 +++
 hw/rdma/rdma_utils.h          |  43 +++
 hw/rdma/trace-events          |   5 +
 hw/rdma/vmw/pvrdma.h          | 122 +++++++
 hw/rdma/vmw/pvrdma_cmd.c      | 656 +++++++++++++++++++++++++++++++++
 hw/rdma/vmw/pvrdma_dev_api.h  | 602 +++++++++++++++++++++++++++++++
 hw/rdma/vmw/pvrdma_dev_ring.c | 140 ++++++++
 hw/rdma/vmw/pvrdma_dev_ring.h |  42 +++
 hw/rdma/vmw/pvrdma_ib_verbs.h | 433 ++++++++++++++++++++++
 hw/rdma/vmw/pvrdma_main.c     | 653 +++++++++++++++++++++++++++++++++
 hw/rdma/vmw/pvrdma_qp_ops.c   | 212 +++++++++++
 hw/rdma/vmw/pvrdma_qp_ops.h   |  27 ++
 hw/rdma/vmw/pvrdma_ring.h     | 134 +++++++
 hw/rdma/vmw/trace-events      |   5 +
 hw/rdma/vmw/vmw_pvrdma-abi.h  | 311 ++++++++++++++++
 include/exec/memory.h         |  23 ++
 include/exec/ram_addr.h       |   3 +-
 include/hw/pci/pci_ids.h      |   3 +
 include/qemu/osdep.h          |   2 +-
 include/sysemu/hostmem.h      |   2 +-
 include/sysemu/kvm.h          |   2 +-
 memory.c                      |  16 +-
 qemu-options.hx               |  10 +-
 target/s390x/kvm.c            |   4 +-
 util/oslib-posix.c            |   4 +-
 util/oslib-win32.c            |   2 +-
 42 files changed, 5506 insertions(+), 54 deletions(-)
 create mode 100644 docs/pvrdma.txt
 create mode 100644 hw/rdma/Makefile.objs
 create mode 100644 hw/rdma/rdma_backend.c
 create mode 100644 hw/rdma/rdma_backend.h
 create mode 100644 hw/rdma/rdma_backend_defs.h
 create mode 100644 hw/rdma/rdma_rm.c
 create mode 100644 hw/rdma/rdma_rm.h
 create mode 100644 hw/rdma/rdma_rm_defs.h
 create mode 100644 hw/rdma/rdma_utils.c
 create mode 100644 hw/rdma/rdma_utils.h
 create mode 100644 hw/rdma/trace-events
 create mode 100644 hw/rdma/vmw/pvrdma.h
 create mode 100644 hw/rdma/vmw/pvrdma_cmd.c
 create mode 100644 hw/rdma/vmw/pvrdma_dev_api.h
 create mode 100644 hw/rdma/vmw/pvrdma_dev_ring.c
 create mode 100644 hw/rdma/vmw/pvrdma_dev_ring.h
 create mode 100644 hw/rdma/vmw/pvrdma_ib_verbs.h
 create mode 100644 hw/rdma/vmw/pvrdma_main.c
 create mode 100644 hw/rdma/vmw/pvrdma_qp_ops.c
 create mode 100644 hw/rdma/vmw/pvrdma_qp_ops.h
 create mode 100644 hw/rdma/vmw/pvrdma_ring.h
 create mode 100644 hw/rdma/vmw/trace-events
 create mode 100644 hw/rdma/vmw/vmw_pvrdma-abi.h
Signature · 1 line
2.13.5
#1 lore raw

[Qemu-devel] [PULL 1/4] mem: add share parameter to memory-backend-ram

Currently only file backed memory backend can be created with a "share" flag in order to allow sharing guest RAM with other processes in the host.

Add the "share" flag also to RAM Memory Backend
in order to allow remapping parts of the guest RAM to different host virtual addresses. This is needed by the RDMA devices in order to remap non-contiguous QEMU virtual addresses to a contiguous virtual address range.

Moved the "share" flag to the Host Memory base class, modified phys_mem_alloc to include the new parameter and a new interface memory_region_init_ram_shared_nomigrate.

There are no functional changes if the new flag is not used.

---
 backends/hostmem-file.c  | 25 +------------------------
 backends/hostmem-ram.c   |  4 ++--
 backends/hostmem.c       | 21 +++++++++++++++++++++
 exec.c                   | 26 +++++++++++++++-----------
 include/exec/memory.h    | 23 +++++++++++++++++++++++
 include/exec/ram_addr.h  |  3 ++-
 include/qemu/osdep.h     |  2 +-
 include/sysemu/hostmem.h |  2 +-
 include/sysemu/kvm.h     |  2 +-
 memory.c                 | 16 +++++++++++++---
 qemu-options.hx          | 10 +++++++++-
 target/s390x/kvm.c       |  4 ++--
 util/oslib-posix.c       |  4 ++--
 util/oslib-win32.c       |  2 +-
 14 files changed, 94 insertions(+), 50 deletions(-)
backends/hostmem-file.c +1 -24
index e319ec1ad8..134b08d63a 100644
@@ -31,7 +31,6 @@ typedef struct HostMemoryBackendFile HostMemoryBackendFile;
 struct HostMemoryBackendFile {
     HostMemoryBackend parent_obj;
 
-    bool share;
     bool discard_data;
     char *mem_path;
     uint64_t align;
@@ -59,7 +58,7 @@ file_backend_memory_alloc(HostMemoryBackend *backend, Error **errp)
         path = object_get_canonical_path(OBJECT(backend));
         memory_region_init_ram_from_file(&backend->mr, OBJECT(backend),
                                  path,
-                                 backend->size, fb->align, fb->share,
+                                 backend->size, fb->align, backend->share,
                                  fb->mem_path, errp);
         g_free(path);
     }
@@ -86,25 +85,6 @@ static void set_mem_path(Object *o, const char *str, Error **errp)
     fb->mem_path = g_strdup(str);
 }
 
-static bool file_memory_backend_get_share(Object *o, Error **errp)
-{
-    HostMemoryBackendFile *fb = MEMORY_BACKEND_FILE(o);
-
-    return fb->share;
-}
-
-static void file_memory_backend_set_share(Object *o, bool value, Error **errp)
-{
-    HostMemoryBackend *backend = MEMORY_BACKEND(o);
-    HostMemoryBackendFile *fb = MEMORY_BACKEND_FILE(o);
-
-    if (host_memory_backend_mr_inited(backend)) {
-        error_setg(errp, "cannot change property value");
-        return;
-    }
-    fb->share = value;
-}
-
 static bool file_memory_backend_get_discard_data(Object *o, Error **errp)
 {
     return MEMORY_BACKEND_FILE(o)->discard_data;
@@ -171,9 +151,6 @@ file_backend_class_init(ObjectClass *oc, void *data)
     bc->alloc = file_backend_memory_alloc;
     oc->unparent = file_backend_unparent;
 
-    object_class_property_add_bool(oc, "share",
-        file_memory_backend_get_share, file_memory_backend_set_share,
-        &error_abort);
     object_class_property_add_bool(oc, "discard-data",
         file_memory_backend_get_discard_data, file_memory_backend_set_discard_data,
         &error_abort);
backends/hostmem-ram.c +2 -2
index 38977be73e..7ddd08d370 100644
@@ -28,8 +28,8 @@ ram_backend_memory_alloc(HostMemoryBackend *backend, Error **errp)
     }
 
     path = object_get_canonical_path_component(OBJECT(backend));
-    memory_region_init_ram_nomigrate(&backend->mr, OBJECT(backend), path,
-                           backend->size, errp);
+    memory_region_init_ram_shared_nomigrate(&backend->mr, OBJECT(backend), path,
+                           backend->size, backend->share, errp);
     g_free(path);
 }
 
backends/hostmem.c +21 -0
index ee2c2d5bfd..1daf13bd2e 100644
@@ -369,6 +369,24 @@ static void set_id(Object *o, const char *str, Error **errp)
     backend->id = g_strdup(str);
 }
 
+static bool host_memory_backend_get_share(Object *o, Error **errp)
+{
+    HostMemoryBackend *backend = MEMORY_BACKEND(o);
+
+    return backend->share;
+}
+
+static void host_memory_backend_set_share(Object *o, bool value, Error **errp)
+{
+    HostMemoryBackend *backend = MEMORY_BACKEND(o);
+
+    if (host_memory_backend_mr_inited(backend)) {
+        error_setg(errp, "cannot change property value");
+        return;
+    }
+    backend->share = value;
+}
+
 static void
 host_memory_backend_class_init(ObjectClass *oc, void *data)
 {
@@ -399,6 +417,9 @@ host_memory_backend_class_init(ObjectClass *oc, void *data)
         host_memory_backend_get_policy,
         host_memory_backend_set_policy, &error_abort);
     object_class_property_add_str(oc, "id", get_id, set_id, &error_abort);
+    object_class_property_add_bool(oc, "share",
+        host_memory_backend_get_share, host_memory_backend_set_share,
+        &error_abort);
 }
 
 static void host_memory_backend_finalize(Object *o)
exec.c +15 -11
index 629a508385..5e56efefeb 100644
@@ -1285,7 +1285,7 @@ static int subpage_register (subpage_t *mmio, uint32_t start, uint32_t end,
                              uint16_t section);
 static subpage_t *subpage_init(FlatView *fv, hwaddr base);
 
-static void *(*phys_mem_alloc)(size_t size, uint64_t *align) =
+static void *(*phys_mem_alloc)(size_t size, uint64_t *align, bool shared) =
                                qemu_anon_ram_alloc;
 
 /*
@@ -1293,7 +1293,7 @@ static void *(*phys_mem_alloc)(size_t size, uint64_t *align) =
  * Accelerators with unusual needs may need this.  Hopefully, we can
  * get rid of it eventually.
  */
-void phys_mem_set_alloc(void *(*alloc)(size_t, uint64_t *align))
+void phys_mem_set_alloc(void *(*alloc)(size_t, uint64_t *align, bool shared))
 {
     phys_mem_alloc = alloc;
 }
@@ -1921,7 +1921,7 @@ static void dirty_memory_extend(ram_addr_t old_ram_size,
     }
 }
 
-static void ram_block_add(RAMBlock *new_block, Error **errp)
+static void ram_block_add(RAMBlock *new_block, Error **errp, bool shared)
 {
     RAMBlock *block;
     RAMBlock *last_block = NULL;
@@ -1944,7 +1944,7 @@ static void ram_block_add(RAMBlock *new_block, Error **errp)
             }
         } else {
             new_block->host = phys_mem_alloc(new_block->max_length,
-                                             &new_block->mr->align);
+                                             &new_block->mr->align, shared);
             if (!new_block->host) {
                 error_setg_errno(errp, errno,
                                  "cannot set up guest memory '%s'",
@@ -2049,7 +2049,7 @@ RAMBlock *qemu_ram_alloc_from_fd(ram_addr_t size, MemoryRegion *mr,
         return NULL;
     }
 
-    ram_block_add(new_block, &local_err);
+    ram_block_add(new_block, &local_err, share);
     if (local_err) {
         g_free(new_block);
         error_propagate(errp, local_err);
@@ -2091,7 +2091,7 @@ RAMBlock *qemu_ram_alloc_internal(ram_addr_t size, ram_addr_t max_size,
                                   void (*resized)(const char*,
                                                   uint64_t length,
                                                   void *host),
-                                  void *host, bool resizeable,
+                                  void *host, bool resizeable, bool share,
                                   MemoryRegion *mr, Error **errp)
 {
     RAMBlock *new_block;
@@ -2114,7 +2114,7 @@ RAMBlock *qemu_ram_alloc_internal(ram_addr_t size, ram_addr_t max_size,
     if (resizeable) {
         new_block->flags |= RAM_RESIZEABLE;
     }
-    ram_block_add(new_block, &local_err);
+    ram_block_add(new_block, &local_err, share);
     if (local_err) {
         g_free(new_block);
         error_propagate(errp, local_err);
@@ -2126,12 +2126,15 @@ RAMBlock *qemu_ram_alloc_internal(ram_addr_t size, ram_addr_t max_size,
 RAMBlock *qemu_ram_alloc_from_ptr(ram_addr_t size, void *host,
                                    MemoryRegion *mr, Error **errp)
 {
-    return qemu_ram_alloc_internal(size, size, NULL, host, false, mr, errp);
+    return qemu_ram_alloc_internal(size, size, NULL, host, false,
+                                   false, mr, errp);
 }
 
-RAMBlock *qemu_ram_alloc(ram_addr_t size, MemoryRegion *mr, Error **errp)
+RAMBlock *qemu_ram_alloc(ram_addr_t size, bool share,
+                         MemoryRegion *mr, Error **errp)
 {
-    return qemu_ram_alloc_internal(size, size, NULL, NULL, false, mr, errp);
+    return qemu_ram_alloc_internal(size, size, NULL, NULL, false,
+                                   share, mr, errp);
 }
 
 RAMBlock *qemu_ram_alloc_resizeable(ram_addr_t size, ram_addr_t maxsz,
@@ -2140,7 +2143,8 @@ RAMBlock *qemu_ram_alloc_resizeable(ram_addr_t size, ram_addr_t maxsz,
                                                      void *host),
                                      MemoryRegion *mr, Error **errp)
 {
-    return qemu_ram_alloc_internal(size, maxsz, resized, NULL, true, mr, errp);
+    return qemu_ram_alloc_internal(size, maxsz, resized, NULL, true,
+                                   false, mr, errp);
 }
 
 static void reclaim_ramblock(RAMBlock *block)
include/exec/memory.h +23 -0
index 07c5d6d597..1b02bbd334 100644
@@ -428,6 +428,29 @@ void memory_region_init_ram_nomigrate(MemoryRegion *mr,
                                       Error **errp);
 
 /**
+ * memory_region_init_ram_shared_nomigrate:  Initialize RAM memory region.
+ *                                           Accesses into the region will
+ *                                           modify memory directly.
+ *
+ * @mr: the #MemoryRegion to be initialized.
+ * @owner: the object that tracks the region's reference count
+ * @name: Region name, becomes part of RAMBlock name used in migration stream
+ *        must be unique within any device
+ * @size: size of the region.
+ * @share: allow remapping RAM to different addresses
+ * @errp: pointer to Error*, to store an error if it happens.
+ *
+ * Note that this function is similar to memory_region_init_ram_nomigrate.
+ * The only difference is part of the RAM region can be remapped.
+ */
+void memory_region_init_ram_shared_nomigrate(MemoryRegion *mr,
+                                             struct Object *owner,
+                                             const char *name,
+                                             uint64_t size,
+                                             bool share,
+                                             Error **errp);
+
+/**
  * memory_region_init_resizeable_ram:  Initialize memory region with resizeable
  *                                     RAM.  Accesses into the region will
  *                                     modify memory directly.  Only an initial
include/exec/ram_addr.h +2 -1
index 7633ef6342..cf2446a176 100644
@@ -80,7 +80,8 @@ RAMBlock *qemu_ram_alloc_from_fd(ram_addr_t size, MemoryRegion *mr,
                                  Error **errp);
 RAMBlock *qemu_ram_alloc_from_ptr(ram_addr_t size, void *host,
                                   MemoryRegion *mr, Error **errp);
-RAMBlock *qemu_ram_alloc(ram_addr_t size, MemoryRegion *mr, Error **errp);
+RAMBlock *qemu_ram_alloc(ram_addr_t size, bool share, MemoryRegion *mr,
+                         Error **errp);
 RAMBlock *qemu_ram_alloc_resizeable(ram_addr_t size, ram_addr_t max_size,
                                     void (*resized)(const char*,
                                                     uint64_t length,
include/qemu/osdep.h +1 -1
index adb3758275..41658060a7 100644
@@ -255,7 +255,7 @@ extern int daemon(int, int);
 int qemu_daemon(int nochdir, int noclose);
 void *qemu_try_memalign(size_t alignment, size_t size);
 void *qemu_memalign(size_t alignment, size_t size);
-void *qemu_anon_ram_alloc(size_t size, uint64_t *align);
+void *qemu_anon_ram_alloc(size_t size, uint64_t *align, bool shared);
 void qemu_vfree(void *ptr);
 void qemu_anon_ram_free(void *ptr, size_t size);
 
include/sysemu/hostmem.h +1 -1
index ed6a437f4d..4d8f859f03 100644
@@ -55,7 +55,7 @@ struct HostMemoryBackend {
     char *id;
     uint64_t size;
     bool merge, dump;
-    bool prealloc, force_prealloc, is_mapped;
+    bool prealloc, force_prealloc, is_mapped, share;
     DECLARE_BITMAP(host_nodes, MAX_NODES + 1);
     HostMemPolicy policy;
 
include/sysemu/kvm.h +1 -1
index bbf12a1723..85002ac49a 100644
@@ -248,7 +248,7 @@ int kvm_on_sigbus(int code, void *addr);
 
 /* interface with exec.c */
 
-void phys_mem_set_alloc(void *(*alloc)(size_t, uint64_t *align));
+void phys_mem_set_alloc(void *(*alloc)(size_t, uint64_t *align, bool shared));
 
 /* internal API */
 
memory.c +13 -3
index 449a1429b9..3211fdc15f 100644
@@ -1538,11 +1538,21 @@ void memory_region_init_ram_nomigrate(MemoryRegion *mr,
                                       uint64_t size,
                                       Error **errp)
 {
+    memory_region_init_ram_shared_nomigrate(mr, owner, name, size, false, errp);
+}
+
+void memory_region_init_ram_shared_nomigrate(MemoryRegion *mr,
+                                             Object *owner,
+                                             const char *name,
+                                             uint64_t size,
+                                             bool share,
+                                             Error **errp)
+{
     memory_region_init(mr, owner, name, size);
     mr->ram = true;
     mr->terminates = true;
     mr->destructor = memory_region_destructor_ram;
-    mr->ram_block = qemu_ram_alloc(size, mr, errp);
+    mr->ram_block = qemu_ram_alloc(size, share, mr, errp);
     mr->dirty_log_mask = tcg_enabled() ? (1 << DIRTY_MEMORY_CODE) : 0;
 }
 
@@ -1653,7 +1663,7 @@ void memory_region_init_rom_nomigrate(MemoryRegion *mr,
     mr->readonly = true;
     mr->terminates = true;
     mr->destructor = memory_region_destructor_ram;
-    mr->ram_block = qemu_ram_alloc(size, mr, errp);
+    mr->ram_block = qemu_ram_alloc(size, false, mr, errp);
     mr->dirty_log_mask = tcg_enabled() ? (1 << DIRTY_MEMORY_CODE) : 0;
 }
 
@@ -1672,7 +1682,7 @@ void memory_region_init_rom_device_nomigrate(MemoryRegion *mr,
     mr->terminates = true;
     mr->rom_device = true;
     mr->destructor = memory_region_destructor_ram;
-    mr->ram_block = qemu_ram_alloc(size, mr, errp);
+    mr->ram_block = qemu_ram_alloc(size, false,  mr, errp);
 }
 
 void memory_region_init_iommu(void *_iommu_mr,
qemu-options.hx +9 -1
index 8ce427da78..61497ce136 100644
@@ -3975,6 +3975,14 @@ The @option{share} boolean option determines whether the memory
 region is marked as private to QEMU, or shared. The latter allows
 a co-operating external process to access the QEMU memory region.
 
+The @option{share} is also required for pvrdma devices due to
+limitations in the RDMA API provided by Linux.
+
+Setting share=on might affect the ability to configure NUMA
+bindings for the memory backend under some circumstances, see
+Documentation/vm/numa_memory_policy.txt on the Linux kernel
+source tree for additional details.
+
 Setting the @option{discard-data} boolean option to @var{on}
 indicates that file contents can be destroyed when QEMU exits,
 to avoid unnecessarily flushing data to the backing file.  Note
@@ -4017,7 +4025,7 @@ requires an alignment different than the default one used by QEMU, eg
 the device DAX /dev/dax0.0 requires 2M alignment rather than 4K. In
 such cases, users can specify the required alignment via this option.
 
-@item -object memory-backend-ram,id=@var{id},merge=@var{on|off},dump=@var{on|off},prealloc=@var{on|off},size=@var{size},host-nodes=@var{host-nodes},policy=@var{default|preferred|bind|interleave}
+@item -object memory-backend-ram,id=@var{id},merge=@var{on|off},dump=@var{on|off},share=@var{on|off},prealloc=@var{on|off},size=@var{size},host-nodes=@var{host-nodes},policy=@var{default|preferred|bind|interleave}
 
 Creates a memory backend object, which can be used to back the guest RAM.
 Memory backend objects offer more control than the @option{-m} option that is
target/s390x/kvm.c +2 -2
index 8736001156..e4599dd870 100644
@@ -144,7 +144,7 @@ static int cap_gs;
 
 static int active_cmma;
 
-static void *legacy_s390_alloc(size_t size, uint64_t *align);
+static void *legacy_s390_alloc(size_t size, uint64_t *align, bool shared);
 
 static int kvm_s390_query_mem_limit(uint64_t *memory_limit)
 {
@@ -752,7 +752,7 @@ int kvm_s390_mem_op(S390CPU *cpu, vaddr addr, uint8_t ar, void *hostbuf,
  * to grow. We also have to use MAP parameters that avoid
  * read-only mapping of guest pages.
  */
-static void *legacy_s390_alloc(size_t size, uint64_t *align)
+static void *legacy_s390_alloc(size_t size, uint64_t *align, bool shared)
 {
     void *mem;
 
util/oslib-posix.c +2 -2
index 77369c92ce..0cf3548778 100644
@@ -127,10 +127,10 @@ void *qemu_memalign(size_t alignment, size_t size)
 }
 
 /* alloc shared memory pages */
-void *qemu_anon_ram_alloc(size_t size, uint64_t *alignment)
+void *qemu_anon_ram_alloc(size_t size, uint64_t *alignment, bool shared)
 {
     size_t align = QEMU_VMALLOC_ALIGN;
-    void *ptr = qemu_ram_mmap(-1, size, align, false);
+    void *ptr = qemu_ram_mmap(-1, size, align, shared);
 
     if (ptr == MAP_FAILED) {
         return NULL;
util/oslib-win32.c +1 -1
index 69a6286d50..bb5ad28bd3 100644
@@ -67,7 +67,7 @@ void *qemu_memalign(size_t alignment, size_t size)
     return qemu_oom_check(qemu_try_memalign(alignment, size));
 }
 
-void *qemu_anon_ram_alloc(size_t size, uint64_t *align)
+void *qemu_anon_ram_alloc(size_t size, uint64_t *align, bool shared)
 {
     void *ptr;
 
Signature · 1 line
2.13.5
#2 lore raw

[Qemu-devel] [PULL 2/4] docs: add pvrdma device documentation.

In reply to Marcel Apfelbaum
---
 docs/pvrdma.txt | 255 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 255 insertions(+)
 create mode 100644 docs/pvrdma.txt
docs/pvrdma.txt new file +255 -0
new file mode 100644
index 0000000000..5599318159
@@ -0,0 +1,255 @@
+Paravirtualized RDMA Device (PVRDMA)
+====================================
+
+
+1. Description
+===============
+PVRDMA is the QEMU implementation of VMware's paravirtualized RDMA device.
+It works with its Linux Kernel driver AS IS, no need for any special guest
+modifications.
+
+While it complies with the VMware device, it can also communicate with bare
+metal RDMA-enabled machines and does not require an RDMA HCA in the host, it
+can work with Soft-RoCE (rxe).
+
+It does not require the whole guest RAM to be pinned allowing memory
+over-commit and, even if not implemented yet, migration support will be
+possible with some HW assistance.
+
+A project presentation accompany this document:
+- http://events.linuxfoundation.org/sites/events/files/slides/lpc-2017-pvrdma-marcel-apfelbaum-yuval-shaia.pdf
+
+
+
+2. Setup
+========
+
+
+2.1 Guest setup
+===============
+Fedora 27+ kernels work out of the box, older distributions
+require updating the kernel to 4.14 to include the pvrdma driver.
+
+However the libpvrdma library needed by User Level Software is still
+not available as part of the distributions, so the rdma-core library
+needs to be compiled and optionally installed.
+
+Please follow the instructions at:
+  https://github.com/linux-rdma/rdma-core.git
+
+
+2.2 Host Setup
+==============
+The pvrdma backend is an ibdevice interface that can be exposed
+either by a Soft-RoCE(rxe) device on machines with no RDMA device,
+or an HCA SRIOV function(VF/PF).
+Note that ibdevice interfaces can't be shared between pvrdma devices,
+each one requiring a separate instance (rxe or SRIOV VF).
+
+
+2.2.1 Soft-RoCE backend(rxe)
+===========================
+A stable version of rxe is required, Fedora 27+ or a Linux
+Kernel 4.14+ is preferred.
+
+The rdma_rxe module is part of the Linux Kernel but not loaded by default.
+Install the User Level library (librxe) following the instructions from:
+https://github.com/SoftRoCE/rxe-dev/wiki/rxe-dev:-Home
+
+Associate an ETH interface with rxe by running:
+   rxe_cfg add eth0
+An rxe0 ibdevice interface will be created and can be used as pvrdma backend.
+
+
+2.2.2 RDMA device Virtual Function backend
+==========================================
+Nothing special is required, the pvrdma device can work not only with
+Ethernet Links, but also Infinibands Links.
+All is needed is an ibdevice with an active port, for Mellanox cards
+will be something like mlx5_6 which can be the backend.
+
+
+2.2.3 QEMU setup
+================
+Configure QEMU with --enable-rdma flag, installing
+the required RDMA libraries.
+
+
+
+3. Usage
+========
+Currently the device is working only with memory backed RAM
+and it must be mark as "shared":
+   -m 1G \
+   -object memory-backend-ram,id=mb1,size=1G,share \
+   -numa node,memdev=mb1 \
+
+The pvrdma device is composed of two functions:
+ - Function 0 is a vmxnet Ethernet Device which is redundant in Guest
+   but is required to pass the ibdevice GID using its MAC.
+   Examples:
+     For an rxe backend using eth0 interface it will use its mac:
+       -device vmxnet3,addr=<slot>.0,multifunction=on,mac=<eth0 MAC>
+     For an SRIOV VF, we take the Ethernet Interface exposed by it:
+       -device vmxnet3,multifunction=on,mac=<RoCE eth MAC>
+ - Function 1 is the actual device:
+       -device pvrdma,addr=<slot>.1,backend-dev=<ibdevice>,backend-gid-idx=<gid>,backend-port=<port>
+   where the ibdevice can be rxe or RDMA VF (e.g. mlx5_4)
+ Note: Pay special attention that the GID at backend-gid-idx matches vmxnet's MAC.
+ The rules of conversion are part of the RoCE spec, but since manual conversion
+ is not required, spotting problems is not hard:
+    Example: GID: fe80:0000:0000:0000:7efe:90ff:fecb:743a
+             MAC: 7c:fe:90:cb:74:3a
+    Note the difference between the first byte of the MAC and the GID.
+
+
+
+4. Implementation details
+=========================
+
+
+4.1 Overview
+============
+The device acts like a proxy between the Guest Driver and the host
+ibdevice interface.
+On configuration path:
+ - For every hardware resource request (PD/QP/CQ/...) the pvrdma will request
+   a resource from the backend interface, maintaining a 1-1 mapping
+   between the guest and host.
+On data path:
+ - Every post_send/receive received from the guest will be converted into
+   a post_send/receive for the backend. The buffers data will not be touched
+   or copied resulting in near bare-metal performance for large enough buffers.
+ - Completions from the backend interface will result in completions for
+   the pvrdma device.
+
+
+4.2 PCI BARs
+============
+PCI Bars:
+	BAR 0 - MSI-X
+        MSI-X vectors:
+		(0) Command - used when execution of a command is completed.
+		(1) Async - not in use.
+		(2) Completion - used when a completion event is placed in
+		  device's CQ ring.
+	BAR 1 - Registers
+        --------------------------------------------------------
+        | VERSION |  DSR | CTL | REQ | ERR |  ICR | IMR  | MAC |
+        --------------------------------------------------------
+		DSR - Address of driver/device shared memory used
+              for the command channel, used for passing:
+			    - General info such as driver version
+			    - Address of 'command' and 'response'
+			    - Address of async ring
+			    - Address of device's CQ ring
+			    - Device capabilities
+		CTL - Device control operations (activate, reset etc)
+		IMG - Set interrupt mask
+		REQ - Command execution register
+		ERR - Operation status
+
+	BAR 2 - UAR
+        ---------------------------------------------------------
+        | QP_NUM  | SEND/RECV Flag ||  CQ_NUM |   ARM/POLL Flag |
+        ---------------------------------------------------------
+		- Offset 0 used for QP operations (send and recv)
+		- Offset 4 used for CQ operations (arm and poll)
+
+
+4.3 Major flows
+===============
+
+4.3.1 Create CQ
+===============
+    - Guest driver
+        - Allocates pages for CQ ring
+        - Creates page directory (pdir) to hold CQ ring's pages
+        - Initializes CQ ring
+        - Initializes 'Create CQ' command object (cqe, pdir etc)
+        - Copies the command to 'command' address
+        - Writes 0 into REQ register
+    - Device
+        - Reads the request object from the 'command' address
+        - Allocates CQ object and initialize CQ ring based on pdir
+        - Creates the backend CQ
+        - Writes operation status to ERR register
+        - Posts command-interrupt to guest
+    - Guest driver
+        - Reads the HW response code from ERR register
+
+4.3.2 Create QP
+===============
+    - Guest driver
+        - Allocates pages for send and receive rings
+        - Creates page directory(pdir) to hold the ring's pages
+        - Initializes 'Create QP' command object (max_send_wr,
+          send_cq_handle, recv_cq_handle, pdir etc)
+        - Copies the object to 'command' address
+        - Write 0 into REQ register
+    - Device
+        - Reads the request object from 'command' address
+        - Allocates the QP object and initialize
+            - Send and recv rings based on pdir
+            - Send and recv ring state
+        - Creates the backend QP
+        - Writes the operation status to ERR register
+        - Posts command-interrupt to guest
+    - Guest driver
+        - Reads the HW response code from ERR register
+
+4.3.3 Post receive
+==================
+    - Guest driver
+        - Initializes a wqe and place it on recv ring
+        - Write to qpn|qp_recv_bit (31) to QP offset in UAR
+    - Device
+        - Extracts qpn from UAR
+        - Walks through the ring and does the following for each wqe
+            - Prepares the backend CQE context to be used when
+              receiving completion from backend (wr_id, op_code, emu_cq_num)
+            - For each sge prepares backend sge
+            - Calls backend's post_recv
+
+4.3.4 Process backend events
+============================
+    - Done by a dedicated thread used to process backend events;
+      at initialization is attached to the device and creates
+      the communication channel.
+    - Thread main loop:
+        - Polls for completions
+        - Extracts QEMU _cq_num, wr_id and op_code from context
+        - Writes CQE to CQ ring
+        - Writes CQ number to device CQ
+        - Sends completion-interrupt to guest
+        - Deallocates context
+        - Acks the event to backend
+
+
+
+5. Limitations
+==============
+- The device obviously is limited by the Guest Linux Driver features implementation
+  of the VMware device API.
+- Memory registration mechanism requires mremap for every page in the buffer in order
+  to map it to a contiguous virtual address range. Since this is not the data path
+  it should not matter much. If the default max mr size is increased, be aware that
+  memory registration can take up to 0.5 seconds for 1GB of memory.
+- The device requires target page size to be the same as the host page size,
+  otherwise it will fail to init.
+- QEMU cannot map guest RAM from a file descriptor if a pvrdma device is attached,
+  so it can't work with huge pages. The limitation will be addressed in the future,
+  however QEMU allocates Guest RAM with MADV_HUGEPAGE so if there are enough huge
+  pages available, QEMU will use them. QEMU will fail to init if the requirements
+  are not met.
+
+
+
+6. Performance
+==============
+By design the pvrdma device exits on each post-send/receive, so for small buffers
+the performance is affected; however for medium buffers it will became close to
+bare metal and from 1MB buffers and  up it reaches bare metal performance.
+(tested with 2 VMs, the pvrdma devices connected to 2 VFs of the same device)
+
+All the above assumes no memory registration is done on data path.
Signature · 1 line
2.13.5
#3 lore raw

[Qemu-devel] [PULL 4/4] MAINTAINERS: add entry for hw/rdma

In reply to Marcel Apfelbaum
---
 MAINTAINERS | 8 ++++++++
 1 file changed, 8 insertions(+)
MAINTAINERS +8 -0
index 0f952d46ce..3e34ae25ea 100644
@@ -1995,6 +1995,14 @@ F: block/replication.c
 F: tests/test-replication.c
 F: docs/block-replication.txt
 
+PVRDMA
+M: Yuval Shaia <[email protected]>
+M: Marcel Apfelbaum <[email protected]>
+S: Maintained
+F: hw/rdma/*
+F: hw/rdma/vmw/*
+F: docs/pvrdma.txt
+
 Build and test automation
 -------------------------
 Build and test automation
Signature · 1 line
2.13.5
#4 lore raw

[Qemu-devel] [PULL 3/4] pvrdma: initial implementation

In reply to Marcel Apfelbaum

From: Yuval Shaia <[email protected]>

PVRDMA is the QEMU implementation of VMware's paravirtualized RDMA device. It works with its Linux Kernel driver AS IS, no need for any special guest modifications.

While it complies with the VMware device, it can also communicate with bare metal RDMA-enabled machines and does not require an RDMA HCA in the host, it can work with Soft-RoCE (rxe).

It does not require the whole guest RAM to be pinned allowing memory over-commit and, even if not implemented yet, migration support will be possible with some HW assistance.

---
 Makefile.objs                 |   2 +
 configure                     |   9 +-
 hw/Makefile.objs              |   1 +
 hw/rdma/Makefile.objs         |   5 +
 hw/rdma/rdma_backend.c        | 818 ++++++++++++++++++++++++++++++++++++++++++
 hw/rdma/rdma_backend.h        |  99 +++++
 hw/rdma/rdma_backend_defs.h   |  62 ++++
 hw/rdma/rdma_rm.c             | 544 ++++++++++++++++++++++++++++
 hw/rdma/rdma_rm.h             |  69 ++++
 hw/rdma/rdma_rm_defs.h        | 104 ++++++
 hw/rdma/rdma_utils.c          |  52 +++
 hw/rdma/rdma_utils.h          |  43 +++
 hw/rdma/trace-events          |   5 +
 hw/rdma/vmw/pvrdma.h          | 122 +++++++
 hw/rdma/vmw/pvrdma_cmd.c      | 656 +++++++++++++++++++++++++++++++++
 hw/rdma/vmw/pvrdma_dev_api.h  | 602 +++++++++++++++++++++++++++++++
 hw/rdma/vmw/pvrdma_dev_ring.c | 140 ++++++++
 hw/rdma/vmw/pvrdma_dev_ring.h |  42 +++
 hw/rdma/vmw/pvrdma_ib_verbs.h | 433 ++++++++++++++++++++++
 hw/rdma/vmw/pvrdma_main.c     | 653 +++++++++++++++++++++++++++++++++
 hw/rdma/vmw/pvrdma_qp_ops.c   | 212 +++++++++++
 hw/rdma/vmw/pvrdma_qp_ops.h   |  27 ++
 hw/rdma/vmw/pvrdma_ring.h     | 134 +++++++
 hw/rdma/vmw/trace-events      |   5 +
 hw/rdma/vmw/vmw_pvrdma-abi.h  | 311 ++++++++++++++++
 include/hw/pci/pci_ids.h      |   3 +
 26 files changed, 5149 insertions(+), 4 deletions(-)
 create mode 100644 hw/rdma/Makefile.objs
 create mode 100644 hw/rdma/rdma_backend.c
 create mode 100644 hw/rdma/rdma_backend.h
 create mode 100644 hw/rdma/rdma_backend_defs.h
 create mode 100644 hw/rdma/rdma_rm.c
 create mode 100644 hw/rdma/rdma_rm.h
 create mode 100644 hw/rdma/rdma_rm_defs.h
 create mode 100644 hw/rdma/rdma_utils.c
 create mode 100644 hw/rdma/rdma_utils.h
 create mode 100644 hw/rdma/trace-events
 create mode 100644 hw/rdma/vmw/pvrdma.h
 create mode 100644 hw/rdma/vmw/pvrdma_cmd.c
 create mode 100644 hw/rdma/vmw/pvrdma_dev_api.h
 create mode 100644 hw/rdma/vmw/pvrdma_dev_ring.c
 create mode 100644 hw/rdma/vmw/pvrdma_dev_ring.h
 create mode 100644 hw/rdma/vmw/pvrdma_ib_verbs.h
 create mode 100644 hw/rdma/vmw/pvrdma_main.c
 create mode 100644 hw/rdma/vmw/pvrdma_qp_ops.c
 create mode 100644 hw/rdma/vmw/pvrdma_qp_ops.h
 create mode 100644 hw/rdma/vmw/pvrdma_ring.h
 create mode 100644 hw/rdma/vmw/trace-events
 create mode 100644 hw/rdma/vmw/vmw_pvrdma-abi.h
Makefile.objs +2 -0
index 2efba6d768..0b3c630719 100644
@@ -130,6 +130,8 @@ trace-events-subdirs += hw/block/dataplane
 trace-events-subdirs += hw/char
 trace-events-subdirs += hw/intc
 trace-events-subdirs += hw/net
+trace-events-subdirs += hw/rdma
+trace-events-subdirs += hw/rdma/vmw
 trace-events-subdirs += hw/virtio
 trace-events-subdirs += hw/audio
 trace-events-subdirs += hw/misc
configure +5 -4
index 302fdc92ff..996750fc65 100755
@@ -1553,7 +1553,7 @@ disabled with --disable-FEATURE, default is enabled if available:
   kvm             KVM acceleration support
   hax             HAX acceleration support
   hvf             Hypervisor.framework acceleration support
-  rdma            RDMA-based migration support
+  rdma            Enable RDMA-based migration and PVRDMA support
   vde             support for vde network
   netmap          support for netmap network
   linux-aio       Linux AIO support
@@ -2881,15 +2881,16 @@ if test "$rdma" != "no" ; then
 #include <rdma/rdma_cma.h>
 int main(void) { return 0; }
 EOF
-  rdma_libs="-lrdmacm -libverbs"
+  rdma_libs="-lrdmacm -libverbs -libumad"
   if compile_prog "" "$rdma_libs" ; then
     rdma="yes"
+    libs_softmmu="$libs_softmmu $rdma_libs"
   else
     if test "$rdma" = "yes" ; then
         error_exit \
-            " OpenFabrics librdmacm/libibverbs not present." \
+            " OpenFabrics librdmacm/libibverbs/libibumad not present." \
             " Your options:" \
-            "  (1) Fast: Install infiniband packages from your distro." \
+            "  (1) Fast: Install infiniband packages (devel) from your distro." \
             "  (2) Cleanest: Install libraries from www.openfabrics.org" \
             "  (3) Also: Install softiwarp if you don't have RDMA hardware"
     fi
hw/Makefile.objs +1 -0
index cf4cb2010b..6a0ffe0afd 100644
@@ -18,6 +18,7 @@ devices-dirs-$(CONFIG_IPMI) += ipmi/
 devices-dirs-$(CONFIG_SOFTMMU) += isa/
 devices-dirs-$(CONFIG_SOFTMMU) += misc/
 devices-dirs-$(CONFIG_SOFTMMU) += net/
+devices-dirs-$(CONFIG_SOFTMMU) += rdma/
 devices-dirs-$(CONFIG_SOFTMMU) += nvram/
 devices-dirs-$(CONFIG_SOFTMMU) += pci/
 devices-dirs-$(CONFIG_PCI) += pci-bridge/ pci-host/
hw/rdma/Makefile.objs new file +5 -0
new file mode 100644
index 0000000000..3504c39d21
@@ -0,0 +1,5 @@
+ifeq ($(CONFIG_RDMA),y)
+obj-$(CONFIG_PCI) += rdma_utils.o rdma_backend.o rdma_rm.o
+obj-$(CONFIG_PCI) += vmw/pvrdma_dev_ring.o vmw/pvrdma_cmd.o \
+                     vmw/pvrdma_qp_ops.o vmw/pvrdma_main.o
+endif
hw/rdma/rdma_backend.c new file +818 -0

818 lines not on this page · raw message

hw/rdma/rdma_backend.h new file +99 -0

99 lines not on this page · raw message

hw/rdma/rdma_backend_defs.h new file +62 -0

62 lines not on this page · raw message

hw/rdma/rdma_rm.c new file +544 -0

544 lines not on this page · raw message

hw/rdma/rdma_rm.h new file +69 -0

69 lines not on this page · raw message

hw/rdma/rdma_rm_defs.h new file +104 -0

104 lines not on this page · raw message

hw/rdma/rdma_utils.c new file +52 -0

52 lines not on this page · raw message

hw/rdma/rdma_utils.h new file +43 -0

43 lines not on this page · raw message

hw/rdma/trace-events new file +5 -0
new file mode 100644
index 0000000000..c4c202e647
@@ -0,0 +1,5 @@
+# See docs/tracing.txt for syntax documentation.
+
+#hw/rdma/rdma_backend.c
+create_ah_cache_hit(uint64_t subnet, uint64_t net_id) "subnet = 0x%"PRIx64" net_id = 0x%"PRIx64
+create_ah_cache_miss(uint64_t subnet, uint64_t net_id) "subnet = 0x%"PRIx64" net_id = 0x%"PRIx64
hw/rdma/vmw/pvrdma.h new file +122 -0

122 lines not on this page · raw message

hw/rdma/vmw/pvrdma_cmd.c new file +656 -0

656 lines not on this page · raw message

hw/rdma/vmw/pvrdma_dev_api.h new file +602 -0

379 lines not on this page · raw message

hw/rdma/vmw/pvrdma_dev_ring.c new file +140 -0

140 lines not on this page · raw message

hw/rdma/vmw/pvrdma_dev_ring.h new file +42 -0

42 lines not on this page · raw message

hw/rdma/vmw/pvrdma_ib_verbs.h new file +433 -0

433 lines not on this page · raw message

hw/rdma/vmw/pvrdma_main.c new file +653 -0

653 lines not on this page · raw message

hw/rdma/vmw/pvrdma_qp_ops.c new file +212 -0

212 lines not on this page · raw message

hw/rdma/vmw/pvrdma_qp_ops.h new file +27 -0
new file mode 100644
index 0000000000..61ec036835

Lines of this file are not shown. View the raw message.

hw/rdma/vmw/pvrdma_ring.h new file +134 -0

134 lines not on this page · raw message

hw/rdma/vmw/trace-events new file +5 -0
new file mode 100644
index 0000000000..b3f9e2b19f

Lines of this file are not shown. View the raw message.

hw/rdma/vmw/vmw_pvrdma-abi.h new file +311 -0

311 lines not on this page · raw message

include/hw/pci/pci_ids.h +3 -0
index 35df1874a9..1dbf53627c 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.13.5

Part of the diff is not shown here. View the raw message.

#5 lore raw
In reply to Marcel Apfelbaum
Quoted 8 lines · Marcel Apfelbaum

The following changes since commit f24ee107a07f093bd7ed475dd48d7ba57ea3d8fe:

Merge remote-tracking branch 'remotes/kraxel/tags/ui-20180202-pull-request' into staging (2018-02-02 18:54:11 +0000)

are available in the git repository at:

https://github.com/marcel-apf/qemu tags/rdma-pull-request

Quoted 8 lines

for you to fetch changes up to f172ba1b02724fb66dabd69cd553cfa625b413e5:

MAINTAINERS: add entry for hw/rdma (2018-02-05 11:53:00 +0200)

----------------------------------------------------------------
PVRDMA implementation

----------------------------------------------------------------

Hi Peter,

Sorry for bothering, I wonder if you saw this pull request. Since is my first one, I just want to be sure I did everything right.

Thanks,
Marcel

Quoted 75 lines

Marcel Apfelbaum (3):
mem: add share parameter to memory-backend-ram
docs: add pvrdma device documentation.
MAINTAINERS: add entry for hw/rdma

Yuval Shaia (1):
pvrdma: initial implementation

 MAINTAINERS                   |   8 +
 Makefile.objs                 |   2 +
 backends/hostmem-file.c       |  25 +-
 backends/hostmem-ram.c        |   4 +-
 backends/hostmem.c            |  21 ++
 configure                     |   9 +-
 docs/pvrdma.txt               | 255 +++++++++++++
 exec.c                        |  26 +-
 hw/Makefile.objs              |   1 +
 hw/rdma/Makefile.objs         |   5 +
 hw/rdma/rdma_backend.c        | 818 ++++++++++++++++++++++++++++++++++++++++++
 hw/rdma/rdma_backend.h        |  99 +++++
 hw/rdma/rdma_backend_defs.h   |  62 ++++
 hw/rdma/rdma_rm.c             | 544 ++++++++++++++++++++++++++++
 hw/rdma/rdma_rm.h             |  69 ++++
 hw/rdma/rdma_rm_defs.h        | 104 ++++++
 hw/rdma/rdma_utils.c          |  52 +++
 hw/rdma/rdma_utils.h          |  43 +++
 hw/rdma/trace-events          |   5 +
 hw/rdma/vmw/pvrdma.h          | 122 +++++++
 hw/rdma/vmw/pvrdma_cmd.c      | 656 +++++++++++++++++++++++++++++++++
 hw/rdma/vmw/pvrdma_dev_api.h  | 602 +++++++++++++++++++++++++++++++
 hw/rdma/vmw/pvrdma_dev_ring.c | 140 ++++++++
 hw/rdma/vmw/pvrdma_dev_ring.h |  42 +++
 hw/rdma/vmw/pvrdma_ib_verbs.h | 433 ++++++++++++++++++++++
 hw/rdma/vmw/pvrdma_main.c     | 653 +++++++++++++++++++++++++++++++++
 hw/rdma/vmw/pvrdma_qp_ops.c   | 212 +++++++++++
 hw/rdma/vmw/pvrdma_qp_ops.h   |  27 ++
 hw/rdma/vmw/pvrdma_ring.h     | 134 +++++++
 hw/rdma/vmw/trace-events      |   5 +
 hw/rdma/vmw/vmw_pvrdma-abi.h  | 311 ++++++++++++++++
 include/exec/memory.h         |  23 ++
 include/exec/ram_addr.h       |   3 +-
 include/hw/pci/pci_ids.h      |   3 +
 include/qemu/osdep.h          |   2 +-
 include/sysemu/hostmem.h      |   2 +-
 include/sysemu/kvm.h          |   2 +-
 memory.c                      |  16 +-
 qemu-options.hx               |  10 +-
 target/s390x/kvm.c            |   4 +-
 util/oslib-posix.c            |   4 +-
 util/oslib-win32.c            |   2 +-
 42 files changed, 5506 insertions(+), 54 deletions(-)
 create mode 100644 docs/pvrdma.txt
 create mode 100644 hw/rdma/Makefile.objs
 create mode 100644 hw/rdma/rdma_backend.c
 create mode 100644 hw/rdma/rdma_backend.h
 create mode 100644 hw/rdma/rdma_backend_defs.h
 create mode 100644 hw/rdma/rdma_rm.c
 create mode 100644 hw/rdma/rdma_rm.h
 create mode 100644 hw/rdma/rdma_rm_defs.h
 create mode 100644 hw/rdma/rdma_utils.c
 create mode 100644 hw/rdma/rdma_utils.h
 create mode 100644 hw/rdma/trace-events
 create mode 100644 hw/rdma/vmw/pvrdma.h
 create mode 100644 hw/rdma/vmw/pvrdma_cmd.c
 create mode 100644 hw/rdma/vmw/pvrdma_dev_api.h
 create mode 100644 hw/rdma/vmw/pvrdma_dev_ring.c
 create mode 100644 hw/rdma/vmw/pvrdma_dev_ring.h
 create mode 100644 hw/rdma/vmw/pvrdma_ib_verbs.h
 create mode 100644 hw/rdma/vmw/pvrdma_main.c
 create mode 100644 hw/rdma/vmw/pvrdma_qp_ops.c
 create mode 100644 hw/rdma/vmw/pvrdma_qp_ops.h
 create mode 100644 hw/rdma/vmw/pvrdma_ring.h
 create mode 100644 hw/rdma/vmw/trace-events
 create mode 100644 hw/rdma/vmw/vmw_pvrdma-abi.h
#6 lore raw
Quoted 16 lines · Marcel Apfelbaum
Quoted 15 lines · Marcel Apfelbaum

The following changes since commit f24ee107a07f093bd7ed475dd48d7ba57ea3d8fe:

Merge remote-tracking branch 'remotes/kraxel/tags/ui-20180202-pull-request' into staging (2018-02-02 18:54:11 +0000)

are available in the git repository at:

https://github.com/marcel-apf/qemu tags/rdma-pull-request

for you to fetch changes up to f172ba1b02724fb66dabd69cd553cfa625b413e5:

MAINTAINERS: add entry for hw/rdma (2018-02-05 11:53:00 +0200)

----------------------------------------------------------------
PVRDMA implementation

Quoted 6 lines
Quoted 1 line

----------------------------------------------------------------

Hi Peter,

Sorry for bothering, I wonder if you saw this pull request. Since is my first one, I just want to be sure I did everything right.

It's in my queue to process, yes.

thanks
-- PMM

#7 lore raw
In reply to Marcel Apfelbaum
Quoted 15 lines · Marcel Apfelbaum

The following changes since commit f24ee107a07f093bd7ed475dd48d7ba57ea3d8fe:

Merge remote-tracking branch 'remotes/kraxel/tags/ui-20180202-pull-request' into staging (2018-02-02 18:54:11 +0000)

are available in the git repository at:

https://github.com/marcel-apf/qemu tags/rdma-pull-request

for you to fetch changes up to f172ba1b02724fb66dabd69cd553cfa625b413e5:

MAINTAINERS: add entry for hw/rdma (2018-02-05 11:53:00 +0200)

----------------------------------------------------------------
PVRDMA implementation

Quoted 8 lines

----------------------------------------------------------------
Marcel Apfelbaum (3):
mem: add share parameter to memory-backend-ram
docs: add pvrdma device documentation.
MAINTAINERS: add entry for hw/rdma

Yuval Shaia (1):
pvrdma: initial implementation

Hi. The technical details of this pullreq are all fine (pgp key, format, etc), and it passes my build tests. But I gave this pullreq a bit of a closer inspection than I normally would, since it's your first, and there are a few things I thought worth bringing up:

(1) I notice that some of the new files in this pullreq are licensed as "GPL, version 2", rather than "version 2 or any later version". Did you really mean that? Per 'LICENSE', we have a strong preference for 2-or-later for new code.

(2) Some new files have no copyright or license comment at the top of them. Can you fix that, please?

(3) Some of the new headers use kernel-internals __u32 etc types. This isn't portable. ('HACKING' has some suggestions for types you might want instead.)

(4) One of your patches doesn't have any reviewed-by tags. We don't always manage to review everything, but it is nicer if we can get review, especially for patches from new submaintainers.

(5) This is an absolutely enormous diffstat for a single commit:

 26 files changed, 5149 insertions(+), 4 deletions(-)

thanks
-- PMM

#8 lore raw

Hi Peter,

Quoted 22 lines · Peter Maydell
Quoted 21 lines · Marcel Apfelbaum

The following changes since commit f24ee107a07f093bd7ed475dd48d7ba57ea3d8fe:

Merge remote-tracking branch 'remotes/kraxel/tags/ui-20180202-pull-request' into staging (2018-02-02 18:54:11 +0000)

are available in the git repository at:

https://github.com/marcel-apf/qemu tags/rdma-pull-request

for you to fetch changes up to f172ba1b02724fb66dabd69cd553cfa625b413e5:

MAINTAINERS: add entry for hw/rdma (2018-02-05 11:53:00 +0200)

----------------------------------------------------------------
PVRDMA implementation

----------------------------------------------------------------
Marcel Apfelbaum (3):
mem: add share parameter to memory-backend-ram
docs: add pvrdma device documentation.
MAINTAINERS: add entry for hw/rdma

Quoted 8 lines
Quoted 2 lines

Yuval Shaia (1):
pvrdma: initial implementation

Hi. The technical details of this pullreq are all fine (pgp key, format, etc), and it passes my build tests. But I gave this pullreq a bit of a closer inspection than I normally would, since it's your first, and there are a few things I thought worth bringing up:

Thanks for doing it!

Quoted 6 lines

(1) I notice that some of the new files in this pullreq are licensed as "GPL, version 2", rather than "version 2 or any later version". Did you really mean that? Per 'LICENSE', we have a strong preference for 2-or-later for new code.

No real preference, I will modify the license.

Quoted 3 lines

(2) Some new files have no copyright or license comment at the top of them. Can you fix that, please?

Sure.

Quoted 4 lines

(3) Some of the new headers use kernel-internals __u32 etc types. This isn't portable. ('HACKING' has some suggestions for types you might want instead.)

We do not "use" the __u32 types, we just copied a kernel file for structures used for communication between the guest driver and the QEMU code. We had a look on how it is done and we use the model that adds macros __u32 -> uint32_t, so the "__types" do not really create such problems.

Quoted 5 lines

(4) One of your patches doesn't have any reviewed-by tags. We don't always manage to review everything, but it is nicer if we can get review, especially for patches from new submaintainers.

The patch did receive several questions/comments and all of them were addressed, but indeed no RB tag was given. Since the patch was in the mailing list for over a month and *was* reviewed, I thought is enough.
I will ping Eduardo, he had the latest comments for it.

Quoted 3 lines

(5) This is an absolutely enormous diffstat for a single commit:

 26 files changed, 5149 insertions(+), 4 deletions(-)

On the github where the project was developed we have thousands of commits, so it can't be used.
It was reviewed closely by one reviewer and got a lot
of comments from others.
That being said, we will try to split it in a few patches
and send a new version.

Thanks for the comments,
Marcel

Quoted 3 lines

thanks
-- PMM

#15 lore raw
In reply to Peter Maydell
Quoted 48 lines · Peter Maydell
Quoted 15 lines · Marcel Apfelbaum

The following changes since commit f24ee107a07f093bd7ed475dd48d7ba57ea3d8fe:

Merge remote-tracking branch 'remotes/kraxel/tags/ui-20180202-pull-request' into staging (2018-02-02 18:54:11 +0000)

are available in the git repository at:

https://github.com/marcel-apf/qemu tags/rdma-pull-request

for you to fetch changes up to f172ba1b02724fb66dabd69cd553cfa625b413e5:

MAINTAINERS: add entry for hw/rdma (2018-02-05 11:53:00 +0200)

----------------------------------------------------------------
PVRDMA implementation

Quoted 8 lines

----------------------------------------------------------------
Marcel Apfelbaum (3):
mem: add share parameter to memory-backend-ram
docs: add pvrdma device documentation.
MAINTAINERS: add entry for hw/rdma

Yuval Shaia (1):
pvrdma: initial implementation

Hi. The technical details of this pullreq are all fine (pgp key, format, etc), and it passes my build tests. But I gave this pullreq a bit of a closer inspection than I normally would, since it's your first, and there are a few things I thought worth bringing up:

(1) I notice that some of the new files in this pullreq are licensed as "GPL, version 2", rather than "version 2 or any later version". Did you really mean that? Per 'LICENSE', we have a strong preference for 2-or-later for new code.

(2) Some new files have no copyright or license comment at the top of them. Can you fix that, please?

(3) Some of the new headers use kernel-internals __u32 etc types. This isn't portable. ('HACKING' has some suggestions for types you might want instead.)

(4) One of your patches doesn't have any reviewed-by tags. We don't always manage to review everything, but it is nicer if we can get review, especially for patches from new submaintainers.

Quoted 5 lines

(5) This is an absolutely enormous diffstat for a single commit:

 26 files changed, 5149 insertions(+), 4 deletions(-)

thanks
-- PMM

And one of the reasons is that it pulls in some unneeded stuff. E.g. vmw_pvrdma-abi.h should be pulled into standard-headers from Linux, rather than copy-pasted.

Signature · 1 line
MST
#9 lore raw
In reply to Marcel Apfelbaum
Quoted 8 lines · Marcel Apfelbaum

Hi Peter,

Quoted 4 lines · Peter Maydell

(3) Some of the new headers use kernel-internals __u32 etc types. This isn't portable. ('HACKING' has some suggestions for types you might want instead.)

Quoted 5 lines

We do not "use" the __u32 types, we just copied a kernel file for structures used for communication between the guest driver and the QEMU code. We had a look on how it is done and we use the model that adds macros __u32 -> uint32_t, so the "__types" do not really create such problems.

If we're using kernel header files, I would recommend using the scripts/update-headers machinery for this, the way we do for other kernel headers. Among other things, the cp_portable function in that script will fix up the type names for you.

thanks
-- PMM

#11 lore raw
In reply to Marcel Apfelbaum
Quoted 5 lines · Marcel Apfelbaum

We do not "use" the __u32 types, we just copied a kernel file for structures used for communication between the guest driver and the QEMU code. We had a look on how it is done and we use the model that adds macros __u32 -> uint32_t, so the "__types" do not really create such problems.

I don't think this is done like this anywhere in code. Please take a look at how it's done for e.g. input.h

I think that whenever a rule in HACKING, coding style, etc is ignored it should be accompanied by motivation in code comments, so this won't spread out any more.

Signature · 1 line
MST
#13 lore raw
In reply to Marcel Apfelbaum

Hi Marcel,

Quoted 55 lines · Marcel Apfelbaum
Quoted 8 lines · Peter Maydell
Quoted 1 line · Marcel Apfelbaum

The following changes since commit f24ee107a07f093bd7ed475dd48d7ba57ea3d8fe:

Hi. The technical details of this pullreq are all fine (pgp key, format, etc), and it passes my build tests. But I gave this pullreq a bit of a closer inspection than I normally would, since it's your first, and there are a few things I thought worth bringing up:

Thanks for doing it!

Quoted 6 lines

(1) I notice that some of the new files in this pullreq are licensed as "GPL, version 2", rather than "version 2 or any later version". Did you really mean that? Per 'LICENSE', we have a strong preference for 2-or-later for new code.

No real preference, I will modify the license.

Quoted 3 lines

(2) Some new files have no copyright or license comment at the top of them. Can you fix that, please?

Sure.

Quoted 4 lines

(3) Some of the new headers use kernel-internals __u32 etc types. This isn't portable. ('HACKING' has some suggestions for types you might want instead.)

We do not "use" the __u32 types, we just copied a kernel file for structures used for communication between the guest driver and the QEMU code. We had a look on how it is done and we use the model that adds macros __u32 -> uint32_t, so the "__types" do not really create such problems.

Quoted 5 lines

(4) One of your patches doesn't have any reviewed-by tags. We don't always manage to review everything, but it is nicer if we can get review, especially for patches from new submaintainers.

The patch did receive several questions/comments and all of them were addressed, but indeed no RB tag was given. Since the patch was in the mailing list for over a month and *was* reviewed, I thought is enough.
I will ping Eduardo, he had the latest comments for it.

Quoted 3 lines

(5) This is an absolutely enormous diffstat for a single commit:

 26 files changed, 5149 insertions(+), 4 deletions(-)
Quoted 6 lines

On the github where the project was developed we have thousands of commits, so it can't be used.
It was reviewed closely by one reviewer and got a lot
of comments from others.
That being said, we will try to split it in a few patches
and send a new version.

I spent some time to review this but got lost when it became too specific (this is not really my area).
I was hoping some of the VMware folks could review this.

KVM related stuffs are hard to test, but we have some qtests (migration mostly). Adding some tests for this huge code addition would be really great.

Regards,

Phil.

#10 lore raw
In reply to Peter Maydell
Quoted 15 lines · Peter Maydell
Quoted 8 lines · Marcel Apfelbaum

Hi Peter,

Quoted 4 lines · Peter Maydell

(3) Some of the new headers use kernel-internals __u32 etc types. This isn't portable. ('HACKING' has some suggestions for types you might want instead.)

Quoted 5 lines

We do not "use" the __u32 types, we just copied a kernel file for structures used for communication between the guest driver and the QEMU code. We had a look on how it is done and we use the model that adds macros __u32 -> uint32_t, so the "__types" do not really create such problems.

Quoted 5 lines

If we're using kernel header files, I would recommend using the scripts/update-headers machinery for this, the way we do for other kernel headers. Among other things, the cp_portable function in that script will fix up the type names for you.

I will use the mechanism.
Thanks,
Marcel

Quoted 3 lines

thanks
-- PMM

#12 lore raw
In reply to Michael S. Tsirkin
Quoted 8 lines · Michael S. Tsirkin
Quoted 5 lines · Marcel Apfelbaum

We do not "use" the __u32 types, we just copied a kernel file for structures used for communication between the guest driver and the QEMU code. We had a look on how it is done and we use the model that adds macros __u32 -> uint32_t, so the "__types" do not really create such problems.

I don't think this is done like this anywhere in code.

It is used in vmxnet.

Quoted 2 lines

Please take a look at how it's done for e.g. input.h

I will use it as reference.

Quoted 4 lines

I think that whenever a rule in HACKING, coding style, etc is ignored it should be accompanied by motivation in code comments, so this won't spread out any more.

Agreed, I will update the code accordingly.
Thanks,
Marcel

#14 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 65 lines · Philippe Mathieu-Daudé

Hi Marcel,

Quoted 55 lines · Marcel Apfelbaum
Quoted 8 lines · Peter Maydell
Quoted 1 line · Marcel Apfelbaum

The following changes since commit f24ee107a07f093bd7ed475dd48d7ba57ea3d8fe:

Hi. The technical details of this pullreq are all fine (pgp key, format, etc), and it passes my build tests. But I gave this pullreq a bit of a closer inspection than I normally would, since it's your first, and there are a few things I thought worth bringing up:

Thanks for doing it!

Quoted 6 lines

(1) I notice that some of the new files in this pullreq are licensed as "GPL, version 2", rather than "version 2 or any later version". Did you really mean that? Per 'LICENSE', we have a strong preference for 2-or-later for new code.

No real preference, I will modify the license.

Quoted 3 lines

(2) Some new files have no copyright or license comment at the top of them. Can you fix that, please?

Sure.

Quoted 4 lines

(3) Some of the new headers use kernel-internals __u32 etc types. This isn't portable. ('HACKING' has some suggestions for types you might want instead.)

We do not "use" the __u32 types, we just copied a kernel file for structures used for communication between the guest driver and the QEMU code. We had a look on how it is done and we use the model that adds macros __u32 -> uint32_t, so the "__types" do not really create such problems.

Quoted 5 lines

(4) One of your patches doesn't have any reviewed-by tags. We don't always manage to review everything, but it is nicer if we can get review, especially for patches from new submaintainers.

The patch did receive several questions/comments and all of them were addressed, but indeed no RB tag was given. Since the patch was in the mailing list for over a month and *was* reviewed, I thought is enough.
I will ping Eduardo, he had the latest comments for it.

Quoted 3 lines

(5) This is an absolutely enormous diffstat for a single commit:

 26 files changed, 5149 insertions(+), 4 deletions(-)
Quoted 6 lines

On the github where the project was developed we have thousands of commits, so it can't be used.
It was reviewed closely by one reviewer and got a lot
of comments from others.
That being said, we will try to split it in a few patches
and send a new version.

Quoted 4 lines

I spent some time to review this but got lost when it became too specific (this is not really my area).
I was hoping some of the VMware folks could review this.

The code was reviewed by someone from Mellanox and
we have an RDMA developer from Oracle looking into it to. For V10 we will have a second RB for the device, it should be enough.

Quoted 4 lines

KVM related stuffs are hard to test, but we have some qtests (migration mostly). Adding some tests for this huge code addition would be really great.

It is in our plans, yes.
We saw the avocado guys are returning to QEMU, I will ask their help in setting up an avocado test. It should take some time and we are developing the device over an year offline making it had to maintain/review, so
we will work on the tests in parallel with the device submission.

Thanks,
Marcel

Quoted 4 lines

Regards,

Phil.