Exclusive instruction LDAXR for ARM64 used by Zephyr SMP
I am debugging Zephyr SMP on ARM64, but currently I found arm64 LDAXR instruction is used in spin lock function, but I found there is different behavior on different platform.
Here is calling line:
__start à z_arm64_prep_c à z_arm64_mmu_init à setup_page_tables à add_arm_mmu_flat_range à add_map à set_mapping à key = k_spin_lock(&xlat_lock);
The issue is on one ARM A72 platform, there will be “Unknown Exception” (ECR.EC = 000000) with this calling flow, I found the exception is caused by LDAXR instruction, and MMU is disabled when exception occurs. When I enabled MMU firstly and then call LDAXR instruction, there will be no such issue.
But on another A53 platform, there is no such issue both for the case MMU is disabled or enabled.
So I am not sure whether there is some relation with MMU and LDAXR instruction, and I don’t find more information in ARM’s document, I have worked out one patch to avoid to use LDAXR and STLXR before enable MMU, but I want to find out whether it is the root cause of the issue.
Any comments or suggestion is welcome, thanks.