zephyr/kernel
Andy Ross 7022000b5c kernel/mutex: Fix races, make unlock rescheduling
The k_mutex is a priority-inheriting mutex, so on unlock it's possible
that a thread's priority will be lowered.  Make this a reschedule
point so that reasoning about thread priorities is easier (possibly at
the cost of performance): most users are going to expect that the
priority elevation stops at exactly the moment of unlock.

Note that this also reorders the code to fix what appear to be obvious
race conditions.  After the call to z_ready_thread(), that thread may
be run (e.g. by an interrupt preemption or on another SMP core), yet
the return value and mutex weren't correctly set yet.  The spinlock
was also prematurely released.

Fixes #20802

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-12-03 12:33:17 -06:00
..
include kernel: thread: Fix randomness problem with stack pointer random 2019-11-15 13:43:32 -08:00
CMakeLists.txt headers: Refactor kernel and arch headers. 2019-11-06 16:07:32 -08:00
Kconfig kernel: Kconfig: Define dependencies for STACK_CANARIES 2019-11-15 10:13:15 -06:00
Kconfig.power_mgmt kconfig: Clean up header comments and make them consistent 2019-11-04 17:31:27 -05:00
atomic_c.c kernel: fix the bug in atomic_c.c 2019-09-26 21:13:20 -04:00
compiler_stack_protect.c kernel: Fix gcc-9.2 warning with _StackCheckHandler 2019-10-04 05:22:30 -07:00
device.c [Code coverage]: Fix the issue of function code coverage in device.c. 2019-09-17 12:35:30 +08:00
errno.c headers: Refactor kernel and arch headers. 2019-11-06 16:07:32 -08:00
fatal.c kernel: rename z_arch_ to arch_ 2019-11-07 15:21:46 -08:00
futex.c kernel: rename z_arch_ to arch_ 2019-11-07 15:21:46 -08:00
idle.c kernel: rename z_arch_ to arch_ 2019-11-07 15:21:46 -08:00
init.c kernel: init: simplify boot banner printing 2019-11-29 07:52:16 -05:00
mailbox.c kernel: rename z_arch_ to arch_ 2019-11-07 15:21:46 -08:00
mem_domain.c kernel: rename z_arch_ to arch_ 2019-11-07 15:21:46 -08:00
mem_slab.c kernel: rename thread return value functions 2019-09-30 15:25:55 -04:00
mempool.c kernel: rename z_arch_ to arch_ 2019-11-07 15:21:46 -08:00
msg_q.c kernel: rename z_arch_ to arch_ 2019-11-07 15:21:46 -08:00
mutex.c kernel/mutex: Fix races, make unlock rescheduling 2019-12-03 12:33:17 -06:00
pipes.c headers: Refactor kernel and arch headers. 2019-11-06 16:07:32 -08:00
poll.c kernel/sys_clock.h: Deprecate and convert uses of old conversions 2019-11-08 11:08:58 +01:00
queue.c kernel: rename thread return value functions 2019-09-30 15:25:55 -04:00
sched.c kernel/sched: Fix edge case in MetaIRQ preemption of cooperative threads 2019-11-15 13:09:02 +01:00
sem.c kernel: rename z_arch_ to arch_ 2019-11-07 15:21:46 -08:00
smp.c kernel: rename z_arch_ to arch_ 2019-11-07 15:21:46 -08:00
stack.c kernel: rename thread return value functions 2019-09-30 15:25:55 -04:00
system_work_q.c
thread.c kernel/thread: Cancel timeouts on k_thread_suspend(), make schedule point 2019-11-25 19:12:05 -05:00
thread_abort.c kernel: rename z_arch_ to arch_ 2019-11-07 15:21:46 -08:00
timeout.c kernel/sys_clock.h: Deprecate and convert uses of old conversions 2019-11-08 11:08:58 +01:00
timer.c kernel/sys_clock.h: Deprecate and convert uses of old conversions 2019-11-08 11:08:58 +01:00
userspace.c kernel: rename z_arch_ to arch_ 2019-11-07 15:21:46 -08:00
userspace_handler.c kernel: remove vestigal printk references 2019-10-01 16:15:06 -05:00
version.c
work_q.c kernel/sys_clock.h: Deprecate and convert uses of old conversions 2019-11-08 11:08:58 +01:00