Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Documentation/gpu: Clarify drm memory stats definition

Define how to handle buffers with multiple possible placement so we
don't get incompatible implementations. Callout the resident requirement
for drm-purgeable- explicitly. Remove the requirement for there to be
only drm-memory- or only drm-resident-, it's not what's implemented and
having both is better for back-compat. Also re-order the paragraphs to
flow better.

Signed-off-by: Yunxiang Li <Yunxiang.Li@amd.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20241219151411.1150-4-Yunxiang.Li@amd.com
Signed-off-by: Christian König <christian.koenig@amd.com>

authored by

Yunxiang Li and committed by
Christian König
e77d0401 bebf2ebd

+27 -27
+27 -27
Documentation/gpu/drm-usage-stats.rst
··· 145 145 Memory 146 146 ^^^^^^ 147 147 148 - - drm-memory-<region>: <uint> [KiB|MiB] 149 - 150 - Each possible memory type which can be used to store buffer objects by the 151 - GPU in question shall be given a stable and unique name to be returned as the 152 - string here. 148 + Each possible memory type which can be used to store buffer objects by the GPU 149 + in question shall be given a stable and unique name to be used as the "<region>" 150 + string. 153 151 154 152 The region name "memory" is reserved to refer to normal system memory. 155 153 156 - Value shall reflect the amount of storage currently consumed by the buffer 154 + The value shall reflect the amount of storage currently consumed by the buffer 157 155 objects belong to this client, in the respective memory region. 158 156 159 157 Default unit shall be bytes with optional unit specifiers of 'KiB' or 'MiB' 160 158 indicating kibi- or mebi-bytes. 161 159 162 - This key is deprecated and is an alias for drm-resident-<region>. Only one of 163 - the two should be present in the output. 160 + - drm-total-<region>: <uint> [KiB|MiB] 161 + 162 + The total size of all requested buffers, including both shared and private 163 + memory. The backing store for the buffers does not need to be currently 164 + instantiated to count under this category. To avoid double-counting, if a buffer 165 + has multiple regions where it can be allocated to, the implementation should 166 + consistently select a single region for accounting purposes. 164 167 165 168 - drm-shared-<region>: <uint> [KiB|MiB] 166 169 167 - The total size of buffers that are shared with another file (e.g., have more 168 - than a single handle). 169 - 170 - - drm-total-<region>: <uint> [KiB|MiB] 171 - 172 - The total size of all created buffers including shared and private memory. The 173 - backing store for the buffers does not have to be currently instantiated to be 174 - counted under this category. 170 + The total size of buffers that are shared with another file (i.e., have more 171 + than one handle). The same requirement to avoid double-counting that applies to 172 + drm-total-<region> also applies here. 175 173 176 174 - drm-resident-<region>: <uint> [KiB|MiB] 177 175 178 - The total size of buffers that are resident (have their backing store present or 179 - instantiated) in the specified region. 176 + The total size of buffers that are resident (i.e., have their backing store 177 + present or instantiated) in the specified region. 180 178 181 - This is an alias for drm-memory-<region> and only one of the two should be 182 - present in the output. 179 + - drm-memory-<region>: <uint> [KiB|MiB] 180 + 181 + This key is deprecated and is only printed by amdgpu; it is an alias for 182 + drm-resident-<region>. 183 183 184 184 - drm-purgeable-<region>: <uint> [KiB|MiB] 185 185 186 - The total size of buffers that are purgeable. 186 + The total size of buffers that are resident and purgeable. 187 187 188 - For example drivers which implement a form of 'madvise' like functionality can 189 - here count buffers which have instantiated backing store, but have been marked 190 - with an equivalent of MADV_DONTNEED. 188 + For example, drivers that implement functionality similar to 'madvise' can count 189 + buffers that have instantiated backing stores but have been marked with an 190 + equivalent of MADV_DONTNEED. 191 191 192 192 - drm-active-<region>: <uint> [KiB|MiB] 193 193 194 194 The total size of buffers that are active on one or more engines. 195 195 196 - One practical example of this can be presence of unsignaled fences in an GEM 197 - buffer reservation object. Therefore the active category is a subset of 198 - resident. 196 + One practical example of this could be the presence of unsignaled fences in a 197 + GEM buffer reservation object. Therefore, the active category is a subset of the 198 + resident category. 199 199 200 200 Implementation Details 201 201 ======================