Module: xenomai-3 Branch: next Commit: f93cfb92f306d52d5274f6442d530c285b04ea3d URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=f93cfb92f306d52d5274f6442d530c285b04ea3d
Author: Philippe Gerum <r...@xenomai.org> Date: Sun Oct 29 18:09:21 2017 +0100 cobalt/sched: drop obsolete, broken xnthread_migrate() call Migrating a Cobalt thread to a different CPU _must_ go through the regular set_cpus_allowed*() interface. xnthread_migrate() cannot work with the 3.x architecture, and only worked with pure kernel-based threads on 2.x. Let's drop the confusing routine. --- include/cobalt/kernel/thread.h | 6 ---- kernel/cobalt/sched.c | 2 +- kernel/cobalt/thread.c | 76 ---------------------------------------- 3 files changed, 1 insertion(+), 83 deletions(-) diff --git a/include/cobalt/kernel/thread.h b/include/cobalt/kernel/thread.h index 1d904cd..f1f06ff 100644 --- a/include/cobalt/kernel/thread.h +++ b/include/cobalt/kernel/thread.h @@ -534,17 +534,11 @@ static inline void xnthread_commit_ceiling(struct xnthread *curr) } #ifdef CONFIG_SMP -int xnthread_migrate(int cpu); void xnthread_migrate_passive(struct xnthread *thread, struct xnsched *sched); #else -static inline int xnthread_migrate(int cpu) -{ - return cpu ? -EINVAL : 0; -} - static inline void xnthread_migrate_passive(struct xnthread *thread, struct xnsched *sched) { } diff --git a/kernel/cobalt/sched.c b/kernel/cobalt/sched.c index e6b3875..8d0432f 100644 --- a/kernel/cobalt/sched.c +++ b/kernel/cobalt/sched.c @@ -310,7 +310,7 @@ struct xnsched *xnsched_finish_unlocked_switch(struct xnsched *sched) last = sched->last; sched->status &= ~XNINSW; - /* Detect a thread which called xnthread_migrate() */ + /* Detect a thread which has migrated. */ if (last->sched != sched) { xnsched_putback(last); xnthread_clear_state(last, XNMIGRATE); diff --git a/kernel/cobalt/thread.c b/kernel/cobalt/thread.c index bf9b58e..3d84ddd 100644 --- a/kernel/cobalt/thread.c +++ b/kernel/cobalt/thread.c @@ -1784,82 +1784,6 @@ EXPORT_SYMBOL_GPL(xnthread_join); #ifdef CONFIG_SMP -/** - * @fn int xnthread_migrate(int cpu) - * @brief Migrate the current thread. - * - * This call makes the current thread migrate to another (real-time) - * CPU if its affinity allows it. This call is available from - * primary mode only. - * - * @param cpu The destination CPU. - * - * @retval 0 if the thread could migrate ; - * @retval -EPERM if the calling context is invalid, or the - * scheduler is locked. - * @retval -EINVAL if the current thread affinity forbids this - * migration. - * - * @coretags{primary-only, might-switch} - */ -int xnthread_migrate(int cpu) -{ - struct xnthread *curr; - struct xnsched *sched; - int ret = 0; - spl_t s; - - xnlock_get_irqsave(&nklock, s); - - curr = xnthread_current(); - if (!xnsched_primary_p() || curr->lock_count > 0) { - ret = -EPERM; - goto unlock_and_exit; - } - - if (!cpumask_test_cpu(cpu, &curr->affinity)) { - ret = -EINVAL; - goto unlock_and_exit; - } - - sched = xnsched_struct(cpu); - if (sched == curr->sched) - goto unlock_and_exit; - - trace_cobalt_thread_migrate(cpu); - - /* Move to remote scheduler. */ - xnsched_migrate(curr, sched); - - /* - * Migrate the thread's periodic timer. We don't have to care - * about the resource timer, since we can only deal with the - * current thread, which is, well, running, so it can't be - * sleeping on any timed wait at the moment. - */ - __xntimer_migrate(&curr->ptimer, sched); - - /* - * Reset execution time measurement period so that we don't - * mess up per-CPU statistics. - */ - xnstat_exectime_reset_stats(&curr->stat.lastperiod); - - /* - * So that xnthread_relax() will pin the linux mate on the - * same CPU next time the thread switches to secondary mode. - */ - xnthread_set_localinfo(curr, XNMOVED); - - xnsched_run(); - - unlock_and_exit: - xnlock_put_irqrestore(&nklock, s); - - return ret; -} -EXPORT_SYMBOL_GPL(xnthread_migrate); - void xnthread_migrate_passive(struct xnthread *thread, struct xnsched *sched) { /* nklocked, IRQs off */ if (thread->sched == sched) _______________________________________________ Xenomai-git mailing list Xenomai-git@xenomai.org https://xenomai.org/mailman/listinfo/xenomai-git