[PATCH 1/2] cpukit/aarch64: Keep state across context switch

Sebastian Huber sebastian.huber at embedded-brains.de
Sat Feb 26 06:53:16 UTC 2022


On 26/02/2022 00:41, Kinsey Moore wrote:
> This may also be an issue for ARM, RISC-V and others as it doesn't 
> appear that ARM saves CPSR during context switch and I couldn't tell 
> that RISC-V does this either, though I'm less familiar with it.

This doesn't look like the right way to fix this issue.

There is currently the assumption that all processors start multitasking 
with a context switch to _Thread_Handler() which sets the interrupt 
level. It is possible to construct a scenario in which we start 
multitasking with a migration of a thread which already executed the 
_Thread_Handler() prologue. This would result in an execution with 
disabled interrupts. I think the proper fix for this scenario is to 
enable interrupts in _CPU_SMP_Prepare_start_multitasking().

Doing a context switch with interrupts disabled is a fatal application 
error on all architectures with

#define CPU_ENABLE_ROBUST_THREAD_DISPATCH TRUE

or enabled SMP support.

-- 
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.huber at embedded-brains.de
phone: +49-89-18 94 741 - 16
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/


More information about the devel mailing list