Skip to content

Commit 19abb41

Browse files
JasonChenCJwenlingz
authored andcommitted
launch_uos.sh: make sure cpu offline by retry
if acrnd or acrn_guest service enabled, launch_uos.sh will be called early time during system boot up, while a pci driver module may be insmod and disable cpu hotplug in short time, which could make cpu offline fail, we need check it to make sure cpu offline real happen before hypercall to disable vcpu. Tracked-On: #1584 Signed-off-by: Jason Chen CJ <jason.cj.chen@intel.com>
1 parent 241d5a6 commit 19abb41

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

devicemodel/samples/apl-mrb/launch_uos.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,13 @@ for i in `ls -d /sys/devices/system/cpu/cpu[1-99]`; do
407407
echo cpu$idx online=$online
408408
if [ "$online" = "1" ]; then
409409
echo 0 > $i/online
410+
online=`cat $i/online`
411+
# during boot time, cpu hotplug may be disabled by pci_device_probe during a pci module insmod
412+
while [ "$online" = "1" ]; do
413+
sleep 1
414+
echo 0 > $i/online
415+
online=`cat $i/online`
416+
done
410417
echo $idx > /sys/class/vhm/acrn_vhm/offline_cpu
411418
fi
412419
done

devicemodel/samples/nuc/launch_uos.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ for i in `ls -d /sys/devices/system/cpu/cpu[1-99]`; do
3737
echo cpu$idx online=$online
3838
if [ "$online" = "1" ]; then
3939
echo 0 > $i/online
40+
# during boot time, cpu hotplug may be disabled by pci_device_probe during a pci module insmod
41+
while [ "$online" = "1" ]; do
42+
sleep 1
43+
echo 0 > $i/online
44+
online=`cat $i/online`
45+
done
4046
echo $idx > /sys/class/vhm/acrn_vhm/offline_cpu
4147
fi
4248
done

0 commit comments

Comments
 (0)