.\" Automatically generated by Pandoc 3.1.3 .\" .\" Define V font for inline verbatim, using C font in formats .\" that render this, and otherwise B font. .ie "\f[CB]x\f[]"x" \{\ . ftr V B . ftr VI BI . ftr VB B . ftr VBI BI .\} .el \{\ . ftr V CR . ftr VI CI . ftr VB CB . ftr VBI CBI .\} .TH "IBV_ADVISE_MR" "3" "2018-10-19" "libibverbs" "Libibverbs Programmer\[cq]s Manual" .hy .SH NAME .PP ibv_advise_mr - Gives advice or directions to the kernel about an address range belongs to a memory region (MR). .SH SYNOPSIS .IP .nf \f[C] #include int ibv_advise_mr(struct ibv_pd *pd, enum ibv_advise_mr_advice advice, uint32_t flags, struct ibv_sge *sg_list, uint32_t num_sge) \f[R] .fi .SH DESCRIPTION .PP \f[B]ibv_advise_mr()\f[R] Give advice or directions to the kernel about an address range belonging to a memory region (MR). Applications that are aware of future access patterns can use this verb in order to leverage this knowledge to improve system or application performance. .PP \f[B]Conventional advice values\f[R] .TP \f[I]IBV_ADVISE_MR_ADVICE_PREFETCH\f[R] Pre-fetch a range of an on-demand paging MR. Make pages present with read-only permission before the actual IO is conducted. This would provide a way to reduce latency by overlapping paging-in and either compute time or IO to other ranges. .TP \f[I]IBV_ADVISE_MR_ADVICE_PREFETCH_WRITE\f[R] Like IBV_ADVISE_MR_ADVICE_PREFETCH but with read-access and write-access permission to the fetched memory. .TP \f[I]IBV_ADVISE_MR_ADVICE_PREFETCH_NO_FAULT\f[R] Pre-fetch a range of an on-demand paging MR without faulting. This allows presented pages in the CPU to become presented to the device. .SH ARGUMENTS .TP \f[I]pd\f[R] The protection domain (PD) associated with the MR. .TP \f[I]advice\f[R] The requested advise value (as listed above). .TP \f[I]flags\f[R] Describes the properties of the advise operation \f[B]Conventional advice values\f[R] \f[I]IBV_ADVISE_MR_FLAG_FLUSH\f[R] : Request to be a synchronized operation. Return to the caller after the operation is completed. .TP \f[I]sg_list\f[R] Pointer to the s/g array When using IBV_ADVISE_OP_PREFETCH advise value, all the lkeys of all the scatter gather elements (SGEs) must be associated with ODP MRs (MRs that were registered with IBV_ACCESS_ON_DEMAND). .TP \f[I]num_sge\f[R] Number of elements in the s/g array .SH RETURN VALUE .PP \f[B]ibv_advise_mr()\f[R] returns 0 when the call was successful, or the value of errno on failure (which indicates the failure reason). .TP \f[I]EOPNOTSUPP\f[R] libibverbs or provider driver doesn\[cq]t support the ibv_advise_mr() verb (ENOSYS may sometimes be returned by old versions of libibverbs). .TP \f[I]ENOTSUP\f[R] The advise operation isn\[cq]t supported. .TP \f[I]EFAULT\f[R] In one of the following: o When the range requested is out of the MR bounds, or when parts of it are not part of the process address space. o One of the lkeys provided in the scatter gather list is invalid or with wrong write access. .TP \f[I]EINVAL\f[R] In one of the following: o The PD is invalid. o The flags are invalid. o The requested address doesn\[cq]t belong to a MR, but a MW or something. .TP \f[I]EPERM\f[R] In one of the following: o Referencing a valid lkey outside the caller\[cq]s security scope. o The advice is IBV_ADVISE_MR_ADVICE_PREFETCH_WRITE but the specified MR in the scatter gather list is not registered as writable access. .TP \f[I]ENOENT\f[R] The providing lkeys aren\[cq]t consistent with the MR\[cq]s. .TP \f[I]ENOMEM\f[R] Not enough memory. # NOTES .PP An application may pre-fetch any address range within an ODP MR when using the \f[B]IBV_ADVISE_MR_ADVICE_PREFETCH\f[R] or \f[B]IBV_ADVISE_MR_ADVICE_PREFETCH_WRITE\f[R] advice. Semantically, this operation is best-effort. That means the kernel does not guarantee that underlying pages are updated in the HCA or the pre-fetched pages would remain resident. .PP When using \f[B]IBV_ADVISE_MR_ADVICE_PREFETCH\f[R] or \f[B]IBV_ADVISE_MR_ADVICE_PREFETCH_WRITE\f[R] advice, the operation will be done in the following stages: o Page in the user pages to memory (pages aren\[cq]t pinned). o Get the dma mapping of these user pages. o Post the underlying page translations to the HCA. .PP If \f[B]IBV_ADVISE_MR_FLAG_FLUSH\f[R] is specified then the underlying pages are guaranteed to be updated in the HCA before returning SUCCESS. Otherwise the driver can choose to postpone the posting of the new translations to the HCA. When performing a local RDMA access operation it is recommended to use IBV_ADVISE_MR_FLAG_FLUSH flag with one of the pre-fetch advices to increase probability that the pages translations are valid in the HCA and avoid future page faults. .SH SEE ALSO .PP \f[B]ibv_reg_mr\f[R](3), \f[B]ibv_rereg_mr\f[R](3), \f[B]ibv_dereg_mr\f[R](3) .SH AUTHOR .PP Aviad Yehezkel