Commit fdfce71d authored by Mike Hibler's avatar Mike Hibler

Add node/node_type attribute "no_clflush".

This is for FreeBSD to turn off use of the CLFLUSH instruction via the
hw.clflush_disable loader var. We have encountered some opteron machines
on which this causes problems.

The attribute can be set for the node_type (via the web page for editing
node types) or the node (via brute-force SQL hackary) to override whatever
FreeBSD would do by default. This attribute is passed via tmcd to the
diskloader MFS which will fixup the loader.conf file post-frisbee.
parent 04c858da
......@@ -153,6 +153,7 @@ loadone() {
ZFILL=""
ACPI=""
ASF=""
NOCLFLUSH=""
MBRVERS=""
PREPARE=""
IMAGEID=""
......@@ -165,6 +166,7 @@ loadone() {
DISK=*|\
ZFILL=*|\
ACPI=*|\
NOCLFLUSH=*|\
MBRVERS=*|\
ASF=*|\
PREPARE=*|\
......@@ -188,6 +190,7 @@ loadone() {
ZFILL=${ZFILL:-'0'}
ACPI=${ACPI:-'unknown'}
ASF=${ASF:-'unknown'}
NOCLFLUSH=${NOCLFLUSH:-'unknown'}
MBRVERS=${MBRVERS:-'1'}
PREPARE=${PREPARE:-'0'}
......@@ -424,6 +427,7 @@ loadone() {
echo "Adjusting slice-related files"
export SLICEFIX_ACPI=$ACPI
export SLICEFIX_ASF=$ASF
export SLICEFIX_NOCLFLUSH=$NOCLFLUSH
$BINDIR/slicefix $PART $DISK
echo "Image #$_NUM load complete at `date`"
return 0
......
#!/bin/sh
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2005, 2007 University of Utah and the Flux Group.
# Copyright (c) 2000-2011 University of Utah and the Flux Group.
# All rights reserved.
#
......@@ -30,7 +30,7 @@ esac
#
# Handle pseudo arguments in the environment.
#
#
ACPI=${SLICEFIX_ACPI:-'unknown'}
case $ACPI in
0|no|NO)
......@@ -57,6 +57,19 @@ case $ASF in
;;
esac
NOCLFLUSH=${SLICEFIX_NOCLFLUSH:-'unknown'}
case $NOCLFLUSH in
0|no|NO)
NOCLFLUSH=0
;;
1|yes|YES)
NOCLFLUSH=1
;;
*)
NOCLFLUSH=unknown
;;
esac
#
# ...or the filesystem
#
......@@ -134,6 +147,7 @@ dofreebsd() {
changeentropy=0
changeacpi=0
changeasf=0
changeclflush=0
fixit=0
......@@ -226,6 +240,10 @@ dofreebsd() {
esac
fi
if [ $NOCLFLUSH != "unknown" ]; then
fixit=1
fi
# check to see if we need to download any postconfig scripts:
doosconfig=0
if [ -x $BINDIR/osconfig ]; then
......@@ -261,13 +279,13 @@ dofreebsd() {
if [ $changedisk -eq 1 ]; then
echo " updating /etc/fstab"
sed -E -i .orig -e "s;^/dev/[a-zA-Z]+[0-9]+s[0-9]+;/dev/${disk}s${part};" /mnt/etc/fstab || {
sed -E -i .preemulab -e "s;^/dev/[a-zA-Z]+[0-9]+s[0-9]+;/dev/${disk}s${part};" /mnt/etc/fstab || {
echo "Failed to update /etc/fstab"
umount $rootdev
return 1
}
echo " updating /etc/dumpdates"
sed -E -i .orig -e "s;^/dev/[a-zA-Z]+[0-9]+s[0-9]+;/dev/${disk}s${part};" /mnt/etc/dumpdates || {
sed -E -i .preemulab -e "s;^/dev/[a-zA-Z]+[0-9]+s[0-9]+;/dev/${disk}s${part};" /mnt/etc/dumpdates || {
echo "Failed to update /etc/dumpdates"
umount $rootdev
return 1
......@@ -279,6 +297,7 @@ dofreebsd() {
dd if=/dev/random of=/mnt/entropy bs=4096 count=1 >/dev/null 2>&1
fi
lcbak=".preemulab"
if [ $changeacpi -eq 1 ]; then
if [ $ACPI = "no" ]; then
on="dis"
......@@ -286,11 +305,12 @@ dofreebsd() {
on="en"
fi
echo " ${on}abling ACPI"
sed -E -i .orig -e "/[Aa][Cc][Pp][Ii]/d" /mnt/boot/loader.conf || {
sed -E -i $lcbak -e "/[Aa][Cc][Pp][Ii]/d" /mnt/boot/loader.conf || {
echo "Failed to update /boot/loader.conf"
umount $rootdev
return 1
}
lcbak=""
if [ $ACPI = "no" ]; then
cat <<EOF1 >>/mnt/boot/loader.conf
# disable ACPI
......@@ -314,11 +334,12 @@ EOF2
on="en"
fi
echo " ${on}abling ASF"
sed -E -i .orig -e "/[Aa][Ss][Ff]/d" /mnt/boot/loader.conf || {
sed -E -i $lcbak -e "/[Aa][Ss][Ff]/d" /mnt/boot/loader.conf || {
echo "Failed to update /boot/loader.conf"
umount $rootdev
return 1
}
lcbak=""
if [ $ASF = "no" ]; then
cat <<EOF1 >>/mnt/boot/loader.conf
# disable ASF
......@@ -332,6 +353,29 @@ EOF2
fi
fi
#
# See if we need to change the use of NOCLFLUSH.
# If explicitly specified, we override any previous setting.
#
if [ $NOCLFLUSH != "unknown" ]; then
if [ $NOCLFLUSH = "1" ]; then
on="dis"
else
on="en"
fi
echo " ${on}abling use of CLFLUSH"
sed -E -i $lcbak -e "/clflush_disable/d" /mnt/boot/loader.conf || {
echo "Failed to update /boot/loader.conf"
umount $rootdev
return 1
}
lcbak=""
cat <<EOF1 >>/mnt/boot/loader.conf
# ${on}able CLFLUSH (hw.clflush_disable)
hw.clflush_disable=$NOCLFLUSH
EOF1
fi
# actually run any postconfig scripts if we're supposed to:
if [ $doosconfig -eq 1 -a -x $BINDIR/osconfig ]; then
$BINDIR/osconfig -m /mnt -D $rootdev -s FreeBSD postload
......@@ -428,7 +472,7 @@ dolinux() {
fi
# change the swap devices in fstab
sed -i .orig -e "s;^/dev/[hs]d.\([0-7]\);/dev/${ldisk}\1;" /mnt/etc/fstab || {
sed -i .preemulab -e "s;^/dev/[hs]d.\([0-7]\);/dev/${ldisk}\1;" /mnt/etc/fstab || {
echo "Failed to update /etc/fstab"
umount $rootdev
return 1
......@@ -446,7 +490,7 @@ dolinux() {
fi
if [ -r $gconf ]; then
echo " updating $fgconf"
sed -i .orig -e "s;\([br]oot=/dev\)/[hs]d.[0-7];\1/${ldisk}${part};" $gconf || {
sed -i .preemulab -e "s;\([br]oot=/dev\)/[hs]d.[0-7];\1/${ldisk}${part};" $gconf || {
echo "Failed to update $fgconf"
}
......@@ -477,7 +521,7 @@ dolinux() {
lconf=/mnt/etc/lilo.conf
if [ -r $lconf ]; then
echo " updating /etc/lilo.conf"
sed -i .orig -e "s;\([br]oot=/dev\)/[hs]d.[0-7];\1/${ldisk}${part};" $lconf || {
sed -i .preemulab -e "s;\([br]oot=/dev\)/[hs]d.[0-7];\1/${ldisk}${part};" $lconf || {
echo "Failed to update /etc/lilo.conf"
umount $rootdev
return 1
......
......@@ -287,6 +287,7 @@ handle_loadinfo()
local ACPI=`get_value "$LOADINFO" ACPI`
local ASF=`get_value "$LOADINFO" ASF`
local NOCLFLUSH=`get_value "$LOADINFO" NOCLFLUSH`
local MBR=`get_value "$LOADINFO" MBRVERS`
local PREPARE=`get_value "$LOADINFO" PREPARE`
local PTYPE=''
......@@ -395,6 +396,7 @@ handle_loadinfo()
echo "Adjusting slice-related files"
export SLICEFIX_ACPI=$ACPI
export SLICEFIX_ASF=$ASF
export SLICEFIX_NOCLFLUSH=$NOCLFLUSH
$BINDIR/slicefix $PARTITION $FREEBSD_DISK
echo "Image load complete at `date`"
}
......
#!/bin/sh
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2005, 2007 University of Utah and the Flux Group.
# Copyright (c) 2000-2011 University of Utah and the Flux Group.
# All rights reserved.
#
......@@ -68,6 +68,19 @@ case $ASF in
;;
esac
NOCLFLUSH=${SLICEFIX_NOCLFLUSH:-'unknown'}
case $NOCLFLUSH in
0|no|NO)
NOCLFLUSH=0
;;
1|yes|YES)
NOCLFLUSH=1
;;
*)
NOCLFLUSH=unknown
;;
esac
#
# ...or the filesystem
#
......@@ -256,6 +269,10 @@ dofreebsd() {
esac
fi
if [ $NOCLFLUSH != "unknown" ]; then
fixit=1
fi
# check to see if we need to download any postconfig scripts:
doosconfig=0
if [ -x $BINDIR/osconfig ]; then
......@@ -299,7 +316,7 @@ dofreebsd() {
if [ $changedisk -eq 1 ]; then
if [ -f /mnt/etc/fstab ]; then
echo " updating /etc/fstab"
cp -fp /mnt/etc/fstab /mnt/etc/fstab.orig
cp -fp /mnt/etc/fstab /mnt/etc/fstab.preemulab
sed -i -e "s;^/dev/[a-zA-Z][a-zA-Z]*[0-9][0-9]*s[0-9][0-9]*;/dev/${freebsd_disk}s${part};" /mnt/etc/fstab || {
echo "Failed to update /etc/fstab"
umount $rootdev
......@@ -308,7 +325,7 @@ dofreebsd() {
fi
if [ -f /mnt/etc/dumpdates ]; then
echo " updating /etc/dumpdates"
cp -fp /mnt/etc/dumpdates /mnt/etc/dumpdates.orig
cp -fp /mnt/etc/dumpdates /mnt/etc/dumpdates.preemulab
sed -i -e "s;^/dev/[a-zA-Z][a-zA-Z]*[0-9][0-9]*s[0-9][0-9]*;/dev/${freebsd_disk}s${part};" /mnt/etc/dumpdates || {
echo "Failed to update /etc/dumpdates"
umount $rootdev
......@@ -322,6 +339,7 @@ dofreebsd() {
dd if=/dev/random of=/mnt/entropy bs=4096 count=1 >/dev/null 2>&1
fi
lcbak=".preemulab"
if [ $changeacpi -eq 1 ]; then
if [ $ACPI = "no" ]; then
on="dis"
......@@ -329,7 +347,10 @@ dofreebsd() {
on="en"
fi
echo " ${on}abling ACPI"
cp -fp /mnt/boot/loader.conf /mnt/boot/loader.conf.orig
if [ -n "$lcbak" ]; then
cp -fp /mnt/boot/loader.conf /mnt/boot/loader.conf${lcbak}
lcbak=""
fi
sed -i -e "/[Aa][Cc][Pp][Ii]/d" /mnt/boot/loader.conf || {
echo "Failed to update /boot/loader.conf"
umount $rootdev
......@@ -358,7 +379,10 @@ EOF2
on="en"
fi
echo " ${on}abling ASF"
cp -fp /mnt/boot/loader.conf /mnt/boot/loader.conf.orig
if [ -n "$lcbak" ]; then
cp -fp /mnt/boot/loader.conf /mnt/boot/loader.conf${lcbak}
lcbak=""
fi
sed -i -e "/[Aa][Ss][Ff]/d" /mnt/boot/loader.conf || {
echo "Failed to update /boot/loader.conf"
umount $rootdev
......@@ -377,6 +401,32 @@ EOF2
fi
fi
#
# See if we need to change the use of NOCLFLUSH.
# If explicitly specified, we override any previous setting.
#
if [ $NOCLFLUSH != "unknown" ]; then
if [ $NOCLFLUSH = "1" ]; then
on="dis"
else
on="en"
fi
echo " ${on}abling use of CLFLUSH"
if [ -n "$lcbak" ]; then
cp -fp /mnt/boot/loader.conf /mnt/boot/loader.conf${lcbak}
lcbak=""
fi
sed -E -i -e "/clflush_disable/d" /mnt/boot/loader.conf || {
echo "Failed to update /boot/loader.conf"
umount $rootdev
return 1
}
cat <<EOF1 >>/mnt/boot/loader.conf
# ${on}able CLFLUSH (hw.clflush_disable)
hw.clflush_disable=$NOCLFLUSH
EOF1
fi
# actually run any postconfig scripts if we're supposed to:
if [ $doosconfig -eq 1 -a -x $BINDIR/osconfig ]; then
$BINDIR/osconfig -m /mnt -D $rootdev -s FreeBSD postload
......
......@@ -4477,7 +4477,8 @@ COMMAND_PROTOTYPE(doloadinfo)
MYSQL_ROW row, row2;
char buf[MYBUFSIZE];
char *bufp = buf, *ebufp = &buf[sizeof(buf)];
char *disktype, *useacpi, *useasf, address[MYBUFSIZE];
char *disktype, *useacpi, *useasf, *noclflush;
char address[MYBUFSIZE];
char server_address[MYBUFSIZE];
char mbrvers[51];
char *loadpart, *OS, *prepare;
......@@ -4663,6 +4664,7 @@ COMMAND_PROTOTYPE(doloadinfo)
disknum = DISKNUM;
useacpi = "unknown";
useasf = "unknown";
noclflush = "unknown";
res2 = mydb_query("select a.attrkey,a.attrvalue,na.attrvalue "
"from nodes as n "
......@@ -4674,7 +4676,8 @@ COMMAND_PROTOTYPE(doloadinfo)
"where (a.attrkey='bootdisk_unit' or "
" a.attrkey='disktype' or "
" a.attrkey='use_acpi' or "
" a.attrkey='use_asf') and "
" a.attrkey='use_asf' or "
" a.attrkey='no_clflush') and "
" n.node_id='%s'", 3, reqp->nodeid);
if (!res2) {
......@@ -4712,6 +4715,9 @@ COMMAND_PROTOTYPE(doloadinfo)
else if (strcmp(row2[0], "use_asf") == 0) {
useasf = attrstr;
}
else if (strcmp(row2[0], "no_clflush") == 0) {
noclflush = attrstr;
}
}
nrows2--;
}
......@@ -4720,8 +4726,8 @@ COMMAND_PROTOTYPE(doloadinfo)
mysql_free_result(res2);
bufp += OUTPUT(bufp, ebufp - bufp,
" DISK=%s%d ZFILL=%d ACPI=%s MBRVERS=%s ASF=%s PREPARE=%s",
disktype, disknum, zfill, useacpi, mbrvers, useasf, prepare);
" DISK=%s%d ZFILL=%d ACPI=%s MBRVERS=%s ASF=%s PREPARE=%s NOCLFLUSH=%s",
disktype, disknum, zfill, useacpi, mbrvers, useasf, prepare, noclflush);
/*
* Vnodes (and post v32 local nodes) get additional image
......
Markdown is supported
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