Commit Graph

25 Commits

Author SHA1 Message Date
Xiang Xiao
c397692532 sched/semaphore/spinlock.c: spin_trylock handle memory barrier and instrumentation correctly. 2019-11-03 19:40:58 -06:00
Xiang Xiao
e1a89d29ee sched/semaphore/spinlock.c: Remove support for re-entrant spinlocks. They seem like a good idea, but they are never used. 2019-11-03 19:38:39 -06:00
Gregory Nutt
63c9c0c935 sched/semaphore/spinlock.c: Fix build failure caused by a missing semicolon. 2019-09-16 07:44:01 -06:00
Gregory Nutt
5fe6981c9a Squashed commit of the following:
libs/libc/pthread/pthread_spinlock.c:  Resolve several TODO issues by accessing up_testset() via the boardctl() interface rather than attempting to call it directly.

    configs/boardctl.c, include/sys/boardctl.h:  Add access to architecture-specific up_testset() via boardctl().

    arch/Kconfig's, sched/Kconfig, and include/nuttx/spinlock.h:  Spinlocks are not available unless the architecture supports the up_testset() operation.
2019-03-04 14:22:50 -06:00
Gregory Nutt
8a48031615 Update some comments 2018-02-05 07:58:00 -06:00
Masayuki Ishikawa
ab3fa89023 SMP: Introduce spin_lock_wo_note() and spin_unlock_wo_note()
These APIs are used in sched_note.c to protect instumentation data.
The deffrence between these APIs to exsiting spin_lock() and spin_unlock()
is that they do not perform insturumentation to avoid recursive call
when SCHED_INSTRUMENTATION_SPINLOCKS=y.

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2018-01-17 13:29:42 +09:00
Masayuki Ishikawa
e1f71f988b sched/semaphore/spinlock.c: Add memory barrier operations in spin_unlock()
In ARM document regarding memory barrires, SP_DMB() must be issued
before changing a spinlock state to SP_UNLOCKED. However, we found
that SP_DSB() is also needed to ensure that spin_unlock() works
correctly for network streaming aging test.

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2017-12-21 17:40:08 +09:00
Masayuki Ishikawa
5acd26c88f sched/semaphore/spinlock.c: Disable local interrupts in spin_setbit() and spin_clrbit() in order to avoid a deadlock condition. 2017-11-23 06:55:53 -06:00
Gregory Nutt
cfb876263a SMP: There were certain conditions that we must avoid by preventing releasing the pending tasks while withn a critical section. But this logic was incomplete; there was no logic to prevent other CPUs from adding new, running tasks while on CPU is in a critical section.
This commit corrects this.  This is matching logic in sched_addreadytorun to avoid starting new tasks within the critical section (unless the CPU is the holder of the lock).  The holder of the IRQ lock must be permitted to do whatever it needs to do.
2016-12-27 08:49:07 -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
e3fe320e08 SMP: Add support for linking spinlocks into a special, non-cached memory region. 2016-11-26 08:47:03 -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
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
72d3920295 Rename cpuset_t to cpu_set_t which is the type used in some non-standard Linux/GNU interfaces. Move definitions of cpu_set_t to include/sys/types.h. Add prototypes for sched_setaffinity(), sched_getaffinity(), pthread_attr_setaffinity_np(), pthread_attr_getaffinity_np(), pthread_setaffinity_np(), and pthread_getaffinity_np(). No implementation is yet in place. 2016-02-19 15:57:07 -06:00
Gregory Nutt
b50325bb38 SMP: Add funtions to perform atomic bit set/clear operations; fix two errors in SMP macros 2016-02-17 13:20:01 -06:00
Gregory Nutt
a442245479 SMP: Fix some non-SMP errors that crept in; fix a recursion problem; re-partition some functionality to improve design and readability 2016-02-16 10:14:33 -06:00
Gregory Nutt
9cb2a6b1f9 Rename irqsave() and irqrestore() to up_irq_save() and up_irq_restore() 2016-02-14 16:19:15 -06:00
Gregory Nutt
6e3107650d nuttx/sched: Replace irqsave() with enter_critical_section(); replace irqrestore() with leave_critical_section() 2016-02-14 08:17:46 -06:00
Gregory Nutt
97cbd7112f SMP: Implement enter/leave_critical_section 2016-02-13 10:23:16 -06:00
Gregory Nutt
3f7f58de9d SMP: Fix some debug assertion problems when DEBUG is enabled; Partial fix for one bring-up issue 2016-02-12 17:13:38 -06:00
Gregory Nutt
85f663a8ee SMP: Add non-reentrant spinlocks, fix pre-emption controls with SMP, and most of the basic scheduler support for SMP (still missing a few things) 2016-02-12 14:55:31 -06:00
Gregory Nutt
3147dfc7d5 SMP: Add some tentative initialization logic 2016-02-10 13:49:27 -06:00
Gregory Nutt
f5a3b1e89d Add EXPERIMENTAL configuration option to investigate some SMP issues 2016-02-10 10:27:48 -06:00
Gregory Nutt
bf8120d51d Fix some odd logic in CC3000 semaphore handling. Noted by Vladimir Komendantskiy 2016-02-10 09:50:28 -06:00
Gregory Nutt
2c0ad2564f Add CONFIG_SPINLOCK. Also need spinunlock() and spinlock_initialize() 2016-02-09 15:31:14 -06:00