Skip to contentSkip to conversation

Question: how to create a cxl region with the specified numa node and distance

DISCUSSION Xiao Yang 1 participant 1 message Jul 20, 2023

lore
Share & tools
lore

Xiao Yang

author
#0 lore raw

Hi All,

I tried to simulate a cxl memory device by the following qemu options:
--------------------------------------------------------------------
...
-object memory-backend-ram,size=1048576k,id=m0 \
-object memory-backend-ram,size=1048576k,id=m1 \
-numa node,nodeid=0,cpus=0-3,memdev=m0 \
-numa node,nodeid=1,memdev=m1 \
-numa dist,src=0,dst=1,val=15 \
...
-object memory-backend-ram,size=1048576k,share=on,id=vmem0 \
-device pxb-cxl,bus_nr=12,bus=pcie.0,numa_node=1,id=cxl.1 \
-device cxl-rp,port=0,bus=cxl.1,id=root_port13,chassis=0,slot=2 \
-device cxl-type3,bus=root_port13,volatile-memdev=vmem0,id=cxl-vmem0 \
-M cxl-fmw.0.targets.0=cxl.1,cxl-fmw.0.size=4G
--------------------------------------------------------------------

With the above configuration, the cxl memory device (mem0) can locate in the numa node1 but a new created region with mem0 still locates in a new numa node2.
--------------------------------------------------------------------

# cxl list -M
[
  {
    "memdev":"mem0",
    "ram_size":1073741824,
    "serial":0,
    "numa_node":1,
    "host":"0000:0d:00.0"
  }
]
# cxl create-region -t ram -d decoder0.0 -m mem0
...
cxl region: cmd_create_region: created 1 region
# numastat
                           node0           node1           node2
numa_hit                  310897            2090               0
numa_miss                      0               0               0
numa_foreign                   0               0               0
interleave_hit               250             691               0
local_node                310897               0               0
other_node                     0            2090               0
# numactl -H
available: 3 nodes (0-2)
node 0 cpus: 0 1 2 3
node 0 size: 955 MB
node 0 free: 480 MB
node 1 cpus:
node 1 size: 938 MB
node 1 free: 908 MB
node 2 cpus:
node 2 size: 1024 MB
node 2 free: 1024 MB
node distances:
node   0   1   2
  0:  10  15  20
  1:  15  10  20
  2:  20  20  10
---------------------------------------------------------------------
Q1: How to specify the numa node for the new created region?
Q2: How to specify the numa node distance for the new created region?
    The default distance is 20.

Best Regards,
Xiao Yang