有谁知道,vcpu线程id存储在linux中的哪个位置?实际上根据我在KVM中创建VM的研究,有些线程会形成vcpus;我需要它们的ID和位置。 我看了看这个位置:
的/ proc / qemu-kvm process ID
/任务/ * /
qemu-kvm process ID
字段来自此位置:
/var/run/libvirt/qemu/VM_NAME.xml
因为我认为可能在那里找到了vcpu的ID,但不幸的是它们不是vcpu的ID,它们只是一些子进程。
任何帮助将不胜感激。 非常感谢。
答案 0 :(得分:1)
如果您使用参数-qmp unix执行qemu:./ qmp-sock,server,nowait,例如:
# /opt/qemu/bin/qemu-system-x86_64 \
-smp cpus=2 \
-drive file=/opt/test.qcow2,format=qcow2 \
-cdrom CentOS-7-x86_64-DVD-1511.iso \
-qmp unix:./qmp-sock,server,nowait
你可以执行qmp-shell来获取cpu信息:
# /opt/git/qemu/scripts/qmp/qmp-shell /opt/qmp-sock
Welcome to the QMP low-level shell!
Connected to QEMU 2.5.50
(QEMU) query-cpus
{"return": [{"halted": false, "pc": -2124176787, "current": true, "qom_path": "/machine/unattached/device[0]", "thread_id": 2344, "arch": "x86", "CPU": 0}, {"halted": true, "pc": -2130342250, "current": false, "qom_path": "/machine/unattached/device[3]", "thread_id": 2341, "arch": "x86", "CPU": 1}]}
线程ID:2344和2341
# ps -eLf|grep qemu-system
root 2341 2252 2341 9 4 08:52 pts/0 00:00:48 /opt/qemu/bin/qemu-system-x86_64 -smp cpus=2 -drive file=/opt/test.qcow2,format=qcow2 -cdrom CentOS-7-x86_64-DVD-1511.iso -qmp unix:./qmp-sock,server,nowait
root 2341 2252 2342 0 4 08:52 pts/0 00:00:00 /opt/qemu/bin/qemu-system-x86_64 -smp cpus=2 -drive file=/opt/test.qcow2,format=qcow2 -cdrom CentOS-7-x86_64-DVD-1511.iso -qmp unix:./qmp-sock,server,nowait
root 2341 2252 2344 85 4 08:52 pts/0 00:07:04 /opt/qemu/bin/qemu-system-x86_64 -smp cpus=2 -drive file=/opt/test.qcow2,format=qcow2 -cdrom CentOS-7-x86_64-DVD-1511.iso -qmp unix:./qmp-sock,server,nowait
root 2341 2252 2345 0 4 08:52 pts/0 00:00:00 /opt/qemu/bin/qemu-system-x86_64 -smp cpus=2 -drive file=/opt/test.qcow2,format=qcow2 -cdrom CentOS-7-x86_64-DVD-1511.iso -qmp unix:./qmp-sock,server,nowait
root 2378 2304 2378 0 1 09:01 pts/2 00:00:00 grep --color=auto qemu-system
有关详细信息,请参阅http://wiki.qemu.org/QMP
答案 1 :(得分:0)
我认为vcpu线程ID是Qemu的内部,它作为普通线程暴露给linux
struct CPUState {
...
struct QemuThread *thread;
...
int thread_id;
...
bool thread_kicked;
...
bool throttle_thread_scheduled;
...
};
您可以使用Qemu命令info cpus
来显示有关cpus的信息。它给了我这个:
(qemu) info cpus
* CPU #0: pc=0x00000000b483c8c4 thread_id=6660