config_tools: fix cpu offline issue in launch script
In launch script, update cpu offline method to fix the issue
that it isn't offline cpu on ADL-S board.
@@ -98,21 +98,26 @@ def off_line_cpus(args, vmid, uos_type, config):
print('fi', file=config)
print("", file=config)
print("# offline pinned vCPUs from SOS before launch UOS", file=config)
- print("for i in `ls -d /sys/devices/system/cpu/cpu[{}]`; do".format('..'.join(pcpu_id_list)), file=config)
- print(" online=`cat $i/online`", file=config)
+ print('cpu_path="/sys/devices/system/cpu"', file=config)
+ print("for i in `ls ${cpu_path}`; do", file=config)
+ print(" for j in {}; do".format(' '.join([str(i) for i in pcpu_id_list])), file=config)
+ print(' if [ "cpu"$j = $i ]; then', file=config)
+ print(' online=`cat ${cpu_path}/$i/online`', file=config)
print(' idx=`echo $i | tr -cd "[1-99]"`', file=config)
- print(" echo cpu$idx online=$online", file=config)
+ print(' echo $i online=$online', file=config)
print(' if [ "$online" = "1" ]; then', file=config)
- print(" echo 0 > $i/online", file=config)
- print(" online=`cat $i/online`", file=config)
+ print(" echo 0 > ${cpu_path}/$i/online", file=config)
+ print(" online=`cat ${cpu_path}/$i/online`", file=config)
print(" # during boot time, cpu hotplug may be disabled by pci_device_probe during a pci module insmod", file=config)
print(' while [ "$online" = "1" ]; do', file=config)
print(" sleep 1", file=config)
- print(" echo 0 > $i/online", file=config)
- print(" online=`cat $i/online`", file=config)
+ print(" echo 0 > ${cpu_path}/$i/online", file=config)
+ print(" online=`cat ${cpu_path}/$i/online`", file=config)
print(" done", file=config)
print(" echo $idx > ${offline_path}/offline_cpu", file=config)
print(" fi", file=config)
+ print(" fi", file=config)
+ print(" done", file=config)
print("done", file=config)
print("", file=config)
