|
From: | Jonathan Larmour |
Subject: | Re: [lwip-users] Bug in pbuf.c regarding PBUF_POOL |
Date: | Sun, 12 Nov 2006 01:43:57 +0000 |
User-agent: | Mozilla Thunderbird 1.0.8-1.1.fc3.4.legacy (X11/20060515) |
Leon Woestenberg wrote:
Hello all, this is very late reply. On Sun, 2006-10-22 at 07:44 +0100, Kieran Mansley wrote:On Fri, Oct 20, 2006 at 11:37:23PM +0100, Jonathan Larmour wrote:With the current code, I think the only solution is SYS_LIGHTWEIGHT_PROT. My opinion is that the !SYS_LIGHTWEIGHT_PROT stuff should probably just be removed.Thanks for the detailed post - good to see folks getting to grips with the stack. The above seemed to summarise quite nicely and I agree completely with that.I completely agree with you; It's good to see there is interest in the lwIP stack from developers that are concerned abouts its correctness. The SYS_LIGHTWEIGHT_PROT protection was introduced by one of the developers using the stack to protect *ONLY* between interrupt context and single-thread user-space context if I am not mistaken. I am all for removing it, because the locking solution does not scale across different platforms.
I was actually arguing the other way round I'm afraid :-). I was arguing that it looks to me that SYS_LIGHTWEIGHT_PROT is essentially mandatory because packets arrive asynchronously and so pbuf allocation needs to have some protection no matter what since the allocation will take place from a device driver. That would be true whatever the context, or whether single or multi-threaded.
The !SYS_LIGHTWEIGHT_PROT code simply doesn't give any thread or interrupt safety at all. So in fact the !SYS_LIGHTWEIGHT_PROT code does not appear to solve the problem it seems intended to solve. Hence me saying that that code should be removed entirely since as far as I can tell it doesn't achieve anything. If protection is needed, something using SYS_LIGHTWEIGHT_PROT is the solution.
Jifl -- eCosCentric http://www.eCosCentric.com/ The eCos and RedBoot experts ------["The best things in life aren't things."]------ Opinions==mine
[Prev in Thread] | Current Thread | [Next in Thread] |