Topics

SMP support for ARM architecture


Krzysztof Walczak
 

Hi,

For our multicore ARM based project we would like to use SMP and affinity mechanism in Zephyr. When digging into the code I found that it is not implemented.
Mainly, there is an implementation of arch_switch() missing needed by SMP. Can someone give me any guideline as to what would be required for implementation to have an SMP/afinity mechanism operational in Zephyr on ARM platform.

rgds
Krzysztof


Boie, Andrew P
 

Hi Krzysztof,

 

I'm assuming that you're referring to ARM Cortex-A? A patch recently landed to implement switch instead of swap: https://github.com/zephyrproject-rtos/zephyr/pull/27766. There is a GitHub enhancement for ARM64 SMP support https://github.com/zephyrproject-rtos/zephyr/issues/26952 but nobody is working on it AFAIK.

 

CPU affinity is currently implemented via the k_thread_cpu_mask_* APIs in include/kernel.h. So if you get SMP working on your arch the scheduling infrastructure is there.

 

This is just the first step, to fully implement SMP you'll need per-cpu variables, IPIs, some extra arch_* APIs implemented, etc. We don't have a porting guide for SMP yet, and having not done this myself I'm not quite an expert in this area but I would reach out to Andy Ross for general SMP enabling questions, and for ARM64 stuff I would coordinate with  Carlo Caione who has done much of the work so far.

 

We have SMP working on x86_64, ARC, and Xtensa so reviewing that may also be helpful.

 

HTH

Andrew

 

From: devel@... <devel@...> On Behalf Of Krzysztof Walczak via lists.zephyrproject.org
Sent: Friday, October 2, 2020 5:09 AM
To: devel@...
Subject: [Zephyr-devel] SMP support for ARM architecture

 

Hi,

 

For our multicore ARM based project we would like to use SMP and affinity mechanism in Zephyr. When digging into the code I found that it is not implemented.

Mainly, there is an implementation of arch_switch() missing needed by SMP. Can someone give me any guideline as to what would be required for implementation to have an SMP/afinity mechanism operational in Zephyr on ARM platform.

 

rgds

Krzysztof