get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/2217619/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2217619,
    "url": "http://patchwork.ozlabs.org/api/patches/2217619/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/ltp/patch/20260330090844.79598-3-pvorel@suse.cz/",
    "project": {
        "id": 59,
        "url": "http://patchwork.ozlabs.org/api/projects/59/?format=api",
        "name": "Linux Test Project development",
        "link_name": "ltp",
        "list_id": "ltp.lists.linux.it",
        "list_email": "ltp@lists.linux.it",
        "web_url": "",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20260330090844.79598-3-pvorel@suse.cz>",
    "list_archive_url": null,
    "date": "2026-03-30T09:08:43",
    "name": "[v2,2/2] power_management: Remove unused tools",
    "commit_ref": null,
    "pull_url": null,
    "state": "needs-review-ack",
    "archived": false,
    "hash": "7173e05b8b962cd37226136499151ecff094dad1",
    "submitter": {
        "id": 70792,
        "url": "http://patchwork.ozlabs.org/api/people/70792/?format=api",
        "name": "Petr Vorel",
        "email": "pvorel@suse.cz"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/ltp/patch/20260330090844.79598-3-pvorel@suse.cz/mbox/",
    "series": [
        {
            "id": 497983,
            "url": "http://patchwork.ozlabs.org/api/series/497983/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/ltp/list/?series=497983",
            "date": "2026-03-30T09:08:41",
            "name": "power_management: remove unsupported tests",
            "version": 2,
            "mbox": "http://patchwork.ozlabs.org/series/497983/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2217619/comments/",
    "check": "success",
    "checks": "http://patchwork.ozlabs.org/api/patches/2217619/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "ltp@lists.linux.it"
        ],
        "Delivered-To": [
            "patchwork-incoming@legolas.ozlabs.org",
            "ltp@picard.linux.it"
        ],
        "Authentication-Results": [
            "legolas.ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n unprotected) header.d=suse.cz header.i=@suse.cz header.a=rsa-sha256\n header.s=susede2_rsa header.b=2LhHrXga;\n\tdkim=fail reason=\"signature verification failed\" header.d=suse.cz\n header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519\n header.b=VWF1YwuT;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key)\n header.d=suse.cz header.i=@suse.cz header.a=rsa-sha256 header.s=susede2_rsa\n header.b=qG41MlWe;\n\tdkim=neutral header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256\n header.s=susede2_ed25519 header.b=ZT+08ekH;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it\n (client-ip=2001:1418:10:5::2; helo=picard.linux.it;\n envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it;\n receiver=patchwork.ozlabs.org)",
            "smtp-out2.suse.de;\n dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=qG41MlWe;\n dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=ZT+08ekH"
        ],
        "Received": [
            "from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fklnV6P71z1yG8\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 30 Mar 2026 20:09:50 +1100 (AEDT)",
            "from picard.linux.it (localhost [IPv6:::1])\n\tby picard.linux.it (Postfix) with ESMTP id EC8053E4F14\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 30 Mar 2026 11:09:47 +0200 (CEST)",
            "from in-4.smtp.seeweb.it (in-4.smtp.seeweb.it [217.194.8.4])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature ECDSA (secp384r1))\n (No client certificate requested)\n by picard.linux.it (Postfix) with ESMTPS id 832283E4862\n for <ltp@lists.linux.it>; Mon, 30 Mar 2026 11:09:22 +0200 (CEST)",
            "from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n (No client certificate requested)\n by in-4.smtp.seeweb.it (Postfix) with ESMTPS id 6C0BE10000C8\n for <ltp@lists.linux.it>; Mon, 30 Mar 2026 11:09:18 +0200 (CEST)",
            "from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org\n [IPv6:2a07:de40:b281:104:10:150:64:97])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest\n SHA256)\n (No client certificate requested)\n by smtp-out2.suse.de (Postfix) with ESMTPS id 6E8745BCFF;\n Mon, 30 Mar 2026 09:09:02 +0000 (UTC)",
            "from imap1.dmz-prg2.suse.org (localhost [127.0.0.1])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest\n SHA256)\n (No client certificate requested)\n by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id E69FC4A0B1;\n Mon, 30 Mar 2026 09:09:01 +0000 (UTC)",
            "from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167])\n by imap1.dmz-prg2.suse.org with ESMTPSA id 2BtnNq09ymnvDAAAD6G6ig\n (envelope-from <pvorel@suse.cz>); Mon, 30 Mar 2026 09:09:01 +0000"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz;\n s=susede2_rsa;\n t=1774861743;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=vhHxD+GWynE6a9go1xJ4ogKLVqhoWN5r9VLsM9t9HGM=;\n b=2LhHrXgat+Y3GovD3li3MXvXGj2VYbkLsgB5NZcihWOrBNqd/y0F2l5Rsh8BpB0oykDFxA\n 3G0RpuzqdJdvWc9fuVXUGuJfOT+tO1CXYpg0yR5A9Ad+Rb4JWokl34M6jFO4ye4fuivcLr\n 43vLojQxX6f66ko8r8Qqq5EJ1b3FDi4=",
            "v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz;\n s=susede2_ed25519; t=1774861743;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=vhHxD+GWynE6a9go1xJ4ogKLVqhoWN5r9VLsM9t9HGM=;\n b=VWF1YwuTHKwoLUI5VlrlpX+jvyMCCymfmy3nLmfVqEXpRH5J5miVBEcQBmT2Xd0rFNHPa/\n wxnem9ZM3vOf0WDw==",
            "v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz;\n s=susede2_rsa;\n t=1774861742;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=vhHxD+GWynE6a9go1xJ4ogKLVqhoWN5r9VLsM9t9HGM=;\n b=qG41MlWeIRVVvzMhXGDWcbycqkukKNQbhDvOxWgRGOe76F1VDNYdd95X7ndRYRlmeFeK51\n eOh3eNBkT4mzAfX51sM8xtfN6pQaTa7G9INgJv3iqcoQrVSnNvWng5Pl7I+Kr/9oB360PN\n bqGqlxC9Vw2L9MrjEd5uLZVA5bGQutI=",
            "v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz;\n s=susede2_ed25519; t=1774861742;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=vhHxD+GWynE6a9go1xJ4ogKLVqhoWN5r9VLsM9t9HGM=;\n b=ZT+08ekHXNQQCoO1CMT4ukpUshozfws/1rFrMOnP9G9PbAnOyDGLZdETZOd5vp+9ni5ePw\n mXgb24Pl97hIymDg=="
        ],
        "From": "Petr Vorel <pvorel@suse.cz>",
        "To": "ltp@lists.linux.it",
        "Date": "Mon, 30 Mar 2026 11:08:43 +0200",
        "Message-ID": "<20260330090844.79598-3-pvorel@suse.cz>",
        "X-Mailer": "git-send-email 2.53.0",
        "In-Reply-To": "<20260330090844.79598-1-pvorel@suse.cz>",
        "References": "<20260330090844.79598-1-pvorel@suse.cz>",
        "MIME-Version": "1.0",
        "X-Rspamd-Action": "no action",
        "X-Rspamd-Server": "rspamd2.dmz-prg2.suse.org",
        "X-Spamd-Result": "default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%];\n MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000];\n R_MISSING_CHARSET(0.50)[];\n R_DKIM_ALLOW(-0.20)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519];\n NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain];\n MX_GOOD(-0.01)[]; RCPT_COUNT_TWELVE(0.00)[15];\n TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_TRACE(0.00)[0:+];\n FUZZY_RATELIMITED(0.00)[rspamd.com];\n DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519];\n ARC_NA(0.00)[];\n RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from];\n RCVD_TLS_ALL(0.00)[]; DKIM_TRACE(0.00)[suse.cz:+];\n SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from];\n FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[];\n TO_DN_SOME(0.00)[]; RCVD_COUNT_TWO(0.00)[2];\n RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received];\n DNSWL_BLOCKED(0.00)[2a07:de40:b281:106:10:150:64:167:received,2a07:de40:b281:104:10:150:64:97:from];\n R_RATELIMIT(0.00)[to_ip_from(RL9hby1rshmenoep4g4mwnfqt6)];\n RCVD_VIA_SMTP_AUTH(0.00)[];\n DBL_BLOCKED_OPENRESOLVER(0.00)[pm_include.sh:url,\n imap1.dmz-prg2.suse.org:helo,\n imap1.dmz-prg2.suse.org:rdns, suse.cz:dkim, suse.cz:mid, suse.cz:email,\n test.sh:url]",
        "X-Rspamd-Queue-Id": "6E8745BCFF",
        "X-Spam-Score": "-3.01",
        "X-Spam-Level": "",
        "X-Spam-Status": "No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID,\n DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS shortcircuit=no\n autolearn=disabled version=4.0.1",
        "X-Spam-Checker-Version": "SpamAssassin 4.0.1 (2024-03-25) on in-4.smtp.seeweb.it",
        "X-Virus-Scanned": "clamav-milter 1.0.9 at in-4.smtp.seeweb.it",
        "X-Virus-Status": "Clean",
        "Subject": "[LTP] [PATCH v2 2/2] power_management: Remove unused tools",
        "X-BeenThere": "ltp@lists.linux.it",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "Linux Test Project <ltp.lists.linux.it>",
        "List-Unsubscribe": "<https://lists.linux.it/options/ltp>,\n <mailto:ltp-request@lists.linux.it?subject=unsubscribe>",
        "List-Archive": "<http://lists.linux.it/pipermail/ltp/>",
        "List-Post": "<mailto:ltp@lists.linux.it>",
        "List-Help": "<mailto:ltp-request@lists.linux.it?subject=help>",
        "List-Subscribe": "<https://lists.linux.it/listinfo/ltp>,\n <mailto:ltp-request@lists.linux.it?subject=subscribe>",
        "Cc": "\"Rafael J . Wysocki\" <rafael@kernel.org>, linux-pm@vger.kernel.org,\n Daniel Lezcano <daniel.lezcano@linaro.org>, tomasz.ossowski@intel.com,\n helena.anna.dubel@intel.com, Zhang Rui <rui.zhang@intel.com>,\n Lukasz Luba <lukasz.luba@arm.com>, automated-testing@lists.yoctoproject.org",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it",
        "Sender": "\"ltp\" <ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it>"
    },
    "content": "Remove now unneeded tools and functions from pm_include.sh (see previous commit).\nAlso move functions from pm_include.sh used only in single shell script to it.\n\nThis removes the rest of python code in power management tests.\n\nSigned-off-by: Petr Vorel <pvorel@suse.cz>\n---\n testcases/kernel/power_management/Makefile    |   2 +-\n .../kernel/power_management/lib/Makefile      |  25 -\n .../power_management/lib/pm_sched_mc.py       | 835 ------------------\n .../kernel/power_management/pm_ilb_test.py    |  57 --\n .../kernel/power_management/pm_include.sh     | 311 +------\n .../power_management/pm_sched_domain.py       |  54 --\n .../kernel/power_management/runpwtests03.sh   |  10 +\n .../kernel/power_management/runpwtests06.sh   |  31 +\n 8 files changed, 43 insertions(+), 1282 deletions(-)\n delete mode 100644 testcases/kernel/power_management/lib/Makefile\n delete mode 100755 testcases/kernel/power_management/lib/pm_sched_mc.py\n delete mode 100755 testcases/kernel/power_management/pm_ilb_test.py\n delete mode 100755 testcases/kernel/power_management/pm_sched_domain.py",
    "diff": "diff --git a/testcases/kernel/power_management/Makefile b/testcases/kernel/power_management/Makefile\nindex 935f47eea1..4357bd9c29 100644\n--- a/testcases/kernel/power_management/Makefile\n+++ b/testcases/kernel/power_management/Makefile\n@@ -26,4 +26,4 @@ INSTALL_TARGETS \t:= *.py *.sh\n \n MAKE_DEPS\t\t+= $(APICMDS_DIR)/tst_kvercmp\n \n-include $(top_srcdir)/include/mk/generic_trunk_target.mk\n+include $(top_srcdir)/include/mk/generic_leaf_target.mk\ndiff --git a/testcases/kernel/power_management/lib/Makefile b/testcases/kernel/power_management/lib/Makefile\ndeleted file mode 100644\nindex 2aadac0a5b..0000000000\n--- a/testcases/kernel/power_management/lib/Makefile\n+++ /dev/null\n@@ -1,25 +0,0 @@\n-#\n-# Copyright (c) 2015 Fujitsu Ltd.\n-#\n-# This program is free software; you can redistribute it and/or modify\n-# it under the terms of the GNU General Public License as published by\n-# the Free Software Foundation; either version 2 of the License, or\n-# (at your option) any later version.\n-#\n-# This program is distributed in the hope that it will be useful,\n-# but WITHOUT ANY WARRANTY; without even the implied warranty of\n-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n-# GNU General Public License for more details.\n-#\n-# You should have received a copy of the GNU General Public License along\n-# with this program; if not, write to the Free Software Foundation, Inc.,\n-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\n-#\n-\n-top_srcdir \t\t?= ../../../..\n-\n-include $(top_srcdir)/include/mk/env_pre.mk\n-\n-INSTALL_TARGETS \t:= *.py\n-\n-include $(top_srcdir)/include/mk/generic_leaf_target.mk\ndiff --git a/testcases/kernel/power_management/lib/pm_sched_mc.py b/testcases/kernel/power_management/lib/pm_sched_mc.py\ndeleted file mode 100755\nindex 743b6debf3..0000000000\n--- a/testcases/kernel/power_management/lib/pm_sched_mc.py\n+++ /dev/null\n@@ -1,835 +0,0 @@\n-#!/usr/bin/env python3\n-''' Reusable functions related to sched mc FVT are put together\n-'''\n-\n-import os\n-import sys\n-import re\n-from time import time\n-\n-__author__ = \"Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>\"\n-__author__ = \"Poornima Nayak <mpnayak@linux.vnet.ibm.com>\"\n-\n-\n-cpu_map = {}\n-stats_start = {}\n-stats_stop = {}\n-stats_percentage = {}\n-intr_start = []\n-intr_stop = []\n-cpu_count = 0\n-socket_count = 0\n-cpu1_max_intr = 0\n-cpu2_max_intr = 0\n-intr_stat_timer_0 = []\n-siblings_list = []\n-\n-def clear_dmesg():\n-    '''\n-       Clears dmesg\n-    '''\n-    try:\n-        os.system('dmesg -c >/dev/null')\n-    except OSError as e:\n-        print('Clearing dmesg failed', e)\n-        sys.exit(1)\n-\n-def count_num_cpu():\n-    ''' Returns number of cpu's in system\n-    '''\n-    try:\n-        cpuinfo = open('/proc/cpuinfo', 'r')\n-        global cpu_count\n-        for line in cpuinfo:\n-            if line.startswith('processor'):\n-                cpu_count += 1\n-        cpuinfo.close()\n-    except IOError as e:\n-        print(\"Could not get cpu count\", e)\n-        sys.exit(1)\n-\n-def count_num_sockets():\n-    ''' Returns number of cpu's in system\n-    '''\n-    socket_list = []\n-    global socket_count\n-    try:\n-        for i in range(0, cpu_count):\n-            phy_pkg_file = '/sys/devices/system/cpu/cpu%s' % i\n-            phy_pkg_file += '/topology/physical_package_id'\n-            socket_id = open(phy_pkg_file).read().rstrip()\n-            if socket_id not in socket_list:\n-                socket_list.append(socket_id)\n-                socket_count = socket_count + 1\n-    except Exception as details:\n-        print(\"INFO: Failed to get number of sockets in system\", details)\n-        sys.exit(1)\n-\n-def is_multi_socket():\n-    '''Return 1 if the system is multi socket else return 0\n-    '''\n-    try:\n-        if socket_count > 1:\n-            return 1\n-        else:\n-            return 0\n-    except Exception:\n-        print(\"Failed to check if system is multi socket system\")\n-        sys.exit(1)\n-\n-def is_hyper_threaded():\n-    '''Return 1 if the system is hyper threaded else return 0\n-    '''\n-    try:\n-        file_cpuinfo = open(\"/proc/cpuinfo\", 'r')\n-        for line in file_cpuinfo:\n-            if line.startswith('siblings'):\n-                siblings = line.split(\":\")\n-            if line.startswith('cpu cores'):\n-                cpu_cores = line.split(\":\")\n-                break\n-        if int( siblings[1] ) / int( cpu_cores[1] )> 1:\n-            file_cpuinfo.close()\n-            return 1\n-        else:\n-            return 0\n-    except Exception:\n-        print(\"Failed to check if system is hyper-threaded\")\n-        sys.exit(1)\n-\n-def is_multi_core():\n-    ''' Return true if system has sockets has multiple cores\n-    '''\n-\n-    try:\n-        file_cpuinfo = open(\"/proc/cpuinfo\", 'r')\n-        for line in file_cpuinfo:\n-            if line.startswith('siblings'):\n-                siblings = line.split(\":\")\n-            if line.startswith('cpu cores'):\n-                cpu_cores = line.split(\":\")\n-                break\n-\n-        if int( siblings[1] ) == int( cpu_cores[1] ):\n-            if int( cpu_cores[1] ) > 1:\n-                multi_core = 1\n-            else:\n-                multi_core = 0\n-        else:\n-            num_of_cpus = int(siblings[1]) / int(cpu_cores[1])\n-            if num_of_cpus > 1:\n-                multi_core = 1\n-            else:\n-                multi_core = 0\n-        file_cpuinfo.close()\n-        return multi_core\n-    except Exception:\n-        print(\"Failed to check if system is multi core system\")\n-        sys.exit(1)\n-\n-def get_hyper_thread_count():\n-    ''' Return number of threads in CPU. For eg for x3950 this function\n-        would return 2. In future if 4 threads are supported in CPU, this\n-        routine would return 4\n-    '''\n-    try:\n-        file_cpuinfo = open(\"/proc/cpuinfo\", 'r')\n-        for line in file_cpuinfo:\n-            if line.startswith('siblings'):\n-                siblings = line.split(\":\")\n-            if line.startswith('cpu cores'):\n-                cpu_cores = line.split(\":\")\n-                break\n-        return( int( siblings[1] ) / int( cpu_cores[1] ) )\n-    except Exception:\n-        print(\"Failed to check if system is hyper-threaded\")\n-        sys.exit(1)\n-\n-def map_cpuid_pkgid():\n-    ''' Routine to map physical package id to cpu id\n-    '''\n-    if is_hyper_threaded():\n-        core_info = {}\n-        try:\n-            for i in range(0, cpu_count):\n-                phy_pkg_file = '/sys/devices/system/cpu/cpu%s' % i\n-                phy_pkg_file += '/topology/physical_package_id'\n-                core_file = '/sys/devices/system/cpu/cpu%s' % i\n-                core_file += '/topology/core_id'\n-                core_id = open(core_file).read().rstrip()\n-                cpu_phy_id = open(phy_pkg_file).read().rstrip()\n-                if not cpu_phy_id in list(cpu_map.keys()):\n-                    core_info = {}\n-                else:\n-                    core_info = cpu_map[cpu_phy_id]\n-                if not core_id in list(core_info.keys()):\n-                    core_info[core_id] = [i]\n-                else:\n-                    core_info[core_id].append(i)\n-                cpu_map[cpu_phy_id] = core_info\n-        except Exception as details:\n-            print(\"Package, core & cpu map table creation failed\", e)\n-            sys.exit(1)\n-    else:\n-        for i in range(0, cpu_count):\n-            try:\n-                phy_pkg_file = '/sys/devices/system/cpu/cpu%s' %i\n-                phy_pkg_file += '/topology/physical_package_id'\n-                cpu_phy_id = open(phy_pkg_file).read().rstrip()\n-                if not cpu_phy_id in list(cpu_map.keys()):\n-                    cpu_map[cpu_phy_id] = [i]\n-                else:\n-                    cpu_map[cpu_phy_id].append(i)\n-            except IOError as e:\n-                print(\"Mapping of CPU to pkg id failed\", e)\n-                sys.exit(1)\n-\n-\n-def generate_sibling_list():\n-    ''' Routine to generate siblings list\n-    '''\n-    try:\n-        for i in range(0, cpu_count):\n-            siblings_file = '/sys/devices/system/cpu/cpu%s' % i\n-            siblings_file += '/topology/thread_siblings_list'\n-            threads_sibs = open(siblings_file).read().rstrip()\n-            thread_ids = threads_sibs.split(\"-\")\n-\n-            if not thread_ids in siblings_list:\n-                siblings_list.append(thread_ids)\n-    except Exception as details:\n-        print(\"Exception in generate_siblings_list\", details)\n-        sys.exit(1)\n-\n-def get_siblings(cpu_id):\n-    ''' Return siblings of cpu_id\n-    '''\n-    try:\n-        cpus = \"\"\n-        for i in range(0, len(siblings_list)):\n-            for cpu in siblings_list[i]:\n-                if cpu_id == cpu:\n-                    for j in siblings_list[i]:\n-                        # Exclude cpu_id in the list of siblings\n-                        if j != cpu_id:\n-                            cpus += j\n-                    return cpus\n-        return cpus\n-    except Exception as details:\n-        print(\"Exception in get_siblings\", details)\n-        sys.exit(1)\n-\n-def get_proc_data(stats_list):\n-    ''' Read /proc/stat info and store in dictionary\n-    '''\n-    try:\n-        file_procstat = open(\"/proc/stat\", 'r')\n-        for line in file_procstat:\n-            if line.startswith('cpu'):\n-                data = line.split()\n-                stats_list[data[0]] = data\n-        file_procstat.close()\n-    except OSError as e:\n-        print(\"Could not read statistics\", e)\n-        sys.exit(1)\n-\n-def get_proc_loc_count(loc_stats):\n-    ''' Read /proc/interrupts info and store in list\n-    '''\n-    try:\n-        file_procstat = open(\"/proc/interrupts\", 'r')\n-        for line in file_procstat:\n-            if line.startswith(' LOC:') or line.startswith('LOC:'):\n-                data = line.split()\n-                for i in range(0, cpu_count):\n-                    # To skip LOC\n-                    loc_stats.append(data[i+1])\n-                file_procstat.close()\n-                return\n-    except Exception as details:\n-        print(\"Could not read interrupt statistics\", details)\n-        sys.exit(1)\n-\n-\n-def set_sched_mc_power(sched_mc_level):\n-    ''' Routine to set sched_mc_power_savings to required level\n-    '''\n-    try:\n-        os.system('echo %s > \\\n-            /sys/devices/system/cpu/sched_mc_power_savings 2>/dev/null'\n-            % sched_mc_level)\n-\n-        get_proc_data(stats_start)\n-    except OSError as e:\n-        print(\"Could not set sched_mc_power_savings to\", sched_mc_level, e)\n-    sys.exit(1)\n-\n-def set_sched_smt_power(sched_smt_level):\n-    ''' Routine to set sched_smt_power_savings to required level\n-    '''\n-    try:\n-        os.system('echo %s > \\\n-            /sys/devices/system/cpu/sched_smt_power_savings 2>/dev/null'\n-            % sched_smt_level)\n-\n-        get_proc_data(stats_start)\n-    except OSError as e:\n-        print(\"Could not set sched_smt_power_savings to\", sched_smt_level, e)\n-    sys.exit(1)\n-\n-def set_timer_migration_interface(value):\n-    ''' Set value of timer migration interface to a value\n-        passed as argument\n-    '''\n-    try:\n-        os.system('echo %s > \\\n-            /proc/sys/kernel/timer_migration 2>/dev/null' % value)\n-    except OSError as e:\n-        print(\"Could not set timer_migration to \", value, e)\n-        sys.exit(1)\n-\n-def get_job_count(stress, workload, sched_smt):\n-    ''' Returns number of jobs/threads to be triggered\n-    '''\n-\n-    try:\n-        if stress == \"thread\":\n-            threads = get_hyper_thread_count()\n-        if stress == \"partial\":\n-            threads = cpu_count / socket_count\n-            if is_hyper_threaded():\n-                if workload == \"ebizzy\" and int(sched_smt) ==0:\n-                    threads = threads / get_hyper_thread_count()\n-                if workload == \"kernbench\" and int(sched_smt) < 2:\n-                    threads = threads / get_hyper_thread_count()\n-        if stress == \"full\":\n-            threads = cpu_count\n-        if stress == \"single_job\":\n-            threads = 1\n-            duration = 180\n-        return threads\n-    except Exception as details:\n-        print(\"get job count failed \", details)\n-        sys.exit(1)\n-\n-def trigger_ebizzy (sched_smt, stress, duration, background, pinned):\n-    ''' Triggers ebizzy workload for sched_mc=1\n-        testing\n-    '''\n-    try:\n-        threads = get_job_count(stress, \"ebizzy\", sched_smt)\n-        workload = \"ebizzy\"\n-        olddir = os.getcwd()\n-        path = '%s/testcases/bin' % os.environ['LTPROOT']\n-        os.chdir(path)\n-        workload_file = \"\"\n-        for file_name in os.listdir('.'):\n-            if file_name == workload:\n-                workload_file = file_name\n-                break\n-        if workload_file == \"\":\n-            print(\"INFO: ebizzy benchmark not found\")\n-            os.chdir(olddir)\n-            sys.exit(1)\n-        get_proc_data(stats_start)\n-        get_proc_loc_count(intr_start)\n-        try:\n-            if background == \"yes\":\n-                succ = os.system('./ebizzy -t%s -s4096 -S %s >/dev/null &'\n-                    % (threads, duration))\n-            else:\n-                if pinned == \"yes\":\n-                    succ = os.system('taskset -c %s ./ebizzy -t%s -s4096 -S %s >/dev/null'\n-                        % (cpu_count -1, threads, duration))\n-                else:\n-                    succ = os.system('./ebizzy -t%s -s4096 -S %s >/dev/null'\n-                        % (threads, duration))\n-\n-            if succ == 0:\n-                print(\"INFO: ebizzy workload triggerd\")\n-                os.chdir(olddir)\n-                #Commented bcoz it doesnt make sense to capture it when workload triggered\n-                #in background\n-                #get_proc_loc_count(intr_stop)\n-                #get_proc_data(stats_stop)\n-            else:\n-                print(\"INFO: ebizzy workload triggerd failed\")\n-                os.chdir(olddir)\n-                sys.exit(1)\n-        except Exception as details:\n-            print(\"Ebizzy workload trigger failed \", details)\n-            sys.exit(1)\n-    except Exception as details:\n-        print(\"Ebizzy workload trigger failed \", details)\n-        sys.exit(1)\n-\n-def trigger_kernbench (sched_smt, stress, background, pinned, perf_test):\n-    ''' Trigger load on system like kernbench.\n-        Copys existing copy of LTP into as LTP2 and then builds it\n-        with make -j\n-    '''\n-    olddir = os.getcwd()\n-    try:\n-        threads = get_job_count(stress, \"kernbench\", sched_smt)\n-\n-        dst_path = \"/root\"\n-        workload = \"kernbench\"\n-        olddir = os.getcwd()\n-        path = '%s/testcases/bin' % os.environ['LTPROOT']\n-        os.chdir(path)\n-        workload_file = \"\"\n-        for file_name in os.listdir('.'):\n-            if file_name == workload:\n-                workload_file = file_name\n-                break\n-        if workload_file != \"\":\n-            benchmark_path = path\n-        else:\n-            print(\"INFO: kernbench benchmark not found\")\n-            os.chdir(olddir)\n-            sys.exit(1)\n-\n-        os.chdir(dst_path)\n-        linux_source_dir=\"\"\n-        for file_name in os.listdir('.'):\n-            if file_name.find(\"linux-2.6\") != -1 and os.path.isdir(file_name):\n-                linux_source_dir=file_name\n-                break\n-        if linux_source_dir != \"\":\n-            os.chdir(linux_source_dir)\n-        else:\n-            print(\"INFO: Linux kernel source not found in /root. Workload\\\n-               Kernbench cannot be executed\")\n-            sys.exit(1)\n-\n-        get_proc_data(stats_start)\n-        get_proc_loc_count(intr_start)\n-        if pinned == \"yes\":\n-            os.system ( 'taskset -c %s %s/kernbench -o %s -M -H -n 1 \\\n-                >/dev/null 2>&1 &' % (cpu_count-1, benchmark_path, threads))\n-\n-            # We have to delete import in future\n-            import time\n-            time.sleep(240)\n-            stop_wkld(\"kernbench\")\n-        else:\n-            if background == \"yes\":\n-                os.system ( '%s/kernbench -o %s -M -H -n 1 >/dev/null 2>&1 &' \\\n-                    % (benchmark_path, threads))\n-            else:\n-                if perf_test == \"yes\":\n-                    os.system ( '%s/kernbench -o %s -M -H -n 1 >/dev/null 2>&1' \\\n-                        % (benchmark_path, threads))\n-                else:\n-                    os.system ( '%s/kernbench -o %s -M -H -n 1 >/dev/null 2>&1 &' \\\n-                        % (benchmark_path, threads))\n-                    # We have to delete import in future\n-                    import time\n-                    time.sleep(240)\n-                    stop_wkld(\"kernbench\")\n-\n-        print(\"INFO: Workload kernbench triggerd\")\n-        os.chdir(olddir)\n-    except Exception as details:\n-        print(\"Workload kernbench trigger failed \", details)\n-        sys.exit(1)\n-\n-def trigger_workld(sched_smt, workload, stress, duration, background, pinned, perf_test):\n-    ''' Triggers workload passed as argument. Number of threads\n-        triggered is based on stress value.\n-    '''\n-    try:\n-        if workload == \"ebizzy\":\n-            trigger_ebizzy (sched_smt, stress, duration, background, pinned)\n-        if workload == \"kernbench\":\n-            trigger_kernbench (sched_smt, stress, background, pinned, perf_test)\n-    except Exception as details:\n-        print(\"INFO: Trigger workload failed\", details)\n-        sys.exit(1)\n-\n-def generate_report():\n-    ''' Generate report of CPU utilization\n-    '''\n-    cpu_labels = ('cpu', 'user', 'nice', 'system', 'idle', 'iowait', 'irq',\n-\t'softirq', 'x', 'y')\n-    if (not os.path.exists('/procstat')):\n-        os.mkdir('/procstat')\n-\n-    get_proc_data(stats_stop)\n-\n-    reportfile = open('/procstat/cpu-utilisation', 'a')\n-    debugfile = open('/procstat/cpu-utilisation.debug', 'a')\n-    for l in stats_stop:\n-        percentage_list = []\n-        total = 0\n-        for i in range(1, len(stats_stop[l])):\n-            stats_stop[l][i] =  int(stats_stop[l][i]) - int(stats_start[l][i])\n-            total += stats_stop[l][i]\n-        percentage_list.append(l)\n-        for i in range(1, len(stats_stop[l])):\n-            percentage_list.append(float(stats_stop[l][i])*100/total)\n-\n-        stats_percentage[l] = percentage_list\n-\n-    for i in range(0, len(cpu_labels)):\n-        print(cpu_labels[i], '\\t', end=' ', file=debugfile)\n-    print(file=debugfile)\n-    for l in sorted(stats_stop.keys()):\n-        print(l, '\\t', end=' ', file=debugfile)\n-        for i in range(1, len(stats_stop[l])):\n-            print(stats_stop[l][i], '\\t', end=' ', file=debugfile)\n-        print(file=debugfile)\n-\n-    for i in range(0, len(cpu_labels)):\n-        print(cpu_labels[i], '\\t', end=' ', file=reportfile)\n-    print(file=reportfile)\n-    for l in sorted(stats_percentage.keys()):\n-        print(l, '\\t', end=' ', file=reportfile)\n-        for i in range(1, len(stats_percentage[l])):\n-            print(\" %3.4f\" % stats_percentage[l][i], end=' ', file=reportfile)\n-        print(file=reportfile)\n-\n-    #Now get the package ID information\n-    try:\n-        print(\"cpu_map: \", cpu_map, file=debugfile)\n-        keyvalfile = open('/procstat/keyval', 'a')\n-        print(\"nr_packages=%d\" % len(cpu_map), file=keyvalfile)\n-        print(\"system-idle=%3.4f\" % (stats_percentage['cpu'][4]), file=keyvalfile)\n-        for pkg in sorted(cpu_map.keys()):\n-            if is_hyper_threaded():\n-                for core in sorted(cpu_map[pkg].keys()):\n-                    total_idle = 0\n-                    total = 0\n-                    for cpu in cpu_map[pkg][core]:\n-                        total_idle += stats_stop[\"cpu%d\" % cpu][4]\n-                        for i in range(1, len(stats_stop[\"cpu%d\" % cpu])):\n-                            total += stats_stop[\"cpu%d\" % cpu][i]\n-            else:\n-                total_idle = 0\n-                total = 0\n-                for cpu in cpu_map[pkg]:\n-                    total_idle += stats_stop[\"cpu%d\" % cpu][4]\n-                    for i in range(1, len(stats_stop[\"cpu%d\" % cpu])):\n-                        total += stats_stop[\"cpu%d\" % cpu][i]\n-            print(\"Package: \", pkg, \"Idle %3.4f%%\" \\\n-\t        % (float(total_idle)*100/total), file=reportfile)\n-            print(\"package-%s=%3.4f\" % \\\n-\t\t(pkg, (float(total_idle)*100/total)), file=keyvalfile)\n-    except Exception as details:\n-        print(\"Generating utilization report failed: \", details)\n-        sys.exit(1)\n-\n-    #Add record delimiter '\\n' before closing these files\n-    print(file=debugfile)\n-    debugfile.close()\n-    print(file=reportfile)\n-    reportfile.close()\n-    print(file=keyvalfile)\n-    keyvalfile.close()\n-\n-def generate_loc_intr_report():\n-    ''' Generate interrupt report of CPU's\n-    '''\n-    try:\n-        if (not os.path.exists('/procstat')):\n-            os.mkdir('/procstat')\n-\n-        get_proc_loc_count(intr_stop)\n-\n-        reportfile = open('/procstat/cpu-loc_interrupts', 'a')\n-        print(\"==============================================\", file=reportfile)\n-        print(\"     Local timer interrupt stats              \", file=reportfile)\n-        print(\"==============================================\", file=reportfile)\n-\n-        for i in range(0, cpu_count):\n-            intr_stop[i] =  int(intr_stop[i]) - int(intr_start[i])\n-            print(\"CPU%s: %s\" %(i, intr_stop[i]), file=reportfile)\n-        print(file=reportfile)\n-        reportfile.close()\n-    except Exception as details:\n-        print(\"Generating interrupt report failed: \", details)\n-        sys.exit(1)\n-\n-def record_loc_intr_count():\n-    ''' Record Interrupt statistics when timer_migration\n-        was disabled\n-    '''\n-    try:\n-        global intr_start, intr_stop\n-        for i in range(0, cpu_count):\n-            intr_stat_timer_0.append(intr_stop[i])\n-        intr_start = []\n-        intr_stop = []\n-    except Exception as details:\n-        print(\"INFO: Record interrupt statistics when timer_migration=0\",details)\n-\n-def expand_range(range_val):\n-    '''\n-       Expand the range of value into actual numbers\n-    '''\n-    ids_list = list()\n-    try:\n-        sep_comma = range_val.split(\",\")\n-        for i in range(0, len(sep_comma)):\n-            hyphen_values = sep_comma[i].split(\"-\")\n-            if len(hyphen_values) == 1:\n-                ids_list.append(int(hyphen_values[0]))\n-            else:\n-                for j in range(int(hyphen_values[0]), int(hyphen_values[1])+1):\n-                    ids_list.append(j)\n-        return(ids_list)\n-    except Exception as details:\n-        print(\"INFO: expand_pkg_grps failed \", details)\n-\n-def is_quad_core():\n-    '''\n-       Read /proc/cpuinfo and check if system is Quad core\n-    '''\n-    try:\n-        cpuinfo = open('/proc/cpuinfo', 'r')\n-        for line in cpuinfo:\n-            if line.startswith('cpu cores'):\n-                cores = line.split(\"cpu cores\")\n-                num_cores = cores[1].split(\":\")\n-                cpuinfo.close()\n-                if int(num_cores[1]) == 4:\n-                    return(1)\n-                else:\n-                    return(0)\n-    except IOError as e:\n-        print(\"Failed to get cpu core information\", e)\n-        sys.exit(1)\n-\n-def validate_cpugrp_map(cpu_group, sched_mc_level, sched_smt_level):\n-    '''\n-       Verify if cpugrp belong to same package\n-    '''\n-    modi_cpu_grp = cpu_group[:]\n-    try:\n-        if is_hyper_threaded():\n-            for pkg in sorted(cpu_map.keys()):\n-                # if CPU utilized is across package this condition will be true\n-                if len(modi_cpu_grp) != len(cpu_group):\n-                    break\n-                for core in sorted(cpu_map[pkg].keys()):\n-                    core_cpus = cpu_map[pkg][core]\n-                    if core_cpus == modi_cpu_grp:\n-                        return 0\n-                    else:\n-                        #if CPUs used across the cores\n-                        for i in range(0, len(core_cpus)):\n-                            if core_cpus[i] in modi_cpu_grp:\n-                                modi_cpu_grp.remove(core_cpus[i])\n-                                if len(modi_cpu_grp) == 0:\n-                                    return 0\n-                            #This code has to be deleted\n-                            #else:\n-                                # If sched_smt == 0 then its oky if threads run\n-                                # in different cores of same package\n-                                #if sched_smt_level > 0 :\n-                                    #return 1\n-        else:\n-            for pkg in sorted(cpu_map.keys()):\n-                pkg_cpus = cpu_map[pkg]\n-                if len(cpu_group) == len(pkg_cpus):\n-                    if pkg_cpus == cpu_group:\n-                        return(0)\n-                else:\n-                    if int(cpus_utilized[0]) in cpu_map[pkg] or int(cpus_utilized[1]) in cpu_map[pkg]:\n-                        return(0)\n-\n-        return(1)\n-\n-    except Exception as details:\n-        print(\"Exception in validate_cpugrp_map: \", details)\n-        sys.exit(1)\n-\n-\n-def verify_sched_domain_dmesg(sched_mc_level, sched_smt_level):\n-    '''\n-       Read sched domain information from dmesg.\n-    '''\n-    cpu_group = list()\n-    try:\n-        dmesg_info = os.popen('dmesg').read()\n-        if dmesg_info != \"\":\n-            lines = dmesg_info.split('\\n')\n-            for i in range(0, len(lines)):\n-                if lines[i].endswith('CPU'):\n-                    groups = lines[i+1].split(\"groups:\")\n-                    group_info = groups[1]\n-                    if group_info.find(\"(\") != -1:\n-                        openindex=group_info.index(\"(\")\n-                        closeindex=group_info.index(\")\")\n-                        group_info=group_info.replace\\\n-                            (group_info[openindex:closeindex+1],\"\")\n-\n-                    subgroup = group_info.split(\",\")\n-                    for j in range(0, len(subgroup)):\n-                        cpu_group = expand_range(subgroup[j])\n-                        status = validate_cpugrp_map(cpu_group, sched_mc_level,\\\n-                        sched_smt_level)\n-                        if status == 1:\n-                            if is_quad_core() == 1:\n-                                if int(sched_mc_level) == 0:\n-                                    return(0)\n-                                else:\n-                                    return(1)\n-                            else:\n-                                return(1)\n-            return(0)\n-        else:\n-            return(1)\n-    except Exception as details:\n-        print(\"Reading dmesg failed\", details)\n-        sys.exit(1)\n-\n-def get_cpu_utilization(cpu):\n-    ''' Return cpu utilization of cpu_id\n-    '''\n-    try:\n-        for l in sorted(stats_percentage.keys()):\n-            if cpu == stats_percentage[l][0]:\n-                return stats_percentage[l][1]\n-        return -1\n-    except Exception as details:\n-        print(\"Exception in get_cpu_utilization\", details)\n-        sys.exit(1)\n-\n-def validate_cpu_consolidation(stress, work_ld, sched_mc_level, sched_smt_level):\n-    ''' Verify if cpu's on which threads executed belong to same\n-    package\n-    '''\n-    cpus_utilized = list()\n-    threads = get_job_count(stress, work_ld, sched_smt_level)\n-    try:\n-        for l in sorted(stats_percentage.keys()):\n-            #modify threshold\n-            cpu_id = stats_percentage[l][0].split(\"cpu\")\n-            if cpu_id[1] == '':\n-                continue\n-            if int(cpu_id[1]) in cpus_utilized:\n-                continue\n-            if is_hyper_threaded():\n-                if work_ld == \"kernbench\" and sched_smt_level < sched_mc_level:\n-                    siblings = get_siblings(cpu_id[1])\n-                    if siblings != \"\":\n-                        sib_list = siblings.split()\n-                        utilization = int(stats_percentage[l][1])\n-                        for i in range(0, len(sib_list)):\n-                            utilization += int(get_cpu_utilization(\"cpu%s\" %sib_list[i]))\n-                    else:\n-                        utilization = stats_percentage[l][1]\n-                    if utilization > 40:\n-                        cpus_utilized.append(int(cpu_id[1]))\n-                        if siblings != \"\":\n-                            for i in range(0, len(sib_list)):\n-                                cpus_utilized.append(int(sib_list[i]))\n-                else:\n-                    # This threshold wuld be modified based on results\n-                    if stats_percentage[l][1] > 40:\n-                        cpus_utilized.append(int(cpu_id[1]))\n-            else:\n-                if work_ld == \"kernbench\" :\n-                    if stats_percentage[l][1] > 50:\n-                        cpus_utilized.append(int(cpu_id[1]))\n-                else:\n-                    if stats_percentage[l][1] > 70:\n-                        cpus_utilized.append(int(cpu_id[1]))\n-            cpus_utilized.sort()\n-        print(\"INFO: CPU's utilized \", cpus_utilized)\n-\n-        # If length of CPU's utilized is not = number of jobs exit with 1\n-        if len(cpus_utilized) < threads:\n-            return 1\n-\n-        status = validate_cpugrp_map(cpus_utilized, sched_mc_level, \\\n-            sched_smt_level)\n-        if status == 1:\n-            print(\"INFO: CPUs utilized is not in same package or core\")\n-\n-        return(status)\n-    except Exception as details:\n-        print(\"Exception in validate_cpu_consolidation: \", details)\n-        sys.exit(1)\n-\n-def get_cpuid_max_intr_count():\n-    '''Return the cpu id's of two cpu's with highest number of intr'''\n-    try:\n-        highest = 0\n-        second_highest = 0\n-        cpus_utilized = []\n-\n-        #Skipping CPU0 as it is generally high\n-        for i in range(1, cpu_count):\n-            if int(intr_stop[i]) > int(highest):\n-                if highest != 0:\n-                    second_highest = highest\n-                    cpu2_max_intr = cpu1_max_intr\n-                highest = int(intr_stop[i])\n-                cpu1_max_intr = i\n-            else:\n-                if int(intr_stop[i]) > int(second_highest):\n-                    second_highest = int(intr_stop[i])\n-                    cpu2_max_intr = i\n-        cpus_utilized.append(cpu1_max_intr)\n-        cpus_utilized.append(cpu2_max_intr)\n-\n-        for i in range(1, cpu_count):\n-            if i != cpu1_max_intr and i != cpu2_max_intr:\n-                diff = second_highest - intr_stop[i]\n-                ''' Threshold of difference has to be manipulated '''\n-                if diff < 10000:\n-                    print(\"INFO: Diff in interrupt count is below threshold\")\n-                    cpus_utilized = []\n-                    return cpus_utilized\n-        print(\"INFO: Interrupt count in other CPU's low as expected\")\n-        return cpus_utilized\n-    except Exception as details:\n-        print(\"Exception in get_cpuid_max_intr_count: \", details)\n-        sys.exit(1)\n-\n-def validate_ilb (sched_mc_level, sched_smt_level):\n-    ''' Validate if ilb is running in same package where work load is running\n-    '''\n-    try:\n-        cpus_utilized = get_cpuid_max_intr_count()\n-        if not cpus_utilized:\n-            return 1\n-\n-        status = validate_cpugrp_map(cpus_utilized, sched_mc_level, sched_smt_level)\n-        return status\n-    except Exception as details:\n-        print(\"Exception in validate_ilb: \", details)\n-        sys.exit(1)\n-\n-def reset_schedmc():\n-    ''' Routine to reset sched_mc_power_savings to Zero level\n-    '''\n-    try:\n-        os.system('echo 0 > \\\n-            /sys/devices/system/cpu/sched_mc_power_savings 2>/dev/null')\n-    except OSError as e:\n-        print(\"Could not set sched_mc_power_savings to 0\", e)\n-        sys.exit(1)\n-\n-def reset_schedsmt():\n-    ''' Routine to reset sched_smt_power_savings to Zero level\n-    '''\n-    try:\n-        os.system('echo 0 > \\\n-            /sys/devices/system/cpu/sched_smt_power_savings 2>/dev/null')\n-    except OSError as e:\n-        print(\"Could not set sched_smt_power_savings to 0\", e)\n-        sys.exit(1)\n-\n-def stop_wkld(work_ld):\n-    ''' Kill workload triggered in background\n-    '''\n-    try:\n-        os.system('pkill %s 2>/dev/null' %work_ld)\n-        if work_ld == \"kernbench\":\n-            os.system('pkill make 2>/dev/null')\n-    except OSError as e:\n-        print(\"Exception in stop_wkld\", e)\n-        sys.exit(1)\ndiff --git a/testcases/kernel/power_management/pm_ilb_test.py b/testcases/kernel/power_management/pm_ilb_test.py\ndeleted file mode 100755\nindex f20717090b..0000000000\n--- a/testcases/kernel/power_management/pm_ilb_test.py\n+++ /dev/null\n@@ -1,57 +0,0 @@\n-#!/usr/bin/env python3\n-''' This Python script interprets interrupt values.\n-    Validates Ideal load balancer runs in same package where workload is running\n-'''\n-\n-import os\n-import sys\n-from optparse import OptionParser\n-from pm_sched_mc import *\n-\n-__author__ = \"Poornima Nayak <mpnayak@linux.vnet.ibm.com>\"\n-\n-class Usage(Exception):\n-    def __init__(self, msg):\n-        self.msg = msg\n-\n-def main(argv=None):\n-    if argv is None:\n-        argv = sys.argv\n-\n-    usage = \"-w\"\n-    parser = OptionParser(usage)\n-    parser.add_option(\"-c\", \"--mc_level\", dest=\"mc_level\",\n-        default=0, help=\"Sched mc power saving value 0/1/2\")\n-    parser.add_option(\"-t\", \"--smt_level\", dest=\"smt_level\",\n-        default=0, help=\"Sched smt power saving value 0/1/2\")\n-    parser.add_option(\"-w\", \"--workload\", dest=\"work_ld\",\n-        default=\"ebizzy\", help=\"Workload can be ebizzy/kernbench\")\n-    (options, args) = parser.parse_args()\n-\n-    try:\n-        count_num_cpu()\n-        count_num_sockets()\n-        if is_multi_socket():\n-            set_sched_mc_power(options.mc_level)\n-        if is_hyper_threaded():\n-            set_sched_smt_power(options.smt_level)\n-        map_cpuid_pkgid()\n-        print(\"INFO: Created table mapping cpu to package\")\n-        background=\"no\"\n-        duration=120\n-        pinned=\"yes\"\n-\n-        trigger_workld(options.smt_level,options.work_ld, \"single_job\", duration, background, pinned, \"no\")\n-        generate_loc_intr_report()\n-        status = validate_ilb(options.mc_level, options.smt_level)\n-        reset_schedmc()\n-        if is_hyper_threaded():\n-            reset_schedsmt()\n-        return(status)\n-\n-    except Exception as details:\n-        print(\"INFO: Idle Load Balancer test failed\", details)\n-        return(1)\n-\n-if __name__ == \"__main__\":\n-    sys.exit(main())\ndiff --git a/testcases/kernel/power_management/pm_include.sh b/testcases/kernel/power_management/pm_include.sh\nindex b83324f607..4cc75aa9ac 100755\n--- a/testcases/kernel/power_management/pm_include.sh\n+++ b/testcases/kernel/power_management/pm_include.sh\n@@ -1,19 +1,4 @@\n-#!/bin/bash\n-\n-TMPDIR=/tmp\n-\n-PASS=0\n-FAIL=1\n-NOSUPPORT=2\n-MISSING_FILE=3\n-UNTESTED=4\n-YES=0\n-\n-cleanup() {\n-\tif [ -f ${1} ] ; then\n-\t\trm -f ${1}\n-\tfi\n-}\n+#!/bin/sh\n \n check_arch() {\n \tcase \"$(uname -m)\" in\n@@ -24,297 +9,3 @@ check_arch() {\n \t\t;;\n \tesac\n }\n-\n-check_config_options() {\n-\tif ( ! ${3} \"${1}\" ${2} | grep -v \"#\" > /dev/null ) ; then\n-\t\ttst_brkm TCONF \"NOSUPPORT: current system dosen't support ${1}\"\n-\tfi\n-}\n-\n-get_topology() {\n-\tdeclare -a cpus\n-\tdeclare -a phyid\n-\n-\ttotal_cpus=`tst_ncpus`\n-\t(( total_cpus-=1 ))\n-\tfor cpu in $(seq 0 \"${total_cpus}\" )\n-\tdo\n-\t\tcpus[$cpu]=cpu${cpu}\n-\t\tphyid[$cpu]=$(cat \\\n-\t\t/sys/devices/system/cpu/cpu${cpu}/topology/physical_package_id)\n-\tdone\n-\tj=0\n-\twhile [ \"${j}\" -lt \"${total_cpus}\" ]\n-\tdo\n-\t\t(( k = $j + 1 ))\n-\t\tif [ ${phyid[$j]} -eq ${phyid[$k]} ] ; then\n-\t\t\techo \"${cpus[$j]} -P ${cpus[$k]}\" | sed -e \"s/cpu//g\"\n-\t\tfi\n-\t\t(( j+=1 ))\n-\tdone\n-}\n-\n-check_cpufreq() {\n-\ttotal_cpus=`tst_ncpus`\n-\t(( total_cpus-=1 ))\n-\n-\tfor cpu in $(seq 0 \"${total_cpus}\" )\n-\tdo\n-\t\tif [ ! -d /sys/devices/system/cpu/cpu${cpu}/cpufreq ] ; then\n-\t\t\ttst_brkm TCONF \"NOSUPPORT: cpufreq support not \" \\\n-\t\t\t\t\"found please check Kernel configuration \" \\\n-\t\t\t\t\"or BIOS settings\"\n-\t\tfi\n-\tdone\n-}\n-\n-get_supporting_freq() {\n-\tcat /sys/devices/system/cpu/cpu*/cpufreq/scaling_available_frequencies \\\n-\t\t| uniq\n-}\n-\n-get_supporting_govr() {\n-\tcat /sys/devices/system/cpu/cpu*/cpufreq/scaling_available_governors \\\n-\t\t| uniq\n-}\n-\n-is_hyper_threaded() {\n-\tsiblings=`grep siblings /proc/cpuinfo | uniq | cut -f2 -d':'`\n-\tcpu_cores=`grep \"cpu cores\" /proc/cpuinfo | uniq | cut -f2 -d':'`\n-\t[ $siblings -gt $cpu_cores ]; echo $?\n-}\n-\n-check_input() {\n-\tvalidity_check=${2:-valid}\n-\ttestfile=$3\n-\tif [ \"${validity_check}\" = \"invalid\" ] ; then\n-\t\tPASS=\"Testcase FAIL - Able to execute\"\n-\t\tFAIL=\"Testcase PASS - Unable to execute\"\n-\telse\n-\t\tPASS=\"Testcase PASS\"\n-\t\tFAIL=\"Testcase FAIL\"\n-\tfi\n-\tRC=0\n-\tfor input in ${1}\n-\tdo\n-\t\techo ${input} > ${test_file} 2>/dev/null\n-\t\treturn_value=$?\n-\t\toutput=$(cat ${test_file})\n-\t\tif [ \"${return_value}\" = \"0\" -a \"${input}\" = \"${output}\" ] ; then\n-\t\t\techo \"${0}: ${PASS}: echo ${input} > ${test_file}\"\n-\t\t\tif [ \"${validity_check}\" = \"invalid\" ] ; then\n-\t\t\t\tRC=1\n-\t\t\tfi\n-\t\telse\n-\t\t\techo \"${0}: ${FAIL}: echo ${input} > ${test_file}\"\n-\t\t\tif [ \"${validity_check}\" = \"valid\" ] ; then\n-\t\t\t\tRC=1\n-\t\t\tfi\n-\t\tfi\n-\tdone\n-\treturn $RC\n-}\n-\n-is_multi_socket() {\n-\tno_of_sockets=`cat \\\n-\t\t/sys/devices/system/cpu/cpu*/topology/physical_package_id \\\n-\t\t| sort -u | wc -l`\n-\t[ $no_of_sockets -gt 1 ] ; echo $?\n-}\n-\n-is_multi_core() {\n-\tsiblings=`grep siblings /proc/cpuinfo | uniq | cut -f2 -d':'`\n-\tcpu_cores=`grep \"cpu cores\" /proc/cpuinfo | uniq | cut -f2 -d':'`\n-\tif [ $siblings -eq $cpu_cores ]; then\n-\t\t[ $cpu_cores -gt 1 ]; echo $?\n-\telse\n-\t\t: $(( num_of_cpus = siblings / cpu_cores ))\n-\t\t[ $num_of_cpus -gt 1 ]; echo $?\n-\tfi\n-}\n-\n-is_dual_core() {\n-\tsiblings=`grep siblings /proc/cpuinfo | uniq | cut -f2 -d':'`\n-\tcpu_cores=`grep \"cpu cores\" /proc/cpuinfo | uniq \\\n-\t\t\t| cut -f2 -d':'`\n-        if [ $siblings -eq $cpu_cores ]; then\n-                [ $cpu_cores -eq 2 ]; echo $?\n-        else\n-                : $(( num_of_cpus = siblings / cpu_cores ))\n-                [ $num_of_cpus -eq 2 ]; echo $?\n-        fi\n-}\n-\n-get_kernel_version() {\n-\t# Get kernel minor version\n-\texport kernel_version=`uname -r | awk -F. '{print $1\".\"$2\".\"$3}' \\\n-\t\t| cut -f1 -d'-'`\n-}\n-\n-get_valid_input() {\n-\tkernel_version=$1\n-\tcase \"$kernel_version\" in\n-\t'2.6.26' | '2.6.27' | '2.6.28')\n-\t\t\texport valid_input=\"0 1\" ;;\n-\t\t*) export valid_input=\"0 1 2\" ;;\n-\tesac\n-}\n-\n-analyze_result_hyperthreaded() {\n-\tsched_mc=$1\n-    pass_count=$2\n-    sched_smt=$3\n-\tPASS=\"Test PASS\"\n-\tFAIL=\"Test FAIL\"\n-\n-\tRC=0\n-\tcase \"$sched_mc\" in\n-\t0)\n-\t\tcase \"$sched_smt\" in\n-\t\t0)\n-\t\t\tif [ $pass_count -lt 5 ]; then\n-\t\t\t\techo \"${PASS}: cpu consolidation failed for\" \\\n-\t\t\t\t\t\"sched_mc=$sched_mc & sched_smt=$sched_smt\"\n-\t\t\telse\n-\t\t\t\tRC=1\n-\t\t\t\techo \"${FAIL}: cpu consolidation passed for\" \\\n-\t\t\t\t\t\"sched_mc=$sched_mc & sched_smt=$sched_smt\"\n-\t\t\tfi\n-\t\t\t;;\n-\t\t*)\n-\t\t\tif [ $pass_count -lt 5 ]; then\n-\t\t\t\tRC=1\n-\t\t\t\techo \"${FAIL}: cpu consolidation for\" \\\n-\t\t\t\t\t\"sched_mc=$sched_mc & sched_smt=$sched_smt\"\n-\t\t\telse\n-\t\t\t\techo \"${PASS}: cpu consolidation for\" \\\n-\t\t\t\t\t\"sched_mc=$sched_mc & sched_smt=$sched_smt\"\n-\t\t\tfi\n-\t\t\t;;\n-\t\tesac ;;\n-\t*)\n-\t\tif [ $pass_count -lt 5 ]; then\n-\t\t\tRC=1\n-\t\t\techo \"${FAIL}: cpu consolidation for\" \\\n-\t\t\t\t\"sched_mc=$sched_mc & sched_smt=$sched_smt\"\n-\t\telse\n-\t\t\techo \"${PASS}: cpu consolidation for\" \\\n-\t\t\t\t\"sched_mc=$sched_mc & sched_smt=$sched_smt\"\n-\t\tfi\n-\t\t;;\n-\tesac\n-\treturn $RC\n-}\n-\n-analyze_package_consolidation_result() {\n-\tsched_mc=$1\n-    pass_count=$2\n-\n-\tif [ $# -gt 2 ]\n-\tthen\n-\t\tsched_smt=$3\n-\telse\n-\t\tsched_smt=-1\n-\tfi\n-\n-\tPASS=\"Test PASS\"\n-\tFAIL=\"Test FAIL\"\n-\n-\tRC=0\n-\tif [ $hyper_threaded -eq $YES -a $sched_smt -gt -1 ]; then\n-\t\tanalyze_result_hyperthreaded $sched_mc $pass_count $sched_smt\n-\telse\n-\t\tcase \"$sched_mc\" in\n-\t    0)\n-    \t    if [ $pass_count -lt 5 ]; then\n-\t\t\t\techo \"${PASS}: cpu consolidation failed for\" \\\n-\t\t\t\t\t\"sched_mc=$sched_mc\"\n-        \telse\n-\t\t\t\tRC=1\n-\t\t\t\techo \"${FAIL}: cpu consolidation passed for\" \\\n-\t\t\t\t\t\"sched_mc=$sched_mc\"\n-\t\t\tfi\n-\t\t\t;;\n-    \t*)\n-\t\t\tif [ $pass_count -lt 5 ]; then\n-\t\t\t\tRC=1\n-\t\t\t\techo \"${FAIL}: consolidation at package level\" \\\n-\t\t\t\t\t\"failed for sched_mc=$sched_mc\"\n-\t\t\telse\n-\t\t\t\techo \"${PASS}: consolidation at package level\" \\\n-\t\t\t\t\t\"passed for sched_mc=$sched_mc\"\n-\t\t\tfi\n-        \t;;\n-    \tesac\n-\tfi\n-\treturn $RC\n-}\n-\n-analyze_core_consolidation_result() {\n-\tsched_smt=$1\n-\tpass_count=$2\n-\tPASS=\"Test PASS\"\n-\tFAIL=\"Test FAIL\"\n-\n-\tRC=0\n-\tcase \"$sched_smt\" in\n-\t0)\n-\t\tif [ $pass_count -lt 5 ]; then\n-\t\t\techo \"${PASS}: consolidation at core level failed\" \\\n-\t\t\t\t\"when sched_smt=$sched_smt\"\n-\t\telse\n-\t\t\tRC=1\n-\t\t\techo \"${FAIL}: consolidation at core level passed for\" \\\n-\t\t\t\t\"sched_smt=$sched_smt\"\n-\t\tfi ;;\n-\t*)\n-\t\tif [ $pass_count -lt 5 ]; then\n-\t\t\tRC=1\n-\t\t\techo \"${FAIL}: consolidation at core level failed for\" \\\n-\t\t\t\t\"sched_smt=$sched_smt\"\n-\t\telse\n-\t\t\techo \"${PASS}: consolidation at core level passed for\" \\\n-\t\t\t\t\"sched_smt=$sched_smt\"\n-\t\tfi ;;\n-\tesac\n-\treturn $RC\n-}\n-\n-analyze_sched_domain_result(){\n-\tsched_mc=$1\n-\tresult=$2\n-\tsched_smt=$3\n-\tPASS=\"Test PASS\"\n-\tFAIL=\"Test FAIL\"\n-\n-\tRC=0\n-\tif [ $hyper_threaded -eq $YES ]; then\n-\t\tif [ $sched_smt ]; then\n-\t\t\tif [ \"$result\" = 0 ];then\n-\t\t\t\techo \"${PASS}: sched domain test for\" \\\n-\t\t\t\t\t\"sched_mc=$sched_mc & sched_smt=$sched_smt\"\n-\t\t\telse\n-\t\t\t\tRC=1\n-\t\t\t\techo \"${FAIL}: sched domain test for\" \\\n-\t\t\t\t\t\"sched_mc=$sched_mc & sched_smt=$sched_smt\"\n-\t\t\tfi\n-\t\telse\n-\t\t\tif [ \"$result\" = 0 ];then\n-\t\t\t\techo \"${PASS}: sched domain test for\" \\\n-\t\t\t\t\t\"sched_mc=$sched_mc\"\n-\t\t\telse\n-\t\t\t\tRC=1\n-\t\t\t\techo \"${FAIL}: sched domain test for\" \\\n-\t\t\t\t\t\"sched_mc=$sched_mc\"\n-\t\t\tfi\n-\t\tfi\n-\telse\n-\t\tif [ \"$result\" = 0 ];then\n-\t\t\techo \"${PASS}: sched domain test for sched_mc=$sched_mc\"\n-\t\telse\n-\t\t\tRC=1\n-\t\t\techo \"${FAIL}: sched domain test for sched_mc=$sched_mc\"\n-\t\tfi\n-\tfi\n-\treturn $RC\n-}\ndiff --git a/testcases/kernel/power_management/pm_sched_domain.py b/testcases/kernel/power_management/pm_sched_domain.py\ndeleted file mode 100755\nindex dddc481690..0000000000\n--- a/testcases/kernel/power_management/pm_sched_domain.py\n+++ /dev/null\n@@ -1,54 +0,0 @@\n-#!/usr/bin/env python3\n-''' This Python script validates sched domain information in dmesg\n-    with information in sysfs topology\n-'''\n-\n-import os\n-import sys\n-from pm_sched_mc import *\n-from optparse import OptionParser\n-\n-__author__ = \"Poornima Nayak <mpnayak@linux.vnet.ibm.com>\"\n-\n-class Usage(Exception):\n-    def __init__(self, msg):\n-        self.msg = msg\n-\n-def main(argv=None):\n-    if argv is None:\n-        argv = sys.argv\n-\n-    usage = \"-w\"\n-    parser = OptionParser(usage)\n-    parser.add_option(\"-c\", \"--mc_level\", dest=\"mc_level\", default=-1,\n-        help=\"Sched mc power saving value 0/1/2\")\n-    parser.add_option(\"-t\", \"--smt_level\", dest=\"smt_level\", default=-1,\n-        help=\"Sched smt power saving value 0/1/2\")\n-    (options, args) = parser.parse_args()\n-\n-    try:\n-        clear_dmesg()\n-        count_num_cpu()\n-        map_cpuid_pkgid()\n-\n-        if is_hyper_threaded() and int(options.smt_level) >= 0:\n-            set_sched_smt_power(options.smt_level)\n-\n-        if int(options.mc_level) >= 0:\n-            set_sched_mc_power(options.mc_level)\n-        if int(options.smt_level) >= 0 or int(options.mc_level) >= 0:\n-            status = verify_sched_domain_dmesg(options.mc_level, options.smt_level)\n-            reset_schedmc()\n-            if is_hyper_threaded():\n-                reset_schedsmt()\n-                return(status)\n-        else:\n-            print(\"INFO: Invalid arguments given\")\n-            return 1\n-    except Exception as details:\n-        print(\"INFO: sched domain test failed: \", details)\n-        return(1)\n-\n-# Run test based on the command line arguments\n-if __name__ == \"__main__\":\n-    sys.exit(main())\ndiff --git a/testcases/kernel/power_management/runpwtests03.sh b/testcases/kernel/power_management/runpwtests03.sh\nindex ebd0957e64..78e0a1b9a7 100755\n--- a/testcases/kernel/power_management/runpwtests03.sh\n+++ b/testcases/kernel/power_management/runpwtests03.sh\n@@ -24,6 +24,16 @@ export TST_TOTAL=4\n . test.sh\n . pm_include.sh\n \n+get_supporting_freq() {\n+\tcat /sys/devices/system/cpu/cpu*/cpufreq/scaling_available_frequencies \\\n+\t\t| uniq\n+}\n+\n+get_supporting_govr() {\n+\tcat /sys/devices/system/cpu/cpu*/cpufreq/scaling_available_governors \\\n+\t\t| uniq\n+}\n+\n check_cpufreq_sysfs_files() {\n \ttotal_cpus=`expr $(tst_ncpus) - 1`\n \tRC=0\ndiff --git a/testcases/kernel/power_management/runpwtests06.sh b/testcases/kernel/power_management/runpwtests06.sh\nindex 16e50a670b..1638aaaf82 100755\n--- a/testcases/kernel/power_management/runpwtests06.sh\n+++ b/testcases/kernel/power_management/runpwtests06.sh\n@@ -24,6 +24,37 @@ export TST_TOTAL=1\n . test.sh\n . pm_include.sh\n \n+check_input() {\n+\tvalidity_check=${2:-valid}\n+\ttestfile=$3\n+\tif [ \"${validity_check}\" = \"invalid\" ] ; then\n+\t\tPASS=\"Testcase FAIL - Able to execute\"\n+\t\tFAIL=\"Testcase PASS - Unable to execute\"\n+\telse\n+\t\tPASS=\"Testcase PASS\"\n+\t\tFAIL=\"Testcase FAIL\"\n+\tfi\n+\tRC=0\n+\tfor input in ${1}\n+\tdo\n+\t\techo ${input} > ${test_file} 2>/dev/null\n+\t\treturn_value=$?\n+\t\toutput=$(cat ${test_file})\n+\t\tif [ \"${return_value}\" = \"0\" -a \"${input}\" = \"${output}\" ] ; then\n+\t\t\techo \"${0}: ${PASS}: echo ${input} > ${test_file}\"\n+\t\t\tif [ \"${validity_check}\" = \"invalid\" ] ; then\n+\t\t\t\tRC=1\n+\t\t\tfi\n+\t\telse\n+\t\t\techo \"${0}: ${FAIL}: echo ${input} > ${test_file}\"\n+\t\t\tif [ \"${validity_check}\" = \"valid\" ] ; then\n+\t\t\t\tRC=1\n+\t\t\tfi\n+\t\tfi\n+\tdone\n+\treturn $RC\n+}\n+\n test_timer_migration() {\n \tvalid_input=\"0 1\"\n \tinvalid_input=\"3 4 5 6 7 8 a abcefg x1999 xffff -1 -00000\n",
    "prefixes": [
        "v2",
        "2/2"
    ]
}