arch: support customized up_cpu_index() in AMP mode#13886
Conversation
|
[Experimental Bot, please feedback here] No, this PR does not meet the NuttX requirements. Here's why and how to improve it: Missing Information:
How to Improve:
Remember: A well-documented PR significantly increases its chances of being reviewed and merged quickly. Be thorough and provide as much context as possible! |
|
Isn't up_cpu_index the logical core number (which is only meaningful to the NuttX kernel), not the physical core number? I presume for AMP communication you need the physical core. |
Yes, that's why we have two api now: this_cpu and up_cpu_index. this_cpu is logical core number, up_cpu_index is physical core number. |
This makes sense, but the function description of up_cpu_index is still talking about SMP / logical CPU number, you need to update that too. |
d2b6d09 to
32f1a0d
Compare
9637c97 to
c96e54f
Compare
7ffb4ab to
79cf4ab
Compare
Some app with same code runs on different cores in AMP mode, need the physical core on which the function is called. Signed-off-by: hujun5 <hujun5@xiaomi.com> Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
| list(APPEND SRCS sim_smpsignal.c sim_cpuidlestack.c) | ||
| endif() | ||
|
|
||
| if(CONFIG_ARCH_HAVE_MULTICPU) |
This commit fixes the regression from apache#13886 Signed-off-by: hujun5 <hujun5@xiaomi.com>
This commit fixes the regression from #13886 Signed-off-by: hujun5 <hujun5@xiaomi.com>
|
@hujun260 @xiaoxiang781216 do you have a plan to introduce conversion between logical <-> physical CPU index via the this_cpu() macro in the future ? Now this_cpu() is still equal to up_cpu_index(). |
what's conversion do you want?
it isn't always equals, when SMP is off, up_cpu_index may return nonzero value, but this_cpu always return zero. |
|
A logical CPU index just an arbitrary number and its value is only meaningful for the operating system code, while the physical CPU index can have meaning in things like interrupt acknowledgement etc. They most definitely do not have to be the same, even though in our case they are, at least atm. The issue arises when we introduce a platform, that has CPU cores with unequal capabilities e.g. MPFS / Polarfire SoC. It has harts 0..4 but hart0 cannot participate in NuttX SMP as it is less capable than harts 1..4, it does not have an MMU for one example. On the other hand, for interrupt acknowledgment the physical core (hartID) is needed. This is why some kind of logical <-> physical conversion (other than physical=logical) is inevitably needed. I think Linux handles this via FDT, but we can do with something much simpler. My question was simply to ask if you were already implementing something for this_cpu(). If not, then I'll do the simple translation that fixes MPFS SMP. |
|
No, this type of mapping can only be handled by arch/chip specific code. |
|
Yep, I'll add a hook under arch for it |
Summary
support customized up_cpu_index() in AMP mode
Some app with same code runs on different cores in AMP mode, need the physical core on which the function is called.
Impact
arm
Testing
ostest