Re: [PATCH v5 4/4] drm/amdgpu: track bo memory stats at runtime

2024-10-25 Thread Tvrtko Ursulin
On 23/10/2024 13:56, Christian König wrote: Am 23.10.24 um 14:24 schrieb Tvrtko Ursulin: [SNIP] To fold or not the special placements (GWS, GDS & co) is also tangential. In my patch I just preserved the legacy behaviour so it can easily be tweaked on top. Yeah, but again the original behav

Re: [PATCH v5 4/4] drm/amdgpu: track bo memory stats at runtime

2024-10-25 Thread Tvrtko Ursulin
On 23/10/2024 14:31, Li, Yunxiang (Teddy) wrote: [AMD Official Use Only - AMD Internal Distribution Only] From: Tvrtko Ursulin Sent: Wednesday, October 23, 2024 8:25 On 23/10/2024 13:12, Christian König wrote: Am 23.10.24 um 13:37 schrieb Tvrtko Ursulin: On 23/10/2024 10:14, Christian Kön

Re: [PATCH v5 4/4] drm/amdgpu: track bo memory stats at runtime

2024-10-23 Thread Tvrtko Ursulin
On 22/10/2024 17:24, Christian König wrote: Am 22.10.24 um 17:17 schrieb Li, Yunxiang (Teddy): [Public] +static uint32_t fold_memtype(uint32_t memtype) { In general please add prefixes to even static functions, e.g. amdgpu_vm_ or amdgpu_bo_. +   /* Squash private placements into 'cpu' to

Re: [PATCH v5 4/4] drm/amdgpu: track bo memory stats at runtime

2024-10-23 Thread Tvrtko Ursulin
On 23/10/2024 10:14, Christian König wrote: Am 23.10.24 um 09:38 schrieb Tvrtko Ursulin: On 22/10/2024 17:24, Christian König wrote: Am 22.10.24 um 17:17 schrieb Li, Yunxiang (Teddy): [Public] +static uint32_t fold_memtype(uint32_t memtype) { In general please add prefixes to even static

Re: [PATCH v5 4/4] drm/amdgpu: track bo memory stats at runtime

2024-10-23 Thread Tvrtko Ursulin
On 22/10/2024 18:06, Christian König wrote: Am 22.10.24 um 18:46 schrieb Li, Yunxiang (Teddy): [Public] I suppose we could add a field like amd-memory-private: to cover the private placements. No, that is not really appropriate either. GWS, GDS and OA are not memory in the first place.

Re: [PATCH v5 4/4] drm/amdgpu: track bo memory stats at runtime

2024-10-23 Thread Tvrtko Ursulin
On 23/10/2024 13:12, Christian König wrote: Am 23.10.24 um 13:37 schrieb Tvrtko Ursulin: On 23/10/2024 10:14, Christian König wrote: Am 23.10.24 um 09:38 schrieb Tvrtko Ursulin: On 22/10/2024 17:24, Christian König wrote: Am 22.10.24 um 17:17 schrieb Li, Yunxiang (Teddy): [Public] +sta

RE: [PATCH v5 4/4] drm/amdgpu: track bo memory stats at runtime

2024-10-23 Thread Li, Yunxiang (Teddy)
[AMD Official Use Only - AMD Internal Distribution Only] Yeah it looks like I missed the whole active/purgeable thing as well... Teddy

RE: [PATCH v5 4/4] drm/amdgpu: track bo memory stats at runtime

2024-10-23 Thread Li, Yunxiang (Teddy)
[AMD Official Use Only - AMD Internal Distribution Only] > From: Tvrtko Ursulin > Sent: Wednesday, October 23, 2024 8:25 > On 23/10/2024 13:12, Christian König wrote: > > Am 23.10.24 um 13:37 schrieb Tvrtko Ursulin: > >> > >> On 23/10/2024 10:14, Christian König wrote: > >>> Am 23.10.24 um 09:38

Re: [PATCH v5 4/4] drm/amdgpu: track bo memory stats at runtime

2024-10-23 Thread Christian König
Am 23.10.24 um 14:24 schrieb Tvrtko Ursulin: [SNIP] To fold or not the special placements (GWS, GDS & co) is also tangential. In my patch I just preserved the legacy behaviour so it can easily be tweaked on top. Yeah, but again the original behavior is completely broken. GWS, GDS and OA are

Re: [PATCH v5 4/4] drm/amdgpu: track bo memory stats at runtime

2024-10-23 Thread Christian König
Am 23.10.24 um 13:37 schrieb Tvrtko Ursulin: On 23/10/2024 10:14, Christian König wrote: Am 23.10.24 um 09:38 schrieb Tvrtko Ursulin: On 22/10/2024 17:24, Christian König wrote: Am 22.10.24 um 17:17 schrieb Li, Yunxiang (Teddy): [Public] +static uint32_t fold_memtype(uint32_t memtype) { I

Re: [PATCH v5 4/4] drm/amdgpu: track bo memory stats at runtime

2024-10-23 Thread Christian König
Am 23.10.24 um 09:38 schrieb Tvrtko Ursulin: On 22/10/2024 17:24, Christian König wrote: Am 22.10.24 um 17:17 schrieb Li, Yunxiang (Teddy): [Public] +static uint32_t fold_memtype(uint32_t memtype) { In general please add prefixes to even static functions, e.g. amdgpu_vm_ or amdgpu_bo_. + 

Re: [PATCH v5 4/4] drm/amdgpu: track bo memory stats at runtime

2024-10-22 Thread Christian König
Am 22.10.24 um 19:09 schrieb Li, Yunxiang (Teddy): [AMD Official Use Only - AMD Internal Distribution Only] It sounds like it makes the most sense to ignore the BOs that have no placement or private placements then, it would simplify the code too. Yeah, that works for me. Regards, Christian.

RE: [PATCH v5 4/4] drm/amdgpu: track bo memory stats at runtime

2024-10-22 Thread Li, Yunxiang (Teddy)
[AMD Official Use Only - AMD Internal Distribution Only] It sounds like it makes the most sense to ignore the BOs that have no placement or private placements then, it would simplify the code too. Teddy

Re: [PATCH v5 4/4] drm/amdgpu: track bo memory stats at runtime

2024-10-22 Thread Christian König
Am 22.10.24 um 18:46 schrieb Li, Yunxiang (Teddy): [Public] I suppose we could add a field like amd-memory-private: to cover the private placements. No, that is not really appropriate either. GWS, GDS and OA are not memory in the first place. Those BOs are HW blocks which the driver alloca

RE: [PATCH v5 4/4] drm/amdgpu: track bo memory stats at runtime

2024-10-22 Thread Li, Yunxiang (Teddy)
[Public] I suppose we could add a field like amd-memory-private: to cover the private placements. When would a BO not have a placement, is it when it is being moved? Since we are tracking the state changes, I wonder if such situations can be avoided now so whenever we call these stat update fun

Re: [PATCH v5 4/4] drm/amdgpu: track bo memory stats at runtime

2024-10-22 Thread Christian König
Am 22.10.24 um 17:17 schrieb Li, Yunxiang (Teddy): [Public] +static uint32_t fold_memtype(uint32_t memtype) { In general please add prefixes to even static functions, e.g. amdgpu_vm_ or amdgpu_bo_. + /* Squash private placements into 'cpu' to keep the legacy userspace view. */ + switch

RE: [PATCH v5 4/4] drm/amdgpu: track bo memory stats at runtime

2024-10-22 Thread Li, Yunxiang (Teddy)
[Public] > > > > +static uint32_t fold_memtype(uint32_t memtype) { > > In general please add prefixes to even static functions, e.g. amdgpu_vm_ or > amdgpu_bo_. > > > + /* Squash private placements into 'cpu' to keep the legacy userspace > > view. > */ > > + switch (mem_type) { > > + case T

Re: [PATCH v5 4/4] drm/amdgpu: track bo memory stats at runtime

2024-10-22 Thread Christian König
Am 18.10.24 um 15:33 schrieb Yunxiang Li: Before, every time fdinfo is queried we try to lock all the BOs in the VM and calculate memory usage from scratch. This works okay if the fdinfo is rarely read and the VMs don't have a ton of BOs. If either of these conditions is not true, we get a massiv

[PATCH v5 4/4] drm/amdgpu: track bo memory stats at runtime

2024-10-18 Thread Yunxiang Li
Before, every time fdinfo is queried we try to lock all the BOs in the VM and calculate memory usage from scratch. This works okay if the fdinfo is rarely read and the VMs don't have a ton of BOs. If either of these conditions is not true, we get a massive performance hit. In this new revision, we