config_tools: will load msr driver if no /dev/cpu/#/msr is found
`modprobe msr` will be invoked if no /dev/cpu/#/msr is found.
If the "msr" module is built-in that check will pass and
no `modprobe msr` should be invoked.
fixes: aeab5a2
("config_tools: update loading msr driver logic")
Tracked-On: #8410
Signed-off-by: Kunhui-Li <kunhuix.li@intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
This commit is contained in:
parent
1b2b20b07d
commit
cf5ba25de2
|
@ -37,15 +37,15 @@ def vendor_check():
|
||||||
vendor_name = line.split(':')[1].strip()
|
vendor_name = line.split(':')[1].strip()
|
||||||
return vendor_name == CPU_VENDOR
|
return vendor_name == CPU_VENDOR
|
||||||
|
|
||||||
def check_msr_files(cpu_dirs):
|
def check_msr_nodes(cpu_dirs):
|
||||||
cpu_list = []
|
cpu_list_of_no_msr_node = []
|
||||||
for cpu_num in os.listdir(cpu_dirs):
|
for cpu_num in os.listdir(cpu_dirs):
|
||||||
if cpu_num.isdigit():
|
if cpu_num.isdigit():
|
||||||
if os.path.exists(os.path.join(cpu_dirs, "{}/msr".format(cpu_num))):
|
if os.path.exists(os.path.join(cpu_dirs, "{}/msr".format(cpu_num))):
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
cpu_list.append(cpu_num)
|
cpu_list_of_no_msr_node.append(cpu_num)
|
||||||
return cpu_list
|
return cpu_list_of_no_msr_node
|
||||||
|
|
||||||
def check_env():
|
def check_env():
|
||||||
"""Check if there is appropriate environment on this system"""
|
"""Check if there is appropriate environment on this system"""
|
||||||
|
@ -57,15 +57,15 @@ def check_env():
|
||||||
|
|
||||||
# check cpu msr file
|
# check cpu msr file
|
||||||
cpu_dirs = "/dev/cpu"
|
cpu_dirs = "/dev/cpu"
|
||||||
if not check_msr_files(cpu_dirs):
|
if check_msr_nodes(cpu_dirs):
|
||||||
res = external_tools.run("modprobe msr")
|
res = external_tools.run("modprobe msr")
|
||||||
err_msg = res.stderr.readline().decode('ascii')
|
err_msg = res.stderr.readline().decode('ascii')
|
||||||
if err_msg:
|
if err_msg:
|
||||||
logging.critical("{}".format(err_msg))
|
logging.critical("{}".format(err_msg))
|
||||||
exit(-1)
|
exit(-1)
|
||||||
msr_info = check_msr_files(cpu_dirs)
|
msr_node_unavailable_cpus = check_msr_nodes(cpu_dirs)
|
||||||
if msr_info:
|
if msr_node_unavailable_cpus:
|
||||||
for cpu_num in msr_info:
|
for cpu_num in msr_node_unavailable_cpus:
|
||||||
logging.critical("Missing CPU MSR file at {}/{}/msr".format(cpu_dirs, cpu_num))
|
logging.critical("Missing CPU MSR file at {}/{}/msr".format(cpu_dirs, cpu_num))
|
||||||
logging.critical("Missing CPU MSR file /dev/cpu/#/msr. Check the value of CONFIG_X86_MSR in the kernel config." \
|
logging.critical("Missing CPU MSR file /dev/cpu/#/msr. Check the value of CONFIG_X86_MSR in the kernel config." \
|
||||||
" Set it to 'Y' and rebuild the OS. Then rerun the Board Inspector.")
|
" Set it to 'Y' and rebuild the OS. Then rerun the Board Inspector.")
|
||||||
|
|
Loading…
Reference in New Issue