From patchwork Mon Jan 27 06:36:19 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sanjay Singh Rawat X-Patchwork-Id: 23734 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f71.google.com (mail-pa0-f71.google.com [209.85.220.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 13128203C4 for ; Mon, 27 Jan 2014 06:36:49 +0000 (UTC) Received: by mail-pa0-f71.google.com with SMTP id kp14sf14366542pab.2 for ; Sun, 26 Jan 2014 22:36:49 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=9RkOZEuM89Is05ahCQigcmlgirXErkK2JnulBXdbuJY=; b=apNhsupCwgsnU2p4MpLSHh4SLYEOKvwjT/ZBnyRfGBKpPt4t7attULHmJy8Mm4pHQ8 KaU54Nx+jhwTn+SobPXNLW5D/hjWX4EQKB2lgiUgE8Bf92v9yn5eHprnxqoTfTqh/pn4 NYePA2av55YdljSvRgTyzD/LRuJJ10LdJ0e4QjvLaOgx3mcS4TnyC88n+u/Vxdutc86m ptRcL1dEYHyxWSy7XzoklQNll6mslc6lO4t0Fp8lA2HEi3YPqxQ4/I7HK9m3kI0BIvYB ebooZNjhBRBVvF2JYhAjbGrwnJXF36Uu2AWahtNOStp8wrXmxw+dhSGkXTbr9Du3NZ7W nCkA== X-Gm-Message-State: ALoCoQk4jYcFB6P2OP/+xV8dvK1zcLDgfqcW0hlMbNREva8Ng2neXoZMZs8ermGZoLVDc5Rwj8+C X-Received: by 10.68.197.73 with SMTP id is9mr10144748pbc.0.1390804608961; Sun, 26 Jan 2014 22:36:48 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.31.139 with SMTP id f11ls1482862qgf.71.gmail; Sun, 26 Jan 2014 22:36:48 -0800 (PST) X-Received: by 10.220.191.134 with SMTP id dm6mr14878822vcb.16.1390804608820; Sun, 26 Jan 2014 22:36:48 -0800 (PST) Received: from mail-vb0-f51.google.com (mail-vb0-f51.google.com [209.85.212.51]) by mx.google.com with ESMTPS id k10si4754206vca.49.2014.01.26.22.36.48 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 26 Jan 2014 22:36:48 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.51 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.51; Received: by mail-vb0-f51.google.com with SMTP id 11so3123154vbe.38 for ; Sun, 26 Jan 2014 22:36:48 -0800 (PST) X-Received: by 10.53.9.201 with SMTP id du9mr208150vdd.36.1390804608731; Sun, 26 Jan 2014 22:36:48 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp107841vcz; Sun, 26 Jan 2014 22:36:48 -0800 (PST) X-Received: by 10.66.224.109 with SMTP id rb13mr28178749pac.78.1390804607741; Sun, 26 Jan 2014 22:36:47 -0800 (PST) Received: from mail-pa0-f51.google.com (mail-pa0-f51.google.com [209.85.220.51]) by mx.google.com with ESMTPS id fv4si10108085pbd.62.2014.01.26.22.36.47 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 26 Jan 2014 22:36:47 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.51 is neither permitted nor denied by best guess record for domain of sanjay.rawat@linaro.org) client-ip=209.85.220.51; Received: by mail-pa0-f51.google.com with SMTP id ld10so5574322pab.10 for ; Sun, 26 Jan 2014 22:36:47 -0800 (PST) X-Received: by 10.67.14.231 with SMTP id fj7mr27886882pad.115.1390804606997; Sun, 26 Jan 2014 22:36:46 -0800 (PST) Received: from srawat-Latitude-E6420.LGE.NET ([203.247.149.152]) by mx.google.com with ESMTPSA id j3sm28475351pbh.38.2014.01.26.22.36.42 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 26 Jan 2014 22:36:46 -0800 (PST) From: Sanjay Singh Rawat To: private-pmwg@linaro.org Cc: Sanjay Singh Rawat Subject: [PATCH pmqa] cpuhotplug: before running check feature is on Date: Mon, 27 Jan 2014 12:06:19 +0530 Message-Id: <1390804579-11499-1-git-send-email-sanjay.rawat@linaro.org> X-Mailer: git-send-email 1.7.10.4 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: sanjay.rawat@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.51 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Signed-off-by: Sanjay Singh Rawat --- cpuhotplug/cpuhotplug_01.sh | 12 ++++++++++++ cpuhotplug/cpuhotplug_02.sh | 12 ++++++++++++ cpuhotplug/cpuhotplug_03.sh | 12 ++++++++++++ cpuhotplug/cpuhotplug_04.sh | 12 ++++++++++++ cpuhotplug/cpuhotplug_05.sh | 12 ++++++++++++ cpuhotplug/cpuhotplug_06.sh | 12 ++++++++++++ cpuhotplug/cpuhotplug_07.sh | 12 ++++++++++++ cpuhotplug/cpuhotplug_08.sh | 12 ++++++++++++ include/functions.sh | 15 +++++++++++++++ 9 files changed, 111 insertions(+) diff --git a/cpuhotplug/cpuhotplug_01.sh b/cpuhotplug/cpuhotplug_01.sh index 8804df7..81a5e8a 100755 --- a/cpuhotplug/cpuhotplug_01.sh +++ b/cpuhotplug/cpuhotplug_01.sh @@ -29,6 +29,18 @@ source ../include/functions.sh FILES="online offline possible present" +is_root +if [ $? -ne 0 ]; then + log_skip "user is not root" + exit 0 +fi + +cpuhotplug_enabled +if [ $? -ne 0 ]; then + log_skip "cpuhotplug not supported" + exit 0 +fi + for i in $FILES; do check_file $i $CPU_PATH || return 1 done diff --git a/cpuhotplug/cpuhotplug_02.sh b/cpuhotplug/cpuhotplug_02.sh index 3157307..c4efcf7 100755 --- a/cpuhotplug/cpuhotplug_02.sh +++ b/cpuhotplug/cpuhotplug_02.sh @@ -27,6 +27,18 @@ source ../include/functions.sh +is_root +if [ $? -ne 0 ]; then + log_skip "user is not root" + exit 0 +fi + +cpuhotplug_enabled +if [ $? -ne 0 ]; then + log_skip "cpuhotplug not supported" + exit 0 +fi + check_state() { local cpu=$1 local dirpath=$CPU_PATH/$1 diff --git a/cpuhotplug/cpuhotplug_03.sh b/cpuhotplug/cpuhotplug_03.sh index 13a0ce9..83a0fac 100755 --- a/cpuhotplug/cpuhotplug_03.sh +++ b/cpuhotplug/cpuhotplug_03.sh @@ -27,6 +27,18 @@ source ../include/functions.sh +is_root +if [ $? -ne 0 ]; then + log_skip "user is not root" + exit 0 +fi + +cpuhotplug_enabled +if [ $? -ne 0 ]; then + log_skip "cpuhotplug not supported" + exit 0 +fi + check_affinity_fails() { local cpu=$1 local cpuid=${cpu:3} diff --git a/cpuhotplug/cpuhotplug_04.sh b/cpuhotplug/cpuhotplug_04.sh index 8c5ab52..3114911 100755 --- a/cpuhotplug/cpuhotplug_04.sh +++ b/cpuhotplug/cpuhotplug_04.sh @@ -28,6 +28,18 @@ CPUBURN=../utils/cpuburn source ../include/functions.sh +is_root +if [ $? -ne 0 ]; then + log_skip "user is not root" + exit 0 +fi + +cpuhotplug_enabled +if [ $? -ne 0 ]; then + log_skip "cpuhotplug not supported" + exit 0 +fi + check_task_migrate() { local cpu=$1 local cpuid=${cpu:3} diff --git a/cpuhotplug/cpuhotplug_05.sh b/cpuhotplug/cpuhotplug_05.sh index a8eb312..8db2060 100755 --- a/cpuhotplug/cpuhotplug_05.sh +++ b/cpuhotplug/cpuhotplug_05.sh @@ -27,6 +27,18 @@ source ../include/functions.sh +is_root +if [ $? -ne 0 ]; then + log_skip "user is not root" + exit 0 +fi + +cpuhotplug_enabled +if [ $? -ne 0 ]; then + log_skip "cpuhotplug not supported" + exit 0 +fi + check_procinfo() { local cpu=$1 local cpuid=${cpu:3} diff --git a/cpuhotplug/cpuhotplug_06.sh b/cpuhotplug/cpuhotplug_06.sh index 347906d..5e6954c 100755 --- a/cpuhotplug/cpuhotplug_06.sh +++ b/cpuhotplug/cpuhotplug_06.sh @@ -27,6 +27,18 @@ source ../include/functions.sh +is_root +if [ $? -ne 0 ]; then + log_skip "user is not root" + exit 0 +fi + +cpuhotplug_enabled +if [ $? -ne 0 ]; then + log_skip "cpuhotplug not supported" + exit 0 +fi + check_procinfo() { local cpu=$1 local cpuid=${cpu:3} diff --git a/cpuhotplug/cpuhotplug_07.sh b/cpuhotplug/cpuhotplug_07.sh index d3674d2..97299bb 100755 --- a/cpuhotplug/cpuhotplug_07.sh +++ b/cpuhotplug/cpuhotplug_07.sh @@ -28,6 +28,18 @@ source ../include/functions.sh TMPFILE=cpuhotplug_07.tmp +is_root +if [ $? -ne 0 ]; then + log_skip "user is not root" + exit 0 +fi + +cpuhotplug_enabled +if [ $? -ne 0 ]; then + log_skip "cpuhotplug not supported" + exit 0 +fi + waitfor_udevadm() { while [ 1 ]; do lsof | grep udevadm | grep 'sock\|netlink' > /dev/null diff --git a/cpuhotplug/cpuhotplug_08.sh b/cpuhotplug/cpuhotplug_08.sh index 9e2c355..7295e5b 100755 --- a/cpuhotplug/cpuhotplug_08.sh +++ b/cpuhotplug/cpuhotplug_08.sh @@ -27,6 +27,18 @@ source ../include/functions.sh +is_root +if [ $? -ne 0 ]; then + log_skip "user is not root" + exit 0 +fi + +cpuhotplug_enabled +if [ $? -ne 0 ]; then + log_skip "cpuhotplug not supported" + exit 0 +fi + function randomize() { echo $[ ( $RANDOM % $1 ) + 1 ] } diff --git a/include/functions.sh b/include/functions.sh index 2a9cf21..8ee1acf 100644 --- a/include/functions.sh +++ b/include/functions.sh @@ -353,6 +353,21 @@ cpuidle_enabled() { test -d /sys/devices/system/cpu/cpuidle } +cpuhotplug_enabled() { + cpus=$(ls $CPU_PATH | grep "cpu[0-9].*") + + for cpu in $cpus; do + # assuming cpu0 can't be plugged out + if [ $cpu != "cpu0" ]; then + test -w $CPU_PATH/$cpu/online + if [ $? -ne 0 ]; then + return 1 + fi + fi + done + return 0 +} + # currently we support ubuntu and android get_os() { lsb_release -a 2>&1 | grep -i ubuntu > /dev/null