riscv支持cpu并行启动#297
Conversation
mainline inclusion from mainline-6.11-rc1 commit c0e81a4 category: feature bugzilla: RVCK-Project#292 -------------------------------- Provide stub functions for SMT related parallel bring up functions so that HOTPLUG_PARALLEL can work without HOTPLUG_SMT. Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/all/20240716-loongarch-hotplug-v3-1-af59b3bb35c8@flygoat.com
…up() mainline inclusion from mainline-6.11-rc2 commit 2dce993 category: feature bugzilla: RVCK-Project#292 -------------------------------- CONFIG_HOTPLUG_PARALLEL expects the architecture to implement arch_cpuhp_init_parallel_bringup() to decide whether paralllel hotplug is possible and to do the necessary architecture specific initialization. There are architectures which can enable it unconditionally and do not require architecture specific initialization. Provide a weak fallback for arch_cpuhp_init_parallel_bringup() so that such architectures are not forced to implement empty stub functions. Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/all/20240716-loongarch-hotplug-v3-2-af59b3bb35c8@flygoat.com
mainline inclusion from mainline-6.18-rc7 commit 231fb99 category: feature bugzilla: RVCK-Project#292 -------------------------------- The core kernel already supports parallel bringup of secondary CPUs (aka HOTPLUG_PARALLEL). The x86 and MIPS architectures already use HOTPLUG_PARALLEL and ARM is also moving toward it. On RISC-V, there is no arch specific global data accessed in the RISC-V secondary CPU bringup path so enabling HOTPLUG_PARALLEL for RISC-V would only require: 1) Providing RISC-V specific arch_cpuhp_kick_ap_alive() 2) Calling cpuhp_ap_sync_alive() from smp_callin() This patch is tested natively with OpenSBI on QEMU RV64 virt machine with 64 cores and also tested with KVM RISC-V guest with 32 VCPUs. Signed-off-by: Anup Patel <apatel@ventanamicro.com> Reviewed-by: Atish Patra <atishp@rivosinc.com> Link: https://patch.msgid.link/20250905122512.71684-1-apatel@ventanamicro.com Signed-off-by: Paul Walmsley <pjw@kernel.org>
|
开始测试 log: https://github.com/RVCK-Project/rvck/actions/runs/26795112262 参数解析结果
测试完成 详细结果:
Kunit Test Result[02:48:53] Testing complete. Ran 482 tests: passed: 466, skipped: 16
Kernel Build Result
Check Patch Result
|
|
开始测试 log: https://github.com/RVCK-Project/rvck/actions/runs/26795112262 参数解析结果
测试完成 详细结果:
Kunit Test Result[02:57:37] Testing complete. Ran 482 tests: passed: 466, skipped: 16
Kernel Build Result
Check Patch Result
测试完成 详细结果:
Kunit Test Result[02:57:37] Testing complete. Ran 482 tests: passed: 466, skipped: 16
Kernel Build Result
Check Patch Result
|
|
开始测试 log: https://github.com/RVCK-Project/rvck/actions/runs/26795112262 参数解析结果
测试完成 详细结果:
Kunit Test Result[02:20:16] Testing complete. Ran 482 tests: passed: 466, skipped: 16
Kernel Build Result
Check Patch Result
LAVA Check (qemu)
result: Lava check done!
|
issues: #292
kernel内核社区已经支持riscv辅助 CPU 的并行启动(即 HOTPLUG_PARALLEL),现将相关功能合入,全部补丁均来源于L0社区,无修改
测试用例
OpenSBI 环境下的 QEMU RV64 virt 虚拟机(64 核心),系统多次启动无异常,启动日志如下
[ 0.000000] Linux version 6.6.137-01350-g7f82d4757505 (root@anolis) (riscv64-unknown-linux-gnu-gcc (g) 15.1.0, GNU ld (GNU Binutils) 2.45) #39 SMP Mon Jun 1 14:15:09 CST 2026
[ 0.000000] SBI specification v3.0 detected
[ 0.000000] SBI implementation ID=0x1 Version=0x10008
[ 0.000000] SBI TIME extension detected
[ 0.000000] SBI IPI extension detected
[ 0.000000] SBI RFENCE extension detected
[ 0.000000] SBI SRST extension detected
[ 0.000000] SBI DBCN extension detected
[ 0.000000] SBI FWFT extension detected
[ 0.000000] earlycon: ns16550a0 at MMIO 0x0000000010000000 (options '')
[ 0.000000] printk: bootconsole [ns16550a0] enabled
[ 0.000000] printk: debug: ignoring loglevel setting.
[ 0.000000] efi: EFI v2.7 by EDK II
[ 0.000000] efi: SMBIOS 3.0=0xfff43000 MEMATTR=0xfd9d3118 ACPI=0xff660000 ACPI 2.0=0xff660014 MEMRESERVE=0xfd9d2f18
[ 0.000000] ACPI: Early table checksum verification disabled
[ 0.000000] ACPI: RSDP 0x00000000FF660014 000024 (v02 BOCHS )
[ 0.000000] ACPI: XSDT 0x00000000FF65F0E8 000054 (v01 BOCHS BXPC 00000001 01000013)
[ 0.000000] ACPI: FACP 0x00000000FDA91000 000114 (v06 BOCHS BXPC 00000001 BXPC 00000001)
[ 0.000000] ACPI: DSDT 0x00000000FD9DC000 002047 (v02 BOCHS BXPC 00000001 BXPC 00000001)
[ 0.000000] ACPI: APIC 0x00000000FDA19000 000960 (v07 BOCHS BXPC 00000001 BXPC 00000001)
[ 0.000000] ACPI: RHCT 0x00000000FDA18000 0007C8 (v01 BOCHS BXPC 00000001 BXPC 00000001)
[ 0.000000] ACPI: RIMT 0x00000000FDA17000 000080 (v01 BOCHS BXPC 00000001 BXPC 00000001)
[ 0.000000] ACPI: SPCR 0x00000000FD9F5000 00005A (v04 BOCHS BXPC 00000001 BXPC 00000001)
[ 0.000000] ACPI: MCFG 0x00000000FD9F4000 00003C (v01 BOCHS BXPC 00000001 BXPC 00000001)
[ 0.000000] ACPI: SPCR: console: uart,mmio,0x10000000,115200
[ 0.000000] NUMA: Faking a node at [mem 0x0000000080000000-0x00000002ffffffff]
[ 0.000000] NUMA: NODE_DATA [mem 0x2ffff5440-0x2ffff6fff]
[ 0.000000] Zone ranges:
[ 0.000000] DMA32 [mem 0x0000000080000000-0x00000000ffffffff]
[ 0.000000] Normal [mem 0x0000000100000000-0x00000002ffffffff]
[ 0.000000] Movable zone start for each node
[ 0.000000] Early memory node ranges
[ 0.000000] node 0: [mem 0x0000000080000000-0x00000000801fffff]
[ 0.000000] node 0: [mem 0x0000000080200000-0x00000000ffe3cfff]
[ 0.000000] node 0: [mem 0x00000000ffe3d000-0x00000000ffffefff]
[ 0.000000] node 0: [mem 0x00000000fffff000-0x00000002ffffffff]
[ 0.000000] Initmem setup node 0 [mem 0x0000000080000000-0x00000002ffffffff]
[ 0.000000] SBI HSM extension detected
[ 0.000000] riscv: base ISA extensions acdfhimv
[ 0.000000] riscv: ELF capabilities acdfimv
[ 0.000000] Queued spinlock using Ziccrse: enabled
[ 0.000000] percpu: cpu 0 has no node -1 or node-local memory
[ 0.000000] percpu: Embedded 29 pages/cpu s79992 r8192 d30600 u118784
[ 0.000000] pcpu-alloc: s79992 r8192 d30600 u118784 alloc=29*4096
[ 0.000000] pcpu-alloc: [0] 00 [0] 01 [0] 02 [0] 03 [0] 04 [0] 05 [0] 06 [0] 07
[ 0.000000] pcpu-alloc: [0] 08 [0] 09 [0] 10 [0] 11 [0] 12 [0] 13 [0] 14 [0] 15
[ 0.000000] pcpu-alloc: [0] 16 [0] 17 [0] 18 [0] 19 [0] 20 [0] 21 [0] 22 [0] 23
[ 0.000000] pcpu-alloc: [0] 24 [0] 25 [0] 26 [0] 27 [0] 28 [0] 29 [0] 30 [0] 31
[ 0.000000] pcpu-alloc: [0] 32 [0] 33 [0] 34 [0] 35 [0] 36 [0] 37 [0] 38 [0] 39
[ 0.000000] pcpu-alloc: [0] 40 [0] 41 [0] 42 [0] 43 [0] 44 [0] 45 [0] 46 [0] 47
[ 0.000000] pcpu-alloc: [0] 48 [0] 49 [0] 50 [0] 51 [0] 52 [0] 53 [0] 54 [0] 55
[ 0.000000] pcpu-alloc: [0] 56 [0] 57 [0] 58 [0] 59 [0] 60 [0] 61 [0] 62 [0] 63
[ 0.000000] Kernel command line: earlycon=ns16550a,0x10000000 console=ttyS0 root=/dev/vda rw console=ttyS0 loglevel=7 debug ignore_loglevel
[ 0.000000] printk: log_buf_len individual max cpu contribution: 4096 bytes
[ 0.000000] printk: log_buf_len total cpu_extra contributions: 258048 bytes
[ 0.000000] printk: log_buf_len min size: 131072 bytes
[ 0.000000] printk: log_buf_len: 524288 bytes
[ 0.000000] printk: early log buf free: 127256(97%)
[ 0.000000] Dentry cache hash table entries: 2097152 (order: 12, 16777216 bytes, linear)
[ 0.000000] Inode-cache hash table entries: 1048576 (order: 11, 8388608 bytes, linear)
[ 0.000000] Fallback order for Node 0: 0
[ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 2580480
[ 0.000000] Policy zone: Normal
[ 0.000000] mem auto-init: stack:all(zero), heap alloc:off, heap free:off
[ 0.000000] software IO TLB: area num 64.
[ 0.000000] software IO TLB: mapped [mem 0x00000000f4800000-0x00000000f8800000] (64MB)
[ 0.000000] Virtual kernel memory layout:
[ 0.000000] fixmap : 0xff1bfffffea00000 - 0xff1bffffff000000 (6144 kB)
[ 0.000000] pci io : 0xff1bffffff000000 - 0xff1c000000000000 ( 16 MB)
[ 0.000000] vmemmap : 0xff1c000000000000 - 0xff20000000000000 (1024 TB)
[ 0.000000] vmalloc : 0xff20000000000000 - 0xff60000000000000 (16384 TB)
[ 0.000000] modules : 0xffffffff01a77000 - 0xffffffff80000000 (2021 MB)
[ 0.000000] lowmem : 0xff60000000000000 - 0xff60000280000000 ( 10 GB)
[ 0.000000] kernel : 0xffffffff80000000 - 0xffffffffffffffff (2047 MB)
[ 0.000000] Memory: 10172272K/10485760K available (11341K kernel code, 5447K rwdata, 6144K rodata, 2702K init, 515K bss, 313488K reserved, 0K cma-reserved)
[ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=64, Nodes=1
[ 0.000000] ftrace: allocating 42496 entries in 166 pages
[ 0.000000] ftrace: allocated 166 pages with 4 groups
[ 0.000000] rcu: Hierarchical RCU implementation.
[ 0.000000] rcu: RCU debug extended QS entry/exit.
[ 0.000000] Rude variant of Tasks RCU enabled.
[ 0.000000] Tracing variant of Tasks RCU enabled.
[ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies.
[ 0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0
[ 0.000000] riscv-intc: 64 local interrupts mapped using AIA
[ 0.000000] riscv-imsic: imsic: providing IPIs using interrupt 1
[ 0.000000] riscv-imsic: imsic: hart-index-bits: 6, guest-index-bits: 3
[ 0.000000] riscv-imsic: imsic: group-index-bits: 0, group-index-shift: 24
[ 0.000000] riscv-imsic: imsic: per-CPU IDs 255 at base address 0x0000000028000000
[ 0.000000] riscv-imsic: imsic: total 16256 interrupts available
[ 0.000000] rcu: srcu_init: Setting srcu_struct sizes based on contention.
[ 0.000000] clocksource: riscv_clocksource: mask: 0xffffffffffffffff max_cycles: 0x24e6a1710, max_idle_ns: 440795202120 ns
[ 0.000144] sched_clock: 64 bits at 10MHz, resolution 100ns, wraps every 4398046511100ns
[ 0.000649] riscv-timer: Timer interrupt in S-mode is available via sstc extension
[ 0.054419] Console: colour dummy device 80x25
[ 0.063184] ACPI: Core revision 20230628
[ 0.079711] Calibrating delay loop (skipped), value calculated using timer frequency.. 20.00 BogoMIPS (lpj=40000)
[ 0.080503] pid_max: default: 65536 minimum: 512
[ 0.084910] LSM: initializing lsm=capability,integrity
[ 0.099150] Mount-cache hash table entries: 32768 (order: 6, 262144 bytes, linear)
[ 0.099674] Mountpoint-cache hash table entries: 32768 (order: 6, 262144 bytes, linear)
[ 0.259919] ACPI PPTT: No PPTT table found, CPU and cache topology may be inaccurate
[ 0.279844] RCU Tasks Rude: Setting shift to 6 and lim to 1 rcu_task_cb_adjust=1 rcu_task_cpu_ids=64.
[ 0.280848] RCU Tasks Trace: Setting shift to 6 and lim to 1 rcu_task_cb_adjust=1 rcu_task_cpu_ids=64.
[ 0.285127] riscv: ELF compat mode supported
[ 0.285596] ASID allocator using 16 bits (65536 entries)
[ 0.287489] rcu: Hierarchical SRCU implementation.
[ 0.287753] rcu: Max phase no-delay instances is 1000.
[ 0.304678] Remapping and enabling EFI services.
[ 0.333697] smp: Bringing up secondary CPUs ...
[ 0.895873] smp: Brought up 1 node, 64 CPUs