RDMA queue
The following changes since commit 412fbef3d076c43e56451bacb28c4544858c66a3:
Merge remote-tracking branch 'remotes/philmd-gitlab/tags/fw_cfg-next-pull-request' into staging (2019-11-05 20:17: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 68b89aee710ab48b3dcaaa721bbc5d8aa5ea24d1:
hw/rdma: Utilize ibv_reg_mr_iova for memory registration (2019-11-06 12:49:04 +0200)
----------------------------------------------------------------
RDMA queue
* better memory registration performance
----------------------------------------------------------------
Yuval Shaia (2):
configure: Check if we can use ibv_reg_mr_iova hw/rdma: Utilize ibv_reg_mr_iova for memory registration
configure | 28 ++++++++++++++++++++++++++++ hw/rdma/rdma_backend.c | 13 +++++++++++++ hw/rdma/rdma_backend.h | 5 +++++ hw/rdma/rdma_rm.c | 5 +++++ hw/rdma/vmw/pvrdma_main.c | 6 ++++++ 5 files changed, 57 insertions(+)
Signature · 1 line
2.17.2
[Qemu-devel] [PATCH PULL 1/2] configure: Check if we can use ibv_reg_mr_iova
From: Yuval Shaia <[email protected]>
The function reg_mr_iova is an enhanced version of ibv_reg_mr function that can help to easly register and use guest's MRs.
Add check in 'configure' phase to detect if we have libibverbs with this support.
Message-Id: <[email protected]>
--- configure | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
configure +28 -0
@@ -3217,6 +3217,34 @@ else pvrdma="no" fi +# Let's see if enhanced reg_mr is supported +if test "$pvrdma" = "yes" ; then + +cat > $TMPC <<EOF && +#include <infiniband/verbs.h> + +int +main(void) +{ + struct ibv_mr *mr; + struct ibv_pd *pd = NULL; + size_t length = 10; + uint64_t iova = 0; + int access = 0; + void *addr = NULL; + + mr = ibv_reg_mr_iova(pd, addr, length, iova, access); + + ibv_dereg_mr(mr); + + return 0; +} +EOF + if ! compile_prog "" "-libverbs"; then + QEMU_CFLAGS="$QEMU_CFLAGS -DLEGACY_RDMA_REG_MR" + fi +fi + ########################################## # VNC SASL detection if test "$vnc" = "yes" && test "$vnc_sasl" != "no" ; then
Signature · 1 line
2.17.2
[Qemu-devel] [PATCH PULL 2/2] hw/rdma: Utilize ibv_reg_mr_iova for memory registration
In reply to Marcel ApfelbaumFrom: Yuval Shaia <[email protected]>
The virtual address that is provided by the guest in post_send and post_recv operations is related to the guest address space. This address space is unknown to the HCA resides on host so extra step in these operations is needed to adjust the address to host virtual address.
This step, which is done in data-path affects performances.
An enhanced verion of MR registration introduced here
https://patchwork.kernel.org/patch/11044467/ can be used so that the guest virtual address space for this MR is known to the HCA in host.
This will save the data-path adjustment.
Message-Id: <[email protected]>
--- hw/rdma/rdma_backend.c | 13 +++++++++++++ hw/rdma/rdma_backend.h | 5 +++++ hw/rdma/rdma_rm.c | 5 +++++ hw/rdma/vmw/pvrdma_main.c | 6 ++++++ 4 files changed, 29 insertions(+)
hw/rdma/rdma_backend.c +13 -0
@@ -391,7 +391,11 @@ static int build_host_sge_array(RdmaDeviceResources *rdma_dev_res,return VENDOR_ERR_INVLKEY | ssge[ssge_idx].lkey; } +#ifdef LEGACY_RDMA_REG_MR dsge->addr = (uintptr_t )mr->virt + ssge[ssge_idx].addr - mr->start; +#else + dsge->addr = ssge[ssge_idx].addr; +#endif dsge->length = ssge[ssge_idx].length; dsge->lkey =rdma_backend_mr_lkey (&mr->backend_mr);
@@ -735,10 +739,19 @@ void rdma_backend_destroy_pd(RdmaBackendPD *pd) } } +#ifdef LEGACY_RDMA_REG_MR int rdma_backend_create_mr (RdmaBackendMR *mr,RdmaBackendPD *pd,void *addr, size_t length, int access) +#else +int rdma_backend_create_mr (RdmaBackendMR *mr,RdmaBackendPD *pd,void *addr, + size_t length, uint64_t guest_start, int access) +#endif { +#ifdef LEGACY_RDMA_REG_MR mr->ibmr =ibv_reg_mr (pd->ibpd, addr, length, access); +#else + mr->ibmr =ibv_reg_mr_iova (pd->ibpd, addr, length, guest_start, access); +#endif if (!mr->ibmr) {rdma_error_report ("ibv_reg_mr fail, errno=%d" , errno);return -EIO ;
hw/rdma/rdma_backend.h +5 -0
@@ -78,8 +78,13 @@ int rdma_backend_query_port(RdmaBackendDev *backend_dev,int rdma_backend_create_pd (RdmaBackendDev *backend_dev,RdmaBackendPD *pd);void rdma_backend_destroy_pd (RdmaBackendPD *pd); +#ifdef LEGACY_RDMA_REG_MR int rdma_backend_create_mr (RdmaBackendMR *mr,RdmaBackendPD *pd,void *addr,size_t length,int access); +#else +int rdma_backend_create_mr (RdmaBackendMR *mr,RdmaBackendPD *pd,void *addr, +size_t length,uint64_t guest_start,int access); +#endif void rdma_backend_destroy_mr (RdmaBackendMR *mr); int rdma_backend_create_cq(RdmaBackendDev *backend_dev, RdmaBackendCQ *cq,
hw/rdma/rdma_rm.c +5 -0
@@ -227,8 +227,13 @@ int rdma_rm_alloc_mr(RdmaDeviceResources *dev_res, uint32_t pd_handle, mr->length = guest_length; mr->virt += (mr->start & (TARGET_PAGE_SIZE -1 )); +#ifdef LEGACY_RDMA_REG_MR ret =rdma_backend_create_mr (&mr->backend_mr, &pd->backend_pd, mr->virt, mr->length, access_flags); +#else + ret =rdma_backend_create_mr (&mr->backend_mr, &pd->backend_pd, mr->virt, + mr->length, guest_start, access_flags); +#endif if (ret) { ret = -EIO ; goto out_dealloc_mr;
hw/rdma/vmw/pvrdma_main.c +6 -0
@@ -664,6 +664,12 @@ static void pvrdma_realize(PCIDevice *pdev, Error **errp) dev->shutdown_notifier.notify = pvrdma_shutdown_notifier;qemu_register_shutdown_notifier (&dev->shutdown_notifier); +#ifdef LEGACY_RDMA_REG_MR +rdma_info_report ("Using legacy reg_mr" ); +#else +rdma_info_report ("Using iova reg_mr" ); +#endif + out:if (rc) {pvrdma_fini (pdev);
Signature · 1 line
2.17.2
Peter Maydell
AppliedQuoted 11 lines · Marcel Apfelbaum
The following changes since commit
412fbef3d076c43e56451bacb28c4544858c66a3:Merge remote-tracking branch 'remotes/philmd-gitlab/tags/fw_cfg-next-pull-request' into staging (2019-11-05 20:17: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
68b89aee710ab48b3dcaaa721bbc5d8aa5ea24d1:
Quoted 8 lines
hw/rdma: Utilize
ibv_reg_mr_iovafor memory registration (2019-11-06 12:49:04 +0200)----------------------------------------------------------------
RDMA queue* better memory registration performance
----------------------------------------------------------------
Applied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/4.2
for any user-visible changes.
-- PMM