drm/amdgpu: add new trace event for page table update v3
Subsystems (2)
PATCH v3 1/1 drm/amdgpu: add new trace event for page table update v3
This patch adds a new trace event to track the PTE update events. This specific event will provide information like:
- start and end of virtual memory mapping
- HW engine flags for the map
- physical address for mapping
This will be particularly useful for memory profiling tools (like RMV) which are monitoring the page table update events.
V2: Added physical address lookup logic in trace point
V3: switch to use __dynamic_array
added nptes int the TPprint arguments list added page size in the arg list
--- drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h | 38 +++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 9 ++++-- 2 files changed, 45 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h +38 -0
@@ -321,6 +321,44 @@ DEFINE_EVENT(amdgpu_vm_mapping, amdgpu_vm_bo_cs,TP_ARGS (mapping) ); +TRACE_EVENT (amdgpu_vm_update_ptes, + TP_PROTO(struct amdgpu_vm_update_params *p, + uint64_t start, uint64_t end, + unsigned int nptes, uint64_t dst, + uint64_t incr, uint64_t flags), +TP_ARGS (p, start, end, nptes, dst, incr, flags), +TP_STRUCT__entry ( + __field(u64, start) + __field(u64, end) + __field(u64, flags) + __field(u64, incr) + __field(unsigned int, nptes) +__dynamic_array (u64, dst, nptes) + ), + +TP_fast_assign ( + unsigned int i; + + __entry->start = start; + __entry->end = end; + __entry->flags = flags; + __entry->incr = incr; + __entry->nptes = nptes; + + for (i = 0; i < nptes; ++i) { +u64 addr = p->pages_addr ?amdgpu_vm_map_gart ( + p->pages_addr, dst) : dst; + + ((u64 *)__get_dynamic_array (dst))[i] = addr; + dst += incr; + } + ), +TP_printk ("seg:0x%010llx-0x%010llx, flags:0x%llx, nptr=%u, pgsz:%llu," +" dst:\n%s" , __entry->start, __entry->end, __entry->flags, + __entry->nptes, __entry->incr, +__print_array (__get_dynamic_array (dst), __entry->nptes,8 )) +); + TRACE_EVENT(amdgpu_vm_set_ptes, TP_PROTO(uint64_t pe, uint64_t addr, unsigned count, uint32_t incr, uint64_t flags, bool direct),
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +7 -2
@@ -1513,17 +1513,22 @@ static int amdgpu_vm_update_ptes(struct amdgpu_vm_update_params *params, do { uint64_t upd_end = min(entry_end, frag_end); unsigned nptes = (upd_end - frag_start) >> shift; + uint64_t upd_flags = flags | AMDGPU_PTE_FRAG(frag); /* This can happen when we set higher level PDs to * silent to stop fault floods. */ nptes = max(nptes, 1u); + + trace_amdgpu_vm_update_ptes(params, frag_start, upd_end, + nptes, dst, incr, + upd_flags); amdgpu_vm_update_flags(params, pt, cursor.level, pe_start, dst, nptes, incr, - flags | AMDGPU_PTE_FRAG(frag)); + upd_flags); pe_start += nptes * 8; - dst += (uint64_t)nptes * AMDGPU_GPU_PAGE_SIZE << shift; + dst += nptes * incr; frag_start = upd_end; if (frag_start >= frag_end) {
Signature · 6 lines
2.25.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Am 12.08.20 um 06:33 schrieb Shashank Sharma:
Quoted 56 lines
This patch adds a new trace event to track the PTE update events. This specific event will provide information like:
- start and end of virtual memory mapping
- HW engine flags for the map
- physical address for mappingThis will be particularly useful for memory profiling tools (like RMV) which are monitoring the page table update events.
V2: Added physical address lookup logic in trace point
V3: switch to use__dynamic_array
added nptes int the TPprint arguments list added page size in the arg listCc Christian König <[email protected]>Cc Alex Deucher <[email protected]>Signed-off-by Christian König <[email protected]>Signed-off-by Shashank Sharma <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h | 38 +++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 9 ++++-- 2 files changed, 45 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h +25
-0@@ -321,6 +321,44 @@ DEFINE_EVENT(amdgpu_vm_mapping, amdgpu_vm_bo_cs,TP_ARGS (mapping) ); +TRACE_EVENT(amdgpu_vm_update_ptes, + TP_PROTO(struct amdgpu_vm_update_params *p, + uint64_t start, uint64_t end, + unsigned int nptes, uint64_t dst, + uint64_t incr, uint64_t flags), + TP_ARGS(p, start, end, nptes, dst, incr, flags), + TP_STRUCT__entry( + __field(u64, start) + __field(u64, end) + __field(u64, flags) + __field(u64, incr) + __field(unsigned int, nptes) + __dynamic_array(u64, dst, nptes) + ), + + TP_fast_assign( + unsigned int i; + + __entry->start = start; + __entry->end = end; + __entry->flags = flags; + __entry->incr = incr; + __entry->nptes = nptes; + + for (i = 0; i < nptes; ++i) {
drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h DEFINE_EVENT(amdgpu_vm_mapping, amdgpu_vm_bo_cs, · line 358
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h +10
-0+u64 addr = p->pages_addr ?amdgpu_vm_map_gart ( + p->pages_addr, dst) : dst; + + ((u64 *)__get_dynamic_array (dst))[i] = addr; + dst += incr; + } + ), + TP_printk("seg:0x%010llx-0x%010llx, flags:0x%llx, nptr=%u, pgsz:%llu," + " dst:\n%s", __entry->start, __entry->end, __entry->flags, + __entry->nptes, __entry->incr,
This is not correct. The increment is NOT the page size, but rather the page size rounded down to a power of 512+4K.
In other words page size can be 4K, 8K, 16K, 32K, 64K....1M, 2M, 4M....512M, 1G, 2G....
But the increment can only be 4K, 2M, 1G....
And do we need the nptes here? We just need it to print the correct number of destination addresses.
Regards,
Christian.
Quoted 25 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h +3
-0+ __print_array(__get_dynamic_array(dst), __entry->nptes, 8)) +); + TRACE_EVENT(amdgpu_vm_set_ptes, TP_PROTO(uint64_t pe, uint64_t addr, unsigned count, uint32_t incr, uint64_t flags, bool direct),drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +5
-0@@ -1513,17 +1513,22 @@ static int amdgpu_vm_update_ptes(struct amdgpu_vm_update_params *params, do { uint64_t upd_end = min(entry_end, frag_end); unsigned nptes = (upd_end - frag_start) >> shift; + uint64_t upd_flags = flags | AMDGPU_PTE_FRAG(frag); /* This can happen when we set higher level PDs to * silent to stop fault floods. */ nptes = max(nptes, 1u); + + trace_amdgpu_vm_update_ptes(params, frag_start, upd_end, + nptes, dst, incr, + upd_flags); amdgpu_vm_update_flags(params, pt, cursor.level,
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c static int amdgpu_vm_update_ptes(struct amdgpu_vm_update_params *params, · line 1534
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +2
-2pe_start, dst, nptes, incr, - flags | AMDGPU_PTE_FRAG(frag)); + upd_flags); pe_start += nptes *8 ; - dst += (uint64_t )nptes *AMDGPU_GPU_PAGE_SIZE << shift; + dst += nptes * incr; frag_start = upd_end;if (frag_start >= frag_end) {
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Hello Christian,
Quoted 70 lines · Christian König
Am 12.08.20 um 06:33 schrieb Shashank Sharma:
Quoted 56 lines
This patch adds a new trace event to track the PTE update events. This specific event will provide information like:
- start and end of virtual memory mapping
- HW engine flags for the map
- physical address for mappingThis will be particularly useful for memory profiling tools (like RMV) which are monitoring the page table update events.
V2: Added physical address lookup logic in trace point
V3: switch to use__dynamic_array
added nptes int the TPprint arguments list added page size in the arg listCc Christian König <[email protected]>Cc Alex Deucher <[email protected]>Signed-off-by Christian König <[email protected]>Signed-off-by Shashank Sharma <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h | 38 +++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 9 ++++-- 2 files changed, 45 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h +25
-0@@ -321,6 +321,44 @@ DEFINE_EVENT(amdgpu_vm_mapping, amdgpu_vm_bo_cs,TP_ARGS (mapping) ); +TRACE_EVENT(amdgpu_vm_update_ptes, + TP_PROTO(struct amdgpu_vm_update_params *p, + uint64_t start, uint64_t end, + unsigned int nptes, uint64_t dst, + uint64_t incr, uint64_t flags), + TP_ARGS(p, start, end, nptes, dst, incr, flags), + TP_STRUCT__entry( + __field(u64, start) + __field(u64, end) + __field(u64, flags) + __field(u64, incr) + __field(unsigned int, nptes) + __dynamic_array(u64, dst, nptes) + ), + + TP_fast_assign( + unsigned int i; + + __entry->start = start; + __entry->end = end; + __entry->flags = flags; + __entry->incr = incr; + __entry->nptes = nptes; + + for (i = 0; i < nptes; ++i) {drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h DEFINE_EVENT(amdgpu_vm_mapping, amdgpu_vm_bo_cs, · line 358
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h +10
-0+u64 addr = p->pages_addr ?amdgpu_vm_map_gart ( + p->pages_addr, dst) : dst; + + ((u64 *)__get_dynamic_array (dst))[i] = addr; + dst += incr; + } + ), + TP_printk("seg:0x%010llx-0x%010llx, flags:0x%llx, nptr=%u, pgsz:%llu," + " dst:\n%s", __entry->start, __entry->end, __entry->flags, + __entry->nptes, __entry->incr,This is not correct. The increment is NOT the page size, but rather the page size rounded down to a power of 512+4K.
Quoted 4 lines
In other words page size can be 4K, 8K, 16K, 32K, 64K....1M, 2M, 4M....512M, 1G, 2G....
But the increment can only be 4K, 2M, 1G....
Understood. But I think the requirement here is for increment. My understanding is that the tool needs to save the page entries, and for that, it will need start of virtual mem, start of physical mem, mapping size and step to increment the entries. If that's so, we can re-label this entry as "step" instead of "page size". Please let me know if you think it's the right thing to do.
Quoted 2 lines
And do we need the nptes here? We just need it to print the correct number of destination addresses.
Agree, we don't really need nptes here, I will remove that and send V4.
- Shashank
Quoted 33 lines
Regards,
Christian.Quoted 29 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h +3
-0+ __print_array(__get_dynamic_array(dst), __entry->nptes, 8)) +); + TRACE_EVENT(amdgpu_vm_set_ptes, TP_PROTO(uint64_t pe, uint64_t addr, unsigned count, uint32_t incr, uint64_t flags, bool direct),drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +6
-1@@ -1513,17 +1513,22 @@ static int amdgpu_vm_update_ptes(struct amdgpu_vm_update_params *params, do { uint64_t upd_end = min(entry_end, frag_end); unsigned nptes = (upd_end - frag_start) >> shift; + uint64_t upd_flags = flags | AMDGPU_PTE_FRAG(frag); /* This can happen when we set higher level PDs to * silent to stop fault floods. */ nptes = max(nptes, 1u); + + trace_amdgpu_vm_update_ptes(params, frag_start, upd_end, + nptes, dst, incr, + upd_flags); amdgpu_vm_update_flags(params, pt, cursor.level, pe_start, dst, nptes, incr, - flags | AMDGPU_PTE_FRAG(frag)); + upd_flags);
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c static int amdgpu_vm_update_ptes(struct amdgpu_vm_update_params *params, · line 1534
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1
-1pe_start += nptes *8 ; - dst += (uint64_t )nptes *AMDGPU_GPU_PAGE_SIZE << shift; + dst += nptes * incr; frag_start = upd_end;if (frag_start >= frag_end) {
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Christian König
maintainerAm 12.08.20 um 10:15 schrieb Shashank Sharma:
Quoted 73 lines
Hello Christian,
Quoted 70 lines · Christian König
Am 12.08.20 um 06:33 schrieb Shashank Sharma:
Quoted 56 lines
This patch adds a new trace event to track the PTE update events. This specific event will provide information like:
- start and end of virtual memory mapping
- HW engine flags for the map
- physical address for mappingThis will be particularly useful for memory profiling tools (like RMV) which are monitoring the page table update events.
V2: Added physical address lookup logic in trace point
V3: switch to use__dynamic_array
added nptes int the TPprint arguments list added page size in the arg listCc Christian König <[email protected]>Cc Alex Deucher <[email protected]>Signed-off-by Christian König <[email protected]>Signed-off-by Shashank Sharma <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h | 38 +++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 9 ++++-- 2 files changed, 45 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h +25
-0@@ -321,6 +321,44 @@ DEFINE_EVENT(amdgpu_vm_mapping, amdgpu_vm_bo_cs,TP_ARGS (mapping) ); +TRACE_EVENT(amdgpu_vm_update_ptes, + TP_PROTO(struct amdgpu_vm_update_params *p, + uint64_t start, uint64_t end, + unsigned int nptes, uint64_t dst, + uint64_t incr, uint64_t flags), + TP_ARGS(p, start, end, nptes, dst, incr, flags), + TP_STRUCT__entry( + __field(u64, start) + __field(u64, end) + __field(u64, flags) + __field(u64, incr) + __field(unsigned int, nptes) + __dynamic_array(u64, dst, nptes) + ), + + TP_fast_assign( + unsigned int i; + + __entry->start = start; + __entry->end = end; + __entry->flags = flags; + __entry->incr = incr; + __entry->nptes = nptes; + + for (i = 0; i < nptes; ++i) {drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h DEFINE_EVENT(amdgpu_vm_mapping, amdgpu_vm_bo_cs, · line 358
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h +10
-0+u64 addr = p->pages_addr ?amdgpu_vm_map_gart ( + p->pages_addr, dst) : dst; + + ((u64 *)__get_dynamic_array (dst))[i] = addr; + dst += incr; + } + ), + TP_printk("seg:0x%010llx-0x%010llx, flags:0x%llx, nptr=%u, pgsz:%llu," + " dst:\n%s", __entry->start, __entry->end, __entry->flags, + __entry->nptes, __entry->incr,This is not correct. The increment is NOT the page size, but rather the page size rounded down to a power of 512+4K.
Quoted 5 lines
Quoted 4 lines
In other words page size can be 4K, 8K, 16K, 32K, 64K....1M, 2M, 4M....512M, 1G, 2G....
But the increment can only be 4K, 2M, 1G....
Understood. But I think the requirement here is for increment. My understanding is that the tool needs to save the page entries, and for that, it will need start of virtual mem, start of physical mem, mapping size and step to increment the entries. If that's so, we can re-label this entry as "step" instead of "page size". Please let me know if you think it's the right thing to do.
We could stick with the naming increment if that helps, but this can also be derived from the number of destination addresses we have.
On the other hand explicitly mentioning it probably won't hurt us either.
And by the way what does "seg" mean?
Christian.
Quoted 38 lines
Quoted 2 lines
And do we need the nptes here? We just need it to print the correct number of destination addresses.
Agree, we don't really need nptes here, I will remove that and send V4.
- Shashank
Quoted 32 lines
Regards,
Christian.Quoted 29 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h +3
-0+ __print_array(__get_dynamic_array(dst), __entry->nptes, 8)) +); + TRACE_EVENT(amdgpu_vm_set_ptes, TP_PROTO(uint64_t pe, uint64_t addr, unsigned count, uint32_t incr, uint64_t flags, bool direct),drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +6
-1@@ -1513,17 +1513,22 @@ static int amdgpu_vm_update_ptes(struct amdgpu_vm_update_params *params, do { uint64_t upd_end = min(entry_end, frag_end); unsigned nptes = (upd_end - frag_start) >> shift; + uint64_t upd_flags = flags | AMDGPU_PTE_FRAG(frag); /* This can happen when we set higher level PDs to * silent to stop fault floods. */ nptes = max(nptes, 1u); + + trace_amdgpu_vm_update_ptes(params, frag_start, upd_end, + nptes, dst, incr, + upd_flags); amdgpu_vm_update_flags(params, pt, cursor.level, pe_start, dst, nptes, incr, - flags | AMDGPU_PTE_FRAG(frag)); + upd_flags);
Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c static int amdgpu_vm_update_ptes(struct amdgpu_vm_update_params *params, · line 1534
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1
-1pe_start += nptes *8 ; - dst += (uint64_t )nptes *AMDGPU_GPU_PAGE_SIZE << shift; + dst += nptes * incr; frag_start = upd_end;if (frag_start >= frag_end) {
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 74 lines · Christian König
Am 12.08.20 um 10:15 schrieb Shashank Sharma:
Quoted 73 lines
Hello Christian,
Quoted 70 lines · Christian König
Am 12.08.20 um 06:33 schrieb Shashank Sharma:
Quoted 56 lines
This patch adds a new trace event to track the PTE update events. This specific event will provide information like:
- start and end of virtual memory mapping
- HW engine flags for the map
- physical address for mappingThis will be particularly useful for memory profiling tools (like RMV) which are monitoring the page table update events.
V2: Added physical address lookup logic in trace point
V3: switch to use__dynamic_array
added nptes int the TPprint arguments list added page size in the arg listCc Christian König <[email protected]>Cc Alex Deucher <[email protected]>Signed-off-by Christian König <[email protected]>Signed-off-by Shashank Sharma <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h | 38 +++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 9 ++++-- 2 files changed, 45 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h +25
-0@@ -321,6 +321,44 @@ DEFINE_EVENT(amdgpu_vm_mapping, amdgpu_vm_bo_cs,TP_ARGS (mapping) ); +TRACE_EVENT(amdgpu_vm_update_ptes, + TP_PROTO(struct amdgpu_vm_update_params *p, + uint64_t start, uint64_t end, + unsigned int nptes, uint64_t dst, + uint64_t incr, uint64_t flags), + TP_ARGS(p, start, end, nptes, dst, incr, flags), + TP_STRUCT__entry( + __field(u64, start) + __field(u64, end) + __field(u64, flags) + __field(u64, incr) + __field(unsigned int, nptes) + __dynamic_array(u64, dst, nptes) + ), + + TP_fast_assign( + unsigned int i; + + __entry->start = start; + __entry->end = end; + __entry->flags = flags; + __entry->incr = incr; + __entry->nptes = nptes; + + for (i = 0; i < nptes; ++i) {drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h DEFINE_EVENT(amdgpu_vm_mapping, amdgpu_vm_bo_cs, · line 358
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h +10
-0+u64 addr = p->pages_addr ?amdgpu_vm_map_gart ( + p->pages_addr, dst) : dst; + + ((u64 *)__get_dynamic_array (dst))[i] = addr; + dst += incr; + } + ), + TP_printk("seg:0x%010llx-0x%010llx, flags:0x%llx, nptr=%u, pgsz:%llu," + " dst:\n%s", __entry->start, __entry->end, __entry->flags, + __entry->nptes, __entry->incr,This is not correct. The increment is NOT the page size, but rather the page size rounded down to a power of 512+4K.
Quoted 7 lines
Quoted 5 lines
Quoted 4 lines
In other words page size can be 4K, 8K, 16K, 32K, 64K....1M, 2M, 4M....512M, 1G, 2G....
But the increment can only be 4K, 2M, 1G....
Understood. But I think the requirement here is for increment. My understanding is that the tool needs to save the page entries, and for that, it will need start of virtual mem, start of physical mem, mapping size and step to increment the entries. If that's so, we can re-label this entry as "step" instead of "page size". Please let me know if you think it's the right thing to do.
We could stick with the naming increment if that helps, but this can also be derived from the number of destination addresses we have.
sure, i will make it increment.
Quoted 4 lines
On the other hand explicitly mentioning it probably won't hurt us either.
And by the way what does "seg" mean?
Ah, to get into 80 char limit, I made 'segment' as 'seg' and later just realized I have to still break the print into two lines :) . I will make it back to segment or start/end
- Shashank
Quoted 41 lines
Christian.
Quoted 38 lines
Quoted 2 lines
And do we need the nptes here? We just need it to print the correct number of destination addresses.
Agree, we don't really need nptes here, I will remove that and send V4.
- Shashank
Quoted 32 lines
Regards,
Christian.Quoted 29 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h +3
-0+ __print_array(__get_dynamic_array(dst), __entry->nptes, 8)) +); + TRACE_EVENT(amdgpu_vm_set_ptes, TP_PROTO(uint64_t pe, uint64_t addr, unsigned count, uint32_t incr, uint64_t flags, bool direct),drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +6
-1@@ -1513,17 +1513,22 @@ static int amdgpu_vm_update_ptes(struct amdgpu_vm_update_params *params, do { uint64_t upd_end = min(entry_end, frag_end); unsigned nptes = (upd_end - frag_start) >> shift; + uint64_t upd_flags = flags | AMDGPU_PTE_FRAG(frag); /* This can happen when we set higher level PDs to * silent to stop fault floods. */ nptes = max(nptes, 1u); + + trace_amdgpu_vm_update_ptes(params, frag_start, upd_end, + nptes, dst, incr, + upd_flags); amdgpu_vm_update_flags(params, pt, cursor.level, pe_start, dst, nptes, incr, - flags | AMDGPU_PTE_FRAG(frag)); + upd_flags);
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c static int amdgpu_vm_update_ptes(struct amdgpu_vm_update_params *params, · line 1534
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1
-1pe_start += nptes *8 ; - dst += (uint64_t )nptes *AMDGPU_GPU_PAGE_SIZE << shift; + dst += nptes * incr; frag_start = upd_end;if (frag_start >= frag_end) {
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Am 12.08.20 um 14:09 schrieb Shashank Sharma:
Quoted 79 lines · Christian König
Quoted 78 lines
Am 12.08.20 um 10:15 schrieb Shashank Sharma:
Quoted 77 lines
Hello Christian,
Quoted 74 lines · Christian König
Am 12.08.20 um 06:33 schrieb Shashank Sharma:
Quoted 56 lines
This patch adds a new trace event to track the PTE update events. This specific event will provide information like:
- start and end of virtual memory mapping
- HW engine flags for the map
- physical address for mappingThis will be particularly useful for memory profiling tools (like RMV) which are monitoring the page table update events.
V2: Added physical address lookup logic in trace point
V3: switch to use__dynamic_array
added nptes int the TPprint arguments list added page size in the arg listCc Christian König <[email protected]>Cc Alex Deucher <[email protected]>Signed-off-by Christian König <[email protected]>Signed-off-by Shashank Sharma <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h | 38 +++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 9 ++++-- 2 files changed, 45 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h +25
-0@@ -321,6 +321,44 @@ DEFINE_EVENT(amdgpu_vm_mapping, amdgpu_vm_bo_cs,TP_ARGS (mapping) ); +TRACE_EVENT(amdgpu_vm_update_ptes, + TP_PROTO(struct amdgpu_vm_update_params *p, + uint64_t start, uint64_t end, + unsigned int nptes, uint64_t dst, + uint64_t incr, uint64_t flags), + TP_ARGS(p, start, end, nptes, dst, incr, flags), + TP_STRUCT__entry( + __field(u64, start) + __field(u64, end) + __field(u64, flags) + __field(u64, incr) + __field(unsigned int, nptes) + __dynamic_array(u64, dst, nptes) + ), + + TP_fast_assign( + unsigned int i; + + __entry->start = start; + __entry->end = end; + __entry->flags = flags; + __entry->incr = incr; + __entry->nptes = nptes; + + for (i = 0; i < nptes; ++i) {drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h DEFINE_EVENT(amdgpu_vm_mapping, amdgpu_vm_bo_cs, · line 358
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h +10
-0+u64 addr = p->pages_addr ?amdgpu_vm_map_gart ( + p->pages_addr, dst) : dst; + + ((u64 *)__get_dynamic_array (dst))[i] = addr; + dst += incr; + } + ), + TP_printk("seg:0x%010llx-0x%010llx, flags:0x%llx, nptr=%u, pgsz:%llu," + " dst:\n%s", __entry->start, __entry->end, __entry->flags, + __entry->nptes, __entry->incr,This is not correct. The increment is NOT the page size, but rather the page size rounded down to a power of 512+4K.
In other words page size can be 4K, 8K, 16K, 32K, 64K....1M, 2M, 4M....512M, 1G, 2G....
But the increment can only be 4K, 2M, 1G....
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
Understood. But I think the requirement here is for increment. My understanding is that the tool needs to save the page entries, and for that, it will need start of virtual mem, start of physical mem, mapping size and step to increment the entries. If that's so, we can re-label this entry as "step" instead of "page size". Please let me know if you think it's the right thing to do.
We could stick with the naming increment if that helps, but this can also be derived from the number of destination addresses we have.
sure, i will make it increment.
Quoted 3 lines
On the other hand explicitly mentioning it probably won't hurt us either.
And by the way what does "seg" mean?
Ah, to get into 80 char limit, I made 'segment' as 'seg' and later just realized I have to still break the print into two lines :) . I will make it back to segment or start/end
Ah, maybe rather use VA for virtual address. But start/end is probably the best option.
Christian.
Quoted 47 lines
- Shashank
Quoted 44 lines
Christian.
Quoted 42 lines
Quoted 2 lines
And do we need the nptes here? We just need it to print the correct number of destination addresses.
Agree, we don't really need nptes here, I will remove that and send V4.
- Shashank
Quoted 36 lines
Regards,
Christian.Quoted 33 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h +3
-0+ __print_array(__get_dynamic_array(dst), __entry->nptes, 8)) +); + TRACE_EVENT(amdgpu_vm_set_ptes, TP_PROTO(uint64_t pe, uint64_t addr, unsigned count, uint32_t incr, uint64_t flags, bool direct),drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +7
-2@@ -1513,17 +1513,22 @@ static int amdgpu_vm_update_ptes(struct amdgpu_vm_update_params *params, do { uint64_t upd_end = min(entry_end, frag_end); unsigned nptes = (upd_end - frag_start) >> shift; + uint64_t upd_flags = flags | AMDGPU_PTE_FRAG(frag); /* This can happen when we set higher level PDs to * silent to stop fault floods. */ nptes = max(nptes, 1u); + + trace_amdgpu_vm_update_ptes(params, frag_start, upd_end, + nptes, dst, incr, + upd_flags); amdgpu_vm_update_flags(params, pt, cursor.level, pe_start, dst, nptes, incr, - flags | AMDGPU_PTE_FRAG(frag)); + upd_flags); pe_start += nptes * 8; - dst += (uint64_t)nptes * AMDGPU_GPU_PAGE_SIZE << shift; + dst += nptes * incr;
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c static int amdgpu_vm_update_ptes(struct amdgpu_vm_update_params *params, · line 1534
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0
-0frag_start = upd_end;if (frag_start >= frag_end) {_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx