get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 815202,
    "url": "http://patchwork.ozlabs.org/api/patches/815202/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/20170918230553.1624357-5-yhs@fb.com/",
    "project": {
        "id": 7,
        "url": "http://patchwork.ozlabs.org/api/projects/7/?format=api",
        "name": "Linux network development",
        "link_name": "netdev",
        "list_id": "netdev.vger.kernel.org",
        "list_email": "netdev@vger.kernel.org",
        "web_url": null,
        "scm_url": null,
        "webscm_url": null,
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20170918230553.1624357-5-yhs@fb.com>",
    "list_archive_url": null,
    "date": "2017-09-18T23:05:53",
    "name": "[net-next,v3,4/4] bpf: add a test case for helper bpf_perf_prog_read_value",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "c8d0faf96b0ae7cce9a31220ef3e3f97bff518ad",
    "submitter": {
        "id": 71628,
        "url": "http://patchwork.ozlabs.org/api/people/71628/?format=api",
        "name": "Yonghong Song",
        "email": "yhs@fb.com"
    },
    "delegate": {
        "id": 34,
        "url": "http://patchwork.ozlabs.org/api/users/34/?format=api",
        "username": "davem",
        "first_name": "David",
        "last_name": "Miller",
        "email": "davem@davemloft.net"
    },
    "mbox": "http://patchwork.ozlabs.org/project/netdev/patch/20170918230553.1624357-5-yhs@fb.com/mbox/",
    "series": [
        {
            "id": 3748,
            "url": "http://patchwork.ozlabs.org/api/series/3748/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/netdev/list/?series=3748",
            "date": "2017-09-18T23:05:50",
            "name": "bpf: add two helpers to read perf event enabled/running time",
            "version": 3,
            "mbox": "http://patchwork.ozlabs.org/series/3748/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/815202/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/815202/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<netdev-owner@vger.kernel.org>",
        "X-Original-To": "patchwork-incoming@ozlabs.org",
        "Delivered-To": "patchwork-incoming@ozlabs.org",
        "Authentication-Results": [
            "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)",
            "ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=fb.com header.i=@fb.com header.b=\"RxnI73gC\";\n\tdkim-atps=neutral"
        ],
        "Received": [
            "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xx1p917M3z9s2G\n\tfor <patchwork-incoming@ozlabs.org>;\n\tTue, 19 Sep 2017 09:06:09 +1000 (AEST)",
            "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751463AbdIRXGH (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tMon, 18 Sep 2017 19:06:07 -0400",
            "from mx0b-00082601.pphosted.com ([67.231.153.30]:37435 \"EHLO\n\tmx0b-00082601.pphosted.com\" rhost-flags-OK-OK-OK-OK)\n\tby vger.kernel.org with ESMTP id S1751301AbdIRXFz (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Mon, 18 Sep 2017 19:05:55 -0400",
            "from pps.filterd (m0109332.ppops.net [127.0.0.1])\n\tby mx0a-00082601.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id\n\tv8IN3fXc031772\n\tfor <netdev@vger.kernel.org>; Mon, 18 Sep 2017 16:05:55 -0700",
            "from mail.thefacebook.com ([199.201.64.23])\n\tby mx0a-00082601.pphosted.com with ESMTP id 2d2jfw1m8g-4\n\t(version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT)\n\tfor <netdev@vger.kernel.org>; Mon, 18 Sep 2017 16:05:55 -0700",
            "from mx-out.facebook.com (192.168.52.123) by\n\tPRN-CHUB10.TheFacebook.com (192.168.16.20) with Microsoft SMTP Server\n\tid 14.3.319.2; Mon, 18 Sep 2017 16:05:53 -0700",
            "by devbig474.prn1.facebook.com (Postfix, from userid 128203)  id\n\t8225746E047A; Mon, 18 Sep 2017 16:05:53 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com;\n\th=from : to : cc : subject\n\t: date : message-id : in-reply-to : references : mime-version :\n\tcontent-type; s=facebook;\n\tbh=6QvSmhOnwGRBQrwjrt8nw6CmyzDh9nWl/sGUwwJgJCg=; \n\tb=RxnI73gCX/3PHX1bBBsLLXj/Qu2AzzW1FnGNdSn9H2GNRGDbV6wSvTu1DTnW2DKOADe3\n\t1Y9LbHow1YxkWrWhwvUbOtQLOoceusGfTnTD5JTePfCJ9CGGd4rcnwSxKr4kLsoD2SmP\n\tAoslSRAtIjiIV3Xws1hwXTZycAtdYQjfVjw= ",
        "Smtp-Origin-Hostprefix": "devbig",
        "From": "Yonghong Song <yhs@fb.com>",
        "Smtp-Origin-Hostname": "devbig474.prn1.facebook.com",
        "To": "<peterz@infradead.org>, <rostedt@goodmis.org>, <ast@fb.com>,\n\t<daniel@iogearbox.net>, <netdev@vger.kernel.org>",
        "CC": "<kernel-team@fb.com>",
        "Smtp-Origin-Cluster": "prn1c29",
        "Subject": "[PATCH net-next v3 4/4] bpf: add a test case for helper\n\tbpf_perf_prog_read_value",
        "Date": "Mon, 18 Sep 2017 16:05:53 -0700",
        "Message-ID": "<20170918230553.1624357-5-yhs@fb.com>",
        "X-Mailer": "git-send-email 2.9.5",
        "In-Reply-To": "<20170918230553.1624357-1-yhs@fb.com>",
        "References": "<20170918230553.1624357-1-yhs@fb.com>",
        "X-FB-Internal": [
            "Safe",
            "Safe"
        ],
        "MIME-Version": "1.0",
        "Content-Type": "text/plain",
        "X-Proofpoint-Spam-Reason": "safe",
        "X-Proofpoint-Virus-Version": "vendor=fsecure engine=2.50.10432:, ,\n\tdefinitions=2017-09-18_11:, , signatures=0",
        "Sender": "netdev-owner@vger.kernel.org",
        "Precedence": "bulk",
        "List-ID": "<netdev.vger.kernel.org>",
        "X-Mailing-List": "netdev@vger.kernel.org"
    },
    "content": "The bpf sample program trace_event is enhanced to use the new\nhelper to print out enabled/running time.\n\nSigned-off-by: Yonghong Song <yhs@fb.com>\n---\n samples/bpf/trace_event_kern.c            | 10 ++++++++++\n samples/bpf/trace_event_user.c            | 13 ++++++++-----\n tools/include/uapi/linux/bpf.h            |  3 ++-\n tools/testing/selftests/bpf/bpf_helpers.h |  3 +++\n 4 files changed, 23 insertions(+), 6 deletions(-)",
    "diff": "diff --git a/samples/bpf/trace_event_kern.c b/samples/bpf/trace_event_kern.c\nindex 41b6115..a77a583d 100644\n--- a/samples/bpf/trace_event_kern.c\n+++ b/samples/bpf/trace_event_kern.c\n@@ -37,10 +37,14 @@ struct bpf_map_def SEC(\"maps\") stackmap = {\n SEC(\"perf_event\")\n int bpf_prog1(struct bpf_perf_event_data *ctx)\n {\n+\tchar time_fmt1[] = \"Time Enabled: %llu, Time Running: %llu\";\n+\tchar time_fmt2[] = \"Get Time Failed, ErrCode: %d\";\n \tchar fmt[] = \"CPU-%d period %lld ip %llx\";\n \tu32 cpu = bpf_get_smp_processor_id();\n+\tstruct bpf_perf_event_value value_buf;\n \tstruct key_t key;\n \tu64 *val, one = 1;\n+\tint ret;\n \n \tif (ctx->sample_period < 10000)\n \t\t/* ignore warmup */\n@@ -54,6 +58,12 @@ int bpf_prog1(struct bpf_perf_event_data *ctx)\n \t\treturn 0;\n \t}\n \n+\tret = bpf_perf_prog_read_value(ctx, (void *)&value_buf, sizeof(struct bpf_perf_event_value));\n+\tif (!ret)\n+\t  bpf_trace_printk(time_fmt1, sizeof(time_fmt1), value_buf.enabled, value_buf.running);\n+\telse\n+\t  bpf_trace_printk(time_fmt2, sizeof(time_fmt2), ret);\n+\n \tval = bpf_map_lookup_elem(&counts, &key);\n \tif (val)\n \t\t(*val)++;\ndiff --git a/samples/bpf/trace_event_user.c b/samples/bpf/trace_event_user.c\nindex 7bd827b..bf4f1b6 100644\n--- a/samples/bpf/trace_event_user.c\n+++ b/samples/bpf/trace_event_user.c\n@@ -127,6 +127,9 @@ static void test_perf_event_all_cpu(struct perf_event_attr *attr)\n \tint *pmu_fd = malloc(nr_cpus * sizeof(int));\n \tint i, error = 0;\n \n+\t/* system wide perf event, no need to inherit */\n+\tattr->inherit = 0;\n+\n \t/* open perf_event on all cpus */\n \tfor (i = 0; i < nr_cpus; i++) {\n \t\tpmu_fd[i] = sys_perf_event_open(attr, -1, i, -1, 0);\n@@ -154,6 +157,11 @@ static void test_perf_event_task(struct perf_event_attr *attr)\n {\n \tint pmu_fd;\n \n+\t/* per task perf event, enable inherit so the \"dd ...\" command can be traced properly.\n+\t * Enabling inherit will cause bpf_perf_prog_read_time helper failure.\n+\t */\n+\tattr->inherit = 1;\n+\n \t/* open task bound event */\n \tpmu_fd = sys_perf_event_open(attr, 0, -1, -1, 0);\n \tif (pmu_fd < 0) {\n@@ -175,14 +183,12 @@ static void test_bpf_perf_event(void)\n \t\t.freq = 1,\n \t\t.type = PERF_TYPE_HARDWARE,\n \t\t.config = PERF_COUNT_HW_CPU_CYCLES,\n-\t\t.inherit = 1,\n \t};\n \tstruct perf_event_attr attr_type_sw = {\n \t\t.sample_freq = SAMPLE_FREQ,\n \t\t.freq = 1,\n \t\t.type = PERF_TYPE_SOFTWARE,\n \t\t.config = PERF_COUNT_SW_CPU_CLOCK,\n-\t\t.inherit = 1,\n \t};\n \tstruct perf_event_attr attr_hw_cache_l1d = {\n \t\t.sample_freq = SAMPLE_FREQ,\n@@ -192,7 +198,6 @@ static void test_bpf_perf_event(void)\n \t\t\tPERF_COUNT_HW_CACHE_L1D |\n \t\t\t(PERF_COUNT_HW_CACHE_OP_READ << 8) |\n \t\t\t(PERF_COUNT_HW_CACHE_RESULT_ACCESS << 16),\n-\t\t.inherit = 1,\n \t};\n \tstruct perf_event_attr attr_hw_cache_branch_miss = {\n \t\t.sample_freq = SAMPLE_FREQ,\n@@ -202,7 +207,6 @@ static void test_bpf_perf_event(void)\n \t\t\tPERF_COUNT_HW_CACHE_BPU |\n \t\t\t(PERF_COUNT_HW_CACHE_OP_READ << 8) |\n \t\t\t(PERF_COUNT_HW_CACHE_RESULT_MISS << 16),\n-\t\t.inherit = 1,\n \t};\n \tstruct perf_event_attr attr_type_raw = {\n \t\t.sample_freq = SAMPLE_FREQ,\n@@ -210,7 +214,6 @@ static void test_bpf_perf_event(void)\n \t\t.type = PERF_TYPE_RAW,\n \t\t/* Intel Instruction Retired */\n \t\t.config = 0xc0,\n-\t\t.inherit = 1,\n \t};\n \n \tprintf(\"Test HW_CPU_CYCLES\\n\");\ndiff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h\nindex 79eb529..fa1be2c 100644\n--- a/tools/include/uapi/linux/bpf.h\n+++ b/tools/include/uapi/linux/bpf.h\n@@ -633,7 +633,8 @@ union bpf_attr {\n \tFN(redirect_map),\t\t\\\n \tFN(sk_redirect_map),\t\t\\\n \tFN(sock_map_update),\t\t\\\n-\tFN(perf_event_read_value),\n+\tFN(perf_event_read_value),\t\t\\\n+\tFN(perf_prog_read_value),\n \n /* integer value in 'imm' field of BPF_CALL instruction selects which helper\n  * function eBPF program intends to call\ndiff --git a/tools/testing/selftests/bpf/bpf_helpers.h b/tools/testing/selftests/bpf/bpf_helpers.h\nindex c866682..892d785 100644\n--- a/tools/testing/selftests/bpf/bpf_helpers.h\n+++ b/tools/testing/selftests/bpf/bpf_helpers.h\n@@ -73,6 +73,9 @@ static int (*bpf_sock_map_update)(void *map, void *key, void *value,\n static int (*bpf_perf_event_read_value)(void *map, unsigned long long flags,\n \t\t\t\t       void *buf, unsigned int buf_size) =\n \t(void *) BPF_FUNC_perf_event_read_value;\n+static int (*bpf_perf_prog_read_value)(void *ctx, void *buf,\n+\t\t\t\t      unsigned int buf_size) =\n+\t(void *) BPF_FUNC_perf_prog_read_value;\n \n \n /* llvm builtin functions that eBPF C program may use to\n",
    "prefixes": [
        "net-next",
        "v3",
        "4/4"
    ]
}