Module: xenomai-gch Branch: for-forge Commit: 08c67e725b8aee6ae711a2e6e6f361651ba0cd9b URL: http://git.xenomai.org/?p=xenomai-gch.git;a=commit;h=08c67e725b8aee6ae711a2e6e6f361651ba0cd9b
Author: Gilles Chanteperdrix <gilles.chanteperd...@xenomai.org> Date: Sun Oct 13 20:40:25 2013 +0200 drivers/switchtest: use set_cpu_allowed in rtswitch_create_ktask In order to pin the calling task to the same cpu as the created task, allowing to pass the arguments to the created task on the calling task stack, without any race condition. --- kernel/drivers/testing/switchtest.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/kernel/drivers/testing/switchtest.c b/kernel/drivers/testing/switchtest.c index ea36ee6..6f77ee9 100644 --- a/kernel/drivers/testing/switchtest.c +++ b/kernel/drivers/testing/switchtest.c @@ -483,6 +483,8 @@ static int rtswitch_create_ktask(rtswitch_context_t *ctx, iattr.affinity = cpumask_of_cpu(ctx->cpu); param.rt.prio = 1; + set_cpus_allowed(current, cpumask_of_cpu(ctx->cpu)); + err = xnthread_init(&task->ktask, &iattr, &xnsched_class_rt, ¶m); if (!err) { @@ -498,7 +500,8 @@ static int rtswitch_create_ktask(rtswitch_context_t *ctx, task->base.flags = 0; /* * Putting the argument on stack is safe, because the new - * thread will preempt the current thread immediately, and + * thread, thanks to the abovce call of set_cpus_allowed, + * will preempt the current thread immediately, and * will suspend only once the arguments on stack are used. */ _______________________________________________ Xenomai-git mailing list Xenomai-git@xenomai.org http://www.xenomai.org/mailman/listinfo/xenomai-git