Commit 109046f
committed
Preliminary support for NVIDIA Jetson boards
NVIDIA Jetson device is an insdustrial Linux based embedded aarch64
platfrom with powerful builtin GPU, which is used for AI tasks,
mostly for CV purposes.
The support is provided via --enable-nvidia-jetson switch in the
configure script.
All the source code related to the NVIDIA Jetson is placed in the
linux/NvidiaJetson.{h,c} source files and hidden by 'NVIDIA_JETSON'
C preprocessor define. So, for x86_64 platforms the
source code stays unchanged.
Additional functionality added by this commit:
1. Fix for the CPU temperature reading. The Jetson device is not
supported by libsensors. The CPU has 8 cores with only one CPU
temperature sensor for all of them located in the thermal zone file.
libsensor might be compiled in or turned off. The additional care was
taken to provide successfull build with/without libsensors.
2. The Jetson GPU Meter was added: current load, frequency and
temperature.
3. The exact GPU memory allocated by each process is loaded from the
nvgpu kernel driver via sysfs and merged to the LinuxProcess data
(field LinuxProcess::gpu_mem). The field "GPU_MEM" visualizes this
field. For root user only.
4. Additional filter for processes which use GPU right now via hot
key 'g', the help is supplied. For root user only.
== Technical details ==
The code tries to find out the correct sensors during the application
startup. As an example, the sensors location for NVIDIA Jetson Orin
are the following:
- CPU temperature: /sys/devices/virtual/thermal/thermal_zone0/type
- GPU temperature: /sys/devices/virtual/thermal/thermal_zone1/type
- GPU frequency: /sys/class/devfreq/17000000.gpu/cur_freq
- GPU curr load: /sys/class/devfreq/17000000.gpu/device/load
Measure:
- The GPU frequency is provided in Hz, shown in MHz.
- The CPU/GPU temperatures are provided in Celsius multipled by 1000
(milli Celsius), shown in Cesius
P.S. The GUI shows all temperatures for NVIDIA Jetson with additional
precision comparing to the default x86_64 platform.
If htop starts with root privileges (effective user id is 0), the
experimental code activates. It reads the fixed sysfs file
/sys/kernel/debug/nvmap/iovmm/clients with the following content, e.g.:
```
CLIENT PROCESS PID SIZE
user gpu_burn 7979 23525644K
user gnome_shell 8119 5800K
user Xorg 2651 17876K
total 23549320K
```
Unfortunately, the /sys/kernel/debug/* files are allowed to read only for
the root user, that's why the restriction applies.
The patch also adds a separate field 'GPU_MEM', which reads data from
the added LinuxProcess::gpu_mem field. The field stores memory allocated for GPU
in kilobytes. It is populated by the function NvidiaJetson_LoadGpuProcessTable
(the implementation is located in NvidiaJetson.c), which is called at the end of
the function Machine_scanTables.
Additionally, the new Action is added: actionToggleGpuFilter, which is activated by
'g' hot key (the help is updated appropriately). The GpuFilter shows only the
processes which currently utilize GPU (i.e. highly extended nvmap/iovmm/clients table).
It is achieved by the filtering machinery associated with ProcessTable::pidMatchList.
The code below constructs GPU_PID_MATCH_LIST hash table, then actionToggleGpuFilter
either stores it to the ProcessTable::pidMatchList or restores old value of
ProcessTable::pidMatchList.
The separate LinuxProcess's PROCESS_FLAG_LINUX_GPU_JETSON (or something ...) flag isn't
added for GPU_MEM, because currently the functionality of population LinuxProcess::gpu_mem
is shared with the GPU consumers filter construction.
So, even if GPU_MEM field is not activated, the filter showing GPU consumers should work.
This kind of architecture is chosen intentially since it saves memory for the hash table
GPU_PID_MATCH_LIST (which is now actually a set), and therefore increases performance.
All other approaches convert GPU_PID_MATCH_LIST to a true key/value storage (key = pid,
value = gpu memory allocated) with further merge code.
== NVIDIA Jetson models ==
Tested for NVIDIA Jetson Orin and Xavier boards.1 parent 45d9a1d commit 109046f
19 files changed
+500
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
646 | 646 | | |
647 | 647 | | |
648 | 648 | | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
649 | 672 | | |
650 | 673 | | |
651 | 674 | | |
| |||
658 | 681 | | |
659 | 682 | | |
660 | 683 | | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
661 | 687 | | |
662 | 688 | | |
663 | 689 | | |
| |||
933 | 959 | | |
934 | 960 | | |
935 | 961 | | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
936 | 965 | | |
937 | 966 | | |
938 | 967 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
42 | 45 | | |
43 | 46 | | |
44 | 47 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
101 | 113 | | |
102 | 114 | | |
103 | 115 | | |
104 | 116 | | |
105 | 117 | | |
106 | 118 | | |
107 | | - | |
| 119 | + | |
108 | 120 | | |
109 | 121 | | |
110 | 122 | | |
111 | 123 | | |
| 124 | + | |
112 | 125 | | |
113 | 126 | | |
114 | 127 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
231 | 231 | | |
232 | 232 | | |
233 | 233 | | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
234 | 237 | | |
235 | 238 | | |
236 | 239 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
161 | 164 | | |
162 | 165 | | |
163 | 166 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
176 | | - | |
177 | | - | |
178 | | - | |
| 176 | + | |
179 | 177 | | |
| 178 | + | |
| 179 | + | |
180 | 180 | | |
181 | 181 | | |
182 | 182 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
128 | 129 | | |
129 | 130 | | |
130 | 131 | | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
131 | 136 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
195 | 195 | | |
196 | 196 | | |
197 | 197 | | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
198 | 203 | | |
199 | 204 | | |
200 | 205 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
215 | 215 | | |
216 | 216 | | |
217 | 217 | | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
218 | 223 | | |
219 | 224 | | |
220 | 225 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
126 | 133 | | |
127 | 134 | | |
128 | 135 | | |
| |||
178 | 185 | | |
179 | 186 | | |
180 | 187 | | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
181 | 193 | | |
0 commit comments