Whamcloud - gitweb
LU-958 tests: debug_mb set incorrectly for smp or vm
authorDenis Kondratenko <Denis_Kondratenko@xyratex.com>
Fri, 10 Feb 2012 10:54:45 +0000 (12:54 +0200)
committerOleg Drokin <green@whamcloud.com>
Thu, 1 Mar 2012 17:41:28 +0000 (12:41 -0500)
For cpus with number of cores or for some VMs,
number of possible CPUs in the system could
be greater than number of cpu reported by getconf.
Added check for maximum debug buffer size.

Xyratex-bug-id: MRP-219 incorrect settings for debug_mb

Reviewed-by: Andrew Perepechko <Andrew_Perepechko@xyratex.com>
Reviewed-by: Alexey Lyashko <Alexey_Lyashko@xyratex.com>
Signed-off-by: Denis Kondratenko <Denis_Kondratenko@xyratex.com>
Change-Id: I7001af7b1c88d5be056734d7d73a0263cca01627
Reviewed-on: http://review.whamcloud.com/1912
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Andrew Perepechko <andrew_perepechko@xyratex.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/tests/cfg/local.sh
lustre/tests/test-framework.sh

index 2364b49..acbd6b2 100644 (file)
@@ -44,10 +44,19 @@ STRIPES_PER_OBJ=${STRIPES_PER_OBJ:-0}
 SINGLEMDS=${SINGLEMDS:-"mds1"}
 TIMEOUT=${TIMEOUT:-20}
 PTLDEBUG=${PTLDEBUG:-0x33f0404}
-DEBUG_SIZE=${DEBUG_SIZE:-10}
-if [ `grep processor /proc/cpuinfo | wc -l` -gt 5 ]; then
-    DEBUG_SIZE=$((`grep processor /proc/cpuinfo | wc -l` * 2))   # promise 2MB for every cpu
+
+# promise 2MB for every cpu
+_debug_mb=$((($(cut -d "-" -f 2 /sys/devices/system/cpu/possible)+1)*2))
+
+# but not less then 10Mb, and limited by 512Mb in libcfs
+if (( _debug_mb < 10 )); then
+        _debug_mb=10
+elif ((_debug_mb > 512 )); then
+        _debug_mb=512
 fi
+
+DEBUG_SIZE=${DEBUG_SIZE:-$_debug_mb}
+
 SUBSYSTEM=${SUBSYSTEM:- 0xffb7e3ff}
 
 ENABLE_QUOTA=${ENABLE_QUOTA:-""}
index 495ccbd..640e737 100644 (file)
@@ -591,7 +591,7 @@ ostdevlabel() {
 
 set_debug_size () {
     local dz=${1:-$DEBUG_SIZE}
-    local cpus=$(getconf _NPROCESSORS_CONF)
+    local cpus=$(($(cut -d "-" -f 2 /sys/devices/system/cpu/possible)+1))
 
     # bug 19944, adjust size to be -gt num_possible_cpus()
     # promise 2MB for every cpu at least