[PATCH 11/12] cpukit/libblock: Workaround SMP problem in bdbuf
Gedare Bloom
gedare at rtems.org
Thu May 29 13:14:15 UTC 2014
On Tue, May 27, 2014 at 11:29 AM, Sebastian Huber
<sebastian.huber at embedded-brains.de> wrote:
> On 2014-05-27 17:21, Gedare Bloom wrote:
>>
>> On Tue, May 27, 2014 at 10:48 AM, Ralf Kirchner
>> <ralf.kirchner at embedded-brains.de> wrote:
>>>
>>> >Enabling and disabling preemption as done for single core will not work
>>> > for SMP.
>>> >Thus as a temporary workaround use POSIX mutexes and POSIX condition
>>> > variables for SMP instead of the combination of semaphores and preemption
>>> > handling used for single core.
>>> >---
>>> > cpukit/libblock/src/bdbuf.c | 348
>>> > +++++++++++++++++++++++++++++++++++--------
>>> > 1 Datei geändert, 282 Zeilen hinzugefügt(+), 66 Zeilen entfernt(-)
>>> >
>>> >diff --git a/cpukit/libblock/src/bdbuf.c b/cpukit/libblock/src/bdbuf.c
>>> >index 1e4887c..0caf8f5 100644
>>> >--- a/cpukit/libblock/src/bdbuf.c
>>> >+++ b/cpukit/libblock/src/bdbuf.c
>>> >@@ -43,6 +43,23 @@
>>> >
>>> > #include "rtems/bdbuf.h"
>>> >
>>> >+#if defined( RTEMS_SMP )
>>> >+ #if defined( RTEMS_POSIX_API )
>>> >+ /* The single core implementation with enabling and disabling
>>> > preemption
>>> >+ * will not work under SMP. Thus we need to use POSIX mutexes and
>>> > POSIX
>>> >+ * condition variables as a workaround
>>> >+ * Required POSIX mutexes and POSIX condition variables will be
>>> > allocated
>>> >+ * automatically in confdefs.h if RTEMS_SMP and RTEMS_POSIX_API
>>> >+ * are #defined
>>> >+ */
>>> >+ #define RTEMS_BDBUF_SMP_WORKAROUND
>>
>> Workaround implies a temporary solution. Is there a longer-term
>> solution in the works? Otherwise, we should just condition this on
>> RTEMS_SMP?
>
>
> We need condition variables in the Classic API.
>
>
Is it OK and feasible to require POSIX and use posix condition
variables for applications that use the bdbuf? If so, I think this
would be better than the workaround that splits the code in these two
cases, and probably the SMP and non-SMP can share most code then?
-Gedare
>>
>> What if RTEMS_SMP is defined, but RTEMS_POSIX_API is not? This would
>> be an error here I suppose? Or possibly elsewhere in the bdbuf
>> workaround code? Probably it should be accounted in confdefs.h and an
>> error emitted?
>>
>
> RTEMS_SMP without RTEMS_POSIX_API falls back to the current situation. You
> get a fatal error at run-time. A compile-time error is bad, since this
> would break the test suite build.
>
> --
> Sebastian Huber, embedded brains GmbH
>
> Address : Dornierstr. 4, D-82178 Puchheim, Germany
> Phone : +49 89 189 47 41-16
> Fax : +49 89 189 47 41-09
> E-Mail : sebastian.huber at embedded-brains.de
> PGP : Public key available on request.
>
> Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
>
> _______________________________________________
> rtems-devel mailing list
> rtems-devel at rtems.org
> http://www.rtems.org/mailman/listinfo/rtems-devel
More information about the devel
mailing list