casaroli opened a new pull request, #21457:
URL: https://github.com/apache/nuttx/pull/21457

   ## Summary
   
   Change SMP_NCPUS on a configured qemu-armv7a:smp (with menuconfig or 
kconfig-tweak) from 4 to 2, and the link fails: `arm_head.S: undefined 
reference to cpu2_start` and `cpu3_start`. NCPUS has a prompt, so the 4 in 
.config stays when SMP_NCPUS changes. arm_head.S tests NCPUS and refers to 
cpu2_start and cpu3_start, while arm_cpuhead.S tests SMP_NCPUS and does not 
define them.
   
   An SMP build must have NCPUS equal to SMP_NCPUS. This PR shows the NCPUS 
prompt only when SMP is off, so in an SMP build the value always comes from its 
default. arm_head.S keeps its test of NCPUS, and a build with SMP off keeps the 
option and its value.
   
   ## Impact
   
   Only a .config that has an NCPUS different from SMP_NCPUS changes: NCPUS now 
follows SMP_NCPUS. A configuration from a defconfig does not change: no 
defconfig in the tree sets NCPUS. The .config files of qemu-armv7a:nsh, 
qemu-armv7a:nsh with NCPUS=2, qemu-armv7a:smp, qemu-armv8a:nsh_smp and 
pimoroni-pico-2-plus:smp are the same before and after. The ARMv7-R arm_head.S 
has the same test and gets the same fix; the tree has no ARMv7-R SMP 
configuration, so this is by reading only. No API change, no documentation 
change (Documentation/ does not name NCPUS).
   
   ## Testing
   
   qemu-armv7a:smp, EXTRAFLAGS="-Wno-cpp -Werror", toolchain GNU Arm 13.2:
   
   | Configuration | master | this PR |
   |---|---|---|
   | kconfig-tweak SMP_NCPUS=2 on the configured tree | NCPUS=4, link FAIL | 
NCPUS=2, OK |
   | kconfig-tweak SMP_NCPUS=3 on the configured tree | NCPUS=4, not built | 
NCPUS=3, OK |
   | SMP_NCPUS=2 in the defconfig | NCPUS=2, OK | NCPUS=2, OK |
   | default (SMP_NCPUS=4) | OK | OK |
   
   Runs under QEMU TCG with a test program that pins a thread to each CPU, with 
SCHED_CRITMONITOR and ARCH_PERF_EVENTS. qemu-armv7a:smp with SMP_NCPUS=2 set by 
kconfig-tweak, `-smp 2`: both CPUs run the thread, 500 ms of CPU time for a 
busy loop of 500 ms, ostest exits with status 0. With 3 CPUs each CPU runs the 
thread (500 to 511 ms; no ostest). With 4 CPUs: 500 ms on each CPU, ostest 
exits with status 0.
   
   The first 4-CPU run on this PR aborted at boot with PC 0xdeadbeee. Master 
also does this, with the same .config, so this PR does not cause it.
   
   Other builds with -Werror: qemu-armv7a:knsh_smp (4 and 2 CPUs, kernel), 
sabre-6quad:smp (2 CPUs), qemu-armv7a:nsh (no SMP).
   
   The runs and builds are on 39a1f27900c. After the rebase on 3d57048f1e1, the 
2-CPU run gives the same result.
   
   The branch is now rebased on f19dbe6f6d3 (no change in the touched files).
   


-- 
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