From patchwork Mon Oct 3 08:18:31 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 4483 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 22B9F23F57 for ; Mon, 3 Oct 2011 08:20:48 +0000 (UTC) Received: from mail-ey0-f180.google.com (mail-ey0-f180.google.com [209.85.215.180]) by fiordland.canonical.com (Postfix) with ESMTP id 19B87A181A0 for ; Mon, 3 Oct 2011 08:20:48 +0000 (UTC) Received: by mail-ey0-f180.google.com with SMTP id 6so3380973eyb.11 for ; Mon, 03 Oct 2011 01:20:48 -0700 (PDT) Received: by 10.223.55.136 with SMTP id u8mr20555165fag.46.1317630047881; Mon, 03 Oct 2011 01:20:47 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.152.23.170 with SMTP id n10cs6256laf; Mon, 3 Oct 2011 01:20:47 -0700 (PDT) Received: by 10.227.145.134 with SMTP id d6mr5742622wbv.66.1317630047140; Mon, 03 Oct 2011 01:20:47 -0700 (PDT) Received: from smtp.smtpout.orange.fr (smtp11.smtpout.orange.fr. [80.12.242.133]) by mx.google.com with ESMTP id es7si674885wbb.44.2011.10.03.01.20.46; Mon, 03 Oct 2011 01:20:47 -0700 (PDT) Received-SPF: neutral (google.com: 80.12.242.133 is neither permitted nor denied by best guess record for domain of daniel.lezcano@linaro.org) client-ip=80.12.242.133; Authentication-Results: mx.google.com; spf=neutral (google.com: 80.12.242.133 is neither permitted nor denied by best guess record for domain of daniel.lezcano@linaro.org) smtp.mail=daniel.lezcano@linaro.org Received: from monster.dhcp.lxc ([90.60.119.82]) by mwinf5d34 with ME id g8Lj1h0021mlJK6038Lm3z; Mon, 03 Oct 2011 10:20:46 +0200 X-ME-engine: default From: Daniel Lezcano To: linaro-dev@lists.linaro.org Subject: [pm-qa 06/10] check the task is migrated when offlining a cpu Date: Mon, 3 Oct 2011 10:18:31 +0200 Message-Id: <1317629915-31767-6-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1317629915-31767-1-git-send-email-daniel.lezcano@linaro.org> References: <1317629915-31767-1-git-send-email-daniel.lezcano@linaro.org> Signed-off-by: Daniel Lezcano (IBM Corporation) +# - initial API and implementation +# + +# URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Doc/QA/Scripts#cpuhotplug_04 + +CPUBURN=../utils/cpuburn +source ../include/functions.sh + +check_task_migrate() { + local cpu=$1 + local cpuid=${cpu:3} + local cpumask=$((1 << cpuid)) + local dirpath=$CPU_PATH/$1 + local pid= + local ret= + + if [ "$cpu" == "cpu0" ]; then + return 0 + fi + + taskset -c 0x$cpumask $CPUBURN $cpu & + pid=$! + sleep 1 # let taskset to do setaffinity before checking + + ret=$(taskset -p $pid | cut -d ':' -f 2) + ret=$(echo $ret) # remove trailing whitespace + ret=$(printf "%d" 0x$ret) + check "affinity is set" "test $cpumask -eq $ret" + + sleep 1 + set_offline $cpu + ret=$? + + check "offlining a cpu with affinity succeed" "test $ret -eq 0" + + ret=$(taskset -p $pid | cut -d ':' -f 2) + ret=$(echo $ret) + ret=$(printf "%d" 0x$ret) + check "affinity changed" "test $cpumask -ne $ret" + + kill $pid + + # in any case we set the cpu online in case of the test fails + set_online $cpu + + return 0 +} + +for_each_cpu check_task_migrate diff --git a/cpuhotplug/cpuhotplug_04.txt b/cpuhotplug/cpuhotplug_04.txt new file mode 100644 index 0000000..c0689a3 --- /dev/null +++ b/cpuhotplug/cpuhotplug_04.txt @@ -0,0 +1 @@ +test task is migrated with task affinity