procfs cpuinfo: use sequence number as processor
Change-Id: Idbfa48e9b60c03495d7ba72e962c55f0ffb8bec9
This commit is contained in:
committed by
Masamichi Takagi
parent
32b32f0c4a
commit
bb7e140655
@ -1223,7 +1223,7 @@ long ihk_mc_show_cpuinfo(char *buf, size_t buf_size, unsigned long read_off, int
|
|||||||
|
|
||||||
/* generate strings */
|
/* generate strings */
|
||||||
loff += scnprintf(lbuf + loff, lbuf_size - loff,
|
loff += scnprintf(lbuf + loff, lbuf_size - loff,
|
||||||
"processor\t: %d\n", cpuinfo->hwid);
|
"processor\t: %d\n", i);
|
||||||
loff += scnprintf(lbuf + loff, lbuf_size - loff, "Features\t:");
|
loff += scnprintf(lbuf + loff, lbuf_size - loff, "Features\t:");
|
||||||
|
|
||||||
for (j = 0; hwcap_str[j]; j++) {
|
for (j = 0; hwcap_str[j]; j++) {
|
||||||
|
|||||||
63
test/issues/1457/C1457.py
Normal file
63
test/issues/1457/C1457.py
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
#
|
||||||
|
# Test script for issue #1439
|
||||||
|
#
|
||||||
|
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
def get_command_result(cmd):
|
||||||
|
results = subprocess.Popen(
|
||||||
|
cmd, stdout=subprocess.PIPE,
|
||||||
|
shell=True).stdout.readlines()
|
||||||
|
return [str(x).rstrip("\n") for x in results]
|
||||||
|
|
||||||
|
def enumerate_cpu(cpu_list):
|
||||||
|
allcpus = []
|
||||||
|
for ranged_cpu in cpu_list.split(','):
|
||||||
|
try:
|
||||||
|
cpu_begin, cpu_end = ranged_cpu.split('-')
|
||||||
|
except ValueError:
|
||||||
|
cpu_begin = cpu_end = ranged_cpu
|
||||||
|
for i in range(int(cpu_begin), int(cpu_end) + 1):
|
||||||
|
allcpus.append(i)
|
||||||
|
allcpus.sort()
|
||||||
|
return allcpus
|
||||||
|
|
||||||
|
def get_online_cpu():
|
||||||
|
online_file = open('/sys/devices/system/cpu/online', 'r')
|
||||||
|
return online_file.readlines()[0].strip()
|
||||||
|
|
||||||
|
def get_cpuinfo_processors():
|
||||||
|
processors = []
|
||||||
|
cpuinfo_file = open('/proc/cpuinfo', 'r')
|
||||||
|
for line in cpuinfo_file.readlines():
|
||||||
|
if line.startswith('processor'):
|
||||||
|
processor = int(line.strip().split()[-1])
|
||||||
|
processors.append(processor)
|
||||||
|
return processors
|
||||||
|
|
||||||
|
def main():
|
||||||
|
onlines = enumerate_cpu(get_online_cpu())
|
||||||
|
processors = get_cpuinfo_processors()
|
||||||
|
|
||||||
|
print '# of online cpus:', len(onlines)
|
||||||
|
print '# of cpuinfo processors:', len(processors)
|
||||||
|
if len(onlines) != len(processors):
|
||||||
|
print 'ERROR: # of processors is not equal to # of cpus'
|
||||||
|
print 'FAIL'
|
||||||
|
exit()
|
||||||
|
|
||||||
|
i = 0
|
||||||
|
for cpu in processors:
|
||||||
|
print i, 'processor:', cpu
|
||||||
|
if i != cpu:
|
||||||
|
print 'ERROR: processor number is not ordered'
|
||||||
|
print 'FAIL'
|
||||||
|
exit()
|
||||||
|
i = i + 1
|
||||||
|
|
||||||
|
print 'SUCCESS'
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
7
test/issues/1457/C1457.sh
Executable file
7
test/issues/1457/C1457.sh
Executable file
@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
. ${HOME}/.mck_test_config
|
||||||
|
export MCK_DIR
|
||||||
|
sudo ${MCK_DIR}/sbin/mcreboot.sh 1,3,5,7,9-12,50-58
|
||||||
|
${MCK_DIR}/bin/mcexec python C1457.py
|
||||||
|
sudo ${MCK_DIR}/sbin/mcstop+release.sh
|
||||||
2
test/issues/1457/Makefile
Normal file
2
test/issues/1457/Makefile
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
test::
|
||||||
|
./C1457.shy
|
||||||
22
test/issues/1457/README
Normal file
22
test/issues/1457/README
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
□ テスト内容
|
||||||
|
|
||||||
|
arm64環境における/proc/cpuinfoについて、以下を確かめる。
|
||||||
|
|
||||||
|
(1) "processor" フィールドが/sys/devices/system/cpu/onlineファイルが示す
|
||||||
|
CPUの数だけ存在すること。
|
||||||
|
(2) "processor" フィールドの値が0からはじまる連番であること。
|
||||||
|
|
||||||
|
|
||||||
|
□ 実行手順
|
||||||
|
|
||||||
|
(1) $HOME/.mck_test_configを、MCK_DIRがMcKernelのインストール先を指すように編集する
|
||||||
|
(2) 以下を実行する
|
||||||
|
|
||||||
|
$ make test
|
||||||
|
|
||||||
|
|
||||||
|
□ 確認方法
|
||||||
|
|
||||||
|
標準出力にSUCCESSが出力されること
|
||||||
|
|
||||||
|
|
||||||
31
test/issues/1457/aarch64_result.log
Normal file
31
test/issues/1457/aarch64_result.log
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
# of online cpus: 28
|
||||||
|
# of cpuinfo processors: 28
|
||||||
|
0 processor: 0
|
||||||
|
1 processor: 1
|
||||||
|
2 processor: 2
|
||||||
|
3 processor: 3
|
||||||
|
4 processor: 4
|
||||||
|
5 processor: 5
|
||||||
|
6 processor: 6
|
||||||
|
7 processor: 7
|
||||||
|
8 processor: 8
|
||||||
|
9 processor: 9
|
||||||
|
10 processor: 10
|
||||||
|
11 processor: 11
|
||||||
|
12 processor: 12
|
||||||
|
13 processor: 13
|
||||||
|
14 processor: 14
|
||||||
|
15 processor: 15
|
||||||
|
16 processor: 16
|
||||||
|
17 processor: 17
|
||||||
|
18 processor: 18
|
||||||
|
19 processor: 19
|
||||||
|
20 processor: 20
|
||||||
|
21 processor: 21
|
||||||
|
22 processor: 22
|
||||||
|
23 processor: 23
|
||||||
|
24 processor: 24
|
||||||
|
25 processor: 25
|
||||||
|
26 processor: 26
|
||||||
|
27 processor: 27
|
||||||
|
SUCCESS
|
||||||
Reference in New Issue
Block a user