get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 127285,
    "url": "http://patchwork.dpdk.org/api/patches/127285/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dts/patch/20230524085727.123156-2-tadhg.kearney@intel.com/",
    "project": {
        "id": 3,
        "url": "http://patchwork.dpdk.org/api/projects/3/?format=api",
        "name": "DTS",
        "link_name": "dts",
        "list_id": "dts.dpdk.org",
        "list_email": "dts@dpdk.org",
        "web_url": "",
        "scm_url": "git://dpdk.org/tools/dts",
        "webscm_url": "http://git.dpdk.org/tools/dts/",
        "list_archive_url": "https://inbox.dpdk.org/dts",
        "list_archive_url_format": "https://inbox.dpdk.org/dts/{}",
        "commit_url_format": ""
    },
    "msgid": "<20230524085727.123156-2-tadhg.kearney@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dts/20230524085727.123156-2-tadhg.kearney@intel.com",
    "date": "2023-05-24T08:57:26",
    "name": "[v2,1/2] tests/power_intel_uncore: add new power_intel_uncore test suite",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "7f314dcc066ca4f206e1ece7c57f6bcb157a471e",
    "submitter": {
        "id": 2533,
        "url": "http://patchwork.dpdk.org/api/people/2533/?format=api",
        "name": "Tadhg Kearney",
        "email": "tadhg.kearney@intel.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.dpdk.org/project/dts/patch/20230524085727.123156-2-tadhg.kearney@intel.com/mbox/",
    "series": [
        {
            "id": 28149,
            "url": "http://patchwork.dpdk.org/api/series/28149/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dts/list/?series=28149",
            "date": "2023-05-24T08:57:25",
            "name": "add new power_intel_uncore testsuite",
            "version": 2,
            "mbox": "http://patchwork.dpdk.org/series/28149/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/127285/comments/",
    "check": "pending",
    "checks": "http://patchwork.dpdk.org/api/patches/127285/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dts-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 690F842B8A;\n\tWed, 24 May 2023 11:00:50 +0200 (CEST)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 66D72410F9;\n\tWed, 24 May 2023 11:00:50 +0200 (CEST)",
            "from mga05.intel.com (mga05.intel.com [192.55.52.43])\n by mails.dpdk.org (Postfix) with ESMTP id B623E4067E\n for <dts@dpdk.org>; Wed, 24 May 2023 11:00:48 +0200 (CEST)",
            "from orsmga005.jf.intel.com ([10.7.209.41])\n by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 24 May 2023 01:57:36 -0700",
            "from silpixa00401183.ir.intel.com ([10.55.129.127])\n by orsmga005.jf.intel.com with ESMTP; 24 May 2023 01:57:34 -0700"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1684918849; x=1716454849;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=u+A5llXLWhxU3/tU/KmKYWLc7RwB4jM9WnEqlBuLjd8=;\n b=W9V5c3vM+Yb8F+3NevU6dFKcmLcT8BocGWFjbHAC5JfalLGxXyse8X57\n CWT39yb9W7TMeh6YeNZJ7d1KM4qfr+7VBivP98NuSWx8yvAXr+bAsEyYt\n eRPseRkqC2HNr2VeH4Rwb4hI0k2gK2K/y+xt4YqkZUtrclmcu5rp3M8lc\n PNK024LuKo2hLKM1Y9BzK0BwRPFQLy6XHwZOqT6YYJKTfR8rGpU6yz5j6\n FGZ3QovnbvKYZ4s9zRPSS3e1DFZvEgf+mUmVGpgQA+9z4z9xXz1zQRNh8\n kdNmZOBcDswLlrN4Vab9GXD/SdU5GKbBYZWhuaUrSe/dVK0tLfOZnK9Fp A==;",
        "X-IronPort-AV": [
            "E=McAfee;i=\"6600,9927,10719\"; a=\"439858708\"",
            "E=Sophos;i=\"6.00,188,1681196400\"; d=\"scan'208\";a=\"439858708\"",
            "E=McAfee;i=\"6600,9927,10719\"; a=\"878570986\"",
            "E=Sophos;i=\"6.00,188,1681196400\"; d=\"scan'208\";a=\"878570986\""
        ],
        "X-ExtLoop1": "1",
        "From": "Tadhg Kearney <tadhg.kearney@intel.com>",
        "To": "dts@dpdk.org",
        "Cc": "reshma.pattan@intel.com, karen.kelly@intel.com,\n Tadhg Kearney <tadhg.kearney@intel.com>",
        "Subject": "[dts][PATCH v2 1/2] tests/power_intel_uncore: add new\n power_intel_uncore test suite",
        "Date": "Wed, 24 May 2023 08:57:26 +0000",
        "Message-Id": "<20230524085727.123156-2-tadhg.kearney@intel.com>",
        "X-Mailer": "git-send-email 2.34.1",
        "In-Reply-To": "<20230524085727.123156-1-tadhg.kearney@intel.com>",
        "References": "<20230524085727.123156-1-tadhg.kearney@intel.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "X-BeenThere": "dts@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "test suite reviews and discussions <dts.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dts>,\n <mailto:dts-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dts/>",
        "List-Post": "<mailto:dts@dpdk.org>",
        "List-Help": "<mailto:dts-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dts>,\n <mailto:dts-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dts-bounces@dpdk.org"
    },
    "content": "Automated tests added to test intel uncore API enabled through\nl3fwd-power.\n\nSigned-off-by: Tadhg Kearney <tadhg.kearney@intel.com>\n---\n tests/TestSuite_power_intel_uncore.py | 294 ++++++++++++++++++++++++++\n 1 file changed, 294 insertions(+)\n create mode 100644 tests/TestSuite_power_intel_uncore.py",
    "diff": "diff --git a/tests/TestSuite_power_intel_uncore.py b/tests/TestSuite_power_intel_uncore.py\nnew file mode 100644\nindex 00000000..f0d7f078\n--- /dev/null\n+++ b/tests/TestSuite_power_intel_uncore.py\n@@ -0,0 +1,294 @@\n+# SPDX-License-Identifier: BSD-3-Clause\n+# Copyright(c) 2023 Intel Corporation\n+#\n+\n+\"\"\"\n+DPDK Test suite.\n+Power Intel Uncore test suite.\n+\"\"\"\n+\n+import os\n+import traceback\n+\n+from framework.exception import VerifyFailure\n+from framework.test_case import TestCase\n+\n+BASE_CLOCK = 100000\n+\n+\n+class TestPowerIntelUncore(TestCase):\n+    @property\n+    def target_dir(self):\n+        # get absolute directory of target source code\n+        target_dir = (\n+            \"/root\" + self.dut.base_dir[1:]\n+            if self.dut.base_dir.startswith(\"~\")\n+            else self.dut.base_dir\n+        )\n+        return target_dir\n+\n+    def prepare_binary(self, name):\n+        example_dir = \"examples/\" + name\n+        self.dut.build_dpdk_apps(\"./\" + example_dir)\n+        return os.path.join(self.target_dir, self.dut.apps_name[os.path.basename(name)])\n+\n+    def init_l3fwd_power(self):\n+        self.l3fwd_power = self.prepare_binary(\"l3fwd-power\")\n+\n+    def start_l3fwd_power(self, option):\n+        l3fwd_cmd = f'-c 0x6 -n 1 -- -p 0x1 -P --config=\"(0,0,2)\" {option}'\n+        prompt = \"L3FWD_POWER: lcore 1 has nothing to do\"\n+        # timeout of 120 seconds as it takes that long for l3fwd-power to output its final command\n+        self.l3fwd_session.send_expect(\n+            \" \".join([self.l3fwd_power, l3fwd_cmd]), prompt, 120\n+        )\n+        self.is_l3fwd_on = True\n+\n+    def close_l3fwd_power(self):\n+        if not self.is_l3fwd_on:\n+            return\n+        cmd = \"^C\"\n+        self.l3fwd_session.send_expect(cmd, \"#\")\n+\n+    def preset_test_environment(self):\n+        self.is_l3fwd_on = None\n+        self.init_l3fwd_power()\n+        # initialise seperate session for l3fwd, so that while l3fwd-power is ran rdmsr can check values\n+        self.l3fwd_session = self.dut.new_session(\"l3fwd\")\n+\n+    def validate_power_uncore_values_equal(self, target_value, current_value):\n+        if target_value != current_value:\n+            msg = \"l3fwd-power failed to set the correct value for uncore\"\n+            raise VerifyFailure(msg)\n+\n+    def get_current_uncore_max(self):\n+        current_uncore_max_cmd = \"rdmsr 0x620 -f 8:0 -d\"\n+        current_uncore_max = int(self.dut.send_expect(current_uncore_max_cmd, \"#\"))\n+        return current_uncore_max * BASE_CLOCK\n+\n+    def get_current_uncore_min(self):\n+        current_uncore_min_cmd = \"rdmsr 0x620 -f 16:8 -d\"\n+        current_uncore_min = int(self.dut.send_expect(current_uncore_min_cmd, \"#\"))\n+        return current_uncore_min * BASE_CLOCK\n+\n+    #\n+    # Test cases.\n+    #\n+    def set_up_all(self):\n+        \"\"\"\n+        Run at the start of each test suite.\n+        \"\"\"\n+        # prerequisites\n+        cpu_attr = r\"/sys/devices/system/cpu/intel_uncore_frequency\"\n+        cmd = \"ls {0}\".format(cpu_attr)\n+        self.dut.send_expect(cmd, \"#\")\n+        self.dut.send_expect(\"modprobe msr\", \"#\")\n+        self.dut.send_expect(\"modprobe intel-uncore-frequency\", \"#\")\n+\n+        # build the 'dpdk-l3fwd-power' tool\n+        out = self.dut.build_dpdk_apps(\"examples/l3fwd-power\")\n+        self.verify(\"Error\" not in out, ' \"dpdk-l3fwd-power\" build error')\n+        self.l3fwd_path = self.dut.apps_name[\"l3fwd-power\"]\n+        self.logger.debug(\"l3fwd-power tool path: {}\".format(self.l3fwd_path))\n+        self.l3fwd_is_on = False\n+        self.l3fwd_session = self.dut.new_session(\"l3fwd\")\n+\n+        # prepare testing environment\n+        self.preset_test_environment()\n+\n+    def validate_power_uncore_freq_max(self):\n+        \"\"\"\n+        Check that setting max uncore frequency, sets to correct value without errors\n+        \"\"\"\n+        # Make sure that current uncore max is not equal to max possible uncore freq\n+        current_uncore_max = self.get_current_uncore_max()\n+        # can just check pkg 0 die 0 as it will be the same for each pkg\n+        initial_uncore_max_cmd = \"cat /sys/devices/system/cpu/intel_uncore_frequency/package_00_die_00/initial_max_freq_khz\"\n+        initial_uncore_max = int(self.dut.send_expect(initial_uncore_max_cmd, \"#\"))\n+\n+        if current_uncore_max == initial_uncore_max:\n+            # reducing freq by BASE_CLOCK is easiest and safest freq value to set\n+            lower_uncore_max = current_uncore_max - BASE_CLOCK\n+            intel_uncore_dir_cmd = (\n+                'os.listdir(\"/sys/devices/system/cpu/intel_uncore_frequency\")'\n+            )\n+            intel_uncore_dir = self.dut.send_expect(intel_uncore_dir_cmd, \"#\")\n+            for uncore_die_sysfs_file in intel_uncore_dir:\n+                # check if current path is a file\n+                if os.path.isfile(\n+                    os.path.join(intel_uncore_dir, uncore_die_sysfs_file)\n+                ):\n+                    set_freq_cmd = f\"echo {lower_uncore_max} > /sys/devices/system/cpu/intel_uncore_frequency/{uncore_die_sysfs_file}/max_freq_khz\"\n+                    self.dut.send_expect(set_freq_cmd, \"#\")\n+\n+        except_content = None\n+        try:\n+            self.start_l3fwd_power(\"-U\")\n+            current_uncore_max = self.get_current_uncore_max()\n+            self.validate_power_uncore_values_equal(\n+                initial_uncore_max, current_uncore_max\n+            )\n+            current_uncore_min = self.get_current_uncore_min()\n+            self.validate_power_uncore_values_equal(\n+                initial_uncore_max, current_uncore_min\n+            )\n+        except Exception as e:\n+            self.logger.error(traceback.format_exc())\n+            except_content = e\n+        finally:\n+            self.close_l3fwd_power()\n+\n+        # check verify result\n+        if except_content:\n+            raise VerifyFailure(except_content)\n+        else:\n+            msg = \"test validate_power_uncore_freq_max successful !!!\"\n+            self.logger.info(msg)\n+\n+    def validate_power_uncore_freq_min(self):\n+        \"\"\"\n+        Check that setting min uncore frequency, sets to correct value without errors\n+        \"\"\"\n+        # Make sure that current uncore min is not equal to min possible uncore freq\n+        current_uncore_min = self.get_current_uncore_min()\n+        # can just check pkg 0 die 0 as it will be the same for each pkg\n+        initial_uncore_min_cmd = \"cat /sys/devices/system/cpu/intel_uncore_frequency/package_00_die_00/initial_min_freq_khz\"\n+        initial_uncore_min = int(self.dut.send_expect(initial_uncore_min_cmd, \"#\"))\n+\n+        if current_uncore_min == initial_uncore_min:\n+            # reducing freq by BASE_CLOCK is easiest and safest freq value to set\n+            higher_uncore_min = current_uncore_min + BASE_CLOCK\n+            intel_uncore_dir_cmd = (\n+                'os.listdir(\"/sys/devices/system/cpu/intel_uncore_frequency\")'\n+            )\n+            intel_uncore_dir = self.dut.send_expect(intel_uncore_dir_cmd, \"#\")\n+            for uncore_die_sysfs_file in intel_uncore_dir:\n+                # check if current path is a file\n+                if os.path.isfile(\n+                    os.path.join(intel_uncore_dir, uncore_die_sysfs_file)\n+                ):\n+                    set_freq_cmd = f\"echo {higher_uncore_min} > /sys/devices/system/cpu/intel_uncore_frequency/{uncore_die_sysfs_file}/min_freq_khz\"\n+                    self.dut.send_expect(set_freq_cmd, \"#\")\n+\n+        except_content = None\n+        try:\n+            self.start_l3fwd_power(\"-u\")\n+            current_uncore_min = self.get_current_uncore_min()\n+            self.validate_power_uncore_values_equal(\n+                initial_uncore_min, current_uncore_min\n+            )\n+            current_uncore_max = self.get_current_uncore_max()\n+            self.validate_power_uncore_values_equal(\n+                initial_uncore_min, current_uncore_max\n+            )\n+        except Exception as e:\n+            self.logger.error(traceback.format_exc())\n+            except_content = e\n+        finally:\n+            self.close_l3fwd_power()\n+\n+        # check verify result\n+        if except_content:\n+            raise VerifyFailure(except_content)\n+        else:\n+            msg = \"test validate_power_uncore_freq_min successful !!!\"\n+            self.logger.info(msg)\n+\n+    def validate_power_uncore_freq_idx(self):\n+        \"\"\"\n+        Check that setting idx uncore frequency, sets to correct value without errors\n+        \"\"\"\n+        # Make sure that current uncore idx is not equal to idx possible uncore freq\n+        current_uncore_max = self.get_current_uncore_max()\n+        # can just check pkg 0 die 0 as it will be the same for each pkg\n+        initial_uncore_idx_cmd = \"cat /sys/devices/system/cpu/intel_uncore_frequency/package_00_die_00/initial_max_freq_khz\"\n+        # 200000 is taken from initial_uncore_idx as the index selected is 2 steps below max\n+        target_uncore_idx = (\n+            int(self.dut.send_expect(initial_uncore_idx_cmd, \"#\")) - 200000\n+        )\n+\n+        if current_uncore_max == target_uncore_idx:\n+            # increasing freq by BASE_CLOCK is easiest and safest freq value to set\n+            higher_uncore_idx = current_uncore_max + BASE_CLOCK\n+            intel_uncore_dir_cmd = (\n+                'os.listdir(\"/sys/devices/system/cpu/intel_uncore_frequency\")'\n+            )\n+            intel_uncore_dir = self.dut.send_expect(intel_uncore_dir_cmd, \"#\")\n+            for uncore_die_sysfs_file in intel_uncore_dir:\n+                # check if current path is a file\n+                if os.path.isfile(\n+                    os.path.join(intel_uncore_dir, uncore_die_sysfs_file)\n+                ):\n+                    set_freq_cmd = f\"echo {higher_uncore_idx} > /sys/devices/system/cpu/intel_uncore_frequency/{uncore_die_sysfs_file}/max_freq_khz\"\n+                    self.dut.send_expect(set_freq_cmd, \"#\")\n+\n+        except_content = None\n+        try:\n+            self.start_l3fwd_power(\"-i 2\")\n+            current_uncore_max = self.get_current_uncore_max()\n+            self.validate_power_uncore_values_equal(\n+                target_uncore_idx, current_uncore_max\n+            )\n+            current_uncore_min = self.get_current_uncore_min()\n+            self.validate_power_uncore_values_equal(\n+                target_uncore_idx, current_uncore_min\n+            )\n+        except Exception as e:\n+            self.logger.error(traceback.format_exc())\n+            except_content = e\n+        finally:\n+            self.close_l3fwd_power()\n+\n+        # check verify result\n+        if except_content:\n+            raise VerifyFailure(except_content)\n+        else:\n+            msg = \"test validate_power_uncore_freq_idx successful !!!\"\n+            self.logger.info(msg)\n+\n+    def validate_power_uncore_exit(self):\n+        except_content = None\n+        try:\n+            # any command works, output doesn't matter\n+            self.start_l3fwd_power(\"-U\")\n+            if not self.is_l3fwd_on:\n+                return\n+            # final line when exiting l3fwd-power with this setup and there are no issues\n+            prompt = \"mode and been set back to the original\"\n+            self.l3fwd_session.send_expect(\"^C\", prompt)\n+        except Exception as e:\n+            self.logger.error(traceback.format_exc())\n+            except_content = e\n+        finally:\n+            self.close_l3fwd_power()\n+\n+        # check verify result\n+        if except_content:\n+            raise VerifyFailure(except_content)\n+        else:\n+            msg = \"test validate_power_uncore_exit successful !!!\"\n+            self.logger.info(msg)\n+\n+    def tear_down_all(self):\n+        \"\"\"Run after each test suite.\"\"\"\n+        pass\n+\n+    def set_up(self):\n+        \"\"\"Run before each test case.\"\"\"\n+        pass\n+\n+    def tear_down(self):\n+        \"\"\"Run after each test case.\"\"\"\n+        self.dut.kill_all()\n+\n+    def test_validate_power_uncore_freq_max(self):\n+        self.validate_power_uncore_freq_max()\n+\n+    def test_validate_power_uncore_freq_min(self):\n+        self.validate_power_uncore_freq_min()\n+\n+    def test_validate_power_uncore_freq_idx(self):\n+        self.validate_power_uncore_freq_idx()\n+\n+    def test_validate_power_uncore_exit(self):\n+        self.validate_power_uncore_exit()\n",
    "prefixes": [
        "v2",
        "1/2"
    ]
}