← Documents Documentation/gpu/rfc/i915_small_bar.rst GitHub 원문 ↗

Linux 6.18.37 · GPU·DRM·RFC

I915 Small BAR RFC

DG2 small BAR의 CPU-visible memory placement·region info·error capture를 설명합니다.

Source pathDocumentation/gpu/rfc/i915_small_bar.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

요약·해설

i915_small_bar.rst:1-47

DG2 small BAR의 CPU-visible memory placement·region info·error capture를 설명합니다.

문서 위치
항목
SourceDocumentation/gpu/rfc/i915_small_bar.rst
분량47 source lines
관련I915_MEMORY_CLASS_DEVICE · VkMemoryHeap

Source와 관련 symbol입니다.

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

원문 전체 펼치기
1 ==========================
2 I915 Small BAR RFC Section
3 ==========================
4 Starting from DG2 we will have resizable BAR support for device local-memory(i.e
5 I915_MEMORY_CLASS_DEVICE), but in some cases the final BAR size might still be
6 smaller than the total probed_size. In such cases, only some subset of
7 I915_MEMORY_CLASS_DEVICE will be CPU accessible(for example the first 256M),
8 while the remainder is only accessible via the GPU.
9
10 I915_GEM_CREATE_EXT_FLAG_NEEDS_CPU_ACCESS flag
11 ----------------------------------------------
12 New gem_create_ext flag to tell the kernel that a BO will require CPU access.
13 This becomes important when placing an object in I915_MEMORY_CLASS_DEVICE, where
14 underneath the device has a small BAR, meaning only some portion of it is CPU
15 accessible. Without this flag the kernel will assume that CPU access is not
16 required, and prioritize using the non-CPU visible portion of
17 I915_MEMORY_CLASS_DEVICE.
18
19 .. kernel-doc:: Documentation/gpu/rfc/i915_small_bar.h
20 :functions: __drm_i915_gem_create_ext
21
22 probed_cpu_visible_size attribute
23 ---------------------------------
24 New struct__drm_i915_memory_region attribute which returns the total size of the
25 CPU accessible portion, for the particular region. This should only be
26 applicable for I915_MEMORY_CLASS_DEVICE. We also report the
27 unallocated_cpu_visible_size, alongside the unallocated_size.
28
29 Vulkan will need this as part of creating a separate VkMemoryHeap with the
30 VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT set, to represent the CPU visible portion,
31 where the total size of the heap needs to be known. It also wants to be able to
32 give a rough estimate of how memory can potentially be allocated.
33
34 .. kernel-doc:: Documentation/gpu/rfc/i915_small_bar.h
35 :functions: __drm_i915_memory_region_info
36
37 Error Capture restrictions
38 --------------------------
39 With error capture we have two new restrictions:
40
41 1) Error capture is best effort on small BAR systems; if the pages are not
42 CPU accessible, at the time of capture, then the kernel is free to skip
43 trying to capture them.
44
45 2) On discrete and newer integrated platforms we now reject error capture
46 on recoverable contexts. In the future the kernel may want to blit during
47 error capture, when for example something is not currently CPU accessible.
48

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

Small BAR와 CPU-access BO flag

1-21

DG2부터 device local memory인 `I915_MEMORY_CLASS_DEVICE`에 resizable BAR를 지원하지만 최종 BAR size가 전체 `probed_size`보다 작을 수 있습니다. 이 경우 예를 들어 처음 256M만 CPU가 접근하고 나머지는 GPU만 접근합니다.

새 `I915_GEM_CREATE_EXT_FLAG_NEEDS_CPU_ACCESS` gem_create_ext flag는 BO에 CPU access가 필요함을 kernel에 알립니다. Small BAR의 device-memory object placement에서 중요합니다.

Flag가 없으면 kernel은 CPU access가 필요 없다고 가정하고 `I915_MEMORY_CLASS_DEVICE`의 CPU-visible하지 않은 부분을 우선 사용합니다. uAPI kernel-doc은 `Documentation/gpu/rfc/i915_small_bar.h`의 `__drm_i915_gem_create_ext`를 포함합니다.

Small BAR memory
영역접근
CPU-visible BAR subsetCPU와 GPU
Remaining local memoryGPU only

Device region을 CPU visibility로 나눕니다.

NEEDS_CPU_ACCESS placement
gem_create_ext requestNEEDS_CPU_ACCESS flag 확인설정됨: CPU-visible device region 우선설정 안 됨: non-visible region 우선 가능

Flag가 allocation 후보를 제한합니다.

==========================
I915 Small BAR RFC Section
==========================
Starting from DG2 we will have resizable BAR support for device local-memory(i.e
I915_MEMORY_CLASS_DEVICE), but in some cases the final BAR size might still be
smaller than the total probed_size. In such cases, only some subset of
I915_MEMORY_CLASS_DEVICE will be CPU accessible(for example the first 256M),
while the remainder is only accessible via the GPU.

I915_GEM_CREATE_EXT_FLAG_NEEDS_CPU_ACCESS flag
----------------------------------------------
New gem_create_ext flag to tell the kernel that a BO will require CPU access.
This becomes important when placing an object in I915_MEMORY_CLASS_DEVICE, where
underneath the device has a small BAR, meaning only some portion of it is CPU
accessible. Without this flag the kernel will assume that CPU access is not
required, and prioritize using the non-CPU visible portion of
I915_MEMORY_CLASS_DEVICE.

.. kernel-doc:: Documentation/gpu/rfc/i915_small_bar.h
   :functions: __drm_i915_gem_create_ext

CPU-visible region size attribute

22-36

새 `struct__drm_i915_memory_region` attribute `probed_cpu_visible_size`는 특정 region에서 CPU가 접근 가능한 전체 크기를 반환합니다. `I915_MEMORY_CLASS_DEVICE`에만 적용해야 합니다.

전체 미할당 크기 `unallocated_size`와 함께 CPU-visible 미할당 크기 `unallocated_cpu_visible_size`도 보고합니다.

Vulkan은 CPU-visible 부분을 나타내는 `VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT`가 설정된 별도 `VkMemoryHeap`을 만들 때 전체 heap size가 필요합니다. 또한 앞으로 allocation할 수 있는 memory를 대략 추정하려 합니다.

관련 kernel-doc은 `i915_small_bar.h`의 `__drm_i915_memory_region_info`입니다.

Memory-region attribute
Attribute의미
probed_size전체 탐지 local-memory 크기
probed_cpu_visible_sizeCPU-accessible 전체 크기
unallocated_size전체 미할당 크기
unallocated_cpu_visible_sizeCPU-visible 미할당 크기

전체 device memory와 visible subset을 구분합니다.

Vulkan heap 표현
Region info queryprobed_cpu_visible_size 확인HOST_VISIBLE_BIT VkMemoryHeap 생성unallocated_cpu_visible_size로 allocation 가능량 추정

Visible subset을 별도 heap으로 노출합니다.

probed_cpu_visible_size attribute
---------------------------------
New struct__drm_i915_memory_region attribute which returns the total size of the
CPU accessible portion, for the particular region. This should only be
applicable for I915_MEMORY_CLASS_DEVICE. We also report the
unallocated_cpu_visible_size, alongside the unallocated_size.

Vulkan will need this as part of creating a separate VkMemoryHeap with the
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT set, to represent the CPU visible portion,
where the total size of the heap needs to be known. It also wants to be able to
give a rough estimate of how memory can potentially be allocated.

.. kernel-doc:: Documentation/gpu/rfc/i915_small_bar.h
   :functions: __drm_i915_memory_region_info

Error capture 제한

37-47

Small BAR system의 error capture는 best effort입니다. Capture 시점에 page가 CPU-accessible하지 않으면 kernel은 해당 page capture를 생략할 수 있습니다.

Discrete와 더 최신 integrated platform에서는 recoverable context의 error capture를 거부합니다.

미래에는 현재 CPU가 접근할 수 없는 data를 capture하기 위해 kernel이 error capture 중 blit을 사용할 수 있습니다.

Error capture 정책
조건동작
Page CPU-visible직접 capture 가능
Page non-visibleBest effort, 생략 가능
Recoverable contextDiscrete·new integrated에서 거부
FutureBlit으로 non-visible data 이동 가능

CPU visibility와 context 복구성에 따른 제한입니다.

Small BAR capture 판단
Context가 recoverable인지 확인거부 대상이면 error capture 중단Page CPU visibility 확인Visible page capture, non-visible page는 선택적으로 skip

Capture 가능 여부를 visibility와 context로 결정합니다.

Error Capture restrictions
--------------------------
With error capture we have two new restrictions:

    1) Error capture is best effort on small BAR systems; if the pages are not
    CPU accessible, at the time of capture, then the kernel is free to skip
    trying to capture them.

    2) On discrete and newer integrated platforms we now reject error capture
    on recoverable contexts. In the future the kernel may want to blit during
    error capture, when for example something is not currently CPU accessible.