syslog_inbuffer:Fixed the lock reentry issue in single core + spinlock scenario
Summary: When spinlock.h is enabled in a single-core scenario, spinlock reentry and exceptions may occur when spin_lock_irqsave_wo_note is used in syslog_add_intbuffer Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
This commit is contained in:
parent
ad7198069d
commit
3b6f463ce2
1 changed files with 4 additions and 4 deletions
|
|
@ -104,8 +104,6 @@ static void syslog_flush_internal(bool force, size_t buflen)
|
|||
* concurrent modification by other tasks.
|
||||
*/
|
||||
|
||||
flags = spin_lock_irqsave_wo_note(&g_syslog_intbuffer.splock);
|
||||
|
||||
do
|
||||
{
|
||||
buffer = circbuf_get_readptr(&g_syslog_intbuffer.circ, &size);
|
||||
|
|
@ -118,8 +116,6 @@ static void syslog_flush_internal(bool force, size_t buflen)
|
|||
}
|
||||
}
|
||||
while (size > 0 && buflen > 0);
|
||||
|
||||
spin_unlock_irqrestore_wo_note(&g_syslog_intbuffer.splock, flags);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
|
@ -201,7 +197,11 @@ void syslog_add_intbuffer(FAR const char *buffer, size_t buflen)
|
|||
|
||||
void syslog_flush_intbuffer(bool force)
|
||||
{
|
||||
irqstate_t flags;
|
||||
|
||||
flags = spin_lock_irqsave_wo_note(&g_syslog_intbuffer.splock);
|
||||
syslog_flush_internal(force, sizeof(g_syslog_intbuffer.buffer));
|
||||
spin_unlock_irqrestore_wo_note(&g_syslog_intbuffer.splock, flags);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_SYSLOG_INTBUFFER */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue