config_tools: update the regex pattern of offline cpu
The pattern matching logic (used by 'tr') is erroneous in the launch script generation logic. While its purpose is to return the CPU number from the 'cpuX' string (where 'X' is the CPU number), it does it incorrectly for any multiple of 10. Examples: - Processing 'cpu10' returns 1 (instead of 10) - Processing 'cpu20' returns 2 (instead of 20) This patch changes the [1-99] pattern matching to [0-9] which fixes it. This error led to the incorrect CPU cores being used (and offlined) for some VMs which could lead to confusing problems especially when an exclusive use of that CPU core was assumed and expected (e.g. RTVM). when CONFIG_BOOTPARAM_HOTPLUG_CPU0 is turned on in the kernel, there is a risk that we try to offline cpu0. So we also add extra check for cpu0 to aviod the risk. Tracked-On: #6482 Signed-off-by: Kunhui-Li <kunhuix.li@intel.com>
This commit is contained in:
parent
2abda0237c
commit
93ea0075dd
|
@ -95,9 +95,9 @@ def off_line_cpus(args, vmid, uos_type, 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(' idx=`echo $i | tr -cd "[0-9]"`', file=config)
|
||||
print(' echo $i online=$online', file=config)
|
||||
print(' if [ "$online" = "1" ]; then', file=config)
|
||||
print(' if [ "$online" = "1" ] && [ "$idx" != "0" ]; then', 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)
|
||||
|
|
Loading…
Reference in New Issue