Commit Graph

987 Commits

Author SHA1 Message Date
Gregory Nutt b78c3fcc30 Finish backing out previous change 2016-11-30 08:13:43 -06:00
Gregory Nutt e6eb2e8bfa Back out the last change. I just noticed some complexities that need to be verified before this is released onto the world. 2016-11-30 07:41:48 -06:00
Gregory Nutt 8453343426 scheduler instrumentation: Add a little more protection for the SMP case 2016-11-30 07:24:15 -06:00
Gregory Nutt 9ee3f3b933 sched_note: Permit spinlock and critical section notes in in-memory buffer iff sched_not_get() interfaces is disabled. 2016-11-28 18:36:26 -06:00
Gregory Nutt 00215fbc98 sched_note: Add spinlock instrumentation; In SMP configurations, select to log only notes from certain CPUs 2016-11-28 10:33:46 -06:00
Gregory Nutt d65be718c2 sched_note: Extend OS instrumentation to include some SMP events. 2016-11-27 17:14:57 -06:00
Gregory Nutt e3fe320e08 SMP: Add support for linking spinlocks into a special, non-cached memory region. 2016-11-26 08:47:03 -06:00
Gregory Nutt 1d06e786e1 SMP: Clean-up and simplication of logic that I implemented late last night. 2016-11-26 07:05:27 -06:00
Gregory Nutt a0e1af2614 SMP: Fix yet another potential deadlock 2016-11-25 23:04:27 -06:00
Gregory Nutt eb9f8074c0 Update comments 2016-11-24 09:56:43 -06:00
Gregory Nutt 7bec4ffeec Update some comments 2016-11-23 17:40:01 -06:00
Gregory Nutt d4037a30aa Update some comments 2016-11-23 13:20:18 -06:00
Gregory Nutt f90525a5d1 SMP: Update some comments; trivial improvement by inlining static function. 2016-11-22 16:48:57 -06:00
Gregory Nutt bac7153609 SMP: Add logic to avoid a deadlock condition when CPU1 is hung waiting for g_cpu_irqlock and CPU0 is waitin for g_cpu_paused 2016-11-22 11:34:16 -06:00
Gregory Nutt 130bfa3f6b Remove a assertion condition that appears to rarely cause false-alarm assertions. Teported by Petteri Aimonen 2016-11-21 14:43:56 -06:00
Gregory Nutt 558784d06f Spinlocks: Added capability to provide architecture-specific memory barriers. This was for i.MX6 but does not help with the SMP problems. It is still a good feature. 2016-11-21 11:55:59 -06:00
Gregory Nutt 2d1765a014 Remove more of those annoying empty comment blocks. 2016-11-21 07:34:27 -06:00
Gregory Nutt 0029c04dad task_restart: Make sure new task starts with pre-emption disabled and not in a critical section. 2016-11-21 07:33:23 -06:00
Gregory Nutt cee8d59b58 Update TODO list 2016-11-20 12:26:08 -06:00
Gregory Nutt e24f281401 This commit adds a new internal interfaces and fixes a problem with three APIs in the SMP configuration. The new internal interface is sched_cpu_pause(tcb). This function will pause a CPU if the task associated with 'tcb' is running on that CPU. This allows a different CPU to modify that OS data stuctures associated with the CPU. When the other CPU is resumed, those modifications can safely take place.
The three fixes are to handle cases in the SMP configuration where one CPU does need to make modifications to TCB and data structures on a task that could be running running on another CPU.  Those three cases are task_delete(), task_restart(), and execution of signal handles.  In all three cases the solutions is basically the same:  (1) Call sched_cpu_pause(tcb) to pause the CPU on which the task is running, (2) perform the necessary operations, then (3) call up_cpu_resume() to restart the paused CPU.
2016-11-20 07:57:18 -06:00
Gregory Nutt f40fbaa4b9 sched/task: task_restart() test not supported on SMP systems. This is not fully implemented. 2016-11-19 11:41:05 -06:00
Rajan Gill 0d8e191d69 sched/clock: Correct calculation for the case of Tickless mode with a 32-bit timer. In that case, the calculation was returning millisecond accuracy. That is not good when the timer accuracy is < 1 msec. 2016-11-19 09:55:21 -06:00
Gregory Nutt 5ca9128c38 Update comments 2016-11-19 08:33:55 -06:00
Gregory Nutt ceacacbc63 vfork(): Fix a race condition in the SMP case. Existing logic depended on the fact that the child would not run until waitpid was called because the child had the same priority as the parent. BUT in the SMP case that is not true... the child may run immediately on a different CPU. 2016-11-19 07:30:01 -06:00
Gregory Nutt 69e9f8638d Most interrupt handling logic interacts with tasks via standard mechanism such as sem_post, sigqueue, mq_send, etc. This all call enter_critical_section and are assumed to be safe in the SMP case.
But certain logic interacts with tasks in different ways.  The only one that comes to mind are wdogs.  There is a tasking interface that to manipulate wdogs, and a different interface in the timer interrupt handling logic to manage wdog expirations.

In the normal case, this is fine.  Since the tasking level code calls enter_critical_section, interrupts are disabled an no conflicts can occur.  But that may not be the case in the SMP case.  Most architectures do not permit disabling interrupts on other CPUs so enter_critical_section must work differently:  Locks are required to protect code.

So this change adds locking (via enter_critical section) to wdog expiration logic for the the case if the SMP configuration.
2016-11-18 13:57:30 -06:00
Gregory Nutt 78fd358023 Update some comments. 2016-11-18 08:20:52 -06:00
Gregory Nutt 8602e8a8a9 SMP: irq_csection() has a bad assumption. It assumed that the state of certain variables. That was true on entry into the interrupt handler, but might change to the execution of logic within the interrupt handler. 2016-11-18 07:38:16 -06:00
Gregory Nutt 8e029f019b Update comments 2016-11-17 17:30:12 -06:00
Gregory Nutt 47b52a2633 Fix an error in manually bringing in Sebastien's changes; Update some comments. 2016-11-17 16:15:06 -06:00
Gregory Nutt 9acd57c819 Fix up some naming and update some comments. 2016-11-17 15:50:39 -06:00
Gregory Nutt 558f4049d4 sched/irq/irq_csection: Fix a bad DEBUG assertion when SMP is enabled. 2016-11-17 15:36:27 -06:00
Gregory Nutt 2c314464a8 Fix a typo in a comment 2016-11-17 08:03:45 -06:00
Gregory Nutt ccdc11d8ff Fix typo in variable naming. g_cpu_irqset should be g_cpu_irqlock. 2016-11-17 06:37:24 -06:00
Gregory Nutt 1c1564f0c1 Add logic to handled nested calls to enter_critical_section() from interrupts handlers (with SMP). 2016-11-16 22:45:08 -06:00
Gregory Nutt 0c3207e86e Fix backward logic in an assertion. 2016-11-16 21:48:27 -06:00
Gregory Nutt 16f0b8fa96 Fix typos in DEBUASSERT statements 2016-11-16 19:58:51 -06:00
Gregory Nutt f1e4951a8d Fix some comments 2016-11-16 19:11:31 -06:00
Gregory Nutt 4ca653a1cc Add some experimental changes to enter/leave_critical_section to deal with the case where interrupts are disabled only on the local CPU 2016-11-16 18:28:35 -06:00
Gregory Nutt 5ce3b399d5 Correct some typos in comments 2016-11-15 16:48:40 -06:00
Gregory Nutt 40d7216a22 Back out 65ab12 and parts of 21f92b 2016-11-15 15:44:43 -06:00
Gregory Nutt 6683f01444 Trivial change to comment 2016-11-15 13:38:43 -06:00
Gregory Nutt 21f92ba601 Review some SMP logic; update comments; refresh configuration. 2016-11-15 09:24:00 -06:00
Gregory Nutt 65ab12fbb9 If SMP is enabled, if any interrupt handler calls enter_critical_section(), it should take the spinlock. 2016-11-15 08:37:58 -06:00
Gregory Nutt b53866c872 sched/irq: Change order for SMP case in enter_critical_section: Disble local interrupts BEFORE taking spinlock. 2016-11-15 07:54:18 -06:00
Freddie Chopin 484a1b6104 sem_wait() and sem_trywait() no longer modify the errno value UNLESS an error occurs. This allows these functions to be used internallly without clobbering the errno value. 2016-11-09 07:01:49 -06:00
Gregory Nutt 120d29b480 Update some Kconfig comments 2016-11-06 09:06:37 -06:00
Heesub Shin 8e94d8e7cc Signal sent from work_signal() may interrupt the low priority worker thread that is already running. For example, the worker thread that is waiting for a semaphore could be woken up by the signal and break any synchronization assumption as a result. It also does not make any sense to send signal if it is already running and busy. This commit fixes it. 2016-11-06 08:00:12 -06:00
Gregory Nutt 796969f6b6 Update TODO. Provide do-nothing stubs for mutex attribute interfaces if features not enabled. pthread_cond includes a signaling semaphore and should call sem_setprotocol. 2016-11-05 11:06:52 -06:00
Gregory Nutt 6f1c5e7b43 Add some comments. 2016-11-05 09:44:29 -06:00
Gregory Nutt 4b0372e542 Missing # on endif 2016-11-03 21:27:52 -06:00