drm/amd/display: Don't call dm_log_to_buffer directly in dc_conn_log
Subsystems (3)
PATCH 1/1 drm/amd/display: Don't call dm_log_to_buffer directly in dc_conn_log
From: Michel Dänzer <[email protected]>
dm_log_to_buffer logs unconditionally, so calling it directly resulted in the main message being logged even when the event type isn't enabled in the event mask.
To fix this, remove the trailing newline from the format string and call dm_logger_append instead.
Fixes spurious messages like
[drm] {1920x1200, 2080x1235@154000Khz}
in dmesg when a mode is set.
--- drivers/gpu/drm/amd/display/dc/basics/log_helpers.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/display/dc/basics/log_helpers.c +9 -11
@@ -60,6 +60,8 @@ void dc_conn_log(struct dc_context *ctx,va_list args;struct log_entry entry = {0 };enum signal_type signal; +char *msg_no_newline = (char *)msg; +size_t msg_len =strlen (msg) -1 ;if (link->local_sink) signal = link->local_sink->sink_signal;
@@ -79,17 +81,15 @@ void dc_conn_log(struct dc_context *ctx, signal_type_info_tbl[i].name, link->link_index); -va_start (args, msg); - entry.buf_offset +=dm_log_to_buffer ( - &entry.buf[entry.buf_offset], -LOG_MAX_LINE_SIZE - entry.buf_offset, - msg, args); - -if (entry.buf[strlen (entry.buf) -1 ] =='\n' ) { - entry.buf[strlen (entry.buf) -1 ] ='\0' ; - entry.buf_offset--; +if (msg[msg_len] =='\n' ) { + msg_no_newline =kstrdup (msg,GFP_KERNEL ); + msg_no_newline[msg_len] ='\0' ; } +dm_logger_append (&entry, msg_no_newline, args); +if (msg_no_newline != msg) +kfree (msg_no_newline); +if (hex_data)for (i =0 ; i < hex_data_count; i++)dm_logger_append (&entry,"%2.2X " , hex_data[i]);
@@ -97,6 +97,4 @@ void dc_conn_log(struct dc_context *ctx,dm_logger_append (&entry,"^\n" );dm_helpers_dc_conn_log (ctx, &entry, event);dm_logger_close (&entry); - -va_end (args); }
Signature · 6 lines
2.15.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 20171123115109.2177-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org
Harry Wentland
Reviewed-byQuoted 9 lines · Michel Dänzer
From: Michel Dänzer <[email protected]>
dm_log_to_bufferlogs unconditionally, so calling it directly resulted in the main message being logged even when the event type isn't enabled in the event mask.To fix this, remove the trailing newline from the format string and call
dm_logger_appendinstead.
Quoted 7 lines
Fixes spurious messages like
[drm] {1920x1200, 2080x1235@154000Khz}
in dmesg when a mode is set.
Signed-off-by Michel Dänzer <[email protected]>
Thanks for catching and fixing this. I missed this when eye-balling the code yesterday.
Harry
Quoted 44 lines
--- drivers/gpu/drm/amd/display/dc/basics/log_helpers.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-)drivers/gpu/drm/amd/display/dc/basics/log_helpers.c +9
-9@@ -60,6 +60,8 @@ void dc_conn_log(struct dc_context *ctx,va_list args;struct log_entry entry = {0 };enum signal_type signal; +char *msg_no_newline = (char *)msg; +size_t msg_len =strlen (msg) -1 ;if (link->local_sink) signal = link->local_sink->sink_signal;@@ -79,17 +81,15 @@ void dc_conn_log(struct dc_context *ctx, signal_type_info_tbl[i].name, link->link_index); -va_start (args, msg); - entry.buf_offset +=dm_log_to_buffer ( - &entry.buf[entry.buf_offset], -LOG_MAX_LINE_SIZE - entry.buf_offset, - msg, args); - -if (entry.buf[strlen (entry.buf) -1 ] =='\n' ) { - entry.buf[strlen (entry.buf) -1 ] ='\0' ; - entry.buf_offset--; +if (msg[msg_len] =='\n' ) { + msg_no_newline =kstrdup (msg,GFP_KERNEL ); + msg_no_newline[msg_len] ='\0' ; } +dm_logger_append (&entry, msg_no_newline, args); +if (msg_no_newline != msg) +kfree (msg_no_newline); +if (hex_data)for (i =0 ; i < hex_data_count; i++)dm_logger_append (&entry,"%2.2X " , hex_data[i]);
drivers/gpu/drm/amd/display/dc/basics/log_helpers.c void dc_conn_log(struct dc_context *ctx, · line 100
Quoted 6 lines
drivers/gpu/drm/amd/display/dc/basics/log_helpers.c +0
-2@@ -97,6 +97,4 @@ void dc_conn_log(struct dc_context *ctx,dm_logger_append (&entry,"^\n" );dm_helpers_dc_conn_log (ctx, &entry, event);dm_logger_close (&entry); - -va_end (args); }
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 1/2 drm/amd/display: Add dm_logger_append_va API
In reply to a message not in the archiveFrom: Michel Dänzer <[email protected]>
Same as dm_logger_append, except it takes a va_list instead of a variable number of arguments. dm_logger_append is now a minimal wrapper around dm_logger_append_va.
--- drivers/gpu/drm/amd/display/dc/basics/logger.c | 17 ++++++++++++----- drivers/gpu/drm/amd/display/include/logger_interface.h | 5 +++++ 2 files changed, 17 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/display/dc/basics/logger.c +12 -5
@@ -311,6 +311,18 @@ void dm_logger_append(struct log_entry *entry, const char *msg, ...) +{ + va_list args; + +va_start (args, msg); +dm_logger_append_va (entry, msg, args); +va_end (args); +} + +void dm_logger_append_va ( +struct log_entry *entry, +const char *msg, +va_list args) {struct dal_logger *logger;
@@ -325,11 +337,8 @@ void dm_logger_append( dal_logger_should_log(logger, entry->type)) {uint32_t size; -va_list args;char buffer[LOG_MAX_LINE_SIZE ]; -va_start (args, msg); - size =dm_log_to_buffer ( buffer,LOG_MAX_LINE_SIZE , msg, args);
@@ -338,8 +347,6 @@ void dm_logger_append( }else {append_entry (entry,"LOG_ERROR, line too long\n" ,27 ); } - -va_end (args); } }
drivers/gpu/drm/amd/display/include/logger_interface.h +5 -0
@@ -57,6 +57,11 @@ void dm_logger_append( const char *msg, ...); +void dm_logger_append_va ( +struct log_entry *entry, +const char *msg, +va_list args); + void dm_logger_open( struct dal_logger *logger, struct log_entry *entry,
Signature · 6 lines
2.15.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 20171123174834.10773-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org
PATCH v2 2/2 drm/amd/display: Don't call dm_log_to_buffer directly in dc_conn_log
From: Michel Dänzer <[email protected]>
dm_log_to_buffer logs unconditionally, so calling it directly resulted in the main message being logged even when the event type isn't enabled in the event mask.
To fix this, use the new dm_logger_append_va API.
Fixes spurious messages like
[drm] {1920x1200, 2080x1235@154000Khz}
in dmesg when a mode is set.
v2:
* Use new dm_logger_append_va API, fixes incorrect va_list usage in v1
* Just use and decrease entry.buf_offset to get rid of the trailing newline
--- drivers/gpu/drm/amd/display/dc/basics/log_helpers.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/display/dc/basics/log_helpers.c +3 -7
@@ -80,15 +80,11 @@ void dc_conn_log(struct dc_context *ctx, link->link_index);va_start (args, msg); - entry.buf_offset +=dm_log_to_buffer ( - &entry.buf[entry.buf_offset], -LOG_MAX_LINE_SIZE - entry.buf_offset, - msg, args); +dm_logger_append_va (&entry, msg, args); -if (entry.buf[strlen (entry.buf) -1 ] =='\n' ) { - entry.buf[strlen (entry.buf) -1 ] ='\0' ; +if (entry.buf_offset >0 && + entry.buf[entry.buf_offset -1 ] =='\n' ) entry.buf_offset--; - }if (hex_data)for (i =0 ; i < hex_data_count; i++)
Signature · 6 lines
2.15.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 20171123174834.10773-2-michel-otUistvHUpPR7s880joybQ@public.gmane.org
Ping on this series.
This patch is v2 of a previously single patch, which was reviewed by Harry.
Quoted 48 lines · Michel Dänzer
From: Michel Dänzer <[email protected]>
dm_log_to_bufferlogs unconditionally, so calling it directly resulted in the main message being logged even when the event type isn't enabled in the event mask.To fix this, use the new
dm_logger_append_vaAPI.Fixes spurious messages like
[drm] {1920x1200, 2080x1235@154000Khz}
in dmesg when a mode is set.
v2:
* Use newdm_logger_append_vaAPI, fixes incorrectva_listusage in v1
* Just use and decrease entry.buf_offset to get rid of the trailing newlineSigned-off-by Michel Dänzer <[email protected]>--- drivers/gpu/drm/amd/display/dc/basics/log_helpers.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)drivers/gpu/drm/amd/display/dc/basics/log_helpers.c +3
-7@@ -80,15 +80,11 @@ void dc_conn_log(struct dc_context *ctx, link->link_index);va_start (args, msg); - entry.buf_offset +=dm_log_to_buffer ( - &entry.buf[entry.buf_offset], -LOG_MAX_LINE_SIZE - entry.buf_offset, - msg, args); +dm_logger_append_va (&entry, msg, args); -if (entry.buf[strlen (entry.buf) -1 ] =='\n' ) { - entry.buf[strlen (entry.buf) -1 ] ='\0' ; +if (entry.buf_offset >0 && + entry.buf[entry.buf_offset -1 ] =='\n' ) entry.buf_offset--; - }if (hex_data)for (i =0 ; i < hex_data_count; i++)
Signature · 6 lines
Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 3934c254-a037-8d37-b84b-ca5a616b3693-otUistvHUpPR7s880joybQ@public.gmane.org
Alex Deucher
Reviewed-byQuoted 6 lines · Michel Dänzer
Ping on this series.
This patch is v2 of a previously single patch, which was reviewed by Harry.
Series is:
Quoted 46 lines · Michel Dänzer
Quoted 45 lines
From: Michel Dänzer <[email protected]>
dm_log_to_bufferlogs unconditionally, so calling it directly resulted in the main message being logged even when the event type isn't enabled in the event mask.To fix this, use the new
dm_logger_append_vaAPI.Fixes spurious messages like
[drm] {1920x1200, 2080x1235@154000Khz}
in dmesg when a mode is set.
v2:
* Use newdm_logger_append_vaAPI, fixes incorrectva_listusage in v1
* Just use and decrease entry.buf_offset to get rid of the trailing newlineSigned-off-by Michel Dänzer <[email protected]>--- drivers/gpu/drm/amd/display/dc/basics/log_helpers.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)drivers/gpu/drm/amd/display/dc/basics/log_helpers.c +3
-7@@ -80,15 +80,11 @@ void dc_conn_log(struct dc_context *ctx, link->link_index);va_start (args, msg); - entry.buf_offset +=dm_log_to_buffer ( - &entry.buf[entry.buf_offset], -LOG_MAX_LINE_SIZE - entry.buf_offset, - msg, args); +dm_logger_append_va (&entry, msg, args); -if (entry.buf[strlen (entry.buf) -1 ] =='\n' ) { - entry.buf[strlen (entry.buf) -1 ] ='\0' ; +if (entry.buf_offset >0 && + entry.buf[entry.buf_offset -1 ] =='\n' ) entry.buf_offset--; - }
Quoted 12 lines
drivers/gpu/drm/amd/display/dc/basics/log_helpers.c void dc_conn_log(struct dc_context *ctx, · line 90
Quoted 3 lines
drivers/gpu/drm/amd/display/dc/basics/log_helpers.c +0
-0if (hex_data)for (i =0 ; i < hex_data_count; i++)--
Earthling Michel Dänzer | http://www.amd.com
Libre software enthusiast | Mesa and X developer
_______________________________________________
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