diff --git a/arch/arm/src/armv7-a/arm_blocktask.c b/arch/arm/src/armv7-a/arm_blocktask.c index 61cce48de27..8fdbef00a36 100644 --- a/arch/arm/src/armv7-a/arm_blocktask.c +++ b/arch/arm/src/armv7-a/arm_blocktask.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/armv7-a/up_blocktask.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 @@ -76,8 +76,21 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state) { - 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 /* Verify that the context switch can be performed */ @@ -128,7 +141,11 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state) * of the ready-to-run task list. */ +#ifdef CONFIG_SMP + rtcb = current_task(cpu); +#else rtcb = this_task(); +#endif /* Reset scheduler parameters */ @@ -152,7 +169,11 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state) * 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_unblocktask.c b/arch/arm/src/armv7-a/arm_unblocktask.c index a9b0da6d2f8..906d33796b6 100644 --- a/arch/arm/src/armv7-a/arm_unblocktask.c +++ b/arch/arm/src/armv7-a/arm_unblocktask.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/armv7-a/arm_unblocktask.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 @@ -71,7 +71,20 @@ void up_unblock_task(struct tcb_s *tcb) { - 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 /* Verify that the context switch can be performed */ @@ -110,7 +123,11 @@ void up_unblock_task(struct tcb_s *tcb) * of the ready-to-run task list. */ +#ifdef CONFIG_SMP + rtcb = current_task(cpu); +#else rtcb = this_task(); +#endif /* Update scheduler parameters */ @@ -136,7 +153,11 @@ void up_unblock_task(struct tcb_s *tcb) * 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 482e07c542b..462ffeffeda 100644 --- a/configs/sabre-6quad/README.txt +++ b/configs/sabre-6quad/README.txt @@ -121,6 +121,34 @@ Status 2016-12-07: Just a note to remind myself. The PL310 L2 cache has *not* yet been enabled. +2018-02-06: Revisited SMP to see how has been broken due to bit rot. + Several fixes were needed mostly due to: (1) The new version of + this_task() that calls sched_lock() and sched_unlock(), and (2) to + deferred setting g_cpu_irqlock(). That latter setting is now deferred + until sched_resume_scheduler() runs. This means several changes similar + to the following were necessary in order to get things working from: + + struct tcb_s *rtcb = this_task(); + + To: + + 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 + + At present, the NSH prompt does come up but there there still hangs that + must be addressed. Platform Features =================