Module: xenomai-3
Branch: arm64
Commit: 587fc2649724f0ff519a4f75244148898ae85da7
URL:    
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=587fc2649724f0ff519a4f75244148898ae85da7

Author: Gilles Chanteperdrix <gilles.chanteperd...@xenomai.org>
Date:   Fri Oct 16 11:27:39 2015 +0200

cobalt/sched: avoid leaking the reschedule bit

handle_setaffinity_event ends up calling migrate_thread() which sets
the rescheduling bit. However, since this happens for a passive
migration, xnsched_run() is not called, and the reschedule bit
remains. This causes remote notifications to not send an IPI, and
delay them until the system calls xnsched_run() for another reason.

Fix this by setting the reschedule bit in xnsched_migrate_passive() only
if the thread blockbits are not set.

---

 kernel/cobalt/sched.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/kernel/cobalt/sched.c b/kernel/cobalt/sched.c
index 792bb80..fab0d7c 100644
--- a/kernel/cobalt/sched.c
+++ b/kernel/cobalt/sched.c
@@ -481,7 +481,6 @@ static void migrate_thread(struct xnthread *thread, struct 
xnsched *sched)
         * WARNING: the scheduling class may have just changed as a
         * result of calling the per-class migration hook.
         */
-       xnsched_set_resched(thread->sched);
        thread->sched = sched;
 }
 
@@ -491,6 +490,7 @@ static void migrate_thread(struct xnthread *thread, struct 
xnsched *sched)
  */
 void xnsched_migrate(struct xnthread *thread, struct xnsched *sched)
 {
+       xnsched_set_resched(thread->sched);
        migrate_thread(thread, sched);
 
 #ifdef CONFIG_XENO_ARCH_UNLOCKED_SWITCH
@@ -511,11 +511,14 @@ void xnsched_migrate(struct xnthread *thread, struct 
xnsched *sched)
  */
 void xnsched_migrate_passive(struct xnthread *thread, struct xnsched *sched)
 {
+       struct xnsched *last_sched = thread->sched;
+
        migrate_thread(thread, sched);
 
        if (!xnthread_test_state(thread, XNTHREAD_BLOCK_BITS)) {
                xnsched_requeue(thread);
                xnthread_set_state(thread, XNREADY);
+               xnsched_set_resched(last_sched);
        }
 }
 


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://xenomai.org/mailman/listinfo/xenomai-git

Reply via email to