Archives | Categories

Emulate a NUMA machine with QEMU

<2014-11-25 Tue>

在 VirtualBox, VMWare 大行其道的今天,我依然坚持使用 QEMU 的原因不外乎:

今天偶尔发现 QEMU 还可以模拟 NUMA 架构的机器,如下:

qemu-system-x86_64 \
    -enable-kvm \
    -smp cpus=8,sockets=2,cores=4 \
    -m 2048 \
    -numa node,mem=1024,cpus=0-3 \
    -numa node,mem=1024,cpus=4-7 \
    -hda debian64-with-kernel-12G.qcow2 

上面给定 2 个 4 核 CPU 共 8 个 core,2G Memeory,让两个 Node 来平分。

启动后看一下效果:

root@Debian64-QEMU:~# lscpu 
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                8
On-line CPU(s) list:   0-7
Thread(s) per core:    1
Core(s) per socket:    4
Socket(s):             2
NUMA node(s):          2
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 6
Stepping:              3
CPU MHz:               2893.426
BogoMIPS:              5786.85
Hypervisor vendor:     KVM
Virtualization type:   full
L1d cache:             32K
L1i cache:             32K
L2 cache:              4096K
NUMA node0 CPU(s):     0-3
NUMA node1 CPU(s):     4-7
root@Debian64-QEMU:~# numastat 
                           node0           node1
numa_hit                  130695          130093
numa_miss                      0               0
numa_foreign                   0               0
interleave_hit             28713           28693
local_node                101435          129048
other_node                 29260            1045
root@Debian64-QEMU:~# 

一个包含两个 Nodes 的 NUMA 机器已成功启动,以后不愁没有 NUMA 机器做开发调试了 ^_^

Discuss and Comment

Have few questions or feedback? Feel free to send me(killian.zhuo📧gmail.com) an email!

Copyright © KDr2, SOME RIGHTS RESERVED UNDER CC BY-NC 4.0.

Built with Emacs 28.2 (Org mode 9.5.5).

Last updated: 2022-01-28 Fri 13:42.