drm/amd/display: DM trace event cleanups
Subsystems (3)
cover drm/amd/display: DM trace event cleanups
Hey,
I was tracing some amdgpu_dm events and noticed small issues and found areas for minor improvements. So this series is just a collection of those small cleanups.
Melissa
Melissa Wen (8):
drm/amd/display: assign missing trace entry in amdgpu_dm_dc_clocks_state drm/amd/display: remove duplicated prev_p_state_change_support assignment drm/amd/display: fix vready offset assignment in dcn_optc_lock_unlock_state drm/amd/display: declare amdgpu_dm_atomic_state_template as an event class drm/amd/display: use right type for amdgpu_dc_performance event entries drm/amd/display: remove redundant cast on amdgpu_dc_reg_template printk drm/amd/display: copy function name into dcn_fpu trace event drm/amd/display: copy function name into dcn_optc_lock_unlock_state trace event
.../amd/display/amdgpu_dm/amdgpu_dm_trace.h | 99 +++++++++---------- 1 file changed, 45 insertions(+), 54 deletions(-)
Signature · 1 line
2.53.0
PATCH 1/8 drm/amd/display: assign missing trace entry in amdgpu_dm_dc_clocks_state
disp_dpp_voltage_level_khz is declared and printed, but never assigned. So when using clock tracepoint the value of this clock is just garbage. Assign clk->disp_dpp_voltage_level_khz since this is stored in dc_clocks as other entries.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h +1 -0
@@ -513,6 +513,7 @@ TRACE_EVENT(amdgpu_dm_dc_clocks_state,TP_fast_assign ( __entry->dispclk_khz = clk->dispclk_khz; __entry->dppclk_khz = clk->dppclk_khz; + __entry->disp_dpp_voltage_level_khz = clk->disp_dpp_voltage_level_khz; __entry->dcfclk_khz = clk->dcfclk_khz; __entry->socclk_khz = clk->socclk_khz; __entry->dcfclk_deep_sleep_khz = clk->dcfclk_deep_sleep_khz;
Signature · 1 line
2.53.0
Re: [PATCH 1/8] drm/amd/display: assign missing trace entry in amdgpu_dm_dc_clocks_state
Quoted 16 lines · Melissa Wen
disp_dpp_voltage_level_khzis declared and printed, but never assigned. So when using clock tracepoint the value of this clock is just garbage. Assignclk->disp_dpp_voltage_level_khzsince this is stored indc_clocksas other entries.Fixes 13b5ca42ca9c ("drm/amd/display: Add tracepoint for capturing clocks state")Signed-off-by Melissa Wen <[email protected]>--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h | 1 + 1 file changed, 1 insertion(+)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h +0
-0
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h TRACE_EVENT(amdgpu_dm_dc_clocks_state, · line 519
Quoted 7 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h +1
-0@@ -513,6 +513,7 @@ TRACE_EVENT(amdgpu_dm_dc_clocks_state,TP_fast_assign ( __entry->dispclk_khz = clk->dispclk_khz; __entry->dppclk_khz = clk->dppclk_khz; + __entry->disp_dpp_voltage_level_khz = clk->disp_dpp_voltage_level_khz; __entry->dcfclk_khz = clk->dcfclk_khz; __entry->socclk_khz = clk->socclk_khz; __entry->dcfclk_deep_sleep_khz = clk->dcfclk_deep_sleep_khz;
Regards,
Tvrtko
PATCH 2/8 drm/amd/display: remove duplicated prev_p_state_change_support assignment
In reply to Melissa WenThe prev_p_state_change_support trace entry is assigned and printed twice, remove the unnecessary duplicates.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h +2 -4
@@ -523,7 +523,6 @@ TRACE_EVENT(amdgpu_dm_dc_clocks_state, __entry->p_state_change_support = clk->p_state_change_support; __entry->prev_p_state_change_support = clk->prev_p_state_change_support; __entry->pwr_state = clk->pwr_state; - __entry->prev_p_state_change_support = clk->prev_p_state_change_support; __entry->dtm_level = clk->dtm_level; __entry->max_supported_dppclk_khz = clk->max_supported_dppclk_khz; __entry->max_supported_dispclk_khz = clk->max_supported_dispclk_khz;
@@ -533,8 +532,8 @@ TRACE_EVENT(amdgpu_dm_dc_clocks_state, TP_printk("dispclk_khz=%d dppclk_khz=%d disp_dpp_voltage_level_khz=%d dcfclk_khz=%d socclk_khz=%d " "dcfclk_deep_sleep_khz=%d fclk_khz=%d phyclk_khz=%d " "dramclk_khz=%d p_state_change_support=%d " - "prev_p_state_change_support=%d pwr_state=%d prev_p_state_change_support=%d " - "dtm_level=%d max_supported_dppclk_khz=%d max_supported_dispclk_khz=%d " + "prev_p_state_change_support=%d pwr_state=%d dtm_level=%d " + "max_supported_dppclk_khz=%d max_supported_dispclk_khz=%d " "bw_dppclk_khz=%d bw_dispclk_khz=%d ", __entry->dispclk_khz, __entry->dppclk_khz,
@@ -548,7 +547,6 @@ TRACE_EVENT(amdgpu_dm_dc_clocks_state, __entry->p_state_change_support, __entry->prev_p_state_change_support, __entry->pwr_state, - __entry->prev_p_state_change_support, __entry->dtm_level, __entry->max_supported_dppclk_khz, __entry->max_supported_dispclk_khz,
Signature · 1 line
2.53.0
Re: [PATCH 2/8] drm/amd/display: remove duplicated prev_p_state_change_support assignment
Quoted 33 lines · Melissa Wen
The
prev_p_state_change_supporttrace entry is assigned and printed twice, remove the unnecessary duplicates.Fixes 13b5ca42ca9c ("drm/amd/display: Add tracepoint for capturing clocks state")Signed-off-by Melissa Wen <[email protected]>--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h +2
-3@@ -523,7 +523,6 @@ TRACE_EVENT(amdgpu_dm_dc_clocks_state, __entry->p_state_change_support = clk->p_state_change_support; __entry->prev_p_state_change_support = clk->prev_p_state_change_support; __entry->pwr_state = clk->pwr_state; - __entry->prev_p_state_change_support = clk->prev_p_state_change_support; __entry->dtm_level = clk->dtm_level; __entry->max_supported_dppclk_khz = clk->max_supported_dppclk_khz; __entry->max_supported_dispclk_khz = clk->max_supported_dispclk_khz;@@ -533,8 +532,8 @@ TRACE_EVENT(amdgpu_dm_dc_clocks_state, TP_printk("dispclk_khz=%d dppclk_khz=%d disp_dpp_voltage_level_khz=%d dcfclk_khz=%d socclk_khz=%d " "dcfclk_deep_sleep_khz=%d fclk_khz=%d phyclk_khz=%d " "dramclk_khz=%d p_state_change_support=%d " - "prev_p_state_change_support=%d pwr_state=%d prev_p_state_change_support=%d " - "dtm_level=%d max_supported_dppclk_khz=%d max_supported_dispclk_khz=%d " + "prev_p_state_change_support=%d pwr_state=%d dtm_level=%d " + "max_supported_dppclk_khz=%d max_supported_dispclk_khz=%d " "bw_dppclk_khz=%d bw_dispclk_khz=%d ", __entry->dispclk_khz, __entry->dppclk_khz,
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h TRACE_EVENT(amdgpu_dm_dc_clocks_state, · line 552
Quoted 7 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h +0
-1@@ -548,7 +547,6 @@ TRACE_EVENT(amdgpu_dm_dc_clocks_state, __entry->p_state_change_support, __entry->prev_p_state_change_support, __entry->pwr_state, - __entry->prev_p_state_change_support, __entry->dtm_level, __entry->max_supported_dppclk_khz, __entry->max_supported_dispclk_khz,
Regards,
Tvrtko
PATCH 3/8 drm/amd/display: fix vready offset assignment in dcn_optc_lock_unlock_state
In reply to Melissa Wenvready_offset is captured by optc_state, but the trace point entry is wrongly assigned to vupdate_offset. Fix vready_offset tracepoint field in dcn_optc_lock_unloack_state to record optc_state->vready_offset.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h +1 -1
@@ -701,7 +701,7 @@ TRACE_EVENT(dcn_optc_lock_unlock_state, __entry->vstartup_start = optc_state->vstartup_start; __entry->vupdate_offset = optc_state->vupdate_offset; __entry->vupdate_width = optc_state->vupdate_width; - __entry->vready_offset = optc_state->vupdate_offset; + __entry->vready_offset = optc_state->vready_offset; ),TP_printk ("%s: %s()+%d: optc_instance=%d opp_count=%d max_h_total=%d max_v_total=%d " "min_h_blank=%d min_h_sync_width=%d min_v_sync_width=%d min_v_blank=%d "
Signature · 1 line
2.53.0
Re: [PATCH 3/8] drm/amd/display: fix vready offset assignment in dcn_optc_lock_unlock_state
Quoted 3 lines · Melissa Wen
vready_offsetis captured byoptc_state, but the trace point entry is wrongly assigned tovupdate_offset. Fixvready_offsettracepoint field indcn_optc_lock_unloack_stateto recordoptc_state->vready_offset.
unlock
Quoted 12 lines
Fixes f1943a51f0f9 ("drm/amd/display: Add events log to trace OPTC lock and unlock")Signed-off-by Melissa Wen <[email protected]>--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h +0
-0
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h TRACE_EVENT(dcn_optc_lock_unlock_state, · line 707
Quoted 8 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h +1
-1@@ -701,7 +701,7 @@ TRACE_EVENT(dcn_optc_lock_unlock_state, __entry->vstartup_start = optc_state->vstartup_start; __entry->vupdate_offset = optc_state->vupdate_offset; __entry->vupdate_width = optc_state->vupdate_width; - __entry->vready_offset = optc_state->vupdate_offset; + __entry->vready_offset = optc_state->vready_offset; ),TP_printk ("%s: %s()+%d: optc_instance=%d opp_count=%d max_h_total=%d max_v_total=%d " "min_h_blank=%d min_h_sync_width=%d min_v_sync_width=%d min_v_blank=%d "
Regards,
Tvrtko
PATCH 4/8 drm/amd/display: declare amdgpu_dm_atomic_state_template as an event class
In reply to Melissa WenDon't create an amdgpu_dm_atomic_state_template event since this is just a template. Declare the template as an event class that will be used by actual event tracers.
--- .../amd/display/amdgpu_dm/amdgpu_dm_trace.h | 56 +++++++++---------- 1 file changed, 26 insertions(+), 30 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h +26 -30
@@ -314,36 +314,32 @@ DEFINE_EVENT(amdgpu_dm_plane_state_template, amdgpu_dm_atomic_update_cursor, TP_PROTO(const struct drm_plane_state *state), TP_ARGS(state)); -TRACE_EVENT (amdgpu_dm_atomic_state_template, - TP_PROTO(const struct drm_atomic_commit *state), -TP_ARGS (state), - -TP_STRUCT__entry ( - __field(const struct drm_atomic_commit *, state) - __field(bool, allow_modeset) - __field(bool, legacy_cursor_update) - __field(bool, async_update) - __field(bool, duplicated) - __field(int, num_connector) -__field (int, num_private_objs) - ), - -TP_fast_assign ( - __entry->state = state; - __entry->allow_modeset = state->allow_modeset; - __entry->legacy_cursor_update = state->legacy_cursor_update; - __entry->async_update = state->async_update; - __entry->duplicated = state->duplicated; - __entry->num_connector = state->num_connector; - __entry->num_private_objs = state->num_private_objs; - ), - -TP_printk ("state=%p allow_modeset=%d legacy_cursor_update=%d " -"async_update=%d duplicated=%d num_connector=%d " -"num_private_objs=%d" , - __entry->state, __entry->allow_modeset, __entry->legacy_cursor_update, - __entry->async_update, __entry->duplicated, __entry->num_connector, - __entry->num_private_objs) +DECLARE_EVENT_CLASS (amdgpu_dm_atomic_state_template, + TP_PROTO(const struct drm_atomic_commit *state), +TP_ARGS (state), + TP_STRUCT__entry(__field(const struct drm_atomic_commit *, state) + __field(bool, allow_modeset) + __field(bool, legacy_cursor_update) + __field(bool, async_update) + __field(bool, duplicated) + __field(int, num_connector) +__field (int, num_private_objs) + ), + TP_fast_assign(__entry->state = state; + __entry->allow_modeset = state->allow_modeset; + __entry->legacy_cursor_update = state->legacy_cursor_update; + __entry->async_update = state->async_update; + __entry->duplicated = state->duplicated; + __entry->num_connector = state->num_connector; + __entry->num_private_objs = state->num_private_objs; + ), +TP_printk ("state=%p allow_modeset=%d legacy_cursor_update=%d " +"async_update=%d duplicated=%d num_connector=%d " +"num_private_objs=%d" , + __entry->state, __entry->allow_modeset, + __entry->legacy_cursor_update, __entry->async_update, + __entry->duplicated, __entry->num_connector, + __entry->num_private_objs) ); DEFINE_EVENT(amdgpu_dm_atomic_state_template, amdgpu_dm_atomic_commit_tail_begin,
Signature · 1 line
2.53.0
Re: [PATCH 4/8] drm/amd/display: declare amdgpu_dm_atomic_state_template as an event class
Quoted 67 lines · Melissa Wen
Don't create an
amdgpu_dm_atomic_state_templateevent since this is just a template. Declare the template as an event class that will be used by actual event tracers.Fixes e8a982355f96 ("drm/amd/display: Add tracepoint for amdgpu_dm")Signed-off-by Melissa Wen <[email protected]>--- .../amd/display/amdgpu_dm/amdgpu_dm_trace.h | 56 +++++++++---------- 1 file changed, 26 insertions(+), 30 deletions(-)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h +19
-30@@ -314,36 +314,32 @@ DEFINE_EVENT(amdgpu_dm_plane_state_template, amdgpu_dm_atomic_update_cursor, TP_PROTO(const struct drm_plane_state *state), TP_ARGS(state)); -TRACE_EVENT (amdgpu_dm_atomic_state_template, - TP_PROTO(const struct drm_atomic_commit *state), -TP_ARGS (state), - -TP_STRUCT__entry ( - __field(const struct drm_atomic_commit *, state) - __field(bool, allow_modeset) - __field(bool, legacy_cursor_update) - __field(bool, async_update) - __field(bool, duplicated) - __field(int, num_connector) -__field (int, num_private_objs) - ), - -TP_fast_assign ( - __entry->state = state; - __entry->allow_modeset = state->allow_modeset; - __entry->legacy_cursor_update = state->legacy_cursor_update; - __entry->async_update = state->async_update; - __entry->duplicated = state->duplicated; - __entry->num_connector = state->num_connector; - __entry->num_private_objs = state->num_private_objs; - ), - -TP_printk ("state=%p allow_modeset=%d legacy_cursor_update=%d " -"async_update=%d duplicated=%d num_connector=%d " -"num_private_objs=%d" , - __entry->state, __entry->allow_modeset, __entry->legacy_cursor_update, - __entry->async_update, __entry->duplicated, __entry->num_connector, - __entry->num_private_objs) +DECLARE_EVENT_CLASS(amdgpu_dm_atomic_state_template, + TP_PROTO(const struct drm_atomic_commit *state), + TP_ARGS(state), + TP_STRUCT__entry(__field(const struct drm_atomic_commit *, state) + __field(bool, allow_modeset) + __field(bool, legacy_cursor_update) + __field(bool, async_update) + __field(bool, duplicated) + __field(int, num_connector) + __field(int, num_private_objs) + ), + TP_fast_assign(__entry->state = state; + __entry->allow_modeset = state->allow_modeset; + __entry->legacy_cursor_update = state->legacy_cursor_update; + __entry->async_update = state->async_update; + __entry->duplicated = state->duplicated; + __entry->num_connector = state->num_connector; + __entry->num_private_objs = state->num_private_objs; + ),
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h DEFINE_EVENT(amdgpu_dm_plane_state_template, amdgpu_dm_atomic_update_cursor, · line 345
Quoted 10 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h +7
-0+TP_printk ("state=%p allow_modeset=%d legacy_cursor_update=%d " +"async_update=%d duplicated=%d num_connector=%d " +"num_private_objs=%d" , + __entry->state, __entry->allow_modeset, + __entry->legacy_cursor_update, __entry->async_update, + __entry->duplicated, __entry->num_connector, + __entry->num_private_objs) ); DEFINE_EVENT(amdgpu_dm_atomic_state_template, amdgpu_dm_atomic_commit_tail_begin,
Regards,
Tvrtko
P.S. A side question - are %p useful in these tracepoints? I imagine one has to know the object lifetimes really well, or make sure state init and free are also traced to make sense of what is what.
PATCH 5/8 drm/amd/display: use right type for amdgpu_dc_performance event entries
In reply to Melissa WenSome amdgpu_dc_performance trace event params are passed as unsigned long but stored as uint32_t, cutting them off on 64-bit. Use the right type on entry fields and on printk use unsigned format accordingly.
--- .../drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h +7 -10
@@ -76,10 +76,10 @@ TRACE_EVENT(amdgpu_dc_performance, const char *func, unsigned int line),TP_ARGS (read_count ,write_count ,last_read ,last_write ,func ,line ),TP_STRUCT__entry ( - __field(uint32_t, reads) -__field (uint32_t ,writes ) -__field (uint32_t, read_delta) -__field (uint32_t, write_delta) + __field(unsigned long, reads) +__field (unsigned long ,writes ) + __field(unsigned long, read_delta) + __field(unsigned long, write_delta)__string (func, func)__field (uint32_t, line) ),
@@ -93,12 +93,9 @@ TRACE_EVENT(amdgpu_dc_performance, *last_read = read_count; *last_write = write_count; ), -TP_printk ("%s:%d reads=%08ld (%08ld total), writes=%08ld (%08ld total)" , -__get_str (func), __entry->line, - (unsigned long )__entry->read_delta, - (unsigned long )__entry->reads, - (unsigned long )__entry->write_delta, - (unsigned long )__entry->writes) +TP_printk ("%s:%u reads=%08lu (%08lu total), writes=%08lu (%08lu total)" , +__get_str (func), __entry->line, __entry->read_delta, + __entry->reads, __entry->write_delta, __entry->writes) ); TRACE_EVENT(amdgpu_dm_connector_atomic_check,
Signature · 1 line
2.53.0
Re: [PATCH 5/8] drm/amd/display: use right type for amdgpu_dc_performance event entries
Quoted 35 lines · Melissa Wen
Some
amdgpu_dc_performancetrace event params are passed as unsigned long but stored asuint32_t, cutting them off on 64-bit. Use the right type on entry fields and on printk use unsigned format accordingly.Fixes 0cf5eb76e2b4 ("drm/amd/display: Add tracing to dc")Signed-off-by Melissa Wen <[email protected]>--- .../drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h +4
-6@@ -76,10 +76,10 @@ TRACE_EVENT(amdgpu_dc_performance, const char *func, unsigned int line),TP_ARGS (read_count ,write_count ,last_read ,last_write ,func ,line ),TP_STRUCT__entry ( - __field(uint32_t, reads) -__field (uint32_t ,writes ) -__field (uint32_t, read_delta) -__field (uint32_t, write_delta) + __field(unsigned long, reads) +__field (unsigned long ,writes ) + __field(unsigned long, read_delta) + __field(unsigned long, write_delta)__string (func, func)__field (uint32_t, line) ),@@ -93,12 +93,9 @@ TRACE_EVENT(amdgpu_dc_performance, *last_read = read_count; *last_write = write_count; ), - TP_printk("%s:%d reads=%08ld (%08ld total), writes=%08ld (%08ld total)", - __get_str(func), __entry->line,
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h TRACE_EVENT(amdgpu_dc_performance, · line 101
Quoted 10 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h +3
-4- (unsigned long )__entry->read_delta, - (unsigned long )__entry->reads, - (unsigned long )__entry->write_delta, - (unsigned long)__entry->writes) +TP_printk ("%s:%u reads=%08lu (%08lu total), writes=%08lu (%08lu total)" , +__get_str (func), __entry->line, __entry->read_delta, + __entry->reads, __entry->write_delta, __entry->writes) ); TRACE_EVENT(amdgpu_dm_connector_atomic_check,
8 character width might be insufficient now. I have no idea if it can happen in practice, probably not?
Do fields in struct dc_perf_trace need to be 64-bit wide is a related question?
Regards,
Tvrtko
PATCH 6/8 drm/amd/display: remove redundant cast on amdgpu_dc_reg_template printk
In reply to Melissa WenCommit 0cf5eb76e2b4 ("drm/amd/display: Add tracing to dc") prints and casts uint32_t fields in amdgpu_dc_reg_template to unsigned long unnecessarily. Just print those fields with %08x and remove the redundant cast.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h +2 -3
@@ -57,9 +57,8 @@ DECLARE_EVENT_CLASS(amdgpu_dc_reg_template, *count = *count +1 ; ), -TP_printk ("reg=0x%08lx, value=0x%08lx" , - (unsigned long )__entry->reg, - (unsigned long )__entry->value) +TP_printk ("reg=0x%08x, value=0x%08x" , + __entry->reg, __entry->value) ); DEFINE_EVENT(amdgpu_dc_reg_template, amdgpu_dc_rreg,
Signature · 1 line
2.53.0
Re: [PATCH 6/8] drm/amd/display: remove redundant cast on amdgpu_dc_reg_template printk
Quoted 17 lines · Melissa Wen
Commit
0cf5eb76e2b4("drm/amd/display: Add tracing to dc") prints and castsuint32_tfields inamdgpu_dc_reg_templateto unsigned long unnecessarily. Just print those fields with %08x and remove the redundant cast.Assisted-by Claude:claude-opus-5-5Signed-off-by Melissa Wen <[email protected]>--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h +0
-0@@ -57,9 +57,8 @@ DECLARE_EVENT_CLASS(amdgpu_dc_reg_template, *count = *count +1 ;
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h DECLARE_EVENT_CLASS(amdgpu_dc_reg_template, · line 64
Quoted 10 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h +2
-3), -TP_printk ("reg=0x%08lx, value=0x%08lx" , - (unsigned long )__entry->reg, - (unsigned long )__entry->value) +TP_printk ("reg=0x%08x, value=0x%08x" , + __entry->reg, __entry->value) ); DEFINE_EVENT(amdgpu_dc_reg_template, amdgpu_dc_rreg,
Regards,
Tvrtko
PATCH 7/8 drm/amd/display: copy function name into dcn_fpu trace event
In reply to Melissa WenUserspace trace tools that use libtraceevent to read binary buffer only see a kernel address when printing const char *. Use string macros in dcn_fpu to copy the function name into the trace event.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h +3 -3
@@ -637,20 +637,20 @@ TRACE_EVENT(dcn_fpu,TP_STRUCT__entry (__field (bool ,begin ) - __field(const char *, function) +__string (function, function)__field (int, line)__field (int, recursion_depth) ),TP_fast_assign ( __entry->begin = begin; - __entry->function = function; +__assign_str (function); __entry->line = line; __entry->recursion_depth = recursion_depth; ),TP_printk ("%s: recursion_depth: %d: %s()+%d:" , __entry->begin ?"begin" :"end" , __entry->recursion_depth, - __entry->function, +__get_str (function), __entry->line ) );
Signature · 1 line
2.53.0
Re: [PATCH 7/8] drm/amd/display: copy function name into dcn_fpu trace event
Quoted 29 lines · Melissa Wen
Userspace trace tools that use libtraceevent to read binary buffer only see a kernel address when printing const char *. Use string macros in
dcn_fputo copy the function name into the trace event.Fixes 96ee63730fa3 ("drm/amd/display: Add control mechanism for FPU")Assisted-by Claude:claude-opus-5-5Signed-off-by Melissa Wen <[email protected]>--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h +2
-2@@ -637,20 +637,20 @@ TRACE_EVENT(dcn_fpu,TP_STRUCT__entry (__field (bool ,begin ) - __field(const char *, function) +__string (function, function)__field (int, line)__field (int, recursion_depth) ),TP_fast_assign ( __entry->begin = begin; - __entry->function = function; +__assign_str (function); __entry->line = line;
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h TRACE_EVENT(dcn_fpu, · line 656
Quoted 10 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h +1
-1__entry->recursion_depth = recursion_depth; ),TP_printk ("%s: recursion_depth: %d: %s()+%d:" , __entry->begin ?"begin" :"end" , __entry->recursion_depth, - __entry->function, +__get_str (function), __entry->line ) );
The approach taken by TRACE_DCN_FPU is a bit over the top. Macro calling a function, calling a macro, calling a function.
Tracepoints are supposed to be ABI (said Linus, for better or worse) and tying kernel function names to ABI is a bad idea. Even line numbers. All very questionable IMO.
But as your patch fixes an obvious fail:
Regards,
Tvrtko
PATCH 8/8 drm/amd/display: copy function name into dcn_optc_lock_unlock_state trace event
In reply to Melissa WenUserspace trace tools that use libtraceevent to read binary buffer only see a kernel address when printing const char *. Use string macros in dcn_optc_lock_unlock_state to copy the function name into the trace event.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h +3 -3
@@ -660,7 +660,7 @@ TRACE_EVENT(dcn_optc_lock_unlock_state, TP_ARGS(optc_state, instance, lock, function, line),TP_STRUCT__entry ( -__field (const char *,function ) +__string (function ,function )__field (int, instance)__field (bool, lock) __field(int, line)
@@ -678,7 +678,7 @@ TRACE_EVENT(dcn_optc_lock_unlock_state,__field (int, vready_offset) ),TP_fast_assign ( - __entry->function = function; + __assign_str(function); __entry->instance = instance; __entry->lock = lock; __entry->line = line;
@@ -700,7 +700,7 @@ TRACE_EVENT(dcn_optc_lock_unlock_state,"min_v_blank_interlace=%d vstartup_start=%d vupdate_offset=%d vupdate_width=%d " "vready_offset=%d" , __entry->lock ?"Lock" :"Unlock" , - __entry->function, +__get_str (function), __entry->line, __entry->instance, __entry->opp_count,
Signature · 1 line
2.53.0
Re: [PATCH 8/8] drm/amd/display: copy function name into dcn_optc_lock_unlock_state trace event
Quoted 35 lines · Melissa Wen
Userspace trace tools that use libtraceevent to read binary buffer only see a kernel address when printing const char *. Use string macros in
dcn_optc_lock_unlock_stateto copy the function name into the trace event.Fixes f1943a51f0f9 ("drm/amd/display: Add events log to trace OPTC lock and unlock")Assisted-by Claude:claude-opus-5-5Signed-off-by Melissa Wen <[email protected]>--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h +2
-2@@ -660,7 +660,7 @@ TRACE_EVENT(dcn_optc_lock_unlock_state, TP_ARGS(optc_state, instance, lock, function, line),TP_STRUCT__entry ( -__field (const char *,function ) +__string (function ,function )__field (int, instance)__field (bool, lock) __field(int, line)@@ -678,7 +678,7 @@ TRACE_EVENT(dcn_optc_lock_unlock_state,__field (int, vready_offset) ),TP_fast_assign ( - __entry->function = function; + __assign_str(function); __entry->instance = instance; __entry->lock = lock; __entry->line = line;
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h TRACE_EVENT(dcn_optc_lock_unlock_state, · line 706
Quoted 8 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h +1
-1@@ -700,7 +700,7 @@ TRACE_EVENT(dcn_optc_lock_unlock_state,"min_v_blank_interlace=%d vstartup_start=%d vupdate_offset=%d vupdate_width=%d " "vready_offset=%d" , __entry->lock ?"Lock" :"Unlock" , - __entry->function, +__get_str (function), __entry->line, __entry->instance, __entry->opp_count,
Hmm this one does have the macro->function->macro->function trick unlike the previous patch so unless I am wrong function name and line number are always the same? Ie. it could be converted to two separate tracepoints and would just lose the (questionable) line number.
Regards,
Tvrtko
Li, Roman
Reviewed-byRE: [PATCH 8/8] drm/amd/display: copy function name into dcn_optc_lock_unlock_state trace event
Public
Quoted 63 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Tvrtko Ursulin
Sent: Friday, September 25, 2026 6:23 AM
To: Melissa Wen <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>; Pillai, Aurabindo <[email protected]>; Koenig, Christian <[email protected]>; Francis, David <[email protected]>; Wentland, Harry <[email protected]>; [email protected]; [email protected]; Li, Sun peng (Leo) <[email protected]>
Cc: [email protected]; [email protected]; linux- [email protected]
Subject: Re: [PATCH 8/8] drm/amd/display: copy function name intodcn_optc_lock_unlock_statetrace eventQuoted 37 lines · Melissa Wen
Userspace trace tools that use libtraceevent to read binary buffer only see a kernel address when printing const char *. Use string macros in
dcn_optc_lock_unlock_stateto copy the function name into the trace event.Fixes f1943a51f0f9 ("drm/amd/display: Add events log to trace OPTClock and unlock")
Assisted-by Claude:claude-opus-5-5Signed-off-by Melissa Wen <[email protected]>--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h +2
-2@@ -660,7 +660,7 @@ TRACE_EVENT(dcn_optc_lock_unlock_state, TP_ARGS(optc_state, instance, lock, function, line),TP_STRUCT__entry ( -__field (const char *,function ) +__string (function ,function )__field (int, instance)__field (bool, lock) __field(int, line)@@ -678,7 +678,7 @@ TRACE_EVENT(dcn_optc_lock_unlock_state,__field (int, vready_offset) ),TP_fast_assign ( - __entry->function = function; + __assign_str(function); __entry->instance = instance; __entry->lock = lock; __entry->line = line;drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h TRACE_EVENT(dcn_optc_lock_unlock_state, · line 700
Quoted 1 line
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h +0
-0@@ -700,7 +700,7 @@ TRACE_EVENT(dcn_optc_lock_unlock_state, "min_v_blank_interlace=%d vstartup_start=%dvupdate_offset=%d vupdate_width=%d "
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h TRACE_EVENT(dcn_optc_lock_unlock_state, · line 706
Quoted 7 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h +1
-1"vready_offset=%d" , __entry->lock ?"Lock" :"Unlock" , - __entry->function, +__get_str (function), __entry->line, __entry->instance, __entry->opp_count,
Quoted 8 lines
Hmm this one does have the
macro->function->macro->functiontrick unlike the previous patch so unless I am wrong function name and line number are always the same? Ie. it could be converted to two separate tracepoints and would just lose the (questionable) line number.Regards,
Tvrtko
Splitting the tracepoint and reconsidering the line number could be handled as a follow-up. This patch fixes function-name decoding in userspace while keeping the existing tracepoint. Thank you, Melissa and Tvrtko!
For all eight patches in this series: