lwip-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-devel] possible issue in sockets.c


From: Simon Goldschmidt
Subject: Re: [lwip-devel] possible issue in sockets.c
Date: Fri, 24 Jan 2014 15:07:01 +0100 (CET)

Albert Huitsing wrote:
> as far as I understand things correctly then (note I'm on ARM / FreeRTOS)
> 1) SYS_ARCH_UNPROTECT() will call taskENTER_CRITICAL() and block IRQs -> blocking pre-emptive task switching. But this has no consequence for
> the SWI instruction on ARM:
 
I'm on embOS/Cortex-M and this one blocks the scheduler (in addition to blocking interrupts) while in a critical region.
 
During a quick scan through the lwip code, I couldn't find the same situation again: every time
SYS_ARCH_PROTECT() / SYS_ARCH_UNPROTECT() is called there is only plain vanilla code in-between
> (i.e.: no calls to RTOS functions) which strongs my belief that this *really* is a bug inside sockets.c only!
 
That would mainly be because the core code doesn't use threads and the socket layer is one of the only files using multithreading.
 
I think I remember that we had a bug exactly along these lines some time, so I'm not at all enthusiastic about changing it again. I suggest having a look in the file's history if it wasn't as you suggested.
 
Anyway, the fix is easy: just block your scheduler in SYS_ARCH_UNPROTECT(). I'll stick to "it's a bug in the FreeRTOS/lwIP port", even if it triggers nowhere else :-)
 
 
Simon
 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]