mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
nodeinfo: deal with offline cpus in a node
Commit 80533ca
forgot to think about offline cpus. When a node
cpu is offline, then its topology/ subdirectory is not present,
leading to spurious error messages leaked to the user such as:
libvir: error : cannot open /home/dummy/libvirt/tests/nodeinfodata/linux-nodeinfo-sysfs-test-6/node/node0/cpu7/topology/physical_package_id: No such file or directory
Fix that, as well as test it; the test data is gathered from a
machine with one NUMA node, hyperthreading, and with 2 of the
8 cpus offline.
* src/nodeinfo.c (virNodeParseNode): Don't parse topology of
offline cpus.
* tests/nodeinfotest.c (mymain): Run new test.
* tests/nodeinfodata/linux-nodeinfo-sysfs-test-6*: New data.
This commit is contained in:
parent
0fbafe9c50
commit
03e0ec10b4
@ -225,6 +225,12 @@ virNodeParseNode(const char *node, int *sockets, int *cores, int *threads)
|
|||||||
if (sscanf(cpudirent->d_name, "cpu%u", &cpu) != 1)
|
if (sscanf(cpudirent->d_name, "cpu%u", &cpu) != 1)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if ((online = virNodeGetCpuValue(node, cpu, "online", true)) < 0)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
if (!online)
|
||||||
|
continue;
|
||||||
|
|
||||||
/* Parse socket */
|
/* Parse socket */
|
||||||
sock = virNodeParseSocket(node, cpu);
|
sock = virNodeParseSocket(node, cpu);
|
||||||
CPU_SET(sock, &sock_map);
|
CPU_SET(sock, &sock_map);
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
CPUs: 6/8, MHz: 1596, Nodes: 1, Sockets: 1, Cores: 4, Threads: 2
|
150
tests/nodeinfodata/linux-nodeinfo-sysfs-test-6-x86.cpuinfo
Normal file
150
tests/nodeinfodata/linux-nodeinfo-sysfs-test-6-x86.cpuinfo
Normal file
@ -0,0 +1,150 @@
|
|||||||
|
processor : 0
|
||||||
|
vendor_id : GenuineIntel
|
||||||
|
cpu family : 6
|
||||||
|
model : 44
|
||||||
|
model name : Intel(R) Xeon(R) CPU E5640 @ 2.67GHz
|
||||||
|
stepping : 2
|
||||||
|
cpu MHz : 1596.000
|
||||||
|
cache size : 12288 KB
|
||||||
|
physical id : 0
|
||||||
|
siblings : 6
|
||||||
|
core id : 0
|
||||||
|
cpu cores : 4
|
||||||
|
apicid : 0
|
||||||
|
initial apicid : 0
|
||||||
|
fpu : yes
|
||||||
|
fpu_exception : yes
|
||||||
|
cpuid level : 11
|
||||||
|
wp : yes
|
||||||
|
flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm dca sse4_1 sse4_2 popcnt aes lahf_lm ida arat epb dts tpr_shadow vnmi flexpriority ept vpid
|
||||||
|
bogomips : 5333.90
|
||||||
|
clflush size : 64
|
||||||
|
cache_alignment : 64
|
||||||
|
address sizes : 40 bits physical, 48 bits virtual
|
||||||
|
power management:
|
||||||
|
|
||||||
|
processor : 1
|
||||||
|
vendor_id : GenuineIntel
|
||||||
|
cpu family : 6
|
||||||
|
model : 44
|
||||||
|
model name : Intel(R) Xeon(R) CPU E5640 @ 2.67GHz
|
||||||
|
stepping : 2
|
||||||
|
cpu MHz : 1596.000
|
||||||
|
cache size : 12288 KB
|
||||||
|
physical id : 0
|
||||||
|
siblings : 6
|
||||||
|
core id : 1
|
||||||
|
cpu cores : 4
|
||||||
|
apicid : 2
|
||||||
|
initial apicid : 2
|
||||||
|
fpu : yes
|
||||||
|
fpu_exception : yes
|
||||||
|
cpuid level : 11
|
||||||
|
wp : yes
|
||||||
|
flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm dca sse4_1 sse4_2 popcnt aes lahf_lm ida arat epb dts tpr_shadow vnmi flexpriority ept vpid
|
||||||
|
bogomips : 5333.90
|
||||||
|
clflush size : 64
|
||||||
|
cache_alignment : 64
|
||||||
|
address sizes : 40 bits physical, 48 bits virtual
|
||||||
|
power management:
|
||||||
|
|
||||||
|
processor : 2
|
||||||
|
vendor_id : GenuineIntel
|
||||||
|
cpu family : 6
|
||||||
|
model : 44
|
||||||
|
model name : Intel(R) Xeon(R) CPU E5640 @ 2.67GHz
|
||||||
|
stepping : 2
|
||||||
|
cpu MHz : 1596.000
|
||||||
|
cache size : 12288 KB
|
||||||
|
physical id : 0
|
||||||
|
siblings : 6
|
||||||
|
core id : 9
|
||||||
|
cpu cores : 4
|
||||||
|
apicid : 18
|
||||||
|
initial apicid : 18
|
||||||
|
fpu : yes
|
||||||
|
fpu_exception : yes
|
||||||
|
cpuid level : 11
|
||||||
|
wp : yes
|
||||||
|
flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm dca sse4_1 sse4_2 popcnt aes lahf_lm ida arat epb dts tpr_shadow vnmi flexpriority ept vpid
|
||||||
|
bogomips : 5333.90
|
||||||
|
clflush size : 64
|
||||||
|
cache_alignment : 64
|
||||||
|
address sizes : 40 bits physical, 48 bits virtual
|
||||||
|
power management:
|
||||||
|
|
||||||
|
processor : 3
|
||||||
|
vendor_id : GenuineIntel
|
||||||
|
cpu family : 6
|
||||||
|
model : 44
|
||||||
|
model name : Intel(R) Xeon(R) CPU E5640 @ 2.67GHz
|
||||||
|
stepping : 2
|
||||||
|
cpu MHz : 1596.000
|
||||||
|
cache size : 12288 KB
|
||||||
|
physical id : 0
|
||||||
|
siblings : 6
|
||||||
|
core id : 10
|
||||||
|
cpu cores : 4
|
||||||
|
apicid : 20
|
||||||
|
initial apicid : 20
|
||||||
|
fpu : yes
|
||||||
|
fpu_exception : yes
|
||||||
|
cpuid level : 11
|
||||||
|
wp : yes
|
||||||
|
flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm dca sse4_1 sse4_2 popcnt aes lahf_lm ida arat epb dts tpr_shadow vnmi flexpriority ept vpid
|
||||||
|
bogomips : 5333.90
|
||||||
|
clflush size : 64
|
||||||
|
cache_alignment : 64
|
||||||
|
address sizes : 40 bits physical, 48 bits virtual
|
||||||
|
power management:
|
||||||
|
|
||||||
|
processor : 4
|
||||||
|
vendor_id : GenuineIntel
|
||||||
|
cpu family : 6
|
||||||
|
model : 44
|
||||||
|
model name : Intel(R) Xeon(R) CPU E5640 @ 2.67GHz
|
||||||
|
stepping : 2
|
||||||
|
cpu MHz : 1596.000
|
||||||
|
cache size : 12288 KB
|
||||||
|
physical id : 0
|
||||||
|
siblings : 6
|
||||||
|
core id : 0
|
||||||
|
cpu cores : 4
|
||||||
|
apicid : 1
|
||||||
|
initial apicid : 1
|
||||||
|
fpu : yes
|
||||||
|
fpu_exception : yes
|
||||||
|
cpuid level : 11
|
||||||
|
wp : yes
|
||||||
|
flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm dca sse4_1 sse4_2 popcnt aes lahf_lm ida arat epb dts tpr_shadow vnmi flexpriority ept vpid
|
||||||
|
bogomips : 5333.90
|
||||||
|
clflush size : 64
|
||||||
|
cache_alignment : 64
|
||||||
|
address sizes : 40 bits physical, 48 bits virtual
|
||||||
|
power management:
|
||||||
|
|
||||||
|
processor : 6
|
||||||
|
vendor_id : GenuineIntel
|
||||||
|
cpu family : 6
|
||||||
|
model : 44
|
||||||
|
model name : Intel(R) Xeon(R) CPU E5640 @ 2.67GHz
|
||||||
|
stepping : 2
|
||||||
|
cpu MHz : 1596.000
|
||||||
|
cache size : 12288 KB
|
||||||
|
physical id : 0
|
||||||
|
siblings : 6
|
||||||
|
core id : 9
|
||||||
|
cpu cores : 4
|
||||||
|
apicid : 19
|
||||||
|
initial apicid : 19
|
||||||
|
fpu : yes
|
||||||
|
fpu_exception : yes
|
||||||
|
cpuid level : 11
|
||||||
|
wp : yes
|
||||||
|
flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm dca sse4_1 sse4_2 popcnt aes lahf_lm ida arat epb dts tpr_shadow vnmi flexpriority ept vpid
|
||||||
|
bogomips : 5333.90
|
||||||
|
clflush size : 64
|
||||||
|
cache_alignment : 64
|
||||||
|
address sizes : 40 bits physical, 48 bits virtual
|
||||||
|
power management:
|
||||||
|
|
@ -0,0 +1 @@
|
|||||||
|
0
|
@ -0,0 +1 @@
|
|||||||
|
0
|
@ -0,0 +1 @@
|
|||||||
|
11
|
@ -0,0 +1 @@
|
|||||||
|
1
|
@ -0,0 +1 @@
|
|||||||
|
1
|
@ -0,0 +1 @@
|
|||||||
|
0
|
@ -0,0 +1 @@
|
|||||||
|
02
|
@ -0,0 +1 @@
|
|||||||
|
1
|
@ -0,0 +1 @@
|
|||||||
|
9
|
@ -0,0 +1 @@
|
|||||||
|
0
|
@ -0,0 +1 @@
|
|||||||
|
44
|
@ -0,0 +1 @@
|
|||||||
|
1
|
@ -0,0 +1 @@
|
|||||||
|
10
|
@ -0,0 +1 @@
|
|||||||
|
0
|
@ -0,0 +1 @@
|
|||||||
|
08
|
@ -0,0 +1 @@
|
|||||||
|
1
|
@ -0,0 +1 @@
|
|||||||
|
0
|
@ -0,0 +1 @@
|
|||||||
|
0
|
@ -0,0 +1 @@
|
|||||||
|
11
|
@ -0,0 +1 @@
|
|||||||
|
0
|
@ -0,0 +1 @@
|
|||||||
|
1
|
@ -0,0 +1 @@
|
|||||||
|
9
|
@ -0,0 +1 @@
|
|||||||
|
0
|
@ -0,0 +1 @@
|
|||||||
|
44
|
@ -0,0 +1 @@
|
|||||||
|
0
|
1
tests/nodeinfodata/linux-nodeinfo-sysfs-test-6/node/node0/cpu0
Symbolic link
1
tests/nodeinfodata/linux-nodeinfo-sysfs-test-6/node/node0/cpu0
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../cpu/cpu0
|
1
tests/nodeinfodata/linux-nodeinfo-sysfs-test-6/node/node0/cpu1
Symbolic link
1
tests/nodeinfodata/linux-nodeinfo-sysfs-test-6/node/node0/cpu1
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../cpu/cpu1
|
1
tests/nodeinfodata/linux-nodeinfo-sysfs-test-6/node/node0/cpu2
Symbolic link
1
tests/nodeinfodata/linux-nodeinfo-sysfs-test-6/node/node0/cpu2
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../cpu/cpu2
|
1
tests/nodeinfodata/linux-nodeinfo-sysfs-test-6/node/node0/cpu3
Symbolic link
1
tests/nodeinfodata/linux-nodeinfo-sysfs-test-6/node/node0/cpu3
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../cpu/cpu3
|
1
tests/nodeinfodata/linux-nodeinfo-sysfs-test-6/node/node0/cpu4
Symbolic link
1
tests/nodeinfodata/linux-nodeinfo-sysfs-test-6/node/node0/cpu4
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../cpu/cpu4
|
1
tests/nodeinfodata/linux-nodeinfo-sysfs-test-6/node/node0/cpu5
Symbolic link
1
tests/nodeinfodata/linux-nodeinfo-sysfs-test-6/node/node0/cpu5
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../cpu/cpu5
|
1
tests/nodeinfodata/linux-nodeinfo-sysfs-test-6/node/node0/cpu6
Symbolic link
1
tests/nodeinfodata/linux-nodeinfo-sysfs-test-6/node/node0/cpu6
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../cpu/cpu6
|
1
tests/nodeinfodata/linux-nodeinfo-sysfs-test-6/node/node0/cpu7
Symbolic link
1
tests/nodeinfodata/linux-nodeinfo-sysfs-test-6/node/node0/cpu7
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../cpu/cpu7
|
@ -0,0 +1,29 @@
|
|||||||
|
|
||||||
|
Node 0 MemTotal: 8379620 kB
|
||||||
|
Node 0 MemFree: 2971308 kB
|
||||||
|
Node 0 MemUsed: 5408312 kB
|
||||||
|
Node 0 Active: 3795016 kB
|
||||||
|
Node 0 Inactive: 869528 kB
|
||||||
|
Node 0 Active(anon): 3081132 kB
|
||||||
|
Node 0 Inactive(anon): 13352 kB
|
||||||
|
Node 0 Active(file): 713884 kB
|
||||||
|
Node 0 Inactive(file): 856176 kB
|
||||||
|
Node 0 Unevictable: 48324 kB
|
||||||
|
Node 0 Mlocked: 13580 kB
|
||||||
|
Node 0 Dirty: 84 kB
|
||||||
|
Node 0 Writeback: 0 kB
|
||||||
|
Node 0 FilePages: 1585776 kB
|
||||||
|
Node 0 Mapped: 134048 kB
|
||||||
|
Node 0 AnonPages: 866116 kB
|
||||||
|
Node 0 Shmem: 13512 kB
|
||||||
|
Node 0 KernelStack: 3904 kB
|
||||||
|
Node 0 PageTables: 40664 kB
|
||||||
|
Node 0 NFS_Unstable: 0 kB
|
||||||
|
Node 0 Bounce: 0 kB
|
||||||
|
Node 0 WritebackTmp: 0 kB
|
||||||
|
Node 0 Slab: 244404 kB
|
||||||
|
Node 0 SReclaimable: 161784 kB
|
||||||
|
Node 0 SUnreclaim: 82620 kB
|
||||||
|
Node 0 HugePages_Total: 0
|
||||||
|
Node 0 HugePages_Free: 0
|
||||||
|
Node 0 HugePages_Surp: 0
|
BIN
tests/nodeinfodata/linux-nodeinfo-sysfs-test-6/node/online
Normal file
BIN
tests/nodeinfodata/linux-nodeinfo-sysfs-test-6/node/online
Normal file
Binary file not shown.
BIN
tests/nodeinfodata/linux-nodeinfo-sysfs-test-6/node/possible
Normal file
BIN
tests/nodeinfodata/linux-nodeinfo-sysfs-test-6/node/possible
Normal file
Binary file not shown.
@ -130,6 +130,7 @@ mymain(void)
|
|||||||
"nodeinfo-sysfs-test-3",
|
"nodeinfo-sysfs-test-3",
|
||||||
"nodeinfo-sysfs-test-4",
|
"nodeinfo-sysfs-test-4",
|
||||||
"nodeinfo-sysfs-test-5",
|
"nodeinfo-sysfs-test-5",
|
||||||
|
"nodeinfo-sysfs-test-6",
|
||||||
# endif
|
# endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user