[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-devel] RFC: SYS_ARCH_DECL_PROTECT makes no sense, remove it
From: |
pgraf |
Subject: |
Re: [lwip-devel] RFC: SYS_ARCH_DECL_PROTECT makes no sense, remove it |
Date: |
Thu, 06 May 2004 09:49:44 -0000 |
Leon Woestenberg wrote:
> the SYS_ARCH_DECL_PROTECT protection mechanism makes
> no sense to me. It never did.
>
> It protects pbuf->ref count against concurrent read-write-modify
> actions, alright.
>
> But as the rest of the pbuf fields and code is not protected against
concurrent use (let alone the rest of the lwIP core) I see no real
> world use of it.
>
> RFC: Remove this from the stack.
I use lwIP with the multitasking / sockets API on a preemptive
multitasking OS, and handle ethernet by a high-priority task which wakes
up by an interrupt service routine. For me, SYS_ARCH_PROTECT() disables
interrupts of a certain level and thereby prevents any task switch. I
allocate pbufs within the high-priority task (can preempt other tasks),
and need the according allocation routines protected. I concurrently run a
webserver, browser and email client under multitasking conditions on lwIP.
That wasn't stable before, but is, exactly since the introduction of the
SYS_ARCH_PROTECT mechanims (except for a few bugs :-). And BTW
SYS_ARCH_PROTECT allows for less CPU overhead than semaphores used for
region protection.
I'd be glad if this valuable mechanism is kept, otherwise it'll become
hard for me to stick with an up-to-date lwIP codebase.
BTW I wonder how much it hurts users of the sockets API that some pbuf
code and the lwIP core is not protected against concurrent use. The
sequential API and the sockets layer seem to do most of the job (but I
have forgot the details).
All the best
Peter