Skip to content

Commit d929b8a

Browse files
kietavainenkartben
authored andcommitted
Revert "arch: arm: cortex_m: Only trigger context switch if thread is preemptible"
This reverts commit 42036cd. Architecture specific code should not do preemption checking before context switch. This is already handled by the scheduler, so duplicating it would be redundant and error prone. These checks used to be necessary, but the scheduler has been rewritten since then and the checks were removed in 3a0cb2d (kernel: Remove legacy preemption checking, 2018-05-23). The check this reverts was also incorrect, as it didn't take scheduler locking nor meta-IRQs into account. Fixes #80574 Signed-off-by: Kalle Kietäväinen <kalle.kietavainen@silabs.com>
1 parent 026a2c5 commit d929b8a

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

arch/arm/core/cortex_m/exc_exit.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,8 @@ FUNC_ALIAS(z_arm_exc_exit, z_arm_int_exit, void);
5555
Z_GENERIC_SECTION(.text._HandlerModeExit) void z_arm_exc_exit(void)
5656
{
5757
#ifdef CONFIG_PREEMPT_ENABLED
58-
/* If thread is preemptible */
59-
if (_kernel.cpus->current->base.prio >= 0) {
60-
/* and cached thread is not current thread */
61-
if (_kernel.ready_q.cache != _kernel.cpus->current) {
62-
/* trigger a context switch */
63-
SCB->ICSR |= SCB_ICSR_PENDSVSET_Msk;
64-
}
58+
if (_kernel.ready_q.cache != _kernel.cpus->current) {
59+
SCB->ICSR |= SCB_ICSR_PENDSVSET_Msk;
6560
}
6661
#endif /* CONFIG_PREEMPT_ENABLED */
6762

0 commit comments

Comments
 (0)