We are porting
Android to the ST-Ericsson
U8500 chipset, which
contains a dual ARM Cortex A9 SMP CPU subsystem.
In order to enable Android to run on ARM SMP, we have applied an
initial set of simple modifications that we have already submitted
into Gerrit for code review:
Change id 11088 11089 11090 11092
These patches are actually of more general use for ARM v6 and v7 (i.e.
ARM11, ARM Cortex A8/A9) architectures. In particular they replace
the deprecated use of the 'swp' instruction in the bionic library with
ldrex/strex instructions, plus use is made of the TLS (Thread Local
Storage) register, instead of using the "magic" memory location in the
vector page. Memory barrier instructions are also added to enforce
memory consistency when using t __atomic_swap in bionics, and when
setting the TLS register. More details on these changes are
illustrated in the submitted patches above.
With these modifications, Andorid runs successfully in our SMP
platform, including Dalvik applications, browsing, media play. We
haven't observed any regression compared to single-core execution, nor
instabilities of any kind. Both cores are active of course, so that
the CPU load is balanced between the cores as expected, in multi-task/
multi-threaded conditions.
There are however several places in the Android sources where SMP
safeness is not clear, in particular after an initial scan, we found
that memory barriers are potentially missing in these places:
frameworks/base/libs/surfaceflinger/Barrier.h:32
bionic/libc/include/sys/cdefs.h:276
dalvik/vm/Atomic.h:34
external/tremor/Tremor/misc.h (#define MB())
plus probably others that we haven't found yet.
We keep working on our SMP port, and so we will do further testing and
more systematic checks of the places were SMP safeness is potentially
missing, updating the community on our findings of course. We
encourage and welcome any help on SMP safeness and optimization.
These patches have been posted in Gerrit by Vinay Harugop from ST-
Ericsson on behalf of Surinder-pal Singh from STMicroelectronics, who
has identified and developed them on ST-Ericsson U8500 platform.
Best regards