mcreboot-smp-x86: find unused IRQ line and pass start vector to ihk_smp_x86.ko
This commit is contained in:
@ -6,9 +6,10 @@
|
|||||||
#
|
#
|
||||||
# This is an example script for loading IHK, configuring a partition and
|
# This is an example script for loading IHK, configuring a partition and
|
||||||
# booting McKernel on it.
|
# booting McKernel on it.
|
||||||
# The script reserves half of the CPU cores and 512MB from NUMA node 0 if
|
# The script reserves half of the CPU cores and 512MB of RAM from NUMA node 0
|
||||||
# IHK is loaded for the first time, otherwise it destroys the current
|
# when IHK is loaded for the first time, otherwise it destroys the current
|
||||||
# McKernel instances and reboots it using the same set of resources as previously.
|
# McKernel instance and reboots it using the same set of resources as it used
|
||||||
|
# previously.
|
||||||
# Note that the script does not output anything unless an error occurs.
|
# Note that the script does not output anything unless an error occurs.
|
||||||
|
|
||||||
prefix="@prefix@"
|
prefix="@prefix@"
|
||||||
@ -39,20 +40,34 @@ fi
|
|||||||
|
|
||||||
# Load IHK-SMP if not loaded and reserve CPUs and memory
|
# Load IHK-SMP if not loaded and reserve CPUs and memory
|
||||||
if [ "`lsmod | grep ihk_smp_x86`" == "" ]; then
|
if [ "`lsmod | grep ihk_smp_x86`" == "" ]; then
|
||||||
if ! insmod ${KMODDIR}/ihk-smp-x86.ko; then echo "error: loading ihk-smp-x86"; exit; fi;
|
ihk_irq=""
|
||||||
|
for i in `seq 64 255`; do
|
||||||
|
if [ ! -d /proc/irq/$i ] && [ "`cat /proc/interrupts | grep ":" | awk '{print $1}' | grep -o '[0-9]*' | grep $i`" == "" ]; then
|
||||||
|
ihk_irq=$i
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if [ "$ihk_irq" == "" ]; then echo "error: no IRQ available"; exit; fi
|
||||||
|
if ! insmod ${KMODDIR}/ihk-smp-x86.ko ihk_start_irq=$ihk_irq; then echo "error: loading ihk-smp-x86"; exit; fi;
|
||||||
if ! ${SBINDIR}/ihkconfig 0 reserve cpu ${cpus}; then echo "error: reserving CPUs"; exit; fi
|
if ! ${SBINDIR}/ihkconfig 0 reserve cpu ${cpus}; then echo "error: reserving CPUs"; exit; fi
|
||||||
if ! ${SBINDIR}/ihkconfig 0 reserve mem ${mem}; then echo "error: reserving memory"; exit; fi
|
if ! ${SBINDIR}/ihkconfig 0 reserve mem ${mem}; then echo "error: reserving memory"; exit; fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check for existing OS instance and destroy
|
# Check for existing OS instance and destroy
|
||||||
if [ -c /dev/mcos0 ]; then
|
if [ -c /dev/mcos0 ]; then
|
||||||
if ! ${SBINDIR}/ihkconfig 0 destroy 0; then echo "warning: destroy failed"; fi
|
# Query CPU cores and memory of OS instance so that the same values are used as previously
|
||||||
|
if ! ${SBINDIR}/ihkosctl 0 query cpu > /dev/null; then echo "error: querying cpus"; exit; fi
|
||||||
# Query CPU cores and memory so that the same values are used as previously
|
cpus=`${SBINDIR}/ihkosctl 0 query cpu`
|
||||||
if ! ${SBINDIR}/ihkconfig 0 query cpu > /dev/null; then echo "error: querying cpus"; exit; fi
|
if ! ${SBINDIR}/ihkosctl 0 query mem > /dev/null; then echo "error: querying memory"; exit; fi
|
||||||
cpus=`${SBINDIR}/ihkconfig 0 query cpu`
|
mem=`${SBINDIR}/ihkosctl 0 query mem`
|
||||||
if ! ${SBINDIR}/ihkconfig 0 query mem > /dev/null; then echo "error: querying memory"; exit; fi
|
|
||||||
mem=`${SBINDIR}/ihkconfig 0 query mem`
|
if ! ${SBINDIR}/ihkconfig 0 destroy 0; then echo "warning: destroy failed"; fi
|
||||||
|
else
|
||||||
|
# Otherwise query IHK-SMP for resources
|
||||||
|
if ! ${SBINDIR}/ihkconfig 0 query cpu > /dev/null; then echo "error: querying cpus"; exit; fi
|
||||||
|
cpus=`${SBINDIR}/ihkconfig 0 query cpu`
|
||||||
|
if ! ${SBINDIR}/ihkconfig 0 query mem > /dev/null; then echo "error: querying memory"; exit; fi
|
||||||
|
mem=`${SBINDIR}/ihkconfig 0 query mem`
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! ${SBINDIR}/ihkconfig 0 create; then echo "error: create"; exit; fi
|
if ! ${SBINDIR}/ihkconfig 0 create; then echo "error: create"; exit; fi
|
||||||
|
|||||||
Reference in New Issue
Block a user