get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 57031,
    "url": "http://patchwork.dpdk.org/api/patches/57031/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20190724131803.30066-1-david.hunt@intel.com/",
    "project": {
        "id": 1,
        "url": "http://patchwork.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<20190724131803.30066-1-david.hunt@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20190724131803.30066-1-david.hunt@intel.com",
    "date": "2019-07-24T13:18:03",
    "name": "[v1] examples/power: fix oob frequency oscillations",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "ce1c99cc9cb24009ab10cd71f3c9af3ba3331f3f",
    "submitter": {
        "id": 342,
        "url": "http://patchwork.dpdk.org/api/people/342/?format=api",
        "name": "Hunt, David",
        "email": "david.hunt@intel.com"
    },
    "delegate": {
        "id": 1,
        "url": "http://patchwork.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/20190724131803.30066-1-david.hunt@intel.com/mbox/",
    "series": [
        {
            "id": 5708,
            "url": "http://patchwork.dpdk.org/api/series/5708/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=5708",
            "date": "2019-07-24T13:18:03",
            "name": "[v1] examples/power: fix oob frequency oscillations",
            "version": 1,
            "mbox": "http://patchwork.dpdk.org/series/5708/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/57031/comments/",
    "check": "success",
    "checks": "http://patchwork.dpdk.org/api/patches/57031/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 01E491C1FB;\n\tWed, 24 Jul 2019 15:18:10 +0200 (CEST)",
            "from mga05.intel.com (mga05.intel.com [192.55.52.43])\n\tby dpdk.org (Postfix) with ESMTP id 0AC821C1F3;\n\tWed, 24 Jul 2019 15:18:07 +0200 (CEST)",
            "from fmsmga007.fm.intel.com ([10.253.24.52])\n\tby fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t24 Jul 2019 06:18:07 -0700",
            "from silpixa00399952.ir.intel.com (HELO\n\tsilpixa00399952.ger.corp.intel.com) ([10.237.222.88])\n\tby fmsmga007.fm.intel.com with ESMTP; 24 Jul 2019 06:18:05 -0700"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.64,303,1559545200\"; d=\"scan'208\";a=\"171500943\"",
        "From": "David Hunt <david.hunt@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "david.hunt@intel.com,\n\tstable@dpdk.org",
        "Date": "Wed, 24 Jul 2019 14:18:03 +0100",
        "Message-Id": "<20190724131803.30066-1-david.hunt@intel.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "Subject": "[dpdk-dev] [PATCH v1] examples/power: fix oob frequency oscillations",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "The branch ratio algorithm in the vm_power_manager sample application\ncan be very sensitive at patricular loads in a workload, causing\noscillations between min and max frequency. For example, if a\nworkload is at 50%, scaling up may change the ratio\nenough that it immediately thinks it needs to scale down again.\n\nThis patch introduces a sliding window recording the scale up/down\ndirection for the last 32 samples, and scales up if any samples indicate\nwe should scale up, otherwise scale down. Each core has it's own window.\n\nFixes: 4b1a631b8a8a (\"examples/vm_power: add oob monitoring functions\")\nCc: stable@dpdk.org\nSigned-off-by: David Hunt <david.hunt@intel.com>\n---\n examples/vm_power_manager/oob_monitor_x86.c | 34 +++++++++++++++++++--\n examples/vm_power_manager/power_manager.c   |  3 +-\n examples/vm_power_manager/power_manager.h   | 12 ++++++++\n 3 files changed, 44 insertions(+), 5 deletions(-)",
    "diff": "diff --git a/examples/vm_power_manager/oob_monitor_x86.c b/examples/vm_power_manager/oob_monitor_x86.c\nindex ebd96b205..aecfcb2eb 100644\n--- a/examples/vm_power_manager/oob_monitor_x86.c\n+++ b/examples/vm_power_manager/oob_monitor_x86.c\n@@ -39,6 +39,7 @@ apply_policy(int core)\n \tint64_t hits_diff, miss_diff;\n \tfloat ratio;\n \tint ret;\n+\tint freq_window_idx, up_count = 0, i;\n \n \tg_active = 0;\n \tci = get_core_info();\n@@ -101,10 +102,37 @@ apply_policy(int core)\n \n \tratio = (float)miss_diff * (float)100 / (float)hits_diff;\n \n-\tif (ratio < ci->branch_ratio_threshold)\n-\t\tpower_manager_scale_core_min(core);\n+\t/*\n+\t * Store the last few directions that the ratio indicates\n+\t * we should take. If there's on 'up', then we scale up\n+\t * quickly. If all indicate 'down', only then do we scale\n+\t * down. Each core_details struct has it's own array.\n+\t */\n+\tfreq_window_idx = ci->cd[core].freq_window_idx;\n+\tif (ratio > ci->branch_ratio_threshold)\n+\t\tci->cd[core].freq_directions[freq_window_idx] = 1;\n \telse\n-\t\tpower_manager_scale_core_max(core);\n+\t\tci->cd[core].freq_directions[freq_window_idx] = 0;\n+\n+\tfreq_window_idx++;\n+\tfreq_window_idx = freq_window_idx & (FREQ_WINDOW_SIZE-1);\n+\tci->cd[core].freq_window_idx = freq_window_idx;\n+\n+\tup_count = 0;\n+\tfor (i = 0; i < FREQ_WINDOW_SIZE; i++)\n+\t\tup_count +=  ci->cd[core].freq_directions[i];\n+\n+\tif (up_count == 0) {\n+\t\tif (ci->cd[core].freq_state != FREQ_MIN) {\n+\t\t\tpower_manager_scale_core_min(core);\n+\t\t\tci->cd[core].freq_state = FREQ_MIN;\n+\t\t}\n+\t} else {\n+\t\tif (ci->cd[core].freq_state != FREQ_MAX) {\n+\t\t\tpower_manager_scale_core_max(core);\n+\t\t\tci->cd[core].freq_state = FREQ_MAX;\n+\t\t}\n+\t}\n \n \tg_active = 1;\n \treturn ratio;\ndiff --git a/examples/vm_power_manager/power_manager.c b/examples/vm_power_manager/power_manager.c\nindex 9d4e587b0..7b4f4b3c4 100644\n--- a/examples/vm_power_manager/power_manager.c\n+++ b/examples/vm_power_manager/power_manager.c\n@@ -62,14 +62,13 @@ core_info_init(void)\n \tci->core_count = get_nprocs_conf();\n \tci->branch_ratio_threshold = BRANCH_RATIO_THRESHOLD;\n \tci->cd = malloc(ci->core_count * sizeof(struct core_details));\n+\tmemset(ci->cd, 0, ci->core_count * sizeof(struct core_details));\n \tif (!ci->cd) {\n \t\tRTE_LOG(ERR, POWER_MANAGER, \"Failed to allocate memory for core info.\");\n \t\treturn -1;\n \t}\n \tfor (i = 0; i < ci->core_count; i++) {\n \t\tci->cd[i].global_enabled_cpus = 1;\n-\t\tci->cd[i].oob_enabled = 0;\n-\t\tci->cd[i].msr_fd = 0;\n \t}\n \tprintf(\"%d cores in system\\n\", ci->core_count);\n \treturn 0;\ndiff --git a/examples/vm_power_manager/power_manager.h b/examples/vm_power_manager/power_manager.h\nindex e81a60ae5..e324766b6 100644\n--- a/examples/vm_power_manager/power_manager.h\n+++ b/examples/vm_power_manager/power_manager.h\n@@ -8,12 +8,24 @@\n #ifdef __cplusplus\n extern \"C\" {\n #endif\n+\n+#define FREQ_WINDOW_SIZE 32\n+\n+enum {\n+\tFREQ_UNKNOWN,\n+\tFREQ_MIN,\n+\tFREQ_MAX\n+};\n+\n struct core_details {\n \tuint64_t last_branches;\n \tuint64_t last_branch_misses;\n \tuint16_t global_enabled_cpus;\n \tuint16_t oob_enabled;\n \tint msr_fd;\n+\tuint16_t freq_directions[FREQ_WINDOW_SIZE];\n+\tuint16_t freq_window_idx;\n+\tuint16_t freq_state;\n };\n \n struct core_info {\n",
    "prefixes": [
        "v1"
    ]
}