sched/ and arch/arm/src/armv7-a: Replace a few more occurrences of this_task() with current_task(cpu) in an effort to get the i.MX6 working in SMP mode again. It does not yet work, sadly.

This commit is contained in:
Gregory Nutt 2018-02-06 11:17:33 -06:00
parent 8aa1538506
commit de34b4523f
4 changed files with 51 additions and 9 deletions

View File

@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* arch/arm/src/armv7-a/arm_releasepending.c * 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 <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -56,16 +56,28 @@
* Name: up_release_pending * Name: up_release_pending
* *
* Description: * Description:
* Release and ready-to-run tasks that have * Release and ready-to-run tasks that have collected in the pending task
* collected in the pending task list. This can call a * list. This can call a context switch if a new task is placed at the
* context switch if a new task is placed at the head of * head of the ready to run list.
* the ready to run list.
* *
****************************************************************************/ ****************************************************************************/
void up_release_pending(void) 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); sinfo("From TCB=%p\n", rtcb);
@ -96,7 +108,11 @@ void up_release_pending(void)
* of the ready-to-run task list. * of the ready-to-run task list.
*/ */
#ifdef CONFIG_SMP
rtcb = current_task(cpu);
#else
rtcb = this_task(); rtcb = this_task();
#endif
/* Update scheduler parameters */ /* Update scheduler parameters */
@ -121,7 +137,11 @@ void up_release_pending(void)
* of the ready-to-run task list. * of the ready-to-run task list.
*/ */
#ifdef CONFIG_SMP
rtcb = current_task(cpu);
#else
rtcb = this_task(); rtcb = this_task();
#endif
#ifdef CONFIG_ARCH_ADDRENV #ifdef CONFIG_ARCH_ADDRENV
/* Make sure that the address environment for the previously /* Make sure that the address environment for the previously

View File

@ -92,8 +92,21 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
} }
else else
{ {
struct tcb_s *rtcb = this_task(); struct tcb_s *rtcb;
bool switch_needed; 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); 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. * of the ready-to-run task list.
*/ */
#ifdef CONFIG_SMP
rtcb = current_task(cpu);
#else
rtcb = this_task(); rtcb = this_task();
#endif
/* Update scheduler parameters */ /* 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. * of the ready-to-run task list.
*/ */
#ifdef CONFIG_SMP
rtcb = current_task(cpu);
#else
rtcb = this_task(); rtcb = this_task();
#endif
#ifdef CONFIG_ARCH_ADDRENV #ifdef CONFIG_ARCH_ADDRENV
/* Make sure that the address environment for the previously /* Make sure that the address environment for the previously

View File

@ -149,6 +149,7 @@ Status
At present, the NSH prompt does come up but there there still hangs that At present, the NSH prompt does come up but there there still hangs that
must be addressed. must be addressed.
Platform Features Platform Features
================= =================

View File

@ -168,7 +168,7 @@ int sched_unlock(void)
* maximum. * maximum.
*/ */
if (rtcb != this_task()) if (rtcb != current_task(cpu))
{ {
rtcb->timeslice = MSEC2TICK(CONFIG_RR_INTERVAL); rtcb->timeslice = MSEC2TICK(CONFIG_RR_INTERVAL);
} }
@ -206,7 +206,7 @@ int sched_unlock(void)
* change the currently active task. * change the currently active task.
*/ */
if (rtcb == this_task()) if (rtcb == current_task(cpu))
{ {
sched_timer_reassess(); sched_timer_reassess();
} }