From e3f23b5bcacddc1b7c8bd78980db0dd4ebeeac03 Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Fri, 9 Nov 2018 08:39:26 -0600 Subject: [PATCH] drivers/syslog/syslog_putc.c: call sc_force in idle task even interrupt buffer enabled. The following cases may hang randomly in the bring up phase: (1) boot up process and (2) suspend/resume process. Either case runs in the idle task context, so it's difficult to debug the hang issue if these output go through the interrupt buffer. --- drivers/syslog/syslog_putc.c | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/drivers/syslog/syslog_putc.c b/drivers/syslog/syslog_putc.c index 3f19b6c005..437508c24a 100644 --- a/drivers/syslog/syslog_putc.c +++ b/drivers/syslog/syslog_putc.c @@ -77,21 +77,26 @@ int syslog_putc(int ch) if (up_interrupt_context() || sched_idletask()) { #if defined(CONFIG_SYSLOG_INTBUFFER) - /* Buffer the character in the interrupt buffer. The interrupt buffer - * will be flushed before the next normal, non-interrupt SYSLOG output. - */ + if (up_interrupt_context()) + { + /* Buffer the character in the interrupt buffer. The interrupt buffer + * will be flushed before the next normal, non-interrupt SYSLOG output. + */ - return syslog_add_intbuffer(ch); -#else - /* Force the character to the SYSLOG device immediately (if possible). - * This means that the interrupt data may not be in synchronization - * with output data that may have been buffered by sc_putc(). - */ - - DEBUGASSERT(g_syslog_channel->sc_force != NULL); - - return g_syslog_channel->sc_force(ch); + return syslog_add_intbuffer(ch); + } + else #endif + { + /* Force the character to the SYSLOG device immediately (if possible). + * This means that the interrupt data may not be in synchronization + * with output data that may have been buffered by sc_putc(). + */ + + DEBUGASSERT(g_syslog_channel->sc_force != NULL); + + return g_syslog_channel->sc_force(ch); + } } else {