zephyr/kernel/include
Andy Ross eefd3daa81 kernel/smp: arch/x86_64: Address race with CPU migration
Use of the _current_cpu pointer cannot be done safely in a preemptible
context.  If a thread is preempted and migrates to another CPU, the
old CPU record will be wrong.

Add a validation assert to the expression that catches incorrect
usages, and fix up the spots where it was wrong (most important being
a few uses of _current outside of locks, and the arch_is_in_isr()
implementation).

Note that the resulting _current expression now requires locking and
is going to be somewhat slower.  Longer term it's going to be better
to augment the arch API to allow SMP architectures to implement a
faster "get current thread pointer" action than this default.

Note also that this change means that "_current" is no longer
expressible as an lvalue (long ago, it was just a static variable), so
the places where it gets assigned now assign to _current_cpu->current
instead.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2020-02-08 08:51:04 -05:00
..
gen_offset.h
kernel_arch_interface.h kernel: move timing externs to public header 2020-02-06 23:07:37 -05:00
kernel_internal.h
kernel_offsets.h
ksched.h tracing: move headers under include/tracing 2020-02-07 15:58:05 -05:00
kswap.h kernel/smp: arch/x86_64: Address race with CPU migration 2020-02-08 08:51:04 -05:00
offsets_short.h