diff --git a/arch/arm/src/armv7-a/arm_releasepending.c b/arch/arm/src/armv7-a/arm_releasepending.c index 7afc6989a75..b4a811f7d2f 100644 --- a/arch/arm/src/armv7-a/arm_releasepending.c +++ b/arch/arm/src/armv7-a/arm_releasepending.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/armv7-a/arm_releasepending.c * - * Copyright (C) 2013-2015 Gregory Nutt. All rights reserved. + * Copyright (C) 2013-2015, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -56,16 +56,28 @@ * Name: up_release_pending * * Description: - * Release and ready-to-run tasks that have - * collected in the pending task list. This can call a - * context switch if a new task is placed at the head of - * the ready to run list. + * Release and ready-to-run tasks that have collected in the pending task + * list. This can call a context switch if a new task is placed at the + * head of the ready to run list. * ****************************************************************************/ void up_release_pending(void) { - struct tcb_s *rtcb = this_task(); + struct tcb_s *rtcb; +#ifdef CONFIG_SMP + int cpu; + + /* Get the TCB of the currently executing task on this CPU (avoid using + * this_task() because the TCBs may be in an inappropriate state right + * now). + */ + + cpu = this_cpu(); + rtcb = current_task(cpu); +#else + rtcb = this_task(); +#endif sinfo("From TCB=%p\n", rtcb); @@ -96,7 +108,11 @@ void up_release_pending(void) * of the ready-to-run task list. */ +#ifdef CONFIG_SMP + rtcb = current_task(cpu); +#else rtcb = this_task(); +#endif /* Update scheduler parameters */ @@ -121,7 +137,11 @@ void up_release_pending(void) * of the ready-to-run task list. */ +#ifdef CONFIG_SMP + rtcb = current_task(cpu); +#else rtcb = this_task(); +#endif #ifdef CONFIG_ARCH_ADDRENV /* Make sure that the address environment for the previously diff --git a/arch/arm/src/armv7-a/arm_reprioritizertr.c b/arch/arm/src/armv7-a/arm_reprioritizertr.c index eb1a4d2e6a1..359392e990b 100644 --- a/arch/arm/src/armv7-a/arm_reprioritizertr.c +++ b/arch/arm/src/armv7-a/arm_reprioritizertr.c @@ -92,8 +92,21 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority) } else { - struct tcb_s *rtcb = this_task(); + struct tcb_s *rtcb; bool switch_needed; +#ifdef CONFIG_SMP + int cpu; + + /* Get the TCB of the currently executing task on this CPU (avoid + * using this_task() because the TCBs may be in an inappropriate + * state right now). + */ + + cpu = this_cpu(); + rtcb = current_task(cpu); +#else + rtcb = this_task(); +#endif sinfo("TCB=%p PRI=%d\n", tcb, priority); @@ -150,7 +163,11 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority) * of the ready-to-run task list. */ +#ifdef CONFIG_SMP + rtcb = current_task(cpu); +#else rtcb = this_task(); +#endif /* Update scheduler parameters */ @@ -174,7 +191,11 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority) * of the ready-to-run task list. */ +#ifdef CONFIG_SMP + rtcb = current_task(cpu); +#else rtcb = this_task(); +#endif #ifdef CONFIG_ARCH_ADDRENV /* Make sure that the address environment for the previously diff --git a/configs/sabre-6quad/README.txt b/configs/sabre-6quad/README.txt index 462ffeffeda..9966f1eccc2 100644 --- a/configs/sabre-6quad/README.txt +++ b/configs/sabre-6quad/README.txt @@ -149,6 +149,7 @@ Status At present, the NSH prompt does come up but there there still hangs that must be addressed. + Platform Features ================= diff --git a/sched/sched/sched_unlock.c b/sched/sched/sched_unlock.c index 7e95346ba13..73feb87cdbc 100644 --- a/sched/sched/sched_unlock.c +++ b/sched/sched/sched_unlock.c @@ -168,7 +168,7 @@ int sched_unlock(void) * maximum. */ - if (rtcb != this_task()) + if (rtcb != current_task(cpu)) { rtcb->timeslice = MSEC2TICK(CONFIG_RR_INTERVAL); } @@ -206,7 +206,7 @@ int sched_unlock(void) * change the currently active task. */ - if (rtcb == this_task()) + if (rtcb == current_task(cpu)) { sched_timer_reassess(); }