All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philippe Gerum <rpm@xenomai.org>
To: Matthias Schneider <ma30002000@yahoo.de>,
	"xenomai@xenomai.org" <xenomai@xenomai.org>
Subject: Re: [Xenomai] FreeRTOS skin
Date: Tue, 06 May 2014 19:47:07 +0200	[thread overview]
Message-ID: <5369201B.1080108@xenomai.org> (raw)
In-Reply-To: <1399396759.65313.YahooMailNeo@web171604.mail.ir2.yahoo.com>

On 05/06/2014 07:19 PM, Matthias Schneider wrote:
>
> Are you referring to freertos_scheduler.sem? It is used to blocke the
> main thread while the "scheduer" is running. Even when moving the task
> cancellation loop to inside the vTaskEndScheduler(), vTaskStartScheduler()
> would still need to block until vTaskEndScheduler() is a
>

I mean you don't need a syncobj. This is overly complex for the purpose, 
you can use a sem_t. syncobj implements extended semantics we commonly 
find in RTOS, which are not available with regular POSIX ipc. But in 
this case, we don't need them: we just need to wait for a pulse, once.

>> - vTaskSuspendAll()/vTaskResumeAll() maintain useless status flags.
>> Copperplate provides __THREAD_S_SUSPENDED in the core status of threads
>> for the very same purpose.
>
> This is not entirely correct. Consider the following case (part of the demo
> actually):
>
> vTaskSuspendAll();
> vTaskSuspend(th1);
> vTaskResumeAll();
>
> This is supposed to leave th1 suspended after vTaskResumeAll(). This
> information needs to be stored somewhere. After vTaskSuspendAll(), all
> except the current thread have __THREAD_S_SUSPENDED set, so another way to
> store this informaion is needed. I have also experimented modelling these
> functions using threadobj_sched_lock() & co., however, even on UP machines
> the following code would not behave as supposed:
>
> vTaskSuspendAll();
> vTaskDelay(xGetTicksPerSecond() * 0.01);
> vTaskResumeAll();
>
> Obviously, during vTaskDelay() other tasks of lower than "sched" prio may
> be executed.

vTaskSuspendAll() very much looks like plain scheduler lock, preventing 
the caller from scheduling out on preemption. If so, then the whole 
issue disappears, there would not be any cumulative blocking states.

>
>> The other set of issues is all about locking is managed. A couple of hints:
>>
>> - vPortEnterCritical()/vPortExitCritical() can't be emulated since we
>> can't mask IRQs in userland (and we certainly don't want to even try
>> doing so). This would be a RTDM driver's business in the Xenomai model.
>> Looking at the FreeRTOS doc, the closest approximation would be
>> threadobj_sched_lock() in userland, but since hardware drivers should
>> move to kernel space over RTDM, I'm unsure emulating these calls has any
>> benefit in our context.
>
> Correct. I though I had seen use of it in the plateform-independent demo
> previously, but apparently I remember incorrectly. Defining them as empty
> functions thus.
>

I would rather not define them, to make sure the user knows about the 
issue when the compiler complains about it. Silently ignoring a hard 
critical section is unlikely to help.

-- 
Philippe.


  reply	other threads:[~2014-05-06 17:47 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-04 16:59 [Xenomai] FreeRTOS skin Matthias Schneider
2014-05-04 18:42 ` Gilles Chanteperdrix
2014-05-04 21:22   ` Matthias Schneider
2014-05-05  7:24     ` Philippe Gerum
2014-05-17 14:40     ` Matthias Schneider
2014-05-05 10:33 ` Philippe Gerum
2014-05-05 13:37   ` Philippe Gerum
2014-05-06  7:09     ` Matthias Schneider
2014-05-06  7:46       ` Philippe Gerum
2014-05-06  7:54         ` Philippe Gerum
2014-05-06 16:50         ` Matthias Schneider
2014-05-17 14:56           ` Matthias Schneider
2014-05-05 14:03   ` Gilles Chanteperdrix
2014-05-05 14:13     ` Philippe Gerum
2014-05-06 17:19   ` Matthias Schneider
2014-05-06 17:47     ` Philippe Gerum [this message]
2014-05-06 19:46       ` Matthias Schneider
2014-05-18 18:30   ` Matthias Schneider
2014-05-19  7:46     ` Philippe Gerum
2014-05-20  7:06       ` Matthias Schneider
2014-05-20  7:53         ` Philippe Gerum

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5369201B.1080108@xenomai.org \
    --to=rpm@xenomai.org \
    --cc=ma30002000@yahoo.de \
    --cc=xenomai@xenomai.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.