get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 816029,
    "url": "http://patchwork.ozlabs.org/api/patches/816029/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/20170920060935.1102268-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": "<20170920060935.1102268-5-yhs@fb.com>",
    "list_archive_url": null,
    "date": "2017-09-20T06:09:35",
    "name": "[net-next,v5,4/4] bpf: add a test case for helper bpf_perf_prog_read_value",
    "commit_ref": null,
    "pull_url": null,
    "state": "not-applicable",
    "archived": true,
    "hash": "bb7c0fab5658cd3a28c2131c5ae59c6efc681848",
    "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/20170920060935.1102268-5-yhs@fb.com/mbox/",
    "series": [
        {
            "id": 4026,
            "url": "http://patchwork.ozlabs.org/api/series/4026/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/netdev/list/?series=4026",
            "date": "2017-09-20T06:09:31",
            "name": "bpf: add two helpers to read perf event enabled/running time",
            "version": 5,
            "mbox": "http://patchwork.ozlabs.org/series/4026/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/816029/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/816029/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=\"GVLj2IjU\";\n\tdkim-atps=neutral"
        ],
        "Received": [
            "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xxq8Y3xH0z9s7c\n\tfor <patchwork-incoming@ozlabs.org>;\n\tWed, 20 Sep 2017 16:09:49 +1000 (AEST)",
            "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751794AbdITGJr (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tWed, 20 Sep 2017 02:09:47 -0400",
            "from mx0a-00082601.pphosted.com ([67.231.145.42]:33294 \"EHLO\n\tmx0a-00082601.pphosted.com\" rhost-flags-OK-OK-OK-OK)\n\tby vger.kernel.org with ESMTP id S1751686AbdITGJi (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Wed, 20 Sep 2017 02:09:38 -0400",
            "from pps.filterd (m0044010.ppops.net [127.0.0.1])\n\tby mx0a-00082601.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id\n\tv8K65BuV018337\n\tfor <netdev@vger.kernel.org>; Tue, 19 Sep 2017 23:09:38 -0700",
            "from mail.thefacebook.com ([199.201.64.23])\n\tby mx0a-00082601.pphosted.com with ESMTP id 2d3f46s13v-5\n\t(version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT)\n\tfor <netdev@vger.kernel.org>; Tue, 19 Sep 2017 23:09:38 -0700",
            "from PRN-CHUB02.TheFacebook.com (2620:10d:c081:35::11) by\n\tPRN-CHUB14.TheFacebook.com (2620:10d:c081:35::23) with Microsoft SMTP\n\tServer (TLS) id 14.3.319.2; Tue, 19 Sep 2017 23:09:37 -0700",
            "from mx-out.facebook.com (192.168.52.123) by\n\tPRN-CHUB02.TheFacebook.com (192.168.16.12) with Microsoft SMTP Server\n\tid 14.3.319.2; Tue, 19 Sep 2017 23:09:37 -0700",
            "by devbig474.prn1.facebook.com (Postfix, from userid 128203)  id\n\tD3EB246E07D4; Tue, 19 Sep 2017 23:09:35 -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=7LydL9SdwRtJXwsv7Q1CxesX7gO/iD5sG13/IfFNr4g=; \n\tb=GVLj2IjUwnWKPIvxAVLYMiUdsoy0ZP761O4NtfCB7zNdSkt4M/gwjJdhHj/YoqYjJHuG\n\t4q4gyLgz5Pf5/VW2OiC8qLUnQpO7dJwGMB8ECYUk5U5y+9pTxGeF9T6N6QN+Hx8HLgwT\n\tNGKafjnwKeP2Q41K+1jWQtTCr7ab8gWx04U= ",
        "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 v5 4/4] bpf: add a test case for helper\n\tbpf_perf_prog_read_value",
        "Date": "Tue, 19 Sep 2017 23:09:35 -0700",
        "Message-ID": "<20170920060935.1102268-5-yhs@fb.com>",
        "X-Mailer": "git-send-email 2.9.5",
        "In-Reply-To": "<20170920060935.1102268-1-yhs@fb.com>",
        "References": "<20170920060935.1102268-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-20_01:, , 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..50d2bcd 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\\\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 08e6f8c..1d3dcd4 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\tvoid *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",
        "v5",
        "4/4"
    ]
}