mirror of https://gitee.com/openkylin/qemu.git
RDMA queue
* better memory registration performance -----BEGIN PGP SIGNATURE----- iQEcBAABAgAGBQJdwtq7AAoJEDbUwPDPL+RtjiAH/1yGEMPYZWeFQcHrE7URn5M+ gi9W0Y5GyM6q/fa3M9L8072iNPMYj61kbkW9i6oHe4sNNH87NwC7HImwqswroXF6 PP2cKyWtOLdvY9m7ZkLs3euldm8dD8Jf1WMcmeQ81Ybb4BOEHCX2u657fE1Anuki OxlPoJlTWFruJRryJrpubDkMSr5gJIZdLQZ2QH2whhvaANTKwuAewN7j9wbxfFLH OGEA8Ucowvq5GnELfQxCtUZ1JdUh2AMG+ATqDNiKZlNHzGcsaQLtXjXSkqnXU8cy /AjvNZjLE+YiGVLc8D5HRU5B4Yk+IW8oE04y0sHfpaz5ZzJJsIX5GNUCcUgabEk= =Axez -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/marcel/tags/rdma-pull-request' into staging RDMA queue * better memory registration performance # gpg: Signature made Wed 06 Nov 2019 14:37:47 GMT # gpg: using RSA key 36D4C0F0CF2FE46D # gpg: Good signature from "Marcel Apfelbaum <marcel.apfelbaum@zoho.com>" [marginal] # gpg: aka "Marcel Apfelbaum <marcel@redhat.com>" [marginal] # gpg: aka "Marcel Apfelbaum <marcel.apfelbaum@gmail.com>" [marginal] # gpg: WARNING: This key is not certified with sufficiently trusted signatures! # gpg: It is not certain that the signature belongs to the owner. # Primary key fingerprint: B1C6 3A57 F92E 08F2 640F 31F5 36D4 C0F0 CF2F E46D * remotes/marcel/tags/rdma-pull-request: hw/rdma: Utilize ibv_reg_mr_iova for memory registration configure: Check if we can use ibv_reg_mr_iova Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
763657b1fc
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue