Commit 53ed66d8 authored by Dan Reading's avatar Dan Reading
Browse files

This commit releates to the changes needed or exposed by checknode

running in MFS mode on the d710 nodes which have been set up for
TPM booting.

Major issues:
The MFS image for TPM booting is 32bit while other Linux MFS images
are 64bit.
The TPM kernel only supports 4Gb of memory, does not support
multi-processors.

checkutils: Make sure the dd to be run is bit-with compatiable with
the image.
cpucheck: Check and handle missing cpu flags "physical id",
"cpu cores", "siblings". Check and handle different Mhz format.
diskcheck: Differnet blocks/sectors format. Rewrite getwspeed and
getspeed funtions to handle dd and tdd compatibility and/or missing
binaries. Give better error messages for timing speed failures.
parent 482dedd3
......@@ -41,6 +41,9 @@ fi
[[ -z "${projdir-}" ]] && declare projdir # from tmcc hwinfo
[[ -z "${errexit_val-}" ]] && declare errexit_val # holding var for set values, ie -e
[[ -z "${mfsmode-}" ]] && declare -i mfsmode=0 #are we running in a MFS?
[[ -z "${bitsize-}" ]] && declare bitsize=""
[[ -z "${native_bitsize-}" ]] && declare -i native_bitsize=0 # what is our native binary bit size
[[ -z "${whichfile-}" ]] && declare whichfile=""
# PathNames
[[ -z "${logfile-}" ]] && declare logfile # output log
......@@ -79,6 +82,21 @@ initialize () {
mfsmode=0
fi
save_e
set +e
# find native bit size
whichfile=$(which file)
[[ "${whichfile}" ]] || exit 1 # hard stop
bitsize=$(file -L $whichfile)
restore_e
if [ "$bitsize" != "${bitsize/32}" ] ; then
native_bitsize=32
elif [ "$bitsize" != "${bitsize/64}" ] ; then
native_bitsize=64
else
native_bitsize=0
fi
inithostname
initlogs $@
inittestinfo
......
......@@ -27,14 +27,14 @@ echo -n ' Cpucheck..'
source checkutils.sh
x=$(caller)
echo "CPUCHECK standalone = $x"
[[ "${x/NULL}" = "$x" ]] && declare -ri cpucheck_standalone=0 || declare -ri cpucheck_standalone=1
declare arch="" failed="" s=""
declare -i sockets=0 cores_socket=0 threads_core=0 mhz=0 err=0
declare -i hyperthread=0 x64bit=0 hwvirt=0
declare p1="" p2="" p3=""
declare phy="" cid=""
declare phy="" cid=" "
declare p p1 p3 p3 phy
finish() {
echo -n "Cpucheck `date`: " >> ${logfile}
......@@ -120,7 +120,9 @@ fi
case $os in
Linux )
# XXX if have lscpu then us it to get arch
# XXX if have lscpu then us it to get arch
save_e
set +e
x=$(grep "model name" /proc/cpuinfo | head -1)
x=${x##*: }
#takeout all the spaces
......@@ -128,26 +130,33 @@ case $os in
[[ "${x:0:16}" == "Intel(R)Core(TM)" ]] && arch="x86_64" || arch=$x
[[ "${x:0:15}" == "Intel(R)Xeon(R)" ]] && arch="x86_64" || arch=$x
# count sockets using the 'physical id' string
# count sockets using the max 'physical id' string
# need to find how many different ids there are, to bad on some
# it starts at zero and on other machines it starts at 1
x=$(grep "physical id" /proc/cpuinfo)
while read -rd p p1 p2 p3 phy ; do
cid+="$phy "
done <<< $x
first=999 last=0
for i in $cid ; do
[[ $i -lt $first ]] && first=$i
[[ $i -gt $last ]] && last=$i
done
sockets=$(($last - $first))
((++sockets))
if [ -z "$x" ] ; then
sockets=1
else
while read -rd p p1 p2 p3 phy ; do
cid+="$phy "
done <<< $x
first=999 last=0
for i in $cid ; do
[[ $i -lt $first ]] && first=$i
[[ $i -gt $last ]] && last=$i
done
sockets=$(($last - $first))
((++sockets))
fi
x=$(grep "cpu cores" /proc/cpuinfo | head -1)
[[ "$x" ]] || x="cpu cores : 1"
x=${x##*: }
cores_socket=$x
x=$(grep "siblings" /proc/cpuinfo | head -1)
[[ "$x" ]] || x="siblings : 1"
x=${x##*: }
threads_core=$(($x / $cores_socket))
......@@ -156,16 +165,20 @@ case $os in
((++x))
cpus=$x
#better if dmesg not to old
#better if dmesg not to old; else use proc/cpuinfo
dmesgmhz=$(dmesg | grep -i mhz | grep processor)
if [ -n "$dmesgmhz" ] ; then
x=${dmesgmhz#*Detected }
x=${x% MHz*}
rawmhz=$x
else
x=$(grep -i mhz /proc/cpuinfo | head -1)
x=${x#*: }
fi
rawmhz=$x
mhz=$(round1p $rawmhz)
cpuflags=$(grep flags /proc/cpuinfo | head -1)
restore_e
[[ "${cpuflags}" = "${cpuflags/ht/}" ]] && hyperthread=0 || hyperthread=1
[[ "${cpuflags}" = "${cpuflags/lm/}" ]] && x64bit=0 || x64bit=1
[[ ("${cpuflags}" = "${cpuflags/vmx/}") && ("${cpuflags}" = "${cpuflags/svm/}") ]] && hwvirt=0 || hwvirt=1
......
......@@ -21,7 +21,6 @@
#
# }}}
#
echo -n ' Starting diskcheck..'
# find the number of disks
......@@ -30,6 +29,7 @@ echo -n ' Starting diskcheck..'
declare error=""
declare err=""
[[ -z "${USE_TDD-}" ]] && declare USE_TDD=""
source checkutils.sh
......@@ -508,7 +508,6 @@ getserial() {
res=${res^^} # upper case
fi
fi
[[ $res ]] && echo "$res" || echo "UNKNOWN"
return 0
}
......@@ -570,8 +569,7 @@ getbpers() {
hdname=${hdname##*/}
res=$(dmesg | grep "logical blocks" | grep $hdname)
if [ -z "$res" ] ; then
echo 0
return 0
res=$(dmesg | grep "hardware sectors" | grep $hdname)
fi
res=${res%%-byte *}
res=${res##*] }
......@@ -616,12 +614,12 @@ getsectors() {
hdname=${hdname##*/}
res=$(dmesg | grep "logical blocks" | grep $hdname)
if [ -z "$res" ] ; then
echo 0
return 0
res=$(dmesg | grep "hardware sectors" | grep $hdname)
else
res=${res%%-byte *}
fi
res=${res%%-byte *}
res=${res##*] }
res=${res%% *}
res=${res%% *}
[[ $res ]] || res=0
;;
FreeBSD )
......@@ -664,11 +662,44 @@ getsectors() {
return 0
}
getwspeed() {
hdname=$1
# disk is mounted somewhere then don't do the raw write speed
canwe=$(df | grep $hdname)
[[ $canwe ]] && { echo mounted; return 0; }
whichdd2use() {
local usedd
local usetdd
local canwe
local ddbs
local workhouredd
usedd=$(which dd)
canwe=$(ls -l $usedd | grep busybox)
[[ $canwe ]] && { echo "bad_busybox_dd"; return 0; }
workhorsedd=$usedd
# if we have a timed dd, use a timeout rather than a count
usetdd=$(which tdd)
[[ -x $usetdd ]] && { USE_TDD=$usetdd; export TDD_DD=$usedd; usedd=$usetdd; } # the wapper tdd will use /bin/dd by default but this var will override
# check compatabily, ok to have 32bit on 64bit machine
if [ $native_bitsize -ne 64 ] ; then
ddbs=$(file -L $workhorsedd)
if [ "$ddbs" != "${ddbs/64}" ] ; then
echo "bad_64bit_dd_on_32bit_machine"
return 0
fi
if [ "${USE_TDD}" != "${USE_TDD/tdd}" ] ; then
ddbs=$(file -L $USE_TDD)
if [ "$ddbs" != "${ddbs/64}" ] ; then
echo "bad_64bit_ddt_on_32bit_machine"
return 0
fi
fi
fi
echo "$usedd"
return 0
}
# call whichdd2use() before this to use correctly
ddargs() {
local args=""
if [ "$os" == "Linux" ] ; then
#args="bs=64k iflag=direct count=8000"
#note iflag direct can't be used with /dev/zero as infile
......@@ -676,52 +707,47 @@ getwspeed() {
elif [ "$os" == "FreeBSD" ] ; then
args="bs=64k"
fi
# do we have a working dd
dd=$(which dd)
canwe=$(ls -l $dd | grep busybox)
[[ $canwe ]] && { echo bad_dd; return 0; }
# if we have a timed dd, use a timeout rather than a count
tdd=$(which tdd)
if [[ $tdd ]]; then
export TDD_DD=$dd
dd=$tdd
# XXX paranoid: leave a count just in case
args="$args timeout=5 count=20000"
if [ "$USE_TDD" != "${USE_TDD/tdd}" ] ; then
# if we have a timed dd, use a timeout rather than a count
args="$args timeout=5 count=20000" # XXX paranoid: leave a count just in case
else
args="$args count=8000"
fi
echo "$args"
return 0
}
getwspeed() {
hdname=$1
# disk is mounted somewhere then don't do the raw write speed
canwe=$(df | grep $hdname)
[[ $canwe ]] && { echo mounted; return 0; }
dd=$(whichdd2use)
[[ -x $dd ]] || { echo "$dd"; return 0; }
args=$(ddargs)
add_on_exit 'rm -f /tmp/ddresultw'
$dd if=/dev/zero of=$hdname $args >/tmp/ddresultw 2>&1
res=$(grep bytes /tmp/ddresultw)
echo $(parsedd $res)
return 0
}
getrspeed() {
hdname=$1
if [ "$os" == "Linux" ] ; then
args="bs=64k iflag=direct"
elif [ "$os" == "FreeBSD" ] ; then
args="bs=64k"
fi
# do we have a working dd
dd=$(which dd)
canwe=$(ls -l $dd | grep busybox)
[[ $canwe ]] && { echo bad_dd; return 0; }
dd=$(whichdd2use)
[[ -x $dd ]] || { echo "$dd"; return 0; }
args=$(ddargs)
# if we have a timed dd, use a timeout rather than a count
tdd=$(which tdd)
if [[ $tdd ]]; then
export TDD_DD=$dd
dd=$tdd
# XXX paranoid: leave a count just in case
args="$args timeout=5 count=20000"
else
args="$args count=8000"
fi
add_on_exit 'rm -f /tmp/ddresultr'
$dd of=/dev/null if=$hdname $args >/tmp/ddresultr 2>&1
res=$(grep bytes /tmp/ddresultr)
echo $(parsedd $res)
return 0
}
......@@ -730,13 +756,13 @@ parsedd() {
if [ "$os" == "Linux" ] ; then
# linux dd returns 9 positional elements
if [ $# -lt 9 ] ; then
x="DDtimeinERR"
x="DDparseERR"
else
y=$9
if [ $y != ${y/MB} ] ; then
x=$8
else
x="PareddError"
x="ParesddError"
fi
fi
elif [ "$os" == "FreeBSD" ] ; then
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment