Debian Codegraph @

libibverbs/man/ibv_advise_mr.3.md

raw symbols SCIP
1 ---
2 date: 2018-10-19
3 footer: libibverbs
4 header: "Libibverbs Programmer's Manual"
5 layout: page
6 license: 'Licensed under the OpenIB.org BSD license (FreeBSD Variant) - See COPYING.md'
7 section: 3
8 title: IBV_ADVISE_MR
9 ---
10
11 # NAME
12
13 ibv_advise_mr - Gives advice or directions to the kernel about an
14 address range belongs to a memory region (MR).
15
16 # SYNOPSIS
17
18 ```c
19 #include <infiniband/verbs.h>
20
21 int ibv_advise_mr(struct ibv_pd *pd,
22 enum ibv_advise_mr_advice advice,
23 uint32_t flags,
24 struct ibv_sge *sg_list,
25 uint32_t num_sge)
26 ```
27
28 # DESCRIPTION
29
30 **ibv_advise_mr()** Give advice or directions to the kernel about an
31 address range belonging to a memory region (MR).
32 Applications that are aware of future access patterns can use this verb
33 in order to leverage this knowledge to improve system or
34 application performance.
35
36 **Conventional advice values**
37
38 *IBV_ADVISE_MR_ADVICE_PREFETCH*
39 : Pre-fetch a range of an on-demand paging MR.
40 Make pages present with read-only permission before the actual IO is conducted.
41 This would provide a way to reduce latency by overlapping paging-in
42 and either compute time or IO to other ranges.
43
44 *IBV_ADVISE_MR_ADVICE_PREFETCH_WRITE*
45 : Like IBV_ADVISE_MR_ADVICE_PREFETCH but with read-access
46 and write-access permission to the fetched memory.
47
48 *IBV_ADVISE_MR_ADVICE_PREFETCH_NO_FAULT*
49 : Pre-fetch a range of an on-demand paging MR without faulting.
50 This allows presented pages in the CPU to become presented to the device.
51
52 # ARGUMENTS
53 *pd*
54 : The protection domain (PD) associated with the MR.
55
56 *advice*
57 : The requested advise value (as listed above).
58
59 *flags*
60 : Describes the properties of the advise operation
61 **Conventional advice values**
62 *IBV_ADVISE_MR_FLAG_FLUSH*
63 : Request to be a synchronized operation. Return to the caller
64 after the operation is completed.
65
66 *sg_list*
67 : Pointer to the s/g array
68 When using IBV_ADVISE_OP_PREFETCH advise value, all the lkeys of all
69 the scatter gather elements (SGEs) must be associated with ODP MRs
70 (MRs that were registered with IBV_ACCESS_ON_DEMAND).
71
72 *num_sge*
73 : Number of elements in the s/g array
74
75 # RETURN VALUE
76
77 **ibv_advise_mr()** returns 0 when the call was successful, or the value
78 of errno on failure (which indicates the failure reason).
79
80 *EOPNOTSUPP*
81 : libibverbs or provider driver doesn't support the ibv_advise_mr() verb
82 (ENOSYS may sometimes be returned by old versions of libibverbs).
83
84 *ENOTSUP*
85 : The advise operation isn't supported.
86
87 *EFAULT*
88 : In one of the following:
89 o When the range requested is out of the MR bounds, or when parts of
90 it are not part of the process address space.
91 o One of the lkeys provided in the scatter gather list is invalid or
92 with wrong write access.
93
94 *EINVAL*
95 : In one of the following:
96 o The PD is invalid.
97 o The flags are invalid.
98 o The requested address doesn't belong to a MR, but a MW or something.
99
100 *EPERM*
101 : In one of the following:
102 o Referencing a valid lkey outside the caller's security scope.
103 o The advice is IBV_ADVISE_MR_ADVICE_PREFETCH_WRITE but the specified
104 MR in the scatter gather list is not registered as writable access.
105
106 *ENOENT*
107 : The providing lkeys aren't consistent with the MR's.
108
109 *ENOMEM*
110 : Not enough memory.
111 # NOTES
112
113 An application may pre-fetch any address range within an ODP MR when using the
114 **IBV_ADVISE_MR_ADVICE_PREFETCH** or **IBV_ADVISE_MR_ADVICE_PREFETCH_WRITE** advice.
115 Semantically, this operation is best-effort. That means the kernel does not
116 guarantee that underlying pages are updated in the HCA or the pre-fetched pages
117 would remain resident.
118
119 When using **IBV_ADVISE_MR_ADVICE_PREFETCH** or **IBV_ADVISE_MR_ADVICE_PREFETCH_WRITE**
120 advice, the operation will be done in the following stages:
121 o Page in the user pages to memory (pages aren't pinned).
122 o Get the dma mapping of these user pages.
123 o Post the underlying page translations to the HCA.
124
125 If **IBV_ADVISE_MR_FLAG_FLUSH** is specified then the underlying pages are
126 guaranteed to be updated in the HCA before returning SUCCESS.
127 Otherwise the driver can choose to postpone the posting of the new translations
128 to the HCA.
129 When performing a local RDMA access operation it is recommended to use
130 IBV_ADVISE_MR_FLAG_FLUSH flag with one of the pre-fetch advices to
131 increase probability that the pages translations are valid in the HCA
132 and avoid future page faults.
133
134 # SEE ALSO
135
136 **ibv_reg_mr**(3),
137 **ibv_rereg_mr**(3),
138 **ibv_dereg_mr**(3)
139
140 # AUTHOR
141
142 Aviad Yehezkel <[email protected]>
143