Whamcloud - gitweb
LU-958 tests: debug_mb set incorrectly for smp or vm
authorDenis Kondratenko <Denis_Kondratenko@xyratex.com>
Tue, 27 Mar 2012 07:47:51 +0000 (10:47 +0300)
committerOleg Drokin <green@whamcloud.com>
Wed, 1 Aug 2012 20:04:31 +0000 (16:04 -0400)
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.
Added check that "possible" is exist, if not - use old method.

Xyratex-bug-id: MRP-219 incorrect settings for debug_mb
Signed-off-by: Denis Kondratenko <Denis_Kondratenko@xyratex.com>
Change-Id: I1ea367d1b956ae1009c4a501e0f02b6c9209a2f7
Reviewed-on: http://review.whamcloud.com/2377
Reviewed-by: Yu Jian <yujian@whamcloud.com>
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/tests/cfg/local.sh
lustre/tests/test-framework.sh

index 8ae4e1f..407fbc9 100644 (file)
@@ -46,7 +46,11 @@ TIMEOUT=${TIMEOUT:-20}
 PTLDEBUG=${PTLDEBUG:-0x33f0404}
 
 # promise 2MB for every cpu
-_debug_mb=$((($(cut -d "-" -f 2 /sys/devices/system/cpu/possible)+1)*2))
+if [ -f /sys/devices/system/cpu/possible ]; then
+    _debug_mb=$((($(cut -d "-" -f 2 /sys/devices/system/cpu/possible)+1)*2))
+else
+    _debug_mb=$(($(getconf _NPROCESSORS_CONF)*2))
+fi
 
 # but not less then 10Mb, and limited by 512Mb in libcfs
 if (( _debug_mb < 10 )); then
index 7985cad..3096dc2 100644 (file)
@@ -573,7 +573,12 @@ ostdevlabel() {
 
 set_debug_size () {
     local dz=${1:-$DEBUG_SIZE}
-    local cpus=$(($(cut -d "-" -f 2 /sys/devices/system/cpu/possible)+1))
+
+    if [ -f /sys/devices/system/cpu/possible ]; then
+        local cpus=$(($(cut -d "-" -f 2 /sys/devices/system/cpu/possible)+1))
+    else
+        local cpus=$(getconf _NPROCESSORS_CONF)
+    fi
 
     # bug 19944, adjust size to be -gt num_possible_cpus()
     # promise 2MB for every cpu at least