IBV_ADVISE_MR(3)
π
IBV_ADVISE_MR(3) π
okay bestie, welcome to the Libibverbs Programmerβs Manual page for ibv_advise_mr β this is the one where you give the kernel advice/directions about an address range that belongs to a memory region (MR). β¨
πΈ NAME πΈ
ibv_advise_mr β gives advice or directions to the kernel about an address range that belongs to a memory region (MR). π
π¦ SYNOPSIS π¦
#include <infiniband/verbs.h>
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)
β¨ DESCRIPTION β¨
ibv_advise_mr() gives 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. no cap, itβs giving βlet me help the kernel help meβ energy π
π Conventional advice values π
IBV_ADVISE_MR_ADVICE_PREFETCHβ 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. β¨IBV_ADVISE_MR_ADVICE_PREFETCH_WRITEβ likeIBV_ADVISE_MR_ADVICE_PREFETCHbut with read-access and write-access permission to the fetched memory. πIBV_ADVISE_MR_ADVICE_PREFETCH_NO_FAULTβ 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. π¦
π ARGUMENTS π
pdβ the protection domain (PD) associated with the MR. π«Άadviceβ the requested advise value (as listed above). πflagsβ describes the properties of the advise operation. Conventional advice values:IBV_ADVISE_MR_FLAG_FLUSHβ request to be a synchronized operation. Return to the caller after the operation is completed. βsg_listβ pointer to the s/g array. When usingIBV_ADVISE_OP_PREFETCHadvise value, all the lkeys of all the scatter gather elements (SGEs) must be associated with ODP MRs (MRs that were registered withIBV_ACCESS_ON_DEMAND). π§num_sgeβ number of elements in the s/g array. π
π RETURN VALUE π
ibv_advise_mr() returns 0 when the call was successful, or the value of errno on failure (which indicates the failure reason). π
EOPNOTSUPPβ libibverbs or provider driver doesnβt support theibv_advise_mr()verb (ENOSYSmay sometimes be returned by old versions of libibverbs). πENOTSUPβ the advise operation isnβt supported. πEFAULTβ in one of the following:- when the range requested is out of the MR bounds, or when parts of it are not part of the process address space.
- one of the lkeys provided in the scatter gather list is invalid or with wrong write access. π₯
EINVALβ in one of the following:- the PD is invalid.
- the flags are invalid.
- the requested address doesnβt belong to a MR, but a MW or something. π
EPERMβ in one of the following:- referencing a valid lkey outside the callerβs security scope.
- the advice is
IBV_ADVISE_MR_ADVICE_PREFETCH_WRITEbut the specified MR in the scatter gather list is not registered as writable access. π
ENOENTβ the providing lkeys arenβt consistent with the MRβs. π«ΆENOMEMβ not enough memory. π
π NOTES π
An application may pre-fetch any address range within an ODP MR when using the IBV_ADVISE_MR_ADVICE_PREFETCH or IBV_ADVISE_MR_ADVICE_PREFETCH_WRITE 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. π§
When using IBV_ADVISE_MR_ADVICE_PREFETCH or IBV_ADVISE_MR_ADVICE_PREFETCH_WRITE advice, the operation will be done in the following stages:
- page in the user pages to memory (pages arenβt pinned).
- get the dma mapping of these user pages.
- post the underlying page translations to the HCA. π
If IBV_ADVISE_MR_FLAG_FLUSH 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. β
π SEE ALSO π
ibv_reg_mr(3), ibv_rereg_mr(3), ibv_dereg_mr(3) π
π AUTHOR π
Aviad Yehezkel <aviadye@mellanox.com> π«Ά
π source/version: libibverbs Β· date: 2018-10-19 β thatβs the whole page, bestie. periodt. π
π¦ where this page comes from
- alpine 3.24: rdma-core-doc 61.0-r0 Β· GPL-2.0-only OR BSD-2-Clause
- centos-stream 10: rdma-core-devel 62.0-3.el10 Β· GPLv2 or BSD
- centos-stream 9: rdma-core-devel 61.0-3.el9 Β· GPLv2 or BSD
- centos-stream 9: rdma-core-devel 61.0-3.el9 Β· GPLv2 or BSD
- ubuntu jammy: libibverbs-dev 39.0-1 Β· BSD-MIT OR GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms