Whamcloud - gitweb
LU-958 tests: debug_mb set incorrectly for smp or vm
authorEmoly Liu <emoly.liu@intel.com>
Tue, 8 Jan 2013 08:29:15 +0000 (16:29 +0800)
committerJohann Lombardi <johann.lombardi@intel.com>
Mon, 14 Jan 2013 11:43:41 +0000 (06:43 -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.
Added check if that "possible" exists, if not - use old method.

The patch of LU-1249 is also invloved to auto correct improper debug
buffer size setting.

port of patch 2ccb34d882b01305794e7780b6dd691179ddae7e
port of patch 28817cbd133c626042f9b142600c03187ba4a7ce
Xyratex-bug-id: MRP-219 incorrect settings for debug_mb

Test-Parameters: clientarch=x86_64 serverarch=x86_64 testlist=mmp

Signed-off-by: Denis Kondratenko <Denis_Kondratenko@xyratex.com>
Signed-off-by: Bobi Jam <bobijam@gmail.com>
Signed-off-by: Liu Ying <emoly.liu@intel.com>
Change-Id: Ib1e39a26e4d4af8e599d6e5fcdb1fecff8a6f4fa
Reviewed-on: http://review.whamcloud.com/4962
Reviewed-by: Jian Yu <jian.yu@intel.com>
Tested-by: Hudson
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
lnet/libcfs/tracefile.c
lustre/tests/cfg/local.sh
lustre/tests/test-framework.sh

index 81b2da1..ee87a0b 100644 (file)
@@ -895,16 +895,17 @@ int trace_set_debug_mb(int mb)
         struct trace_cpu_data *tcd;
 
         if (mb < num_possible_cpus()) {
-                printk(KERN_ERR "Cannot set debug_mb to %d, "
-                       "the value should be >= %d\n",
-                       mb, num_possible_cpus());
-                return -EINVAL;
+                printk(KERN_WARNING
+                       "Lustre: %d MB is too small for debug buffer size, "
+                       "setting it to %d MB.\n", mb, num_possible_cpus());
+                mb = num_possible_cpus();
         }
 
         if (mb > limit) {
-                printk(KERN_ERR "Lustre: Refusing to set debug buffer size to "
-                       "%dMB - limit is %d\n", mb, limit);
-                return -EINVAL;
+                printk(KERN_WARNING
+                       "Lustre: %d MB is too large for debug buffer size, "
+                       "setting it to %d MB.\n", mb, limit);
+                mb = limit;
         }
 
         mb /= num_possible_cpus();
index 7792f18..70e370b 100644 (file)
@@ -36,7 +36,16 @@ STRIPE_BYTES=${STRIPE_BYTES:-1048576}
 STRIPES_PER_OBJ=${STRIPES_PER_OBJ:-0}
 TIMEOUT=${TIMEOUT:-20}
 PTLDEBUG=${PTLDEBUG:-0x33f1504}
-DEBUG_SIZE=${DEBUG_SIZE:-10}
+
+# promise 2MB for every cpu
+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
+
+DEBUG_SIZE=${DEBUG_SIZE:-$_debug_mb}
+
 SUBSYSTEM=${SUBSYSTEM:- 0xffb7e3ff}
 
 L_GETGROUPS=${L_GETGROUPS:-`do_facet mds which l_getgroups || echo`}
index ff118e1..267e33b 100644 (file)
@@ -435,7 +435,12 @@ set_obdfilter_param() {
 
 set_debug_size () {
     local dz=${1:-$DEBUG_SIZE}
-    local cpus=$(getconf _NPROCESSORS_CONF)
+
+    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