[Xenomai-git] Philippe Gerum : lib/copperplate: prevent unwanted mode switch during thread prologue

2017-05-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: cc4ecb09efd530248d11910db1626d83bbb143b8
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=cc4ecb09efd530248d11910db1626d83bbb143b8

Author: Philippe Gerum 
Date:   Tue May 16 11:12:57 2017 +0200

lib/copperplate: prevent unwanted mode switch during thread prologue

copperplate_renice_local_thread() causes a switch to secondary mode
for an emerging thread context, we want it to happen before such
thread handshakes with its parent, so that the later is released only
after the child is waiting in primary mode on the start barrier.

e.g.

tA(prio=10) creates tB(prio=5), tC(prio=7), then starts them in that
order. The proper scheduling sequence must be: tA -> tC -> tB.

See http://xenomai.org/pipermail/xenomai/2017-May/037311.html for more
details.

---

 lib/copperplate/internal.c |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/copperplate/internal.c b/lib/copperplate/internal.c
index 2549ab0..1d96526 100644
--- a/lib/copperplate/internal.c
+++ b/lib/copperplate/internal.c
@@ -239,14 +239,14 @@ static void *thread_trampoline(void *arg)
 * with the cleanup code the client may run whenever
 * copperplate_create_thread() fails.
 */
-   prepare_wait_corespec();
-   __RT(sem_post(>__reserved.warm));
-   thread_spawn_wait();
-   __RT(sem_destroy());
ret = __bt(copperplate_renice_local_thread(pthread_self(),
   _cta.policy, &_cta.param_ex));
if (ret)
warning("cannot renice core thread, %s", symerror(ret));
+   prepare_wait_corespec();
+   __RT(sem_post(>__reserved.warm));
+   thread_spawn_wait();
+   __RT(sem_destroy());
 
return _cta.run(_cta.arg);
 fail:


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : lib/copperplate: prevent unwanted mode switch during thread prologue

2017-05-16 Thread git repository hosting
Module: xenomai-3
Branch: stable-3.0.x
Commit: cc4ecb09efd530248d11910db1626d83bbb143b8
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=cc4ecb09efd530248d11910db1626d83bbb143b8

Author: Philippe Gerum 
Date:   Tue May 16 11:12:57 2017 +0200

lib/copperplate: prevent unwanted mode switch during thread prologue

copperplate_renice_local_thread() causes a switch to secondary mode
for an emerging thread context, we want it to happen before such
thread handshakes with its parent, so that the later is released only
after the child is waiting in primary mode on the start barrier.

e.g.

tA(prio=10) creates tB(prio=5), tC(prio=7), then starts them in that
order. The proper scheduling sequence must be: tA -> tC -> tB.

See http://xenomai.org/pipermail/xenomai/2017-May/037311.html for more
details.

---

 lib/copperplate/internal.c |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/copperplate/internal.c b/lib/copperplate/internal.c
index 2549ab0..1d96526 100644
--- a/lib/copperplate/internal.c
+++ b/lib/copperplate/internal.c
@@ -239,14 +239,14 @@ static void *thread_trampoline(void *arg)
 * with the cleanup code the client may run whenever
 * copperplate_create_thread() fails.
 */
-   prepare_wait_corespec();
-   __RT(sem_post(>__reserved.warm));
-   thread_spawn_wait();
-   __RT(sem_destroy());
ret = __bt(copperplate_renice_local_thread(pthread_self(),
   _cta.policy, &_cta.param_ex));
if (ret)
warning("cannot renice core thread, %s", symerror(ret));
+   prepare_wait_corespec();
+   __RT(sem_post(>__reserved.warm));
+   thread_spawn_wait();
+   __RT(sem_destroy());
 
return _cta.run(_cta.arg);
 fail:


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git