zephyr/kernel/include
Andy Ross c3046f417a kernel/sched: Use new barrier and spin APIs
The switch_handle field in the thread struct is used as an atomic flag
between CPUs in SMP, and has been known for a long time to technically
require memory barriers for correct operation.  We have an API for
that now, so put them in:

* The code immediately before arch_switch() needs a write barrier to
  ensure that thread state written by the scheduler is seen to happen
  before the outgoing thread is flagged with a valid switch handle.

* The loop in z_sched_switch_spin() needs a read barrier at the end,
  to make sure the calling context doesn't load state from before the
  other CPU stored the switch handle.

Also, that same spot in switch_spin was spinning with interrupts held,
which means it needs a call to arch_spin_relax() to avoid a FPU state
deadlock on some architectures.

Signed-off-by: Andy Ross <andyross@google.com>
2023-05-26 17:09:35 -04:00
..
gen_offset.h
kernel_arch_interface.h
kernel_internal.h
kernel_offsets.h kernel: Remove unused absolute symbols 2023-04-18 10:51:28 -04:00
kernel_tls.h
ksched.h kernel: Add z_sched_wake_thread API 2023-03-09 09:22:21 +01:00
kswap.h kernel/sched: Use new barrier and spin APIs 2023-05-26 17:09:35 -04:00
mmu.h kernel: mmu: Fix Xtensa memory alignment issue 2023-05-23 08:54:29 +02:00
offsets_short.h kernel: Remove unused derived offset symbols 2023-02-22 16:01:32 +01:00