kernel: Add cache coherence management framework
Zephyr SMP kernels need to be able to run on architectures with incoherent caches. Naive implementation of synchronization on such architectures requires extensive cache flushing (e.g. flush+invalidate everything on every spin lock operation, flush on every unlock!) and is a performance problem. Instead, many of these systems will have access to separate "coherent" (usually uncached) and "incoherent" regions of memory. Where this is available, place all writable data sections by default into the coherent region. An "__incoherent" attribute flag is defined for data regions that are known to be CPU-local and which should use the cache. By default, this is used for stack memory. Stack memory will be incoherent by default, as by definition it is local to its current thread. This requires special cache management on context switch, so an arch API has been added for that. Also, when enabled, add assertions to strategic places to ensure that shared kernel data is indeed coherent. We check thread objects, the _kernel struct, waitq's, timeouts and spinlocks. In practice almost all kernel synchronization is built on top of these structures, and any shared data structs will contain at least one of them. Signed-off-by: Andy Ross <andrew.j.ross@intel.com> Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
parent
c151f1768e
commit
f6d32ab0a4
11 changed files with 149 additions and 16 deletions
|
@ -38,6 +38,14 @@
|
|||
#define __nocache
|
||||
#endif /* CONFIG_NOCACHE_MEMORY */
|
||||
|
||||
#if defined(CONFIG_KERNEL_COHERENCE)
|
||||
#define __incoherent __in_section_unique(cached)
|
||||
#define __stackmem __incoherent
|
||||
#else
|
||||
#define __incoherent Z_GENERIC_SECTION(.user_stacks)
|
||||
#define __stackmem __incoherent
|
||||
#endif /* CONFIG_KERNEL_COHERENCE */
|
||||
|
||||
#endif /* !_ASMLANGUAGE */
|
||||
|
||||
#endif /* ZEPHYR_INCLUDE_LINKER_SECTION_TAGS_H_ */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue