Skip to content

Commit a218424

Browse files
author
Jyri Sarha
committed
debug_stream: text_msg: throttle repeated assert prints
Add a temporary per-CPU assert counter in assert_print() to limit duplicate assert messages after an exception dump. This works around cases where reports_sent_cpu[] alone does not suppress late assert prints. Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
1 parent b282d15 commit a218424

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/debug/debug_stream/debug_stream_text_msg.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ static void ds_exception_drain(bool flush)
7878
if (reports_sent_cpu[cpu] > 0)
7979
return;
8080

81+
8182
ds_buf[cpu].msg.hdr.id = DEBUG_STREAM_RECORD_ID_TEXT_MSG;
8283
ds_buf[cpu].msg.hdr.size_words =
8384
SOF_DIV_ROUND_UP(sizeof(ds_buf[cpu].msg) + ds_pos[cpu],
@@ -144,14 +145,17 @@ static int init_exception_dump_hook(void)
144145
SYS_INIT(init_exception_dump_hook, APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
145146

146147
#if defined(CONFIG_SOF_DEBUG_STREAM_TEXT_MSG_ASSERT_PRINT)
147-
148+
static int assert_count_cpu[CONFIG_MP_MAX_NUM_CPUS];
148149
void assert_print(const char *fmt, ...)
149150
{
150151
va_list ap;
151152

152153
/* Do not print assert after exception has been dumped */
153154
if (reports_sent_cpu[arch_proc_id()] > 0)
154155
return;
156+
/* For unknown reason the above does not work, and there is assert prints after dump */
157+
if (assert_count_cpu[arch_proc_id()]++ > 2)
158+
return;
155159

156160
va_start(ap, fmt);
157161

0 commit comments

Comments
 (0)