zyfeier commented on PR #22261:
URL: https://github.com/apache/nuttx/pull/22261#issuecomment-7155612580

   > @zyfeier @jasonbu a few questions regarding the design
   > 
   > **1. Kconfig help vs. PR description**
   > 
   > The `BMP` help text says "a single copy of the OS maintains an overall 
view of all system resources" and "You can use both SMP and BMP on the same 
system". The description says "each CPU runs its own kernel instance", and the 
`choice` makes SMP and BMP mutually exclusive.
   >> You're right, the help now describes the actual model and states that SMP 
and BMP are mutually exclusive members of the same choice, fixed.
   > 
   > **2. BMP vs. AMP naming**
   > 
   > QNX defines BMP as "a single instantiation of an OS manages all CPUs 
simultaneously, but you can lock individual applications or threads to a 
specific CPU", and AMP as "a separate OS, or a separate instantiation of the 
same OS, runs on each CPU". Green Hills (CAST-32A, ARINC 653 Supp. 4/5) calls 
BMP "an enhanced and restricted form of SMP". One kernel per CPU with shared 
code looks like homogeneous AMP. Would a name like `CONFIG_AMP_SHARED_IMAGE` 
work, so `BMP` keeps its industry meaning?
   >>We considered this and would like to keep the name:
   >>
   >>- "Bound Multi-Processing" describes the binding semantics: tasks stay on 
the CPU that created them and a CPU never schedules work onto another. Our 
implementation delivers exactly that behavior, structurally (per-CPU kernel 
instances) rather than through affinity masks in a shared kernel.
   >>- In QNX's taxonomy, "single OS with every thread locked to a CPU" is BMP 
— and NuttX already expresses that today through SMP + sched_setaffinity(). 
This series satisfies the same binding requirement, but performs better on 
non-coherent hardware: in the single-OS model all kernel data is shared, so on 
parts without cache coherency the entire kernel data would have to live in 
non-cacheable memory — and the cores cannot be isolated from each other, since 
there is only one kernel domain. In our model only the explicitly shared data 
is non-cacheable; the per-CPU private majority of kernel data stays cacheable, 
and the instances can be isolated from each other with the MPU.
   >>- We acknowledge the "one OS instantiation vs. one per CPU" axis differs 
from QNX's usage; the rewritten help text states the model explicitly so the 
single-OS reading doesn't apply.
   > 
   > **3. Isolation and D-cache**
   > 
   > Is MPU separation between instances planned, and a strict per-CPU/shared 
data split so the D-cache can be enabled on non-coherent parts like TriCore? If 
not, what does this model gain over SMP with strict affinity?
   
   >> CPU isolation is enabled in the follow-up commits of this series:
   >> - per-CPU data is CPU-private: it lives in a per-core section (what 
PERCPU_SECTION + _percpu_offset provide) and each CPU accesses only its own 
copy. The per-CPU sections are isolated from each other with the MPU.
   >> - non-per-CPU data is shared: on parts without multicore cache coherency 
like TriCore, the shared data is placed in non-cacheable regions, so no 
cross-core cache protocol is needed. Private per-CPU data stays cacheable, so 
the D-cache can be enabled on such parts.
   >>
   >> What this gains over SMP with strict affinity: affinity still leaves one 
scheduler, one TCB space and one lock domain shared by all CPUs, so a wild 
write or a lock bug on any CPU hits every core, and the shared kernel data 
itself requires cache coherency. In this model each CPU has its own scheduler 
and private kernel state, so there are no cross-core scheduling locks, a CPU's 
corruption stays contained (the CAST-32A freedom-from-interference property), 
the kernel works on hardware without cache coherency, and CPUs can be started 
and stopped independently. This is also the multicore model the AUTOSAR OS 
specification prescribes (tasks bound to a core, one scheduling domain per 
core, spinlock-protected shared data), i.e. the architecture of the automotive 
OSes running on TriCore-class parts today.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to