[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-users] CORE_LOCKING
From: |
Simon Goldschmidt |
Subject: |
Re: [lwip-users] CORE_LOCKING |
Date: |
Fri, 15 Jul 2011 11:26:07 +0200 |
Kieran Mansley <address@hidden> wrote:
> > As far as I can tell, there would not be any actual code changes in lwIP
> > to support individual configuration of CORE_LOCKING.
> > All that is needed is:
> > Replace "LWIP_TCPIP_CORE_LOCKING" with "LWIP_TCPIP_CORE_LOCKING_NETCONN"
> > in all netconn files.
> > Replace "LWIP_TCPIP_CORE_LOCKING" with "LWIP_TCPIP_CORE_LOCKING_SOCKET"
> > in all socket files.
> > Replace "LWIP_TCPIP_CORE_LOCKING" with
> > "LWIP_TCPIP_CORE_LOCKING_NETIFAPI" in all netif files.
>
> I would be (pleasantly) surprised if that was all that was needed.
> Wouldn't there be problems if for example the netconn API was configured
> to use core locking, but another task was using the raw API and it had
> not been configured to use core locking?
Technically, it should work: the task that does not use core locking uses
message passing: it passes a message to the tcpip_thread to process. Before the
tcpip_thread processes the message, it locks the core and thus waits for other
threads to unlock it.
However, from the coding point of view, I'd be surprised, too, if the above
changes would be enough to make it work. I guess we would need some more
ifdef'ed defines since some macros are changed based on core locking mode. It
can be done, but it requires work. Being like that, I'd rather fix things that
don't work instead of adding these defines.
One main question I have here is: why do people want to use core locking? The
benefits I see are priority inversion (as one locking mutex is used instead of
multiple "message-passing" mutexes) and speed (no task change). Anything else?
BTW, I'd very much favour cleaning up the existing sockets.c to NOT use the raw
API directly when core locking is enabled. That would mean getting slower, but
getting much cleaner code. Using the raw API directly should be implemented in
a new socket implementation if we really need that speed.
Oh, and I can't tell you anything on stability of the core locking code,
either, as a) I don't use it in a production environment and b) we don't get
that many reports from users using it.
Simon
--
Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir
belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de
Re: [lwip-users] CORE_LOCKING, timmy brolin, 2011/07/17