sched/task: It is not appropriate for logic in task_exit() to call the new version of this_task(). sched/irq: Remove redundant fetch of CPU index; configs/sabre-6qguad: update README.

This commit is contained in:
Gregory Nutt
2018-02-06 19:06:33 -06:00
parent cce21bef32
commit 50ab5d638a
3 changed files with 41 additions and 12 deletions

View File

@@ -127,21 +127,28 @@ Status
deferred setting g_cpu_irqlock(). That latter setting is now deferred
until sched_resume_scheduler() runs. These commits were made:
commit de34b4523fc33c6f2f20619349af8fa081a3bfcd
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.
commit 0ba78530164814360eb09ed9805137b934c6f03b
sched/irq: Fix a infinite recursion problem that a recent change
introduced into the i.MX6 SMP implementation.
commit 8aa15385060bf705bbca2c22a5682128740e55a8
arch/arm/src/armv7-a: Found some additional places were the new
this_task() function cannot be called in the i.MX6 SMP configuration.
commit 0ba78530164814360eb09ed9805137b934c6f03b
sched/irq: Fix a infinite recursion problem that a recent change
introduced into the i.MX6 SMP implementation.
commit de34b4523fc33c6f2f20619349af8fa081a3bfcd
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.
With these changes, basic SMP functionality is restored. Insufficient
stress testing has been done to prove that the solution is stable, however.
commit cce21bef3292a40dcd97b6176ea016e2b559de8b
sched/sched: sched_lock() and sched_unlock().. back out some changes
I made recently. The seemed correct but apparently not. Also
reorder to logic so that g_global_lockcount is incremented for the very
minimum amount of time.
With these changes, basic SMP functionality is restored and there are no
known issues. Insufficient stress testing has been done to prove that the
solution is stable, however.
Platform Features
=================

View File

@@ -342,7 +342,6 @@ try_again:
* the spinlock.
*/
cpu = this_cpu();
DEBUGASSERT((g_cpu_irqset & (1 << cpu)) == 0);
if (!irq_waitlock(cpu))

View File

@@ -1,7 +1,8 @@
/****************************************************************************
* sched/task/task_exit.c
*
* Copyright (C) 2008-2009, 2012-2014, 2016 Gregory Nutt. All rights reserved.
* Copyright (C) 2008-2009, 2012-2014, 2016, 2018 Gregory Nutt. All
* rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -82,9 +83,24 @@
int task_exit(void)
{
FAR struct tcb_s *dtcb = this_task();
FAR struct tcb_s *dtcb;
FAR struct tcb_s *rtcb;
int ret;
#ifdef CONFIG_SMP
int cpu;
/* Get the current CPU. By assumption, we are within a critical section
* and, hence, the CPU index will remain stable.
*
* Avoid using this_task() because it may assume a state that is not
* appropriate for an exiting task.
*/
cpu = this_cpu();
dtcb = current_task(cpu);
#else
dtcb = this_task();
#endif
/* Remove the TCB of the current task from the ready-to-run list. A context
* switch will definitely be necessary -- that must be done by the
@@ -95,7 +111,14 @@ int task_exit(void)
*/
(void)sched_removereadytorun(dtcb);
/* Get the new task at the head of the ready to run list */
#ifdef CONFIG_SMP
rtcb = current_task(cpu);
#else
rtcb = this_task();
#endif
#ifdef CONFIG_SMP
/* Because clearing the global IRQ control in sched_removereadytorun()