mirror of
https://github.com/apache/nuttx.git
synced 2025-01-13 05:08:41 +08:00
arch: qemu-rv: Fix high CPU usage in SMP mode
Summary: - I noticed that QEMU shows high CPU usage if the number of CPUs does not match the kernel configuration. (e.g. -smp 8 and CONFIG_SMP_NCPUS=2) - This commit fixes this issue. Impact: - qemu-rv only Testing: - Tested with the following configs - rv-virt:smp64 (CONFIG_NCPUS=1/2/8) - rv-virt:nsh64 Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
This commit is contained in:
parent
00296c1ef3
commit
d32555f3e0
1 changed files with 12 additions and 4 deletions
|
@ -52,13 +52,21 @@ __start:
|
||||||
j 2f
|
j 2f
|
||||||
1:
|
1:
|
||||||
|
|
||||||
/* In case of single CPU config, stop here */
|
/* Load the number of CPUs that the kernel supports */
|
||||||
|
|
||||||
#if !defined(CONFIG_SMP) || (CONFIG_SMP_NCPUS == 1)
|
#ifdef CONFIG_SMP
|
||||||
csrw mie, zero
|
li t1, CONFIG_SMP_NCPUS
|
||||||
wfi
|
#else
|
||||||
|
li t1, 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* If a0 (mhartid) >= t1 (the number of CPUs), stop here */
|
||||||
|
|
||||||
|
blt a0, t1, 3f
|
||||||
|
csrw mie, zero
|
||||||
|
wfi
|
||||||
|
|
||||||
|
3:
|
||||||
/* To get g_cpu_basestack[mhartid], must get g_cpu_basestack first */
|
/* To get g_cpu_basestack[mhartid], must get g_cpu_basestack first */
|
||||||
|
|
||||||
la t0, g_cpu_basestack
|
la t0, g_cpu_basestack
|
||||||
|
|
Loading…
Reference in a new issue