Bug 27449 - [Anolis23.4-beta][RC1.1][KVM][loongarch]虚拟机cpu hotplug后,新增的cpu处于off line状态,手动使能才能online
Summary: [Anolis23.4-beta][RC1.1][KVM][loongarch]虚拟机cpu hotplug后,新增的cpu处于off line状态,手动...
Status: RESOLVED FIXED
Alias: None
Product: ANCK 6.6 Dev
Classification: ANCK
Component: virt (show other bugs) virt
Version: 6.6.102-5
Hardware: loongarch Linux
: P3-Medium S3-normal
Target Milestone: ---
Assignee: maqiao
QA Contact: shuming
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-12-01 16:34 UTC by ls18518883152
Modified: 2025-12-08 11:48 UTC (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ls18518883152 loongson_group 2025-12-01 16:34:01 UTC
Description of problem:
虚拟机cpu hotplug后,新增的cpu处于off line状态,手动使能才能online

Version-Release number of selected component (if applicable):
物理机内核版本:6.6.102-5.2_rc1.1.an23.loongarch64
虚拟机内核版本:6.6.102-5.2_rc1.1.an23.loongarch64
qemu版本:qemu-8.2.0-36.an23.loongarch64

How reproducible:


Steps to Reproduce:
1、启动虚拟机
/usr/bin/qemu-system-loongarch64   -machine virt,accel=kvm    -nodefaults   -m 2048   -smp 2,maxcpus=4,cores=4,threads=1,sockets=1    -cpu 'la464-loongarch-cpu'   -bios /usr/share/edk2/loongarch64/QEMU_EFI.fd     -drive file=/home/loongson/AnolisOS-23.4.loongarch64.qcow2,if=virtio   -nographic       -serial stdio     -netdev user,id=net1,hostfwd=tcp::2222-:22   -device virtio-net-pci,netdev=net1  -monitor telnet:localhost:4444,server,nowait    -msg timestamp=on
[root@anolis ~]# lscpu
Architecture:          loongarch64
  CPU op-mode(s):      32-bit, 64-bit
  Address sizes:       48 bits physical, 48 bits virtual
  Byte Order:          Little Endian
CPU(s):                2
  On-line CPU(s) list: 0,1

2、qemu monitor 添加 cpu 
在物理机上新开一个端口智行如下操作,热插入一个vcpu
[root@bogon ~]# telnet localhost 4444
Trying ::1...
Connected to localhost.
Escape character is '^]'.
QEMU 8.2.2 monitor - type 'help' for more information
(qemu) 
(qemu) device_add la464-loongarch-cpu,core-id=2,id=vcpu2
(qemu)

3、在虚拟机上输入lscpu,查看刚插入vcpu的状态
[root@anolis ~]# [   76.744761] ACPI: CPU2 has been hot-added
lscpu
Architecture:           loongarch64
  CPU op-mode(s):       32-bit, 64-bit
  Address sizes:        48 bits physical, 48 bits virtual
  Byte Order:           Little Endian
CPU(s):                 3
  On-line CPU(s) list:  0,1
  Off-line CPU(s) list: 2

4.手动使能
[root@anolis ~]# echo 1 > /sys/devices/system/cpu/cpu2/online
[  216.643670] Booting CPU#2...
[  216.644122] 64-bit Loongson Processor probed (LA464 Core)
[  216.644617] CPU2 revision is: 0014c010 (Loongson-64bit)
[  216.645007] FPU2 revision is: 00000001
[  216.645344] CPU#2 finished
[  216.646024] Will online and init hotplugged CPU: 2
[root@anolis ~]# lscpu
Architecture:          loongarch64
  CPU op-mode(s):      32-bit, 64-bit
  Address sizes:       48 bits physical, 48 bits virtual
  Byte Order:          Little Endian
CPU(s):                3
  On-line CPU(s) list: 0-2
BIOS Vendor ID:        QEMU

Actual results:

新增的cpu处于offline状态
Expected results:


Additional info:
cpu hotplug 后,新热插入的vcpu成功被添加,状态是online
Comment 2 mgb01105731 2025-12-05 13:35:47 UTC
systemd-255-12.an23中修复,当前iso中使用的是-10版本
Comment 3 mgb01105731 2025-12-08 11:48:46 UTC
systemd 已经正式构建
https://build.openanolis.cn/buildinfo?buildID=44256